mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-06 02:47:56 +00:00
feat: binary configurable pack detection, auto-select installation method
This commit is contained in:
parent
3539550b0c
commit
3ac4bf61f2
3 changed files with 39 additions and 16 deletions
8
package-lock.json
generated
8
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.19",
|
||||
"config-rocket": "^0.3.20",
|
||||
"default-shell": "^2.2.0",
|
||||
"delay": "^6.0.0",
|
||||
"diff": "^5.2.0",
|
||||
|
|
@ -11073,9 +11073,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/config-rocket": {
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/config-rocket/-/config-rocket-0.3.19.tgz",
|
||||
"integrity": "sha512-6VwCdqHH5G/Q4D5byHiZsFbF3Dp2RYYNrA3RPreYYTmxvkuaGYy+KcWm7yfdwwoyVPFkuIeN5LTOHJjGMtW+rw==",
|
||||
"version": "0.3.20",
|
||||
"resolved": "https://registry.npmjs.org/config-rocket/-/config-rocket-0.3.20.tgz",
|
||||
"integrity": "sha512-Zim3CGz4Psu2OvLU3U7dGhtj+Nzr+fAh51S2/YUO6vAjQUQa1Ll06+I53W1xMQFI4TcLBYKSpJV/jy+YfUZnHg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"c12": "^3.0.3",
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
"cheerio": "^1.0.0",
|
||||
"chokidar": "^4.0.1",
|
||||
"clone-deep": "^4.0.1",
|
||||
"config-rocket": "^0.3.19",
|
||||
"config-rocket": "^0.3.20",
|
||||
"default-shell": "^2.2.0",
|
||||
"delay": "^6.0.0",
|
||||
"diff": "^5.2.0",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import { validateSource, validateSources } from "../../shared/MarketplaceValidat
|
|||
import { getUserLocale } from "./utils"
|
||||
import { GlobalFileNames } from "src/shared/globalFileNames"
|
||||
import { assertsMpContext, MarketplaceContext, registerMarketplaceHooks } from "roo-rocket"
|
||||
import { uint8IsConfigPackWithParameters } from 'config-rocket'
|
||||
import { unpackFromUint8 } from "config-rocket/cli"
|
||||
|
||||
/**
|
||||
* Service for managing marketplace data
|
||||
|
|
@ -573,6 +575,8 @@ export class MarketplaceManager {
|
|||
target = 'project'
|
||||
} = options || {}
|
||||
|
||||
vscode.window.showInformationMessage(`Installing item: "${item.name}"`)
|
||||
|
||||
if (target === 'project' && !vscode.workspace.workspaceFolders?.length)
|
||||
return vscode.window.showErrorMessage("Cannot load current workspace folder")
|
||||
|
||||
|
|
@ -598,18 +602,29 @@ export class MarketplaceManager {
|
|||
) satisfies MarketplaceContext
|
||||
assertsMpContext(mpContext)
|
||||
|
||||
// Create a custom hookable instance to support global installations
|
||||
const customHookable = createHookable()
|
||||
registerMarketplaceHooks(customHookable, mpContext)
|
||||
const binaryUint8 = await fetchBinary(item.binaryUrl)
|
||||
|
||||
// Install via CLI if binary is a configurable pack.
|
||||
if (await uint8IsConfigPackWithParameters(binaryUint8)) {
|
||||
vscode.window.showInformationMessage(`"${item.name}" is a configurable pack, invoking CLI to install...`)
|
||||
vscode.window.showInformationMessage(`*CLI install WIP*`)
|
||||
}
|
||||
// Fast install for non-configurable packs.
|
||||
else {
|
||||
// Create a custom hookable instance to support global installations
|
||||
const customHookable = createHookable()
|
||||
registerMarketplaceHooks(customHookable, mpContext)
|
||||
|
||||
vscode.window.showInformationMessage(`"${item.name}" is non-configurable, fast install...`)
|
||||
await unpackFromUint8(binaryUint8, {
|
||||
hookable: customHookable,
|
||||
nonAssemblyBehavior: true,
|
||||
sha256: item.binaryHash,
|
||||
cwd
|
||||
})
|
||||
vscode.window.showInformationMessage(`"${item.name}" installed successfully`)
|
||||
}
|
||||
|
||||
vscode.window.showInformationMessage(`Installing item: "${item.name}"`)
|
||||
await unpackFromUrl(item.binaryUrl, {
|
||||
hookable: customHookable,
|
||||
nonAssemblyBehavior: true,
|
||||
sha256: item.binaryHash,
|
||||
cwd
|
||||
})
|
||||
vscode.window.showInformationMessage(`Item "${item.name}" installed successfully`)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
@ -623,3 +638,11 @@ export class MarketplaceManager {
|
|||
return settingsDir
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchBinary(url: string) {
|
||||
const res = await fetch(url)
|
||||
if (!res.ok)
|
||||
throw new Error(`Failed to download binary from ${url}`)
|
||||
|
||||
return new Uint8Array(await res.arrayBuffer())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue