Skip to content

fix(provider-detection): detect CLIs on Windows via where (fixes #515)#516

Merged
tomdps merged 1 commit into
the-open-engine:devfrom
atharvwasthere:fix/windows-provider-detection
Jun 22, 2026
Merged

fix(provider-detection): detect CLIs on Windows via where (fixes #515)#516
tomdps merged 1 commit into
the-open-engine:devfrom
atharvwasthere:fix/windows-provider-detection

Conversation

@atharvwasthere

Copy link
Copy Markdown
Contributor

Problem

On Windows, zeroshot providers reports every provider as ✗ not found, even when the CLI is installed and on PATH (claude --version works fine). This makes zeroshot unusable on Windows out of the box.

Fixes #515.

Root cause

lib/provider-detection.js probes for a CLI with the POSIX shell builtin command -v:

execSync(`command -v ${command}`, { stdio: 'pipe' });

On Windows execSync runs through cmd.exe, which has no command builtin, so the probe always throws and commandExists / getCommandPath always fail. The project already solves this correctly in src/preflight.js (process.platform === 'win32' ? 'where' : 'which'), but the provider-detection helpers never got the Windows branch.

Fix

Branch on platform, mirroring src/preflight.js:

const probe = process.platform === 'win32' ? `where ${command}` : `command -v ${command}`;

getCommandPath now takes the first line of output, since where can return multiple matches.

Tests

Adds tests/provider-detection.test.js (mocha + sinon) covering both probe branches and the multi-match path. All 6 pass; lint clean.

Verified locally on Windows 11 — after the fix, installed providers flip to ✓ found:

Claude    ✓ found   C:\Users\...\claude.exe
Codex     ✓ found   C:\Users\...\codex
Gemini    ✓ found   C:\Users\...\gemini
Opencode  ✓ found   C:\Users\...\opencode

Scope note (follow-up)

getHelpOutput / getVersionOutput in the same file call spawnSync(command, ...) without shell: true. On Windows that also fails for .cmd/.ps1 shims (most npm-installed CLIs). Left out to keep this PR focused on the reported detection bug; happy to add a follow-up if you'd like it bundled.

…cted

commandExists/getCommandPath probed for CLIs with the POSIX builtin
`command -v`, which does not exist under cmd.exe. On Windows every probe
threw, so `zeroshot providers` reported all providers as "not found" even
when installed and on PATH.

Branch on platform (mirroring src/preflight.js): use `where` on win32 and
`command -v` elsewhere. getCommandPath takes the first match line since
`where` can return several. Adds cross-platform unit coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants