More VSCode command / build fixes (#3780)

This commit is contained in:
Chris Estreich 2025-05-21 00:07:37 -07:00 committed by GitHub
parent ea93cea9ac
commit 7d99689031
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 80 additions and 38 deletions

View file

@ -38,7 +38,10 @@ jobs:
npm run vsix
package=$(unzip -l bin/roo-cline-${current_package_version}.vsix)
echo "$package"
echo "$package" | grep -q "dist/extension.js" || exit 1
echo "$package" | grep -q "extension/dist/package.json" || exit 1
echo "$package" | grep -q "extension/dist/package.nls.json" || exit 1
echo "$package" | grep -q "extension/dist/extension.js" || exit 1
echo "$package" | grep -q "extension/webview-ui/audio/celebration.wav" || exit 1
echo "$package" | grep -q "extension/webview-ui/build/assets/index.js" || exit 1
echo "$package" | grep -q "extension/node_modules/@vscode/codicons/dist/codicon.ttf" || exit 1
echo "$package" | grep -q ".env" || exit 1

View file

@ -293,8 +293,8 @@ code --install-extension redhat.java &>/dev/null || exit 1
code --install-extension ms-python.python&>/dev/null || exit 1
code --install-extension rust-lang.rust-analyzer &>/dev/null || exit 1
if ! code --list-extensions 2>/dev/null | grep -q "rooveterinaryinc.roo-cline"; then
code --install-extension rooveterinaryinc.roo-cline &>/dev/null || exit 1
if ! code --list-extensions 2>/dev/null | grep -q "RooVeterinaryInc.roo-cline"; then
code --install-extension RooVeterinaryInc.roo-cline &>/dev/null || exit 1
fi
echo "✅ Done"

View file

@ -51,16 +51,6 @@
],
"main": "./dist/extension.js",
"contributes": {
"submenus": [
{
"id": "roo-code.contextMenu",
"label": "%views.contextMenu.label%"
},
{
"id": "roo-code.terminalMenu",
"label": "%views.terminalMenu.label%"
}
],
"viewsContainers": {
"activitybar": [
{
@ -166,7 +156,7 @@
"category": "%configuration.title%"
},
{
"command": "roo.acceptInput",
"command": "roo-cline.acceptInput",
"title": "%command.acceptInput.title%",
"category": "%configuration.title%"
}
@ -174,11 +164,11 @@
"menus": {
"editor/context": [
{
"submenu": "roo-code.contextMenu",
"submenu": "roo-cline.contextMenu",
"group": "navigation"
}
],
"roo-code.contextMenu": [
"roo-cline.contextMenu": [
{
"command": "roo-cline.addToContext",
"group": "1_actions@1"
@ -194,11 +184,11 @@
],
"terminal/context": [
{
"submenu": "roo-code.terminalMenu",
"submenu": "roo-cline.terminalMenu",
"group": "navigation"
}
],
"roo-code.terminalMenu": [
"roo-cline.terminalMenu": [
{
"command": "roo-cline.terminalAddToContext",
"group": "1_actions@1"
@ -277,6 +267,16 @@
}
]
},
"submenus": [
{
"id": "roo-cline.contextMenu",
"label": "%views.contextMenu.label%"
},
{
"id": "roo-cline.terminalMenu",
"label": "%views.terminalMenu.label%"
}
],
"configuration": {
"title": "%configuration.title%",
"properties": {

View file

@ -1544,6 +1544,7 @@ declare const Package: {
readonly publisher: string
readonly name: string
readonly version: string
readonly outputChannel: string
}
/**
* ProviderName

View file

@ -49,9 +49,9 @@ let extensionContext: vscode.ExtensionContext
// Your extension is activated the very first time the command is executed.
export async function activate(context: vscode.ExtensionContext) {
extensionContext = context
outputChannel = vscode.window.createOutputChannel("Roo-Code")
outputChannel = vscode.window.createOutputChannel(Package.outputChannel)
context.subscriptions.push(outputChannel)
outputChannel.appendLine("Roo-Code extension activated")
outputChannel.appendLine(`${Package.name} extension activated`)
// Migrate old settings to new
await migrateSettings(context, outputChannel)
@ -147,13 +147,10 @@ export async function activate(context: vscode.ExtensionContext) {
return new API(outputChannel, provider, socketPath, enableLogging)
}
// This method is called when your extension is deactivated
// This method is called when your extension is deactivated.
export async function deactivate() {
outputChannel.appendLine("Roo-Code extension deactivated")
// Clean up MCP server manager
outputChannel.appendLine(`${Package.name} extension deactivated`)
await McpServerManager.cleanup(extensionContext)
telemetryService.shutdown()
// Clean up terminal handlers
TerminalRegistry.cleanup()
}

View file

@ -1,6 +1,8 @@
// npx jest src/schemas/__tests__/index.test.ts
import { GLOBAL_STATE_KEYS } from "../index"
import { contributes } from "../../../package.json"
import { GLOBAL_STATE_KEYS, Package, codeActionIds, terminalActionIds, commandIds } from "../index"
describe("GLOBAL_STATE_KEYS", () => {
it("should contain provider settings keys", () => {
@ -15,3 +17,25 @@ describe("GLOBAL_STATE_KEYS", () => {
expect(GLOBAL_STATE_KEYS).not.toContain("openRouterApiKey")
})
})
describe("package.json#contributes", () => {
it("is in sync with the schema's commands", () => {
// These aren't explicitly referenced in package.json despite
// being registered by the extension.
const absent = new Set([
"activationCompleted",
"showHumanRelayDialog",
"registerHumanRelayCallback",
"unregisterHumanRelayCallback",
"handleHumanRelayResponse",
])
// This test will notify us if package.json drifts from the schema.
expect(contributes.commands.map((command) => command.command).sort()).toEqual(
[...new Set([...commandIds, ...terminalActionIds, ...codeActionIds])]
.filter((id) => !absent.has(id))
.map((id) => `${Package.name}.${id}`)
.sort(),
)
})
})

View file

@ -12,49 +12,66 @@ import { Equals, Keys, AssertEqual } from "../utils/type-fu"
import { publisher, name, version } from "../../package.json"
// These ENV variables can be defined by ESBuild when building the extension
// in order to override the values in package.json. This allows us to build
// different extension variants with the same package.json file.
// The build process still needs to emit a modified package.json for consumption
// by VSCode, but that build artifact is not used during the transpile step of
// the build, so we still need this override mechanism.
export const Package = {
publisher,
name,
version,
publisher: process.env.PKG_PUBLISHER || publisher,
name: process.env.PKG_NAME || name,
version: process.env.PKG_VERSION || version,
outputChannel: process.env.PKG_OUTPUT_CHANNEL || "Roo-Code",
} as const
/**
* CodeAction
*/
export type CodeActionName = "EXPLAIN" | "FIX" | "IMPROVE" | "ADD_TO_CONTEXT" | "NEW_TASK"
export const codeActionIds = ["explainCode", "fixCode", "improveCode", "addToContext", "newTask"] as const
export type CodeActionId = "explainCode" | "fixCode" | "improveCode" | "addToContext" | "newTask"
export type CodeActionId = (typeof codeActionIds)[number]
export type CodeActionName = "EXPLAIN" | "FIX" | "IMPROVE" | "ADD_TO_CONTEXT" | "NEW_TASK"
/**
* TerminalAction
*/
export const terminalActionIds = ["terminalAddToContext", "terminalFixCommand", "terminalExplainCommand"] as const
export type TerminalActionId = (typeof terminalActionIds)[number]
export type TerminalActionName = "ADD_TO_CONTEXT" | "FIX" | "EXPLAIN"
export type TerminalActionPromptType = `TERMINAL_${TerminalActionName}`
export type TerminalActionId = "terminalAddToContext" | "terminalFixCommand" | "terminalExplainCommand"
/**
* Command
*/
const commandIds = [
export const commandIds = [
"activationCompleted",
"plusButtonClicked",
"mcpButtonClicked",
"promptsButtonClicked",
"popoutButtonClicked",
"openInNewTab",
"settingsButtonClicked",
"mcpButtonClicked",
"historyButtonClicked",
"popoutButtonClicked",
"settingsButtonClicked",
"openInNewTab",
"showHumanRelayDialog",
"registerHumanRelayCallback",
"unregisterHumanRelayCallback",
"handleHumanRelayResponse",
"newTask",
"setCustomStoragePath",
"focusInput",
"acceptInput",
] as const