mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 07:59: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:
@@ -695,10 +695,22 @@ Object.assign(CodemanApp.prototype, {
|
||||
},
|
||||
|
||||
async loadGeminiAvailability() {
|
||||
const btn = document.getElementById('welcomeGeminiBtn');
|
||||
await this._loadCliAvailability('welcomeGeminiBtn', '/api/gemini/status');
|
||||
},
|
||||
|
||||
async loadClaudeAvailability() {
|
||||
await this._loadCliAvailability('welcomeClaudeBtn', '/api/claude/status');
|
||||
},
|
||||
|
||||
async loadOpencodeAvailability() {
|
||||
await this._loadCliAvailability('welcomeOpencodeBtn', '/api/opencode/status');
|
||||
},
|
||||
|
||||
async _loadCliAvailability(buttonId, statusUrl) {
|
||||
const btn = document.getElementById(buttonId);
|
||||
if (!btn) return;
|
||||
try {
|
||||
const res = await fetch('/api/gemini/status');
|
||||
const res = await fetch(statusUrl);
|
||||
const env = await res.json();
|
||||
const status = env?.success === true ? env.data : env;
|
||||
btn.style.display = status?.available ? 'flex' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user