On Windows, every companion command (/opencode:setup, /opencode:review, /opencode:rescue, background serve) fails immediately with:
Error: spawn opencode ENOENT
even when OpenCode is correctly installed via npm install -g opencode-ai and resolvable on PATH.
Root cause: npm installs global CLI shims on Windows as opencode.cmd / opencode.ps1 (there's no extensionless opencode executable). child_process.spawn(\"opencode\", ...) without shell: true can't resolve those shims on Windows — it only works for a real executable. This affects every spawn(\"opencode\", ...) call in scripts/lib/process.mjs and scripts/lib/opencode-server.mjs.
Separately, the install-check in resolveOpencodeBinary() shells out to which opencode, but which isn't a native Windows binary, so the check reports "not installed" even when OpenCode is present.
Opened PR #7 with the fix: add shell: process.platform === \"win32\" to the four affected spawn() calls, and use where instead of which on win32. Tested locally on Windows 11 with OpenCode 1.18.9 — setup --json now returns a correct installed: true result instead of throwing.
On Windows, every companion command (
/opencode:setup,/opencode:review,/opencode:rescue, backgroundserve) fails immediately with:even when OpenCode is correctly installed via
npm install -g opencode-aiand resolvable onPATH.Root cause: npm installs global CLI shims on Windows as
opencode.cmd/opencode.ps1(there's no extensionlessopencodeexecutable).child_process.spawn(\"opencode\", ...)withoutshell: truecan't resolve those shims on Windows — it only works for a real executable. This affects everyspawn(\"opencode\", ...)call inscripts/lib/process.mjsandscripts/lib/opencode-server.mjs.Separately, the install-check in
resolveOpencodeBinary()shells out towhich opencode, butwhichisn't a native Windows binary, so the check reports "not installed" even when OpenCode is present.Opened PR #7 with the fix: add
shell: process.platform === \"win32\"to the four affectedspawn()calls, and usewhereinstead ofwhichonwin32. Tested locally on Windows 11 with OpenCode 1.18.9 —setup --jsonnow returns a correctinstalled: trueresult instead of throwing.