mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
feat: delegate the hooks declaration to roo-rocket, prepare for CLI feat
This commit is contained in:
parent
26be7b3ac7
commit
3539550b0c
3 changed files with 26 additions and 28 deletions
18
package-lock.json
generated
18
package-lock.json
generated
|
|
@ -27,7 +27,7 @@
|
|||
"cheerio": "^1.0.0",
|
||||
"chokidar": "^4.0.1",
|
||||
"clone-deep": "^4.0.1",
|
||||
"config-rocket": "^0.3.18",
|
||||
"config-rocket": "^0.3.19",
|
||||
"default-shell": "^2.2.0",
|
||||
"delay": "^6.0.0",
|
||||
"diff": "^5.2.0",
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
"puppeteer-chromium-resolver": "^23.0.0",
|
||||
"puppeteer-core": "^23.4.0",
|
||||
"reconnecting-eventsource": "^1.6.4",
|
||||
"roo-rocket": "^0.3.7",
|
||||
"roo-rocket": "^0.3.9",
|
||||
"say": "^0.16.0",
|
||||
"serialize-error": "^11.0.3",
|
||||
"simple-git": "^3.27.0",
|
||||
|
|
@ -11073,9 +11073,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/config-rocket": {
|
||||
"version": "0.3.18",
|
||||
"resolved": "https://registry.npmjs.org/config-rocket/-/config-rocket-0.3.18.tgz",
|
||||
"integrity": "sha512-jY5EDbI4q0/Qz8Lm4p8JPFw/jJk3Kcg7n+ZZQUNEMcWpbDjw9DIT5K6G1ypuBGycUsXfhDXvycoVkNDEierVDQ==",
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/config-rocket/-/config-rocket-0.3.19.tgz",
|
||||
"integrity": "sha512-6VwCdqHH5G/Q4D5byHiZsFbF3Dp2RYYNrA3RPreYYTmxvkuaGYy+KcWm7yfdwwoyVPFkuIeN5LTOHJjGMtW+rw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"c12": "^3.0.3",
|
||||
|
|
@ -18972,9 +18972,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/roo-rocket": {
|
||||
"version": "0.3.7",
|
||||
"resolved": "https://registry.npmjs.org/roo-rocket/-/roo-rocket-0.3.7.tgz",
|
||||
"integrity": "sha512-DvCHydroTqrJ4q0n8zrhTEcFlHIkJLIVePko30OZvIr5XsPPGbmdPKMPMWiv+s3I91/Oy70VHzTSJUxK4nyVxw==",
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/roo-rocket/-/roo-rocket-0.3.9.tgz",
|
||||
"integrity": "sha512-w5rKihu6lIkq2fIFYAyhKzZYqSnaVWKvlebNT8uKekyeizfaU89FHzow6TB+Gah57mdaZyulcylKl1hmNRzjXg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"citty": "^0.1.6",
|
||||
|
|
@ -18992,7 +18992,7 @@
|
|||
"url": "https://github.com/sponsors/namesmt"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"config-rocket": "^0.3.16"
|
||||
"config-rocket": "^0.3.19"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"config-rocket": {
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
"cheerio": "^1.0.0",
|
||||
"chokidar": "^4.0.1",
|
||||
"clone-deep": "^4.0.1",
|
||||
"config-rocket": "^0.3.18",
|
||||
"config-rocket": "^0.3.19",
|
||||
"default-shell": "^2.2.0",
|
||||
"delay": "^6.0.0",
|
||||
"diff": "^5.2.0",
|
||||
|
|
@ -474,7 +474,7 @@
|
|||
"puppeteer-chromium-resolver": "^23.0.0",
|
||||
"puppeteer-core": "^23.4.0",
|
||||
"reconnecting-eventsource": "^1.6.4",
|
||||
"roo-rocket": "^0.3.7",
|
||||
"roo-rocket": "^0.3.9",
|
||||
"say": "^0.16.0",
|
||||
"serialize-error": "^11.0.3",
|
||||
"simple-git": "^3.27.0",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import {
|
|||
import { validateSource, validateSources } from "../../shared/MarketplaceValidation"
|
||||
import { getUserLocale } from "./utils"
|
||||
import { GlobalFileNames } from "src/shared/globalFileNames"
|
||||
import { assertsMpContext, MarketplaceContext, registerMarketplaceHooks } from "roo-rocket"
|
||||
|
||||
/**
|
||||
* Service for managing marketplace data
|
||||
|
|
@ -584,25 +585,22 @@ export class MarketplaceManager {
|
|||
if (!item.binaryUrl || !item.binaryHash)
|
||||
return vscode.window.showErrorMessage("Item does not have a binary URL or hash")
|
||||
|
||||
// Creates `mpContext` to delegate context to `roo-rocket`
|
||||
const mpContext = (target === 'project'
|
||||
? { target }
|
||||
: {
|
||||
target,
|
||||
globalFileNames: {
|
||||
mcp: GlobalFileNames.mcpSettings,
|
||||
mode: GlobalFileNames.customModes,
|
||||
}
|
||||
}
|
||||
) satisfies MarketplaceContext
|
||||
assertsMpContext(mpContext)
|
||||
|
||||
// Create a custom hookable instance to support global installations
|
||||
// Currently, we only supports `.roomodes` and `.roo/mcp.json` files for global installation.
|
||||
const customHookable = createHookable()
|
||||
customHookable.hook('onExtract', ({ unzipped }) => {
|
||||
const allowedFiles = new Set(['.roo/mcp.json', '.roomodes'])
|
||||
console.log({ unzipped })
|
||||
for (const key in unzipped) {
|
||||
if (!allowedFiles.has(key))
|
||||
throw new Error('Unsupported file for global installation: ' + key)
|
||||
}
|
||||
})
|
||||
customHookable.hook('onFileOutput', (state) => {
|
||||
if (target === 'global') {
|
||||
if (state.filePath.endsWith('/.roo/mcp.json'))
|
||||
state.filePath = state.filePath.replace('.roo/mcp.json', GlobalFileNames.mcpSettings)
|
||||
else if (state.filePath.endsWith('/.roomodes'))
|
||||
state.filePath = state.filePath.replace('.roomodes', GlobalFileNames.customModes)
|
||||
}
|
||||
})
|
||||
registerMarketplaceHooks(customHookable, mpContext)
|
||||
|
||||
vscode.window.showInformationMessage(`Installing item: "${item.name}"`)
|
||||
await unpackFromUrl(item.binaryUrl, {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue