Skip to content

Commit 7d99689

Browse files
authored
More VSCode command / build fixes (RooCodeInc#3780)
1 parent ea93cea commit 7d99689

File tree

7 files changed

+79
-37
lines changed

7 files changed

+79
-37
lines changed

.github/workflows/marketplace-publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ jobs:
3838
npm run vsix
3939
package=$(unzip -l bin/roo-cline-${current_package_version}.vsix)
4040
echo "$package"
41-
echo "$package" | grep -q "dist/extension.js" || exit 1
41+
echo "$package" | grep -q "extension/dist/package.json" || exit 1
42+
echo "$package" | grep -q "extension/dist/package.nls.json" || exit 1
43+
echo "$package" | grep -q "extension/dist/extension.js" || exit 1
44+
echo "$package" | grep -q "extension/webview-ui/audio/celebration.wav" || exit 1
4245
echo "$package" | grep -q "extension/webview-ui/build/assets/index.js" || exit 1
4346
echo "$package" | grep -q "extension/node_modules/@vscode/codicons/dist/codicon.ttf" || exit 1
4447
echo "$package" | grep -q ".env" || exit 1

evals/scripts/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ code --install-extension redhat.java &>/dev/null || exit 1
293293
code --install-extension ms-python.python&>/dev/null || exit 1
294294
code --install-extension rust-lang.rust-analyzer &>/dev/null || exit 1
295295

296-
if ! code --list-extensions 2>/dev/null | grep -q "rooveterinaryinc.roo-cline"; then
297-
code --install-extension rooveterinaryinc.roo-cline &>/dev/null || exit 1
296+
if ! code --list-extensions 2>/dev/null | grep -q "RooVeterinaryInc.roo-cline"; then
297+
code --install-extension RooVeterinaryInc.roo-cline &>/dev/null || exit 1
298298
fi
299299

300300
echo "✅ Done"

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@
5151
],
5252
"main": "./dist/extension.js",
5353
"contributes": {
54-
"submenus": [
55-
{
56-
"id": "roo-code.contextMenu",
57-
"label": "%views.contextMenu.label%"
58-
},
59-
{
60-
"id": "roo-code.terminalMenu",
61-
"label": "%views.terminalMenu.label%"
62-
}
63-
],
6454
"viewsContainers": {
6555
"activitybar": [
6656
{
@@ -166,19 +156,19 @@
166156
"category": "%configuration.title%"
167157
},
168158
{
169-
"command": "roo.acceptInput",
159+
"command": "roo-cline.acceptInput",
170160
"title": "%command.acceptInput.title%",
171161
"category": "%configuration.title%"
172162
}
173163
],
174164
"menus": {
175165
"editor/context": [
176166
{
177-
"submenu": "roo-code.contextMenu",
167+
"submenu": "roo-cline.contextMenu",
178168
"group": "navigation"
179169
}
180170
],
181-
"roo-code.contextMenu": [
171+
"roo-cline.contextMenu": [
182172
{
183173
"command": "roo-cline.addToContext",
184174
"group": "1_actions@1"
@@ -194,11 +184,11 @@
194184
],
195185
"terminal/context": [
196186
{
197-
"submenu": "roo-code.terminalMenu",
187+
"submenu": "roo-cline.terminalMenu",
198188
"group": "navigation"
199189
}
200190
],
201-
"roo-code.terminalMenu": [
191+
"roo-cline.terminalMenu": [
202192
{
203193
"command": "roo-cline.terminalAddToContext",
204194
"group": "1_actions@1"
@@ -277,6 +267,16 @@
277267
}
278268
]
279269
},
270+
"submenus": [
271+
{
272+
"id": "roo-cline.contextMenu",
273+
"label": "%views.contextMenu.label%"
274+
},
275+
{
276+
"id": "roo-cline.terminalMenu",
277+
"label": "%views.terminalMenu.label%"
278+
}
279+
],
280280
"configuration": {
281281
"title": "%configuration.title%",
282282
"properties": {

src/exports/roo-code.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,7 @@ declare const Package: {
15441544
readonly publisher: string
15451545
readonly name: string
15461546
readonly version: string
1547+
readonly outputChannel: string
15471548
}
15481549
/**
15491550
* ProviderName

src/extension.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ let extensionContext: vscode.ExtensionContext
4949
// Your extension is activated the very first time the command is executed.
5050
export async function activate(context: vscode.ExtensionContext) {
5151
extensionContext = context
52-
outputChannel = vscode.window.createOutputChannel("Roo-Code")
52+
outputChannel = vscode.window.createOutputChannel(Package.outputChannel)
5353
context.subscriptions.push(outputChannel)
54-
outputChannel.appendLine("Roo-Code extension activated")
54+
outputChannel.appendLine(`${Package.name} extension activated`)
5555

5656
// Migrate old settings to new
5757
await migrateSettings(context, outputChannel)
@@ -147,13 +147,10 @@ export async function activate(context: vscode.ExtensionContext) {
147147
return new API(outputChannel, provider, socketPath, enableLogging)
148148
}
149149

150-
// This method is called when your extension is deactivated
150+
// This method is called when your extension is deactivated.
151151
export async function deactivate() {
152-
outputChannel.appendLine("Roo-Code extension deactivated")
153-
// Clean up MCP server manager
152+
outputChannel.appendLine(`${Package.name} extension deactivated`)
154153
await McpServerManager.cleanup(extensionContext)
155154
telemetryService.shutdown()
156-
157-
// Clean up terminal handlers
158155
TerminalRegistry.cleanup()
159156
}

src/schemas/__tests__/index.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// npx jest src/schemas/__tests__/index.test.ts
22

3-
import { GLOBAL_STATE_KEYS } from "../index"
3+
import { contributes } from "../../../package.json"
4+
5+
import { GLOBAL_STATE_KEYS, Package, codeActionIds, terminalActionIds, commandIds } from "../index"
46

57
describe("GLOBAL_STATE_KEYS", () => {
68
it("should contain provider settings keys", () => {
@@ -15,3 +17,25 @@ describe("GLOBAL_STATE_KEYS", () => {
1517
expect(GLOBAL_STATE_KEYS).not.toContain("openRouterApiKey")
1618
})
1719
})
20+
21+
describe("package.json#contributes", () => {
22+
it("is in sync with the schema's commands", () => {
23+
// These aren't explicitly referenced in package.json despite
24+
// being registered by the extension.
25+
const absent = new Set([
26+
"activationCompleted",
27+
"showHumanRelayDialog",
28+
"registerHumanRelayCallback",
29+
"unregisterHumanRelayCallback",
30+
"handleHumanRelayResponse",
31+
])
32+
33+
// This test will notify us if package.json drifts from the schema.
34+
expect(contributes.commands.map((command) => command.command).sort()).toEqual(
35+
[...new Set([...commandIds, ...terminalActionIds, ...codeActionIds])]
36+
.filter((id) => !absent.has(id))
37+
.map((id) => `${Package.name}.${id}`)
38+
.sort(),
39+
)
40+
})
41+
})

src/schemas/index.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,66 @@ import { Equals, Keys, AssertEqual } from "../utils/type-fu"
1212

1313
import { publisher, name, version } from "../../package.json"
1414

15+
// These ENV variables can be defined by ESBuild when building the extension
16+
// in order to override the values in package.json. This allows us to build
17+
// different extension variants with the same package.json file.
18+
// The build process still needs to emit a modified package.json for consumption
19+
// by VSCode, but that build artifact is not used during the transpile step of
20+
// the build, so we still need this override mechanism.
1521
export const Package = {
16-
publisher,
17-
name,
18-
version,
22+
publisher: process.env.PKG_PUBLISHER || publisher,
23+
name: process.env.PKG_NAME || name,
24+
version: process.env.PKG_VERSION || version,
25+
outputChannel: process.env.PKG_OUTPUT_CHANNEL || "Roo-Code",
1926
} as const
2027

2128
/**
2229
* CodeAction
2330
*/
2431

25-
export type CodeActionName = "EXPLAIN" | "FIX" | "IMPROVE" | "ADD_TO_CONTEXT" | "NEW_TASK"
32+
export const codeActionIds = ["explainCode", "fixCode", "improveCode", "addToContext", "newTask"] as const
33+
34+
export type CodeActionId = (typeof codeActionIds)[number]
2635

27-
export type CodeActionId = "explainCode" | "fixCode" | "improveCode" | "addToContext" | "newTask"
36+
export type CodeActionName = "EXPLAIN" | "FIX" | "IMPROVE" | "ADD_TO_CONTEXT" | "NEW_TASK"
2837

2938
/**
3039
* TerminalAction
3140
*/
3241

42+
export const terminalActionIds = ["terminalAddToContext", "terminalFixCommand", "terminalExplainCommand"] as const
43+
44+
export type TerminalActionId = (typeof terminalActionIds)[number]
45+
3346
export type TerminalActionName = "ADD_TO_CONTEXT" | "FIX" | "EXPLAIN"
3447

3548
export type TerminalActionPromptType = `TERMINAL_${TerminalActionName}`
3649

37-
export type TerminalActionId = "terminalAddToContext" | "terminalFixCommand" | "terminalExplainCommand"
38-
3950
/**
4051
* Command
4152
*/
4253

43-
const commandIds = [
54+
export const commandIds = [
4455
"activationCompleted",
56+
4557
"plusButtonClicked",
46-
"mcpButtonClicked",
4758
"promptsButtonClicked",
59+
"mcpButtonClicked",
60+
"historyButtonClicked",
4861
"popoutButtonClicked",
49-
"openInNewTab",
5062
"settingsButtonClicked",
51-
"historyButtonClicked",
63+
64+
"openInNewTab",
65+
5266
"showHumanRelayDialog",
5367
"registerHumanRelayCallback",
5468
"unregisterHumanRelayCallback",
5569
"handleHumanRelayResponse",
70+
5671
"newTask",
72+
5773
"setCustomStoragePath",
74+
5875
"focusInput",
5976
"acceptInput",
6077
] as const

0 commit comments

Comments
 (0)