feat: fix CLI authentication detection to prevent unnecessary browser prompts

- Fix Claude, Codex, and Cursor auth handlers to check if CLI is already authenticated
- Use same detection logic as each provider's internal checkAuth/codexAuthIndicators()
- For Codex: Check for API keys and auth files before requiring manual login
- For Cursor: Check for env var and credentials files before requiring manual auth
- For Claude: Check for cached auth tokens, settings, and credentials files
- If CLI is already authenticated: Just reconnect by removing disconnected marker
- If CLI needs auth: Tell user to manually run login command
- This prevents timeout errors when login commands can't run in non-interactive mode
This commit is contained in:
DhanushSantosh
2026-01-09 21:34:14 +05:30
parent 33d02d1df8
commit 1452232409
17 changed files with 741 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
// Type definitions for Electron IPC API
import type { SessionListItem, Message } from '@/types/electron';
import type { ClaudeUsageResponse } from '@/store/app-store';
import type { ClaudeUsageResponse, CodexUsageResponse } from '@/store/app-store';
import type {
IssueValidationVerdict,
IssueValidationConfidence,
@@ -725,6 +725,9 @@ export interface ElectronAPI {
}>;
};
ideation?: IdeationAPI;
codex?: {
getUsage: () => Promise<CodexUsageResponse>;
};
}
// Note: Window interface is declared in @/types/electron.d.ts