Skip to content

Commit d8f65b6

Browse files
mrubensroomote
andauthored
feat: add pnpm serve command for code-server development (#10964)
Co-authored-by: Roo Code <roomote@roocode.com>
1 parent e771a49 commit d8f65b6

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"clean": "turbo clean --log-order grouped --output-logs new-only && rimraf dist out bin .vite-port .turbo",
2222
"install:vsix": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix && node scripts/install-vsix.js",
2323
"install:vsix:nightly": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix:nightly && node scripts/install-vsix.js --nightly",
24+
"code-server:install": "node scripts/code-server.js",
2425
"changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .",
2526
"knip": "knip --include files",
2627
"evals": "dotenvx run -f packages/evals/.env.development packages/evals/.env.local -- docker compose -f packages/evals/docker-compose.yml --profile server --profile runner up --build --scale runner=0",

scripts/code-server.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
* Serve script for Roo Code extension development
3+
*
4+
* Usage:
5+
* pnpm code-server:install # Build and install the extension into code-server
6+
*
7+
* After making code changes, run `pnpm code-server:install` again and reload the window
8+
* (Cmd+Shift+P → "Developer: Reload Window")
9+
*/
10+
11+
const { execSync } = require("child_process")
12+
const path = require("path")
13+
const os = require("os")
14+
15+
const RESET = "\x1b[0m"
16+
const BOLD = "\x1b[1m"
17+
const GREEN = "\x1b[32m"
18+
const YELLOW = "\x1b[33m"
19+
const CYAN = "\x1b[36m"
20+
const RED = "\x1b[31m"
21+
22+
// Build vsix to a fixed path in temp directory
23+
const VSIX_PATH = path.join(os.tmpdir(), "roo-code-serve.vsix")
24+
25+
function log(message) {
26+
console.log(`${CYAN}[code-server]${RESET} ${message}`)
27+
}
28+
29+
function logSuccess(message) {
30+
console.log(`${GREEN}${RESET} ${message}`)
31+
}
32+
33+
function logWarning(message) {
34+
console.log(`${YELLOW}${RESET} ${message}`)
35+
}
36+
37+
function logError(message) {
38+
console.error(`${RED}${RESET} ${message}`)
39+
}
40+
41+
async function main() {
42+
console.log(`\n${BOLD}🔧 Roo Code - Install Extension${RESET}\n`)
43+
44+
// Build vsix to temp directory
45+
log(`Building vsix to ${VSIX_PATH}...`)
46+
try {
47+
execSync(`pnpm vsix -- --out "${VSIX_PATH}"`, { stdio: "inherit" })
48+
logSuccess("Build complete")
49+
} catch (error) {
50+
logError("Build failed")
51+
process.exit(1)
52+
}
53+
54+
// Install extension into code-server
55+
log("Installing extension into code-server...")
56+
try {
57+
execSync(`code-server --install-extension "${VSIX_PATH}"`, { stdio: "inherit" })
58+
logSuccess("Extension installed")
59+
} catch (error) {
60+
logWarning("Extension installation had warnings (this is usually fine)")
61+
}
62+
63+
console.log(`\n${GREEN}✓ Extension built and installed.${RESET}`)
64+
console.log(` If code-server is running, reload the window to pick up changes.`)
65+
console.log(` (Cmd+Shift+P → "Developer: Reload Window")\n`)
66+
}
67+
68+
main().catch((error) => {
69+
logError(error.message)
70+
process.exit(1)
71+
})

0 commit comments

Comments
 (0)