import { ExternalLink, KeyRound, X } from 'lucide-react'; import StandaloneShell from '../../standalone-shell/view/StandaloneShell'; import { DEFAULT_PROJECT_FOR_EMPTY_SHELL, IS_PLATFORM } from '../../../constants/config'; import type { LLMProvider } from '../../../types/app'; type ProviderLoginModalProps = { isOpen: boolean; onClose: () => void; provider?: LLMProvider; onComplete?: (exitCode: number) => void; customCommand?: string; isAuthenticated?: boolean; }; const getProviderCommand = ({ provider, customCommand, isAuthenticated: _isAuthenticated, }: { provider: LLMProvider; customCommand?: string; isAuthenticated: boolean; }) => { if (customCommand) { return customCommand; } if (provider === 'claude') { return 'claude --dangerously-skip-permissions /login'; } if (provider === 'cursor') { return 'cursor-agent login'; } if (provider === 'codex') { return IS_PLATFORM ? 'codex login --device-auth' : 'codex login'; } return 'gemini status'; }; const getProviderTitle = (provider: LLMProvider) => { if (provider === 'claude') return 'Claude CLI Login'; if (provider === 'cursor') return 'Cursor CLI Login'; if (provider === 'codex') return 'Codex CLI Login'; return 'Gemini CLI Configuration'; }; export default function ProviderLoginModal({ isOpen, onClose, provider = 'claude', onComplete, customCommand, isAuthenticated = false, }: ProviderLoginModalProps) { if (!isOpen) { return null; } const command = getProviderCommand({ provider, customCommand, isAuthenticated }); const title = getProviderTitle(provider); const handleComplete = (exitCode: number) => { onComplete?.(exitCode); // Keep the modal open so users can read terminal output before closing. }; return (

{title}

{provider === 'gemini' ? (

Setup Gemini API Access

The Gemini CLI requires an API key to function. Configure it in your terminal first.

  1. 1

    Get your API key

    Google AI Studio
  2. 2

    Run configuration

    Open your terminal and run:

    gemini config set api_key YOUR_KEY
) : ( )}
); }