fix(websearch): detect Gemini CLI auth status before showing Ready

Previously, WebSearch status showed "Ready (Gemini)" when the CLI binary
was installed, misleading users who hadn't authenticated yet.

Changes:
- Add isGeminiAuthenticated() to check ~/.gemini/oauth_creds.json
- Add 'needs_auth' state to WebSearchReadiness type
- Show warning "[!] Gemini: run 'gemini' to login" when not authenticated
- Fix incorrect 'gemini auth login' references (no such command exists)
- Update docs with correct npm install and authentication instructions
This commit is contained in:
kaitranntt committed 2025-12-18 03:24:59 -05:00
1 parent f3a6f4ef4e
commit 98c21efb5a
3 files changed
+80 -21

No files matched your search

+4 -4
View File
@@ -513,8 +513,8 @@ function outputError(query, error, providerName) {
`Query: "${query}"`,
'',
'Troubleshooting:',
' - Check if Gemini CLI is authenticated: gemini auth status',
' - Re-authenticate if needed: gemini auth login',
' - Check ~/.gemini/oauth_creds.json exists',
' - Re-authenticate: run `gemini` (opens browser)',
].join('\n');
const output = {
@@ -546,7 +546,7 @@ function outputNoProvidersEnabled(query) {
'',
'1. Gemini CLI (FREE, 1000 req/day):',
' npm install -g @google/gemini-cli',
' gemini auth login',
' gemini # opens browser to authenticate',
'',
'2. OpenCode (FREE via Zen):',
' curl -fsSL https://opencode.ai/install | bash',
@@ -595,7 +595,7 @@ function outputAllFailedMessage(query, errors) {
`Query: "${query}"`,
'',
'Troubleshooting:',
' - Gemini: gemini auth status / gemini auth login',
' - Gemini: run `gemini` to authenticate (opens browser)',
' - OpenCode: opencode --version',
' - Grok: Check XAI_API_KEY environment variable',
].join('\n');