Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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 --versionprints "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 loginin 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.