You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
llm: strengthen tool detection with binary presence check #5070
DetectedLLMGatewayClients() in pkg/client/llm_gateway.go currently detects an installed AI tool by checking whether the tool's settings directory exists on disk. This was flagged in PR #5065 review (JAORMX) as false-positive prone:
`/.claude` and `/.gemini` hang around from prior installs or unrelated tooling. Combine with `exec.LookPath("claude")` / `exec.LookPath("gemini")`.
Problem
A settings directory like ~/.claude or ~/.gemini can exist even when the tool is no longer installed (leftover from a prior install, created by unrelated tooling, or seeded by thv client register). In that case thv llm setup will attempt to patch settings.json for a tool the user doesn't actually have, producing a confusing no-op or stale config file.
Proposed fix
Extend clientAppConfig with an optional BinaryName string field. DetectedLLMGatewayClients() should require both conditions:
Settings directory exists (os.Stat of filepath.Dir(settingsPath) succeeds) — current check.
Binary is on $PATH (exec.LookPath(cfg.BinaryName) succeeds) — new check, skipped when BinaryName is empty.
Populate BinaryName for tools where a canonical binary name is well-known:
Client
BinaryName
claude-code
claude
gemini-cli
gemini
cursor
cursor
vscode
code
xcode
(skip — macOS app, not on PATH)
Note: IsClientInstalled() (MCP detection) has the same limitation. Fixing DetectedLLMGatewayClients first is the right scope for this issue; a follow-up can extend IsClientInstalled consistently.
Activity
Strengthen tool detection with binary presence check
Strengthen tool detection with binary presence check
Strengthen tool detection with binary presence check
Strengthen tool detection with binary presence check (#5083)