mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
feat: working CLI interactive install mode
This commit is contained in:
parent
3ac4bf61f2
commit
086523655b
3 changed files with 39 additions and 11 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -54,7 +54,7 @@
|
|||
"puppeteer-chromium-resolver": "^23.0.0",
|
||||
"puppeteer-core": "^23.4.0",
|
||||
"reconnecting-eventsource": "^1.6.4",
|
||||
"roo-rocket": "^0.3.9",
|
||||
"roo-rocket": "^0.3.12",
|
||||
"say": "^0.16.0",
|
||||
"serialize-error": "^11.0.3",
|
||||
"simple-git": "^3.27.0",
|
||||
|
|
@ -18972,9 +18972,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/roo-rocket": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/roo-rocket/-/roo-rocket-0.3.9.tgz",
|
||||
"integrity": "sha512-w5rKihu6lIkq2fIFYAyhKzZYqSnaVWKvlebNT8uKekyeizfaU89FHzow6TB+Gah57mdaZyulcylKl1hmNRzjXg==",
|
||||
"version": "0.3.12",
|
||||
"resolved": "https://registry.npmjs.org/roo-rocket/-/roo-rocket-0.3.12.tgz",
|
||||
"integrity": "sha512-oy9pXRcys5VS3OhtzScve97UJkQ00bjacPpVJQ8GeIlDsMGfQl1ega2X95/rRyWFGsFT1jr/ri4q4AUs2BNzOg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"citty": "^0.1.6",
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@
|
|||
"puppeteer-chromium-resolver": "^23.0.0",
|
||||
"puppeteer-core": "^23.4.0",
|
||||
"reconnecting-eventsource": "^1.6.4",
|
||||
"roo-rocket": "^0.3.9",
|
||||
"roo-rocket": "^0.3.13",
|
||||
"say": "^0.16.0",
|
||||
"serialize-error": "^11.0.3",
|
||||
"simple-git": "^3.27.0",
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@ import {
|
|||
import { validateSource, validateSources } from "../../shared/MarketplaceValidation"
|
||||
import { getUserLocale } from "./utils"
|
||||
import { GlobalFileNames } from "src/shared/globalFileNames"
|
||||
import { assertsMpContext, MarketplaceContext, registerMarketplaceHooks } from "roo-rocket"
|
||||
import { uint8IsConfigPackWithParameters } from 'config-rocket'
|
||||
import { TerminalRegistry } from "src/integrations/terminal/TerminalRegistry"
|
||||
import { assertsMpContext, createHookable, MarketplaceContext, registerMarketplaceHooks } from "roo-rocket"
|
||||
import { unpackFromUint8 } from "config-rocket/cli"
|
||||
import { uint8IsConfigPackWithParameters } from 'config-rocket'
|
||||
|
||||
/**
|
||||
* Service for managing marketplace data
|
||||
|
|
@ -583,8 +584,6 @@ export class MarketplaceManager {
|
|||
const cwd = target === 'project'
|
||||
? vscode.workspace.workspaceFolders![0].uri.fsPath
|
||||
: await this.ensureSettingsDirectoryExists()
|
||||
const { createHookable } = await import("roo-rocket")
|
||||
const { unpackFromUrl } = await import("config-rocket/cli")
|
||||
|
||||
if (!item.binaryUrl || !item.binaryHash)
|
||||
return vscode.window.showErrorMessage("Item does not have a binary URL or hash")
|
||||
|
|
@ -605,9 +604,38 @@ export class MarketplaceManager {
|
|||
const binaryUint8 = await fetchBinary(item.binaryUrl)
|
||||
|
||||
// Install via CLI if binary is a configurable pack.
|
||||
// TODO: think of a way to send the binary to the npx process
|
||||
if (await uint8IsConfigPackWithParameters(binaryUint8)) {
|
||||
vscode.window.showInformationMessage(`"${item.name}" is a configurable pack, invoking CLI to install...`)
|
||||
vscode.window.showInformationMessage(`*CLI install WIP*`)
|
||||
vscode.window.showInformationMessage(`"${item.name}" is configurable, install through interactive CLI...`)
|
||||
|
||||
let pResult: string[] = []
|
||||
let pExitCode: number | undefined
|
||||
// We don't want to create a new terminal at the global dir, so I'm not using cwd here
|
||||
const terminalClass = await TerminalRegistry.getOrCreateTerminal(vscode.workspace.workspaceFolders?.[0]?.uri?.fsPath ?? '', false, `IMI-${item.name}`)
|
||||
terminalClass.terminal.show()
|
||||
await terminalClass.runCommand(`npx --yes roo-rocket@latest --mp="${JSON.stringify(mpContext).replaceAll(/"/g, '\\"')}" --cwd="${cwd}" --sha256="${item.binaryHash}" --url="${item.binaryUrl}"`, {
|
||||
onLine: (line) => {
|
||||
pResult.push(line)
|
||||
},
|
||||
onShellExecutionComplete: (details) => {
|
||||
pExitCode = details.exitCode
|
||||
},
|
||||
})
|
||||
|
||||
if (pExitCode === 0)
|
||||
vscode.window.showInformationMessage(`"${item.name}" CLI reported success!`)
|
||||
else {
|
||||
console.error(pResult)
|
||||
// Revert so error search is potentially faster
|
||||
pResult.reverse()
|
||||
// Search for error line in the result
|
||||
const errorLine = (
|
||||
pResult.find(line => /^((\r)?\n)+ ERROR /.test(line)) ?? // Prefer formatting error
|
||||
pResult.find(line => /error/i.test(line)) ?? // General error
|
||||
'N/A'
|
||||
)
|
||||
return vscode.window.showErrorMessage(`"${item.name}" CLI reported error: (${pExitCode}): ${errorLine}`)
|
||||
}
|
||||
}
|
||||
// Fast install for non-configurable packs.
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue