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