Commit Graph

316 Commits

  • refactor(forms): simplify and modernize form components
    Comprehensive refactoring of form components to reduce complexity,
    improve maintainability, and enhance user experience.
    
    Provider Forms:
    - CodexCommonConfigModal & CodexConfigSections
      * Simplified state management with reduced boilerplate
      * Improved field validation and error handling
      * Better layout with consistent spacing
      * Enhanced model selection with visual indicators
    - GeminiCommonConfigModal & GeminiConfigSections
      * Streamlined authentication flow (OAuth vs API Key)
      * Cleaner form layout with better grouping
      * Improved validation feedback
      * Better integration with parent components
    - CommonConfigEditor
      * Reduced from 178 to 68 lines (-62% complexity)
      * Extracted reusable form patterns
      * Improved JSON editing with syntax validation
      * Better error messages and recovery options
    - EndpointSpeedTest
      * Complete rewrite for better UX
      * Real-time testing progress indicators
      * Enhanced error handling with retry logic
      * Visual feedback for test results (color-coded latency)
    
    MCP & Prompts:
    - McpFormModal
      * Simplified from 581 to ~360 lines
      * Better stdio/http server type handling
      * Improved form validation
      * Enhanced multi-app selection (Claude/Codex/Gemini)
    - PromptPanel
      * Cleaner integration with PromptFormPanel
      * Improved list/grid view switching
      * Better state management for editing workflows
      * Enhanced delete confirmation with safety checks
    
    Code Quality Improvements:
    - Reduced total lines by ~251 lines (-24% code reduction)
    - Eliminated duplicate validation logic
    - Improved TypeScript type safety
    - Better component composition and separation of concerns
    - Enhanced accessibility with proper ARIA labels
    
    These changes make forms more intuitive, responsive, and easier to
    maintain while reducing bundle size and improving runtime performance.
  • refactor(settings): migrate from dialog to full-screen page layout
    Complete migration of settings from modal dialog to dedicated full-screen
    page, improving UX and providing more space for configuration options.
    
    Changes:
    - Remove SettingsDialog component (legacy modal-based interface)
    - Add SettingsPage component with full-screen layout using FullScreenPanel
    - Refactor App.tsx routing to support dedicated settings page
      * Add settings route handler
      * Update navigation logic from dialog-based to page-based
      * Integrate with existing app switcher and provider management
    - Update ImportExportSection to work with new page layout
      * Improve spacing and layout for better readability
      * Enhanced error handling and user feedback
      * Better integration with page-level actions
    - Enhance useSettings hook to support page-based workflow
      * Add navigation state management
      * Improve settings persistence logic
      * Better error boundary handling
    
    Benefits:
    - More intuitive navigation with dedicated settings page
    - Better use of screen space for complex configurations
    - Improved accessibility with clearer visual hierarchy
    - Consistent with modern desktop application patterns
    - Easier to extend with new settings sections
    
    This change is part of the larger UI refactoring initiative to modernize
    the application interface and improve user experience.
  • feat(components): add reusable full-screen panel components
    Add new full-screen panel components to support the UI refactoring:
    
    - FullScreenPanel: Reusable full-screen layout component with header,
      content area, and optional footer. Provides consistent layout for
      settings, prompts, and other full-screen views.
    
    - PromptFormPanel: Dedicated panel for creating and editing prompts
      with markdown preview support. Features real-time validation and
      integrated save/cancel actions.
    
    - AgentsPanel: Panel component for managing agent configurations.
      Provides a consistent interface for agent CRUD operations.
    
    - RepoManagerPanel: Full-featured repository manager panel for Skills.
      Supports repository listing, addition, deletion, and configuration
      management with integrated validation.
    
    These components establish the foundation for the upcoming settings
    page migration from dialog-based to full-screen layout.
  • fix(dialog): prevent dialogs from closing on overlay click
    Add onInteractOutside handler to DialogContent to prevent accidental
    dialog closure when users click on the overlay/backdrop. This prevents
    data loss in forms and improves user experience across all 11 dialog
    components in the application.
    
    Users can still close dialogs using:
    - Close button (X) in the top-right corner
    - Cancel/Close buttons within the dialog
    - ESC key
  • feat(settings): add Gemini configuration directory support (#255)
    * style: apply code formatting across backend and frontend
    
    Apply cargo fmt and prettier formatting to improve code readability.
    No functional changes.
    
    Changes:
    - Rust: multi-line assertion formatting (gemini_config, env_checker)
    - Rust: simplify chained method calls (provider)
    - TypeScript: add trailing commas to function parameters (codexProviderPresets)
    
    * feat(settings): add Gemini configuration directory support
    
    Add custom configuration directory support for Gemini:
    - Add geminiConfigDir field to Settings type
    - Extend DirectorySettings component with Gemini input
    - Update useDirectorySettings hook for Gemini directory management
    - Add i18n translations for Gemini directory settings
  • feat: update Gemini default model and remove Google Official preset model
    Updated default model from gemini-2.5-pro to gemini-3-pro-preview across:
    - Provider presets (PackyCode, Custom)
    - Form field placeholders
    - Default configurations
    - Test cases
    
    Google Official preset now has empty env config, allowing users to choose
    their own model or use application defaults, which is more appropriate for
    OAuth-based authentication.
    
    Changes:
    - geminiProviderPresets.ts: updated model to gemini-3-pro-preview, removed model from Google Official
    - GeminiFormFields.tsx: updated placeholder to gemini-3-pro-preview
    - GeminiConfigSections.tsx: updated placeholder to gemini-3-pro-preview
    - ProviderForm.tsx: updated default config to gemini-3-pro-preview
    - gemini_config.rs: updated test examples to gemini-3-pro-preview
  • fix: sync Gemini form fields with env editor
    The Gemini API key, base URL, and model inputs were not syncing with
    the env editor below due to data source mismatch. The form was using
    generic hooks (useApiKeyState, useBaseUrlState) that only updated
    settingsConfig, while the env editor relied on geminiEnv from
    useGeminiConfigState.
    
    Changes:
    - Use geminiApiKey/geminiBaseUrl from useGeminiConfigState instead of
      generic hooks
    - Wrap handlers to maintain bidirectional sync between geminiEnv and
      settingsConfig
    - Remove unused handleGeminiBaseUrlChange from useBaseUrlState to
      avoid naming conflicts
    
    Now all Gemini form fields properly sync with the env editor in both
    directions.
  • feat: add model configuration support and fix Gemini deeplink bug (#251)
    * feat(providers): add notes field for provider management
    
    - Add notes field to Provider model (backend and frontend)
    - Display notes with higher priority than URL in provider card
    - Style notes as non-clickable text to differentiate from URLs
    - Add notes input field in provider form
    - Add i18n support (zh/en) for notes field
    
    * chore: format code and clean up unused props
    
    - Run cargo fmt on Rust backend code
    - Format TypeScript imports and code style
    - Remove unused appId prop from ProviderPresetSelector
    - Clean up unused variables in tests
    - Integrate notes field handling in provider dialogs
    
    * feat(deeplink): implement ccswitch:// protocol for provider import
    
    Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
    
    Backend:
    - Implement URL parsing and validation (src-tauri/src/deeplink.rs)
    - Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
    - Register ccswitch:// protocol in macOS Info.plist
    - Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
    
    Frontend:
    - Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
    - Add API wrapper (src/lib/api/deeplink.ts)
    - Integrate event listeners in App.tsx
    
    Configuration:
    - Update Tauri config for deep link handling
    - Add i18n support for Chinese and English
    - Include test page for deep link validation (deeplink-test.html)
    
    Files: 15 changed, 1312 insertions(+)
    
    * chore(deeplink): integrate deep link handling into app lifecycle
    
    Wire up deep link infrastructure with app initialization and event handling.
    
    Backend Integration:
    - Register deep link module and commands in mod.rs
    - Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
    - Handle deep links from single instance callback (Windows/Linux CLI)
    - Handle deep links from macOS system events
    - Add tauri-plugin-deep-link dependency (Cargo.toml)
    
    Frontend Integration:
    - Listen for deeplink-import/deeplink-error events in App.tsx
    - Update DeepLinkImportDialog component imports
    
    Configuration:
    - Enable deep link plugin in tauri.conf.json
    - Update Cargo.lock for new dependencies
    
    Localization:
    - Add Chinese translations for deep link UI (zh.json)
    - Add English translations for deep link UI (en.json)
    
    Files: 9 changed, 359 insertions(+), 18 deletions(-)
    
    * refactor(deeplink): enhance Codex provider template generation
    
    Align deep link import with UI preset generation logic by:
    - Adding complete config.toml template matching frontend defaults
    - Generating safe provider name from sanitized input
    - Including model_provider, reasoning_effort, and wire_api settings
    - Removing minimal template that only contained base_url
    - Cleaning up deprecated test file deeplink-test.html
    
    * style: fix clippy uninlined_format_args warnings
    
    Apply clippy --fix to use inline format arguments in:
    - src/mcp.rs (8 fixes)
    - src/services/env_manager.rs (10 fixes)
    
    * style: apply code formatting and cleanup
    
    - Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
    - Organize Rust imports and module order alphabetically
    - Add newline at end of JSON files (en.json, zh.json)
    - Update Cargo.lock for dependency changes
    
    * feat: add model name configuration support for Codex and fix Gemini model handling
    
    - Add visual model name input field for Codex providers
      - Add model name extraction and update utilities in providerConfigUtils
      - Implement model name state management in useCodexConfigState hook
      - Add conditional model field rendering in CodexFormFields (non-official only)
      - Integrate model name sync with TOML config in ProviderForm
    
    - Fix Gemini deeplink model injection bug
      - Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
      - Add test cases for Gemini model injection (with/without model)
      - All tests passing (9/9)
    
    - Fix Gemini model field binding in edit mode
      - Add geminiModel state to useGeminiConfigState hook
      - Extract model value during initialization and reset
      - Sync model field with geminiEnv state to prevent data loss on submit
      - Fix missing model value display when editing Gemini providers
    
    Changes:
      - 6 files changed, 245 insertions(+), 13 deletions(-)
  • 添加Claude和Codex环境变量检查 (#242)
    * feat(env): add environment variable conflict detection and management
    
    实现了系统环境变量冲突检测与管理功能:
    
    核心功能:
    - 自动检测会影响 Claude/Codex 的系统环境变量
    - 支持 Windows 注册表和 Unix shell 配置文件检测
    - 提供可视化的环境变量冲突警告横幅
    - 支持批量选择和删除环境变量
    - 删除前自动备份,支持后续恢复
    
    技术实现:
    - Rust 后端: 跨平台环境变量检测与管理
    - React 前端: EnvWarningBanner 组件交互界面
    - 国际化支持: 中英文界面
    - 类型安全: 完整的 TypeScript 类型定义
    
    * refactor(env): remove unused imports and function
    
    Remove unused HashMap and PathBuf imports, and delete the unused get_source_description function to clean up the code.
  • Feat/claude skills management (#237)
    * feat(skills): add Claude Skills management feature
    
    Implement complete Skills management system with repository discovery,
    installation, and lifecycle management capabilities.
    
    Backend:
    - Add SkillService with GitHub integration and installation logic
    - Implement skill commands (list, install, uninstall, check updates)
    - Support multiple skill repositories with caching
    
    Frontend:
    - Add Skills management page with repository browser
    - Create SkillCard and RepoManager components
    - Add badge, card, table UI components
    - Integrate Skills API with Tauri commands
    
    Files: 10 files changed, 1488 insertions(+)
    
    * feat(skills): integrate Skills feature into application
    
    Integrate Skills management feature with complete dependency updates,
    configuration structure extensions, and internationalization support.
    
    Dependencies:
    - Add @radix-ui/react-visually-hidden for accessibility
    - Add anyhow, zip, serde_yaml, tempfile for Skills backend
    - Enable chrono serde feature for timestamp serialization
    
    Backend Integration:
    - Extend MultiAppConfig with SkillStore field
    - Implement skills.json migration from legacy location
    - Register SkillService and skill commands in main app
    - Export skill module in commands and services
    
    Frontend Integration:
    - Add Skills page route and dialog in App
    - Integrate Skills UI with main navigation
    
    Internationalization:
    - Add complete Chinese translations for Skills UI
    - Add complete English translations for Skills UI
    
    Code Quality:
    - Remove redundant blank lines in gemini_mcp.rs
    - Format log statements in mcp.rs
    
    Tests:
    - Update import_export_sync tests for SkillStore
    - Update mcp_commands tests for new structure
    
    Files: 16 files changed, 540 insertions(+), 39 deletions(-)
    
    * style(skills): improve SkillsPage typography and spacing
    
    Optimize visual hierarchy and readability of Skills page:
    - Reduce title size from 2xl to lg with tighter tracking
    - Improve description spacing and color contrast
    - Enhance empty state with better text hierarchy
    - Use explicit gray colors for better dark mode support
    
    * feat(skills): support custom subdirectory path for skill scanning
    
    Add optional skillsPath field to SkillRepo to enable scanning skills
    from subdirectories (e.g., "skills/") instead of repository root.
    
    Changes:
    - Backend: Add skillsPath field with subdirectory scanning logic
    - Frontend: Add skillsPath input field and display in repo list
    - Presets: Add cexll/myclaude repo with skills/ subdirectory
    - Code quality: Fix clippy warnings (dedup logic, string formatting)
    
    Backward compatible: skillsPath is optional, defaults to root scanning.
    
    * refactor(skills): improve repo manager dialog layout
    
    Optimize dialog structure with fixed header and scrollable content:
    - Add flexbox layout with fixed header and scrollable body
    - Remove outer border wrapper for cleaner appearance
    - Match SkillsPage design pattern for consistency
    - Improve UX with better content hierarchy
  • fix(mcp): improve format/submit UX and fix validation errors
    Fixes two critical issues with the MCP JSON input:
    1. Format button failed with wrapped format like "server": {...}
    2. Submit button failed despite input validation passing
    
    Changes:
    - Updated formatJSON to use smart parser (supports wrapped format)
    - Simplified submit validation logic (removed redundant validateJsonConfig call)
    - Improved UX: input preserves original format, cleanup happens on format/submit
      * Prevents confusing "instant disappearance" when pasting wrapped JSON
      * Auto-fills ID/Name fields while keeping input unchanged
      * Format button now strips wrapper key and formats cleanly
      * Submit button correctly extracts config regardless of format
    
    Code quality:
    - Reduced code by 5 lines (20 changes, 11 insertions, 16 deletions)
    - Consistent use of parseSmartMcpJson across all JSON operations
    - No type errors introduced
  • feat(mcp): add smart JSON parser for flexible input formats
    Support multiple MCP configuration input formats:
    - Pure config object: { "command": "npx", ... }
    - Key-value pair fragment: "server-name": { "command": "npx", ... }
    - Wrapped object: { "server-name": { "command": "npx", ... } }
    
    The parser automatically:
    - Detects and wraps JSON fragments into complete objects
    - Extracts server name from single-key objects
    - Auto-fills ID and Name fields when applicable
    - Formats the config for display
    
    This improves UX by allowing users to paste configs directly from
    .claude.json or .codex/config.toml without manual editing.
  • refactor(mcp): improve form label layout and simplify text
    - Simplify config label from "Full JSON configuration or use" to "Full JSON Configuration"
    - Align wizard button to the right using justify-between layout
    - Apply same pattern to TOML configuration label
    - Improve visual balance with cleaner left-right alignment
  • feat(mcp): enhance form UX with default apps and JSON formatter
    - Enable all apps (Claude, Codex, Gemini) by default when adding MCP servers
    - Improve config label with clearer wording: "Full JSON configuration or use [Config Wizard]"
    - Add JSON format button to beautify configuration with 2-space indentation
    - Update tests to reflect new default behavior
    - Clean up redundant explicit prop passing
    
    This provides a more streamlined experience by enabling all apps out of the box
    and making it easier to format JSON configurations.
  • feat(mcp): add SSE (Server-Sent Events) transport type support
    Add comprehensive support for SSE transport type to MCP server configuration,
    enabling real-time streaming connections alongside existing stdio and http types.
    
    Backend Changes:
    - Add SSE type validation in mcp.rs validate_server_spec()
    - Extend Codex TOML import/export to handle SSE servers
    - Update claude_mcp.rs legacy API for backward compatibility
    - Unify http/sse handling in json_server_to_toml_table()
    
    Frontend Changes:
    - Extend McpServerSpec type definition to include "sse"
    - Add SSE radio button to configuration wizard UI
    - Update wizard form logic to handle SSE url and headers
    - Add SSE validation in McpFormModal submission
    
    Validation & Error Handling:
    - Add SSE support in useMcpValidation hook (TOML/JSON)
    - Extend tomlUtils normalizeServerConfig for SSE parsing
    - Update Zod schemas (common.ts, mcp.ts) with SSE enum
    - Add SSE error message mapping in errorUtils
    
    Internationalization:
    - Add "typeSse" translations (zh: "sse", en: "sse")
    
    Tests:
    - Add SSE validation test cases in useMcpValidation.test.tsx
    
    SSE Configuration Format:
    {
      "type": "sse",
      "url": "https://api.example.com/sse",
      "headers": { "Authorization": "Bearer token" }
    }
  • refactor(codex): simplify custom template with minimal config
    **Changes:**
    - Remove all comments from custom template (align with Claude/Gemini)
    - Remove base_url field from template (user fills in form instead)
    - Simplify getCodexCustomTemplate() - no locale parameter needed
    - Keep preset configurations unchanged with their baseUrl values
    
    **Template now contains only:**
    - model_provider, model, model_reasoning_effort
    - disable_response_storage
    - [model_providers.custom] section with minimal fields
    
    **Benefits:**
    -  Cleaner, more focused template
    -  Consistent with other apps (no comments)
    -  Forces users to fill base_url via form field
    -  Reduced template size from 35+ lines to 12 lines
    
    Net change: -74 lines (codexTemplates.ts)
  • refactor(codex): extract template to config with i18n support
    **Changes:**
    - Create src/config/codexTemplates.ts with getCodexCustomTemplate factory
    - Support both Chinese and English templates based on i18n.language
    - Remove 70 lines of duplicated template strings from ProviderForm.tsx
    - Update both useEffect and handlePresetChange to use template factory
    - Clean up unused "Custom (Blank Template)" preset entry
    
    **Benefits:**
    -  Eliminates code duplication (35-line template repeated twice)
    -  Adds internationalization support for English users
    -  Follows project architecture (templates in config/ directory)
    -  Improves maintainability (single source of truth)
    -  Net reduction: 34 lines (81 additions, 115 deletions)
    
    **Technical Details:**
    - Template selection logic: (i18n.language || "zh").startsWith("zh") ? "zh" : "en"
    - Templates are identical except for comments language
    - Both auth and config are returned as a single CodexTemplate object
    
    Addresses DRY principle violation and architectural concerns identified
    in code review.
  • refactor(codex): remove configuration wizard and unify provider setup experience
    - Remove CodexQuickWizardModal component (~300 lines)
    - Add "Custom (Blank Template)" preset with annotated TOML template
    - Unify configuration experience across Claude/Codex/Gemini
    - Remove wizard-related i18n keys, keep apiUrlLabel for CodexFormFields
    - Simplify component integration by removing wizard state management
    
    This change reduces code complexity by ~250 lines while providing better
    user education through commented configuration templates in Chinese.
    
    Users can now:
    1. Select "Custom (Blank Template)" preset
    2. See annotated TOML template with inline documentation
    3. Follow step-by-step comments to configure custom providers
    
    BREAKING CHANGE: Configuration wizard UI removed, replaced with template-based approach
  • style(mcp): refine panel layout for better visual hierarchy and compactness
    - Replace checkboxes with toggle switches for app selection (more intuitive for enable/disable actions)
    - Change switch color from blue to emerald to match MCP button theme
    - Stack app options vertically with labels on left to save horizontal space
    - Reduce panel width from max-w-4xl to max-w-3xl for more compact design
    - Move docs button next to server name for better information grouping
  • refactor(mcp): complete form refactoring for unified MCP management
    Complete the v3.7.0 MCP refactoring by updating the form layer to match
    the unified architecture already implemented in data/service/API layers.
    
    **Breaking Changes:**
    - Remove confusing `appId` parameter from McpFormModal
    - Replace with `defaultFormat` (json/toml) and `defaultEnabledApps` (array)
    
    **Form Enhancements:**
    - Add app enablement checkboxes (Claude/Codex/Gemini) directly in the form
    - Smart defaults: new servers default to Claude enabled, editing preserves state
    - Support "draft" mode: servers can be created without enabling any apps
    
    **Architecture Improvements:**
    - Eliminate semantic confusion: format selection separate from app targeting
    - One-step workflow: configure and enable apps in single form submission
    - Consistent with unified backend: `apps: { claude, codex, gemini }`
    
    **Testing:**
    - Update test mocks to use `useUpsertMcpServer` hook
    - Add test case for creating servers with no apps enabled
    - Fix parameter references from `appId` to `defaultFormat`
    
    **i18n:**
    - Add `mcp.form.enabledApps` translation (zh/en)
    - Add `mcp.form.noAppsWarning` translation (zh/en)
    
    This completes the MCP management refactoring, ensuring all layers
    (data, service, API, UI) follow the same unified architecture pattern.
  • feat(config): unify common config snippets persistence across all apps
    - Add unified `common_config_snippets` structure to MultiAppConfig
    - Implement `get_common_config_snippet` and `set_common_config_snippet` commands
    - Replace localStorage with config.json persistence for Codex and Gemini
    - Auto-migrate legacy `claude_common_config_snippet` to new unified structure
    - Deprecate individual API methods in favor of unified interface
    - Add automatic migration from localStorage on first load
    
    BREAKING CHANGE: Common config snippets now stored in unified `common_config_snippets` object instead of separate fields
  • refactor(mcp): complete v3.7.0 cleanup - remove legacy code and warnings
    This commit finalizes the v3.7.0 unified MCP architecture migration by
    removing all deprecated code paths and eliminating compiler warnings.
    
    Frontend Changes (~950 lines removed):
    - Remove deprecated components: McpPanel, McpListItem, McpToggle
    - Remove deprecated hook: useMcpActions
    - Remove unused API methods: importFrom*, syncEnabledTo*, syncAllServers
    - Simplify McpFormModal by removing dual-mode logic (unified/legacy)
    - Remove syncOtherSide checkbox and conflict detection
    - Clean up unused imports and state variables
    - Delete associated test files
    
    Backend Changes (~400 lines cleaned):
    - Remove unused Tauri commands: import_mcp_from_*, sync_enabled_mcp_to_*
    - Delete unused Gemini MCP functions: get_mcp_status, upsert/delete_mcp_server
    - Add #[allow(deprecated)] to compatibility layer commands
    - Add #[allow(dead_code)] to legacy helper functions for future migration
    - Simplify boolean expression in mcp.rs per Clippy suggestion
    
    API Deprecation:
    - Mark legacy APIs with @deprecated JSDoc (getConfig, upsertServerInConfig, etc.)
    - Preserve backward compatibility for v3.x, planned removal in v4.0
    
    Verification:
    -  Zero TypeScript errors (pnpm typecheck)
    -  Zero Clippy warnings (cargo clippy)
    -  All code formatted (prettier + cargo fmt)
    -  Builds successfully
    
    Total cleanup: ~1,350 lines of code removed/marked
    Breaking changes: None (all legacy APIs still functional)
  • refactor(frontend): remove redundant 'Sync All' button from MCP panel
    All MCP operations already auto-sync to live configs:
    - upsert_server() → sync_server_to_apps()
    - toggle_app() → sync_server_to_app() or remove_server_from_app()
    - delete_server() → remove_server_from_all_apps()
    
    The manual 'Sync All' button was redundant and could confuse users
    into thinking they need to manually sync after each change.
    
    Changes:
    - Remove 'Sync All' button from UnifiedMcpPanel header
    - Remove useSyncAllMcpServers hook
    - Remove handleSyncAll function and syncAllMutation state
    - Remove RefreshCw icon import
    - Remove sync-related i18n translations (en/zh)
    
    Note: Backend sync_all_mcp_servers command remains for potential
    future use (e.g., recovery tool), but is no longer exposed in UI.
  • refactor(frontend): remove MCP import functionality for v3.7.0
    Auto-migration at startup is sufficient for upgrading from v3.6.x.
    Manual import adds unnecessary complexity since:
    - Gemini MCP support launches with v3.7.0 (no legacy data)
    - Existing Claude/Codex MCP configs are auto-migrated on first run
    - All MCP management should happen within CC Switch
    
    Changes:
    - Remove McpImportDialog component
    - Remove "Import" button from UnifiedMcpPanel
    - Remove import-related i18n translations (en/zh)
    - Simplify user experience with single management interface
    
    Note: Backend import commands (import_mcp_from_*) remain for
    backward compatibility but are no longer exposed in UI.
  • feat(frontend): add MCP import dialog for v3.7.0
    Implement import functionality to migrate MCP servers from existing configs:
    
    **New Component:**
    - src/components/mcp/McpImportDialog.tsx: Import dialog with card-based source selection
    
    **Features:**
    - Import from Claude (~/.claude/claude.json or settings.json)
    - Import from Codex (~/.codex/config.toml)
    - Import from Gemini (config file)
    - Card-based UI with icons and descriptions
    - Loading states with spinner animation
    - Auto-refresh after successful import
    
    **Integration:**
    - Add import button to UnifiedMcpPanel header
    - Handle import completion with refetch
    - Toast notifications for success/info/error cases
    
    **I18n:**
    - Add mcp.unifiedPanel.import namespace (zh/en)
    - Import button, dialog title, descriptions
    - Success/error messages with count interpolation
    
    **UX:**
    - Smart disable: other sources disabled during import
    - Clear feedback: count of imported servers
    - Friendly messages: "No servers found" when empty
    
    TypeScript type check passes 
  • feat(frontend): implement unified MCP panel for v3.7.0
    Complete Phase 3 (P0) frontend implementation for unified MCP management:
    
    **New Files:**
    - src/hooks/useMcp.ts: React Query hooks for unified MCP operations
    - src/components/mcp/UnifiedMcpPanel.tsx: Unified MCP management panel
    - src/components/ui/checkbox.tsx: Checkbox component from shadcn/ui
    
    **Features:**
    - Unified panel with three-column layout: server info + app checkboxes + actions
    - Multi-app control: Claude/Codex/Gemini checkboxes for each server
    - Real-time stats: Show enabled server counts per app
    - Full CRUD operations: Add, edit, delete, sync all servers
    
    **Integration:**
    - Replace old app-specific McpPanel with UnifiedMcpPanel in App.tsx
    - Update McpFormModal to support unified mode with apps field
    - Add i18n support: mcp.unifiedPanel namespace (zh/en)
    
    **Type Safety:**
    - Ensure McpServer.apps field always initialized
    - Fix all test files to include apps field
    - TypeScript type check passes 
    
    **Architecture:**
    - Single source of truth: mcp.servers manages all MCP configs
    - Per-server app control: apps.claude/codex/gemini boolean flags
    - Backward compatible: McpFormModal supports both unified and legacy modes
    
    Next: P1 tasks (import dialogs, sub-components, tests)
  • fix(i18n): add missing Gemini MCP panel title and fix ternary logic
    - Add mcp.geminiTitle to both zh.json and en.json
    - Fix McpPanel title logic to handle all three apps (claude/codex/gemini)
    - Previous logic would incorrectly display codexTitle for gemini
  • feat(gemini): implement full MCP management functionality
    - Add gemini_mcp.rs module for Gemini MCP file I/O operations
    - Implement sync_enabled_to_gemini to export enabled MCPs to ~/.gemini/settings.json
    - Implement import_from_gemini to import MCPs from Gemini config
    - Add Gemini sync logic in services/mcp.rs (upsert_server, delete_server, set_enabled)
    - Register Tauri commands for Gemini MCP sync and import
    - Update frontend API calls and McpPanel to support Gemini
    
    Fixes the issue where adding MCP servers in Gemini tab would not sync to ~/.gemini/settings.json
  • feat(gemini): add config.json editor and common config functionality
    Implements dual-editor pattern for Gemini providers, following the Codex architecture:
    - Environment variables (.env format) editor
    - Extended configuration (config.json) editor with common config support
    
    New Components:
    - GeminiConfigSections: Separate sections for env and config editing
    - GeminiCommonConfigModal: Modal for editing common config snippets
    
    New Hooks:
    - useGeminiConfigState: Manages env/config separation and conversion
      - Converts between .env string format and JSON object
      - Validates JSON config structure
      - Extracts API Key and Base URL from env
    - useGeminiCommonConfig: Handles common config snippets
      - Deep merge algorithm for combining configs
      - Remove common config logic for toggling off
      - localStorage persistence for snippets
    
    Features:
    - Format buttons for both env and config editors
    - Common config toggle with deep merge/remove
    - Error validation and display
    - Auto-open modal on common config errors
    
    Configuration Structure:
    {
      "env": {
        "GOOGLE_GEMINI_BASE_URL": "https://...",
        "GEMINI_API_KEY": "sk-...",
        "GEMINI_MODEL": "gemini-2.5-pro"
      },
      "config": {
        "timeout": 30000,
        "maxRetries": 3
      }
    }
    
    This brings Gemini providers to feature parity with Claude and Codex.
  • fix(i18n): deduplicate category labels by reusing providerForm keys
    - Change ProviderForm to use providerForm.category* instead of providerPreset.category*
    - Remove duplicate category keys from providerPreset namespace in both zh.json and en.json
    - Fix naming inconsistency: use categoryAggregation (not categoryAggregator)
    - Fixes issue where English UI would show Chinese defaultValue fallbacks
    
    This ensures single source of truth for category labels and improves maintainability.
  • feat: migrate Claude common config snippet from localStorage to config.json
    Migrate the Claude common config snippet storage from browser localStorage
    to the persistent config.json file for better cross-device sync and backup support.
    
    **Backend Changes:**
    - Add `claude_common_config_snippet` field to `MultiAppConfig` struct
    - Add `get_claude_common_config_snippet` and `set_claude_common_config_snippet` Tauri commands
    - Include JSON validation in the setter command
    
    **Frontend Changes:**
    - Create new `lib/api/config.ts` API module
    - Refactor `useCommonConfigSnippet` hook to use config.json instead of localStorage
    - Add automatic one-time migration from localStorage to config.json
    - Add loading state during initialization
    
    **Benefits:**
    - Cross-device synchronization via backup/restore
    - More reliable persistence than browser storage
    - Centralized configuration management
    - Seamless migration for existing users
  • fix(ui): prevent URL overflow in provider cards
    Add max-width constraint to URL display to prevent long URLs from breaking card layout.
  • refactor(i18n): remove unnecessary translation for brand names
    - Use hardcoded "Claude", "Codex", "Gemini" instead of i18n keys
    - Brand names should not be translated across different locales
    - Simplifies code by removing useTranslation hook from AppSwitcher
    - Reduces maintenance overhead in translation files
  • fix(i18n): add internationalization support for app names
    - Add i18n for Claude/Codex/Gemini app names in AppSwitcher
    - Use useTranslation hook with existing translation keys
    - Fix ASCII diagram alignment in README files
  • fix(usage-script): add input validation and boundary checks (#208)
    - Backend: validate auto-query interval ≤ 1440 minutes (24 hours)
    - Frontend: add number input sanitization and blur validation
    - Add user-friendly error messages for invalid inputs
    - Support auto-clamping to valid ranges with toast notifications
  • feat(gemini): add Google Official branding with Gemini icon (#211)
    Update Google Gemini preset to match Claude Official styling:
    - Rename 'Google' to 'Google Official'
    - Add GeminiIcon support in preset selector
    - Add custom theme with Google blue (#4285F4) background
    - Update PresetTheme type to support 'gemini' icon type
    
    Changes:
    - Add GeminiPresetTheme interface
    - Add theme config to Google Official preset
    - Import and render GeminiIcon in ProviderPresetSelector
    - Update PresetTheme icon type to include 'gemini'
  • feat(prompts+i18n): add prompt management and improve prompt editor i18n (#193)
    * feat(prompts): add prompt management across Tauri service and React UI
    
    - backend: add commands/prompt.rs, services/prompt.rs, register in commands/mod.rs and lib.rs, refine app_config.rs
    - frontend: add PromptPanel, PromptFormModal, PromptListItem, MarkdownEditor, usePromptActions, integrate in App.tsx
    - api: add src/lib/api/prompts.ts
    - i18n: update src/i18n/locales/{en,zh}.json
    - build: update package.json and pnpm-lock.yaml
    
    * feat(i18n): improve i18n for prompts and Markdown editor
    
    - update src/i18n/locales/{en,zh}.json keys and strings
    - apply i18n in PromptFormModal, PromptPanel, and MarkdownEditor
    - align prompt text with src-tauri/src/services/prompt.rs
    
    * feat(prompts): add enable/disable toggle and simplify panel UI
    
    - Add PromptToggle component and integrate in prompt list items
    - Implement toggleEnabled with optimistic update; enable via API, disable via upsert with enabled=false;
      reload after success
    - Simplify PromptPanel: remove file import and current-file preview to keep CRUD flow focused
    - Tweak header controls style (use mcp variant) and minor copy: rename “Prompt Management” to “Prompts”
    - i18n: add disableSuccess/disableFailed messages
    - Backend (Tauri): prevent duplicate backups when importing original prompt content
    
    * style: unify code formatting with trailing commas
    
    * feat(prompts): add Gemini filename support to PromptFormModal
    
    Update filename mapping to use Record<AppId, string> pattern, supporting
    GEMINI.md alongside CLAUDE.md and AGENTS.md.
    
    * fix(prompts): sync enabled prompt to file when updating
    
    When updating a prompt that is currently enabled, automatically sync
    the updated content to the corresponding live file (CLAUDE.md/AGENTS.md/GEMINI.md).
    
    This ensures the active prompt file always reflects the latest content
    when editing enabled prompts.
  • refactor(endpoint): separate edit and create mode endpoint management (#192)
    Optimize custom endpoint management logic to distinguish between edit and create modes:
    - Edit mode: endpoints are read/written directly to backend via API
    - Create mode: use draftCustomEndpoints to stage, save on submit
    - Remove duplicate endpoint loading in useSpeedTestEndpoints
    - Add isSaving state and initialCustomUrls tracking
  • feat(gemini): add Gemini provider integration (#202)
    * feat(gemini): add Gemini provider integration
    
    - Add gemini_config.rs module for .env file parsing
    - Extend AppType enum to support Gemini
    - Implement GeminiConfigEditor and GeminiFormFields components
    - Add GeminiIcon with standardized 1024x1024 viewBox
    - Add Gemini provider presets configuration
    - Update i18n translations for Gemini support
    - Extend ProviderService and McpService for Gemini
    
    * fix(gemini): resolve TypeScript errors, add i18n support, and fix MCP logic
    
    **Critical Fixes:**
    - Fix TS2741 errors in tests/msw/state.ts by adding missing Gemini type definitions
    - Fix ProviderCard.extractApiUrl to support GOOGLE_GEMINI_BASE_URL display
    - Add missing apps.gemini i18n keys (zh/en) for proper app name display
    - Fix MCP service Gemini cross-app duplication logic to prevent self-copy
    
    **Technical Details:**
    - tests/msw/state.ts: Add gemini default providers, current ID, and MCP config
    - ProviderCard.tsx: Check both ANTHROPIC_BASE_URL and GOOGLE_GEMINI_BASE_URL
    - services/mcp.rs: Skip Gemini in sync_other_side logic with unreachable!() guards
    - Run pnpm format to auto-fix code style issues
    
    **Verification:**
    -  pnpm typecheck passes
    -  pnpm format completed
    
    * feat(gemini): enhance authentication and config parsing
    
    - Add strict and lenient .env parsing modes
    - Implement PackyCode partner authentication detection
    - Support Google OAuth official authentication
    - Auto-configure security.auth.selectedType for PackyCode
    - Add comprehensive test coverage for all auth types
    - Update i18n for OAuth hints and Gemini config
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • refactor(usage-script): replace native checkbox with Switch component
    Upgrade the enable toggle from native checkbox to shadcn/ui Switch component
    for better UX and UI consistency with settings page.
    
    **Improvements**:
    1. Use modern toggle UI (Switch) instead of traditional checkbox
    2. Adopt the same layout pattern as settings page (ToggleRow style)
    3. Add bordered container with proper spacing for better visual hierarchy
    4. Maintain full accessibility support (aria-label)
    
    **Layout changes**:
    - Before: Simple label + checkbox horizontal layout
    - After: Bordered container, label on left, Switch on right, vertically centered
  • fix(usage-script): replace FormLabel with Label to fix white screen crash
    FormLabel component requires FormField context and throws error when used
    standalone, causing the entire component to crash with a white screen.
    
    Root cause:
    - FormLabel internally calls useFormField() hook
    - useFormField() requires FormFieldContext (must be within <FormField>)
    - Without context, it throws: "useFormField should be used within <FormField>"
    - Uncaught error crashes React rendering tree
    
    Solution:
    - Replace FormLabel with standalone Label component
    - Label component from @/components/ui/label doesn't depend on form context
    - Maintains same styling (text-sm font-medium) without requiring context
    
    This fixes the white screen issue when clicking the usage panel.
  • style(usage-script): unify form input styles with shadcn/ui components
    Replace native HTML input elements with shadcn/ui Input and FormLabel
    components to ensure consistent styling across the application.
    
    Changes:
    - Import Input, FormLabel, Eye, and EyeOff components
    - Replace all credential input fields with Input component
    - Add show/hide toggle buttons for password fields (API Key, Access Token)
    - Replace label/span elements with FormLabel component
    - Update timeout and auto-query interval inputs to use Input component
    - Improve spacing consistency (space-y-4 for credential config)
    - Add proper id attributes for accessibility
    - Use muted-foreground for hint text
    
    The form now matches the styling of provider configuration forms
    throughout the application.
  • feat(usage-query): decouple credentials from provider config
    Add independent credential fields for usage query to support different
    query endpoints and authentication methods.
    
    Changes:
    - Add `apiKey` and `baseUrl` fields to UsageScript struct
    - Remove dependency on provider config credentials in query_usage
    - Update test_usage_script to accept independent credential parameters
    - Add credential input fields in UsageScriptModal based on template:
      * General: apiKey + baseUrl
      * NewAPI: baseUrl + accessToken + userId
      * Custom: no additional fields (full freedom)
    - Auto-clear irrelevant fields when switching templates
    - Add i18n text for "credentialsConfig"
    
    Benefits:
    - Query API can use different endpoint/key than provider config
    - Better separation of concerns
    - More flexible for various usage query scenarios
  • fix(toml): normalize CJK quotes to prevent parsing errors
    Add quote normalization to handle Chinese/fullwidth quotes automatically
    converted by IME. This fixes TOML parsing failures when users input
    configuration with non-ASCII quotes (" " ' ' etc.).
    
    Changes:
    - Add textNormalization utility for quote normalization
    - Apply normalization in TOML input handlers (MCP form, Codex config)
    - Disable browser auto-correction in Textarea component
    - Add defensive normalization in TOML parsing layer
  • fix(mcp): preserve custom fields in Codex TOML config editor
    Fixed an issue where custom/extension fields (e.g., timeout_ms, retry_count)
    were silently dropped when editing Codex MCP server configurations in TOML format.
    
    Root cause: The TOML parser functions only extracted known fields (type, command,
    args, env, cwd, url, headers), discarding any additional fields during normalization.
    
    Changes:
    - mcpServerToToml: Now uses spread operator to copy all fields before stringification
    - normalizeServerConfig: Added logic to preserve unknown fields after processing known ones
    - Both stdio and http server types now retain custom configuration fields
    
    This fix enables forward compatibility with future MCP protocol extensions and
    allows users to add custom configurations without code changes.
  • feat(schema): add common JSON/TOML validators and enforce MCP conditional fields
    - Add src/lib/schemas/common.ts with jsonConfigSchema and tomlConfigSchema
    - Enhance src/lib/schemas/mcp.ts to require command for stdio and url for http via superRefine
    - Keep ProviderForm as-is; future steps will wire new schemas into RHF flows
    - Verified: pnpm typecheck passes
  • fix(forms): populate base URL for all non-official provider categories
    The base URL field was not populating when editing providers with
    categories like cn_official or aggregator. The issue was caused by
    inconsistent conditional logic: the input field was shown for all
    non-official categories, but the value extraction only worked for
    third_party and custom categories.
    
    Changed the category check from allowlist (third_party, custom) to
    denylist (official) to match the UI display logic. Now ANTHROPIC_BASE_URL
    correctly populates for all provider categories except official.
  • fix(ui): remove misleading model placeholders from input fields
    Clear placeholder values for model input fields to avoid suggesting specific model names that may not be applicable to all providers. This prevents user confusion when configuring different Claude providers.
  • fix(forms): show endpoint input for all non-official providers
    Previously, endpoint URL input was only shown for aggregator, third_party,
    and custom categories. This excluded cn_official providers from managing
    custom endpoints.
    
    Changed logic to show endpoint input for all categories except official,
    which fixes the issue and simplifies the condition.
  • refactor(settings): improve directory configuration UI layout
    - Rebrand "CC-Switch" to "CC Switch" across all UI text
    - Separate CC Switch config directory into standalone section at top
    - Update description to highlight cloud sync capability
    - Remove redundant descriptions for Claude/Codex directory inputs
    - Improve Chinese grammar for WSL configuration description