Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clean": "turbo clean --log-order grouped --output-logs new-only && rimraf dist out bin .vite-port .turbo",
"install:vsix": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix && node scripts/install-vsix.js",
"install:vsix:nightly": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix:nightly && node scripts/install-vsix.js --nightly",
"serve:install": "node scripts/serve.js",
"changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .",
"knip": "knip --include files",
"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",
Expand Down
71 changes: 71 additions & 0 deletions scripts/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* Serve script for Roo Code extension development
*
* Usage:
* pnpm serve:install # Build and install the extension into code-server
*
* After making code changes, run `pnpm serve: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}[serve]${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)
})
Loading