Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ensure shell scripts always use LF line endings
*.sh text eol=lf

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ dist/
*.tsbuildinfo
.DS_Store
.env

test-collab-project/*
!test-collab-project/.gitkeep
.vscode/extension-host-data-1/
.vscode/extension-host-data-2/
34 changes: 34 additions & 0 deletions .vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# VS Code Debug Configuration

## Node.js Version Manager Support

This project uses a Node.js wrapper script (`node-wrapper.sh`) to ensure debugging works regardless of how Node.js is installed on your system.

### Supported Node Version Managers

- **nvm** (Node Version Manager)
- **volta**
- System-installed Node.js

### How It Works

The `node-wrapper.sh` script automatically detects and loads your Node version manager before running Node.js. This ensures VS Code can find Node.js even when launched from the Dock/Finder on macOS or Start Menu on Windows.

### Troubleshooting

If you're still having issues with Node.js not being found:

1. **Ensure Node.js is installed**: Run `node --version` in your terminal
2. **Check the wrapper is executable**: It should be executable by default, but you can verify with:
```bash
chmod +x .vscode/node-wrapper.sh
```
3. **Alternative: Launch VS Code from terminal**:
```bash
code .
```
This ensures VS Code inherits your shell's PATH environment.

### For Other Version Managers

If you use a different Node version manager (e.g., `fnm`, `asdf`), you can modify `node-wrapper.sh` to add support for it.
36 changes: 36 additions & 0 deletions .vscode/launch-extension-host.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Spawns a second Extension Development Host window (separate process).
* Used for chat testing: run "Run VS Code Extension" first, then this config.
* Requires env: WORKSPACE_FOLDER, VSCODE_EXEC_PATH. Args: folder path, user-data-dir path (relative to workspace).
*/
import { spawn } from 'child_process';
import path from 'path';

const workspaceFolder = process.env.WORKSPACE_FOLDER || process.cwd();
const execPath = process.env.VSCODE_EXEC_PATH;
const folderArg = process.argv[2];
const userDataDirArg = process.argv[3];

if (!execPath || !folderArg || !userDataDirArg) {
console.error('Usage: node launch-extension-host.js <folder> <user-data-dir>');
console.error('Requires env: WORKSPACE_FOLDER, VSCODE_EXEC_PATH');
process.exit(1);
}

const folder = path.resolve(workspaceFolder, folderArg);
const userDataDir = path.resolve(workspaceFolder, userDataDirArg);
const extPath = path.resolve(workspaceFolder, 'packages/open-collaboration-vscode');

// Always use local server (testing only)
const spawnEnv = {
...process.env,
DEVELOPMENT: 'true',
OCT_SERVER_URL: 'http://localhost:8100',
};

const child = spawn(execPath, [
folder,
'--extensionDevelopmentPath=' + extPath,
'--user-data-dir=' + userDataDir,
], { detached: true, stdio: 'ignore', env: spawnEnv });
child.unref();
270 changes: 168 additions & 102 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,170 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Service Process",
"port": "${input:attachPort}",

},
{
"type": "node",
"request": "launch",
"name": "Launch Server",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/packages/open-collaboration-server/lib/app.js",
"args": [
"--hostname=0.0.0.0"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-server/lib/**/*.js",
],
"env": {
"OCT_ACTIVATE_SIMPLE_LOGIN": "true",
"OCT_REDIRECT_URL_WHITELIST": "http://localhost:5173/",
}
},
{
"name": "Run VS Code Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/open-collaboration-vscode"
],
"env": {
"DEVELOPMENT": "true"
},
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-vscode/dist/**/*.js"
]
},
{
"name": "Run VS Code Web Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/open-collaboration-vscode",
"--extensionDevelopmentKind=web"
],
// VS Code cannot debug the web extension directly, which is why we don't configure source maps here
// Instead, use VS Code browser dev tools (Help -> Toggle Developer Tools) to debug the web extension
},
{
"name": "Launch Service Process",
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-service-process/lib/**/*.js"
],
"sourceMaps": true,
"program": "${workspaceFolder}/packages/open-collaboration-service-process/lib/process.js",
"args": [
"--server-address=http://localhost:8100",
"--auth-token=12312"
]
},
{
"name": "Debug Monaco Examples",
"request": "launch",
"type": "chrome",
"url": "http://localhost:5173/",
"webRoot": "${workspaceFolder}/packages/open-collaboration-monaco",
},
{
"name": "Vitest: Run Selected File",
"type": "node",
"request": "launch",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**", "!**/node_modules/vscode-*/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"console": "integratedTerminal",
"smartStep": true,
"sourceMaps": true,
"outFiles": []
}
],
"inputs": [
{
"id": "attachPort",
"type": "promptString",
"description": "What port should the application use for debugging?",
"default": "23698"
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Server",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/packages/open-collaboration-server/lib/app.js",
"args": ["--hostname=0.0.0.0"],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-server/lib/**/*.js"
],
"env": {
"OCT_ACTIVATE_SIMPLE_LOGIN": "true",
"OCT_REDIRECT_URL_WHITELIST": "http://localhost:5173/"
}
},
// Chat test: run "Run VS Code Extension", then "Spawn Second Extension Instance" to get two windows (protocol + vscode).
{
"name": "Run VS Code Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/open-collaboration-vscode",
"--user-data-dir=${workspaceFolder}/.vscode/extension-host-data-1"
],
"env": {
"DEVELOPMENT": "true"
},
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-vscode/dist/**/*.js"
]
},
{
"name": "Spawn Second Extension Instance",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"program": "${workspaceFolder}/.vscode/launch-extension-host.js",
"args": [
"packages/open-collaboration-vscode",
".vscode/extension-host-data-2"
],
"env": {
"WORKSPACE_FOLDER": "${workspaceFolder}",
"VSCODE_EXEC_PATH": "${execPath}",
"OCT_SERVER_URL": "http://localhost:8100"
},
"console": "integratedTerminal"
},
{
"name": "Run VS Code Web Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/open-collaboration-vscode",
"--extensionDevelopmentKind=web"
]
// VS Code cannot debug the web extension directly, which is why we don't configure source maps here
// Instead, use VS Code browser dev tools (Help -> Toggle Developer Tools) to debug the web extension
},
{
"name": "Launch Service Process",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"console": "integratedTerminal",
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-service-process/lib/**/*.js"
],
"sourceMaps": true,
"program": "${workspaceFolder}/packages/open-collaboration-service-process/lib/process.js",
"args": ["--server-address=http://localhost:8100", "--auth-token=12312"]
},
{
"name": "Debug Monaco Examples",
"request": "launch",
"type": "chrome",
"url": "http://localhost:5173/",
"webRoot": "${workspaceFolder}/packages/open-collaboration-monaco"
},
{
"name": "Vitest: Run Selected File",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"autoAttachChildProcesses": true,
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"!**/node_modules/vscode-*/**"
],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"console": "integratedTerminal",
"smartStep": true,
"sourceMaps": true,
"outFiles": []
},
{
"name": "Debug Agent",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/packages/open-collaboration-agent/lib/main.js",
"args": [
"--room",
"${input:roomToken}",
"--server",
"https://api.open-collab.tools"
// Optional: Add "--acp-agent", "npx @zed-industries/claude-code-acp" to override default ACP agent
],
"cwd": "${input:workspaceFolder}",
"console": "integratedTerminal",
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/packages/open-collaboration-agent/lib/**/*.js"
],
"env": {
"NODE_ENV": "development"
},
"envFile": "${workspaceFolder}/.env"
},
{
"name": "Debug Agent (Local)",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/.vscode/node-wrapper.sh",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/node_modules/.bin/tsx",
"args": [
"watch",
"${workspaceFolder}/packages/open-collaboration-agent/src/main.ts",
"--room",
"${input:roomToken}",
"--server",
"http://localhost:8100"
// Optional: Add "--acp-agent", "npx @zed-industries/claude-code-acp" to override default ACP agent
],
"cwd": "${input:workspaceFolder}",
"console": "integratedTerminal",
"restart": true,
"env": {
"NODE_ENV": "development"
},
"envFile": "${workspaceFolder}/.env"
}
],
"inputs": [
{
"id": "roomToken",
"type": "promptString",
"description": "Enter the room token to join"
},
{
"id": "workspaceFolder",
"type": "promptString",
"description": "Enter the workspace folder to use",
"default": "${workspaceFolder}"
}
]
}
19 changes: 19 additions & 0 deletions .vscode/node-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Node.js wrapper for VS Code debugging
# This script ensures Node.js is available regardless of version manager (nvm, volta, etc.)

# Try to source nvm if it exists
if [ -s "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
fi

# Try to source volta if it exists
if [ -d "$HOME/.volta" ]; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi

# Execute node with all arguments passed to this script
exec node "$@"

10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export default [{
'**/*env.d.ts'
],
}, ...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'), {
// Node-based helper scripts (e.g. .vscode/*.js) need Node globals like `process` and `console`.
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
languageOptions: {
globals: {
...globals.node
},
ecmaVersion: 2022,
sourceType: 'module'
}
}, {
files: [
'**/src/**/*.ts',
'**/src/**/*.tsx',
Expand Down
Loading
Loading