opencode
opencode copied to clipboard
How to debug server (worker) code?
Question
I can debug TUI code in two ways:
1 bun run --cwd packages/opencode --conditions=browser --inspect src/index.ts
--------------------- Bun Inspector ---------------------
Listening:
ws://localhost:6499/arzcsfu03h5
Inspect in browser:
https://debug.bun.sh/#localhost:6499/arzcsfu03h5
--------------------- Bun Inspector ---------------------
2 bun run --cwd packages/opencode --conditions=browser src/index.ts in "JavaScript Debug Terminal" in VsCode
However, I don't know how to debug the code in worker.js (/packages/opencode/src/cli/cmd/tui/worker.ts) because the server runs in a separate thread.
What's the recommended method for debugging the server code?