mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 21:49:42 +02:00
fix(welcome): gate Claude and Opencode buttons on CLI availability too
Extends the Gemini gating from bb7fb9e to the other welcome-screen buttons that had the same problem: shown unconditionally even when the underlying CLI isn't installed. - Add isClaudeAvailable() (claude-cli-resolver.ts) and GET /api/claude/status, mirroring the existing opencode/codex/gemini resolvers and status endpoints. - Opencode already had a working /api/opencode/status the welcome screen just wasn't checking; wire it up the same way. - Refactor loadGeminiAvailability() into a shared _loadCliAvailability(buttonId, statusUrl) helper instead of duplicating the fetch/try-catch three times. Run-mode dropdown entries (Opencode/Codex) are intentionally left unconditional here — follow-up PR.
This commit is contained in:
@@ -26,6 +26,15 @@ const CLAUDE_SEARCH_DIRS = [
|
||||
/** Cached directory containing the claude binary (empty string = searched but not found) */
|
||||
let _claudeDir: string | null = null;
|
||||
|
||||
/**
|
||||
* Returns true if the Claude CLI binary can be located (via `which` or one of
|
||||
* the common install directories). Mirrors `isGeminiAvailable`/`isOpenCodeAvailable`/
|
||||
* `isCodexAvailable` in the sibling resolvers.
|
||||
*/
|
||||
export function isClaudeAvailable(): boolean {
|
||||
return findClaudeDir() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the directory containing the `claude` binary.
|
||||
* Checks `which claude` first, then falls back to common install locations.
|
||||
|
||||
Reference in New Issue
Block a user