Skip to content

feat: locate coding-agent CLIs generically, with a path override - #3190

Merged
abose merged 2 commits into
mainfrom
ai
Sep 10, 2026
Merged

feat: locate coding-agent CLIs generically, with a path override#3190
abose merged 2 commits into
mainfrom
ai

Conversation

@abose

@abose abose commented Sep 10, 2026

Copy link
Copy Markdown
Member

Extracts the claude discovery machinery out of claude-code-agent.js into a registry-driven cli-locator, so a second CLI is a table entry rather than a parallel copy of the search.

Validation has to be per-CLI: codex --version prints "codex-cli 0.153.4", which the existing /^\d/ test rejects. Loosening it to "any output" instead would make any exit-0 binary named codex on PATH a match, and codex is a short, generic name — so each CLI brings its own pattern, with a shared floor of "names itself, then a version".

Adds a user-configured path per CLI. It is tried first and always validated, even on Windows and even for a .exe, and a failure does NOT fall through to auto-discovery: quietly running a different binary than the one configured is the worst kind of bug report. The distinct error codes (missing / not executable / not this CLI / timed out) are what lets the panel say which of those went wrong. Cache entries record the override they were built from, so repointing one invalidates it without an explicit clear step that could desync.

getCliSpawnProfile exists because node-pty goes through CreateProcess, which runs .exe/.com only. An npm-installed CLI resolves to a .cmd shim, so passing the resolved path straight to the PTY fails to spawn — an existing bug for claude on Windows, masked because the native .exe usually wins, and one codex would hit far more often.

checkAvailability stays as a claude-shaped shim: four browser call sites read claudePath and the login state, and that legacy key belongs on a claude result rather than becoming a lie on a codex one. No codex login probe — there is no machine-readable status to call, and codex login in a subprocess wants a browser.

Also fixes the install command interpolating a translated string into a single-quoted shell word, where an apostrophe in any of ~40 locales breaks the command.

Extracts the claude discovery machinery out of claude-code-agent.js
into a registry-driven cli-locator, so a second CLI is a table entry
rather than a parallel copy of the search.

Validation has to be per-CLI: `codex --version` prints
"codex-cli 0.153.4", which the existing /^\d/ test rejects. Loosening
it to "any output" instead would make any exit-0 binary named codex on
PATH a match, and codex is a short, generic name — so each CLI brings
its own pattern, with a shared floor of "names itself, then a version".

Adds a user-configured path per CLI. It is tried first and always
validated, even on Windows and even for a .exe, and a failure does NOT
fall through to auto-discovery: quietly running a different binary than
the one configured is the worst kind of bug report. The distinct error
codes (missing / not executable / not this CLI / timed out) are what
lets the panel say which of those went wrong. Cache entries record the
override they were built from, so repointing one invalidates it without
an explicit clear step that could desync.

getCliSpawnProfile exists because node-pty goes through CreateProcess,
which runs .exe/.com only. An npm-installed CLI resolves to a .cmd
shim, so passing the resolved path straight to the PTY fails to spawn —
an existing bug for claude on Windows, masked because the native .exe
usually wins, and one codex would hit far more often.

checkAvailability stays as a claude-shaped shim: four browser call
sites read claudePath and the login state, and that legacy key belongs
on a claude result rather than becoming a lie on a codex one. No codex
login probe — there is no machine-readable status to call, and
`codex login` in a subprocess wants a browser.

Also fixes the install command interpolating a translated string into a
single-quoted shell word, where an apostrophe in any of ~40 locales
breaks the command.
@sonarqubecloud

Copy link
Copy Markdown

@abose
abose merged commit 69a3a5b into main Sep 10, 2026
12 of 21 checks passed
@abose
abose deleted the ai branch September 10, 2026 14:20
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.

1 participant