11/**
22 * Serve script for Roo Code extension development
33 *
4- * This script builds the extension as a vsix, installs it into code-server,
5- * and launches code-server for web-based VS Code testing.
4+ * This script manages code-server for web-based VS Code testing.
65 *
76 * Prerequisites:
87 * brew install code-server
98 *
109 * Usage:
11- * pnpm serve # Build, install, and start code-server on port 9080
10+ * pnpm serve # Start code-server on port 9080
1211 * pnpm serve -- --port 8080 # Use a custom port
1312 * pnpm serve -- --host 0.0.0.0 # Bind to all interfaces (for Docker/remote access)
1413 * pnpm serve -- --auth none # Disable authentication (password|none)
15- * pnpm serve:rebuild # Only rebuild and reinstall the extension
14+ * pnpm serve:install # Build and install the extension into code-server
1615 *
17- * The script will:
18- * 1. Check if code-server is installed
19- * 2. Build the vsix (pnpm vsix)
20- * 3. Install the vsix into code-server
21- * 4. Configure user settings (disable welcome tab)
22- * 5. Start code-server on http://127.0.0.1:9080 (unless --rebuild-only)
16+ * Workflow:
17+ * 1. Run `pnpm serve:install` to build and install the extension
18+ * 2. Run `pnpm serve` to start code-server
19+ * 3. After code changes, run `pnpm serve:install` again and reload the window
20+ * (Cmd+Shift+P → "Developer: Reload Window")
2321 *
2422 * Your password is stored in ~/.config/code-server/config.yaml
2523 */
@@ -40,7 +38,7 @@ const RED = "\x1b[31m"
4038const VSIX_PATH = path . join ( os . tmpdir ( ) , "roo-code-serve.vsix" )
4139
4240// Parse command line flags
43- const rebuildOnly = process . argv . includes ( "--rebuild -only" )
41+ const installOnly = process . argv . includes ( "--install -only" )
4442
4543// Parse --port argument (default: 9080)
4644const DEFAULT_PORT = 9080
@@ -135,10 +133,7 @@ function ensureUserSettings() {
135133}
136134
137135async function main ( ) {
138- const title = rebuildOnly ? "Roo Code - Rebuild Extension" : "Roo Code - code-server Development Server"
139- console . log ( `\n${ BOLD } 🚀 ${ title } ${ RESET } \n` )
140-
141- // Step 1: Check if code-server is installed
136+ // Check if code-server is installed
142137 log ( "Checking for code-server..." )
143138 if ( ! isCodeServerInstalled ( ) ) {
144139 logError ( "code-server is not installed" )
@@ -149,39 +144,42 @@ async function main() {
149144 }
150145 logSuccess ( "code-server found" )
151146
152- // Step 2: Build vsix to temp directory
153- log ( `Building vsix to ${ VSIX_PATH } ...` )
154- try {
155- execSync ( `pnpm vsix -- --out "${ VSIX_PATH } "` , { stdio : "inherit" } )
156- logSuccess ( "Build complete" )
157- } catch ( error ) {
158- logError ( "Build failed" )
159- process . exit ( 1 )
160- }
147+ // If install-only mode, build and install the extension
148+ if ( installOnly ) {
149+ console . log ( `\n${ BOLD } 🔧 Roo Code - Install Extension${ RESET } \n` )
161150
162- // Step 3: Install extension into code-server
163- log ( "Installing extension into code-server..." )
164- try {
165- execSync ( `code-server --install-extension "${ VSIX_PATH } "` , { stdio : "inherit" } )
166- logSuccess ( "Extension installed" )
167- } catch ( error ) {
168- logWarning ( "Extension installation had warnings (this is usually fine)" )
169- }
151+ // Build vsix to temp directory
152+ log ( `Building vsix to ${ VSIX_PATH } ...` )
153+ try {
154+ execSync ( `pnpm vsix -- --out "${ VSIX_PATH } "` , { stdio : "inherit" } )
155+ logSuccess ( "Build complete" )
156+ } catch ( error ) {
157+ logError ( "Build failed" )
158+ process . exit ( 1 )
159+ }
160+
161+ // Install extension into code-server
162+ log ( "Installing extension into code-server..." )
163+ try {
164+ execSync ( `code-server --install-extension "${ VSIX_PATH } "` , { stdio : "inherit" } )
165+ logSuccess ( "Extension installed" )
166+ } catch ( error ) {
167+ logWarning ( "Extension installation had warnings (this is usually fine)" )
168+ }
170169
171- // Step 4: Configure user settings to disable welcome tab
172- log ( "Configuring user settings..." )
173- ensureUserSettings ( )
174- logSuccess ( "User settings configured (welcome tab disabled)" )
170+ // Configure user settings to disable welcome tab
171+ log ( "Configuring user settings..." )
172+ ensureUserSettings ( )
173+ logSuccess ( "User settings configured (welcome tab disabled)" )
175174
176- // If rebuild-only mode, exit here
177- if ( rebuildOnly ) {
178- console . log ( `\n${ GREEN } ✓ Extension rebuilt and installed.${ RESET } ` )
179- console . log ( ` Reload the code-server window to pick up changes.` )
175+ console . log ( `\n${ GREEN } ✓ Extension built and installed.${ RESET } ` )
176+ console . log ( ` If code-server is running, reload the window to pick up changes.` )
180177 console . log ( ` (Cmd+Shift+P → "Developer: Reload Window")\n` )
181178 return
182179 }
183180
184- // Step 5: Start code-server
181+ // Default: Start code-server
182+ console . log ( `\n${ BOLD } 🚀 Roo Code - code-server Development Server${ RESET } \n` )
185183 const cwd = process . cwd ( )
186184 console . log ( `\n${ BOLD } Starting code-server...${ RESET } ` )
187185 console . log ( ` Working directory: ${ cwd } ` )
0 commit comments