mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
* feat: add Gemini CLI provider for AI model execution - Add GeminiProvider class extending CliProvider for Gemini CLI integration - Add Gemini models (Gemini 3 Pro/Flash Preview, 2.5 Pro/Flash/Flash-Lite) - Add gemini-models.ts with model definitions and types - Update ModelProvider type to include 'gemini' - Add isGeminiModel() to provider-utils.ts for model detection - Register Gemini provider in provider-factory with priority 4 - Add Gemini setup detection routes (status, auth, deauth) - Add GeminiCliStatus to setup store for UI state management - Add Gemini to PROVIDER_ICON_COMPONENTS for UI icon display - Add GEMINI_MODELS to model-display for dropdown population - Support thinking levels: off, low, medium, high Based on https://github.com/google-gemini/gemini-cli * chore: update package-lock.json * feat(ui): add Gemini provider to settings and setup wizard - Add GeminiCliStatus component for CLI detection display - Add GeminiSettingsTab component for global settings - Update provider-tabs.tsx to include Gemini as 5th tab - Update providers-setup-step.tsx with Gemini provider detection - Add useGeminiCliStatus hook for querying CLI status - Add getGeminiStatus, authGemini, deauthGemini to HTTP API client - Add gemini query key for React Query - Fix GeminiModelId type to not double-prefix model IDs * feat(ui): add Gemini to settings sidebar navigation - Add 'gemini-provider' to SettingsViewId type - Add GeminiIcon and gemini-provider to navigation config - Add gemini-provider to NAV_ID_TO_PROVIDER mapping - Add gemini-provider case in settings-view switch - Export GeminiSettingsTab from providers index This fixes the missing Gemini entry in the AI Providers sidebar menu. * feat(ui): add Gemini model configuration in settings - Create GeminiModelConfiguration component for model selection - Add enabledGeminiModels and geminiDefaultModel state to app-store - Add setEnabledGeminiModels, setGeminiDefaultModel, toggleGeminiModel actions - Update GeminiSettingsTab to show model configuration when CLI is installed - Import GeminiModelId and getAllGeminiModelIds from types This adds the ability to configure which Gemini models are available in the feature modal, similar to other providers like Codex and OpenCode. * feat(ui): add Gemini models to all model dropdowns - Add GEMINI_MODELS to model-constants.ts for UI dropdowns - Add Gemini to ALL_MODELS array used throughout the app - Add GeminiIcon to PROFILE_ICONS mapping - Fix GEMINI_MODELS in model-display.ts to use correct model IDs - Update getModelDisplayName to handle Gemini models correctly Gemini models now appear in all model selection dropdowns including Model Defaults, Feature Defaults, and feature card settings. * fix(gemini): fix CLI integration and event handling - Fix model ID prefix handling: strip gemini- prefix in agent-service, add it back in buildCliArgs for CLI invocation - Fix event normalization to match actual Gemini CLI output format: - type: 'init' (not 'system') - type: 'message' with role (not 'assistant') - tool_name/tool_id/parameters/output field names - Add --sandbox false and --approval-mode yolo for faster execution - Remove thinking level selector from UI (Gemini CLI doesn't support it) - Update auth status to show errors properly * test: update provider-factory tests for Gemini provider - Add GeminiProvider import and spy mock - Update expected provider count from 4 to 5 - Add test for GeminiProvider inclusion - Add gemini key to checkAllProviders test * fix(gemini): address PR review feedback - Fix npm package name from @anthropic-ai/gemini-cli to @google/gemini-cli - Fix comments in gemini-provider.ts to match actual CLI output format - Convert sync fs operations to async using fs/promises * fix(settings): add Gemini and Codex settings to sync Add enabledGeminiModels, geminiDefaultModel, enabledCodexModels, and codexDefaultModel to SETTINGS_FIELDS_TO_SYNC for persistence across sessions. * fix(gemini): address additional PR review feedback - Use 'Speed' badge for non-thinking Gemini models (consistency) - Fix installCommand mapping in gemini-settings-tab.tsx - Add hasEnvApiKey to GeminiCliStatus interface for API parity - Clarify GeminiThinkingLevel comment (CLI doesn't support --thinking-level) * fix(settings): restore Codex and Gemini settings from server Add sanitization and restoration logic for enabledCodexModels, codexDefaultModel, enabledGeminiModels, and geminiDefaultModel in refreshSettingsFromServer() to match the fields in SETTINGS_FIELDS_TO_SYNC. * feat(gemini): normalize tool names and fix workspace restrictions - Add tool name mapping to normalize Gemini CLI tool names to standard names (e.g., write_todos -> TodoWrite, read_file -> Read) - Add normalizeGeminiToolInput to convert write_todos format to TodoWrite format (description -> content, handle cancelled status) - Pass --include-directories with cwd to fix workspace restriction errors when Gemini CLI has a different cached workspace from previous sessions --------- Co-authored-by: Claude <noreply@anthropic.com>
168 lines
4.0 KiB
TypeScript
168 lines
4.0 KiB
TypeScript
/**
|
|
* CLI Status Query Hooks
|
|
*
|
|
* React Query hooks for fetching CLI tool status (Claude, Cursor, Codex, etc.)
|
|
*/
|
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { getElectronAPI } from '@/lib/electron';
|
|
import { queryKeys } from '@/lib/query-keys';
|
|
import { STALE_TIMES } from '@/lib/query-client';
|
|
|
|
/**
|
|
* Fetch Claude CLI status
|
|
*
|
|
* @returns Query result with Claude CLI status
|
|
*/
|
|
export function useClaudeCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.claude(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getClaudeStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch Claude status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch Cursor CLI status
|
|
*
|
|
* @returns Query result with Cursor CLI status
|
|
*/
|
|
export function useCursorCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.cursor(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getCursorStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch Cursor status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch Codex CLI status
|
|
*
|
|
* @returns Query result with Codex CLI status
|
|
*/
|
|
export function useCodexCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.codex(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getCodexStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch Codex status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch OpenCode CLI status
|
|
*
|
|
* @returns Query result with OpenCode CLI status
|
|
*/
|
|
export function useOpencodeCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.opencode(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getOpencodeStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch OpenCode status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch Gemini CLI status
|
|
*
|
|
* @returns Query result with Gemini CLI status
|
|
*/
|
|
export function useGeminiCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.gemini(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getGeminiStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch Gemini status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch GitHub CLI status
|
|
*
|
|
* @returns Query result with GitHub CLI status
|
|
*/
|
|
export function useGitHubCliStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.github(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getGhStatus();
|
|
if (!result.success) {
|
|
throw new Error(result.error || 'Failed to fetch GitHub CLI status');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch API keys status
|
|
*
|
|
* @returns Query result with API keys status
|
|
*/
|
|
export function useApiKeysStatus() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.apiKeys(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getApiKeys();
|
|
return result;
|
|
},
|
|
staleTime: STALE_TIMES.CLI_STATUS,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fetch platform info
|
|
*
|
|
* @returns Query result with platform info
|
|
*/
|
|
export function usePlatformInfo() {
|
|
return useQuery({
|
|
queryKey: queryKeys.cli.platform(),
|
|
queryFn: async () => {
|
|
const api = getElectronAPI();
|
|
const result = await api.setup.getPlatform();
|
|
if (!result.success) {
|
|
throw new Error('Failed to fetch platform info');
|
|
}
|
|
return result;
|
|
},
|
|
staleTime: Infinity, // Platform info never changes
|
|
});
|
|
}
|