Commit Graph

225 Commits

  • Merge branch 'main' into refactor/ui
    # Conflicts:
    #	src/components/skills/SkillsPage.tsx
  • feat(deeplink): add config merge command for preview
    Expose config merging functionality to frontend for preview.
    - Add merge_deeplink_config Tauri command
    - Make parse_and_merge_config public for reuse
    - Enable frontend to display complete config before import
  • chore: bump version to v3.7.1
    Prepare for v3.7.1 maintenance release.
    
    **Version Updates**:
    - package.json: 3.7.0 → 3.7.1
    - src-tauri/Cargo.toml: 3.7.0 → 3.7.1
    - src-tauri/tauri.conf.json: 3.7.0 → 3.7.1
    - README.md: version badge updated
    - README_ZH.md: version badge updated
    
    **CHANGELOG.md**:
    - Added v3.7.1 release notes (2025-11-22)
    - 3 bug fixes (Skills installation, Gemini persistence, dialog overlay)
    - 2 new features (Gemini config directory, ArchLinux support)
    - 3 improvements (error i18n, download timeout, code formatting)
    - 1 reverted feature (auto-launch)
    
    **Code Formatting**:
    - Applied prettier to SkillsPage.tsx and skillErrorParser.ts
    
    **Pre-Release Checks**:
     TypeScript type check passed
     Prettier format check passed
     All version numbers synchronized
  • feat(deeplink): add config file support for deeplink import
    Support importing provider configuration from embedded or remote config files.
    - Add base64 dependency for config content encoding
    - Support config, configFormat, and configUrl parameters
    - Make homepage/endpoint/apiKey optional when config is provided
    - Add config parsing and merging logic
  • feat(deeplink): add Claude model fields support and enhance import dialog
    - Add Claude-specific model field support in deeplink import:
      * Support model (ANTHROPIC_MODEL) - general default model
      * Support haikuModel (ANTHROPIC_DEFAULT_HAIKU_MODEL)
      * Support sonnetModel (ANTHROPIC_DEFAULT_SONNET_MODEL)
      * Support opusModel (ANTHROPIC_DEFAULT_OPUS_MODEL)
      * Backend: Update DeepLinkImportRequest struct to include optional model fields
      * Frontend: Add TypeScript type definitions for new model parameters
    
    - Enhance deeplink demo page (deplink.html):
      * Add 5 new Claude configuration examples showcasing different model setups
      * Add parameter documentation with required/optional tags
      * Include basic config (no models), single model, complete 4-model, partial models, and third-party provider examples
      * Improve visual design with param-list component and color-coded badges
      * Add detailed descriptions for each configuration scenario
    
    - Redesign DeepLinkImportDialog layout:
      * Switch from 3-column to compact 2-column grid layout
      * Reduce dialog width from 500px to 650px for better content display
      * Add dedicated section for Claude model configurations with blue highlight box
      * Use uppercase labels and smaller text for more information density
      * Add truncation and tooltips for long URLs
      * Improve visual hierarchy with spacing and grouping
      * Increase z-index to 9999 to ensure dialog appears on top
    
    - Minor UI refinements:
      * Update App.tsx layout adjustments
      * Optimize McpFormModal styling
      * Refine ProviderCard and BasicFormFields components
    
    This enables users to import Claude providers with precise model configurations via deeplink.
  • refactor(ui): simplify AppSwitcher styles and migrate to local SVG icons
    - Replace complex gradient animations with clean, minimal tab design
    - Migrate from @lobehub/icons CDN to local SVG assets for better reliability
    - Fix clippy warning in error.rs (use inline format args)
    - Improve code formatting in skill service and commands
    - Reduce CSS complexity in AppSwitcher component (removed blur effects and gradients)
    - Update BrandIcons to use imported local SVG files instead of dynamic image loading
    
    This improves performance, reduces external dependencies, and provides a cleaner UI experience.
  • Merge branch 'main' into refactor/ui
    # Conflicts:
    #	src-tauri/src/services/skill.rs
    #	src/components/skills/SkillsPage.tsx
  • Revert "feat(settings): add auto-launch on system startup feature"
    This reverts commit ba336fc416.
    
    Reason: Found issues that need to be addressed before reintroducing
    the auto-launch feature. Will reimplement with fixes.
  • feat(settings): add auto-launch on system startup feature
    Implement auto-launch functionality with proper state synchronization
    and error handling across Windows, macOS, and Linux platforms.
    
    Key changes:
    - Add auto_launch module using auto-launch crate 0.5
    - Define typed errors (AutoLaunchPathError, AutoLaunchEnableError, etc.)
    - Sync system state with settings.json on app startup
    - Only call system API when auto-launch state actually changes
    - Add UI toggle in Window Settings panel
    - Add i18n support for auto-launch settings (en/zh)
    
    Implementation details:
    - Settings file (settings.json) is the single source of truth
    - On startup, system state is synced to match settings.json
    - Error handling uses Rust type system with proper error propagation
    - Frontend optimized to avoid unnecessary system API calls
    
    Platform support:
    - Windows: HKEY_CURRENT_USER registry modification
    - macOS: AppleScript-based launch item (configurable to Launch Agent)
    - Linux: XDG autostart desktop file
  • feat(backend): add icon fields to Provider model and default mappings
    Extend Rust backend to support provider icon customization:
    
    ## Provider Model (src-tauri/src/provider.rs)
    - Add `icon: Option<String>` field for icon name
    - Add `icon_color: Option<String>` field for hex color
    - Use serde rename `iconColor` for frontend compatibility
    - Apply skip_serializing_if for clean JSON output
    - Update Provider::new() to initialize icon fields as None
    
    ## Provider Defaults (src-tauri/src/provider_defaults.rs) [NEW]
    - Define ProviderIcon struct with name and color fields
    - Create DEFAULT_PROVIDER_ICONS static HashMap with 23 providers:
      - AI providers: OpenAI, Anthropic, Claude, Google, Gemini,
        DeepSeek, Kimi, Moonshot, Zhipu, MiniMax, Baidu, Alibaba,
        Tencent, Meta, Microsoft, Cohere, Perplexity, Mistral, HuggingFace
      - Cloud platforms: AWS, Azure, Huawei, Cloudflare
    - Implement infer_provider_icon() with exact and fuzzy matching
    - Add unit tests for matching logic (exact, fuzzy, case-insensitive)
    
    ## Deep Link Support (src-tauri/src/deeplink.rs)
    - Initialize icon fields when creating Provider from deep link import
    
    ## Module Registration (src-tauri/src/lib.rs)
    - Register provider_defaults module
    
    ## Dependencies (Cargo.toml)
    - Add once_cell for lazy static initialization
    
    This backend support enables icon persistence and future features
    like auto-icon inference during provider creation.
  • feat(skills): enhance error messages with i18n support
    - Add structured error format with error codes and context
    - Create skillErrorParser to format errors for user-friendly display
    - Add comprehensive i18n keys for all skill-related errors (zh/en)
    - Extend download timeout from 15s to 60s to reduce false positives
    - Fix: Pass correct error title based on operation context (load/install/uninstall)
    
    Error improvements:
    - SKILL_NOT_FOUND: Show skill directory name
    - DOWNLOAD_TIMEOUT: Display repo info and timeout duration with network suggestion
    - DOWNLOAD_FAILED: Show HTTP status code with specific suggestions (403/404/429)
    - SKILL_DIR_NOT_FOUND: Show full path with URL check suggestion
    - EMPTY_ARCHIVE: Suggest checking repository URL
    
    Users will now see detailed error messages instead of generic "Error".
  • fix(skills): resolve third-party skills installation failure (#268)
    - Add skills_path field to Skill struct
    - Use skills_path to construct correct source path during installation
    - Fix installation for repos with custom skill subdirectories
  • fix(skills): resolve third-party skills installation failure
    - Add skills_path field to Skill struct
    - Use skills_path to construct correct source path during installation
    - Fix installation for repos with custom skill subdirectories
  • feat(backend): add auto-launch functionality
    Implement system auto-launch feature to allow CC-Switch to start
    automatically on system boot, improving user convenience.
    
    Backend Implementation:
    - auto_launch.rs: New module for auto-launch management
      * Cross-platform support using auto-launch crate
      * Enable/disable auto-launch with system integration
      * Proper error handling for permission issues
      * Platform-specific implementations (macOS/Windows/Linux)
    
    Command Layer:
    - Add get_auto_launch command to check current status
    - Add set_auto_launch command to toggle auto-start
    - Integrate commands with settings API
    
    Settings Integration:
    - Extend Settings struct with auto_launch field
    - Persist auto-launch preference in settings store
    - Automatic state synchronization on app startup
    
    Dependencies:
    - Add auto-launch ^0.5.0 to Cargo.toml
    - Update Cargo.lock with new dependency tree
    
    Technical Details:
    - Uses platform-specific auto-launch mechanisms:
      * macOS: Login Items via LaunchServices
      * Windows: Registry Run key
      * Linux: XDG autostart desktop files
    - Handles edge cases like permission denials gracefully
    - Maintains settings consistency across app restarts
    
    This feature enables users to have CC-Switch readily available
    after system boot without manual intervention, particularly useful
    for users who frequently switch between API providers.
  • chore: update dialogs, i18n and improve component integration
    Various functional updates and improvements across provider dialogs,
    MCP panel, skills page, and internationalization.
    
    Provider Dialogs:
    - AddProviderDialog
      * Simplified form state management
      * Improved preset selection workflow
      * Better validation error messages
      * Enhanced template variable handling
    - EditProviderDialog
      * Streamlined edit flow with better state synchronization
      * Improved handling of live config backfilling
      * Better error recovery for failed updates
      * Enhanced integration with parent components
    
    MCP & Skills:
    - UnifiedMcpPanel
      * Reduced complexity from 140+ to ~95 lines
      * Improved multi-app server management
      * Better server type detection (stdio/http)
      * Enhanced server status indicators
      * Cleaner integration with MCP form modal
    - SkillsPage
      * Simplified navigation and state management
      * Better integration with RepoManagerPanel
      * Improved error handling for repository operations
      * Enhanced loading states
    - SkillCard
      * Minor layout adjustments
      * Better action button placement
    
    Environment & Configuration:
    - EnvWarningBanner
      * Improved conflict detection messages
      * Better visual hierarchy for warnings
      * Enhanced dismissal behavior
    - tauri.conf.json
      * Updated build configuration
      * Added new window management options
    
    Internationalization:
    - en.json & zh.json
      * Added 17 new translation keys for new features
      * Updated existing keys for better clarity
      * Added translations for new settings page
      * Improved consistency across UI text
    
    Code Cleanup:
    - mutations.ts
      * Removed 14 lines of unused mutation definitions
      * Cleaned up deprecated query invalidation logic
      * Better type safety for mutation parameters
    
    Overall Impact:
    - Reduced total lines by 51 (-10% in affected files)
    - Improved component integration and data flow
    - Better error handling and user feedback
    - Enhanced i18n coverage for new features
    
    These changes improve the overall polish and integration of various
    components while removing technical debt and unused code.
  • test: simplify boolean assertions in import_export_sync tests
    Replace verbose assert_eq!(value, true) with idiomatic assert!(value) for improved readability and adherence to Rust best practices
  • style: apply code formatting across backend and frontend (#252)
    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)
  • chore(release): bump version to v3.7.0 and rebrand to include Gemini CLI
    - Update version from 3.6.2 to 3.7.0 across all config files
    - Update project description to "All-in-One Assistant for Claude Code, Codex & Gemini CLI"
    - Update Chinese description to "Claude Code / Codex / Gemini CLI 全方位辅助工具"
    - Sync version in package.json, Cargo.toml, tauri.conf.json
    - Update branding in README.md, README_ZH.md and i18n locale files
  • 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: read both .env and settings.json for Gemini live config
    Previously, when editing a Gemini provider, only the .env file was read,
    missing the settings.json file that contains MCP configuration and other
    settings. This caused the config field in the edit form to be empty or
    show outdated data.
    
    This fix ensures both files are read and merged into the complete
    structure { "env": {...}, "config": {...} }, matching the behavior
    of Codex provider.
    
    Fixed in:
    - read_live_settings(): now reads both .env and settings.json
    - import_default_config(): now reads both files when importing
  • fix: resolve winreg API compatibility issue on Windows
    - Update RegValue.to_string() usage to match current winreg API
      which returns String directly instead of Result
    - Add conditional compilation for std::fs import (Unix only)
  • 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(-)
  • Add Gemini environment variable detection (#250)
    * 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: Add Gemini environment variable detection
  • 添加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
  • feat(window): center window on screen by default
    Add `center: true` to main window configuration to improve initial
    window positioning on Windows and other platforms. This addresses
    user feedback about the window appearing in the top-left corner.
  • fix(provider): sync MCP config for all apps on provider switch
    Previously, only Codex provider switches triggered MCP synchronization,
    which could cause MCP configuration loss when switching Claude or Gemini
    providers.
    
    Changes:
    - Enable MCP sync for all app types (Claude, Codex, Gemini) during provider switch
    - Migrate to v3.7.0 unified MCP sync mechanism using McpService::sync_all_enabled()
    - Replace app-specific sync_enabled_to_codex() with unified sync for all apps
    - Remove unused mcp module import
    
    This ensures MCP servers remain properly configured across all applications
    after provider switches, preventing configuration loss.
  • fix(mcp): correct Codex MCP configuration format to [mcp_servers]
    BREAKING CHANGE: The [mcp.servers] format was completely incorrect and not
    any official Codex format. The only correct format is [mcp_servers] at the
    top level of config.toml.
    
    Changes:
    - Remove incorrect [mcp.servers] nested table support
    - Always use [mcp_servers] top-level table (official Codex format)
    - Auto-migrate and cleanup erroneous [mcp.servers] entries on write
    - Preserve error-tolerant import for migrating old incorrect configs
    - Simplify sync logic by removing format selection branches (~60 lines)
    - Update all documentation and tests to reflect correct format
    - Add warning logs when detecting and cleaning incorrect format
    
    Backend (Rust):
    - mcp.rs: Simplify sync_enabled_to_codex by removing Target enum
    - mcp.rs: sync_single_server_to_codex now always uses [mcp_servers]
    - mcp.rs: remove_server_from_codex cleans both locations
    - mcp.rs: Update import_from_codex comments to clarify format status
    - tests: Rename test to sync_enabled_to_codex_migrates_erroneous_*
    - tests: Update assertions to verify migration behavior
    
    Frontend (TypeScript):
    - tomlUtils.ts: Prioritize [mcp_servers] format in parsing
    - tomlUtils.ts: Update error messages to guide correct format
    
    Documentation:
    - README.md: Correct MCP format reference to [mcp_servers]
    - CLAUDE.md: Add comprehensive format specification with examples
    
    All 79 tests pass. This ensures backward compatibility while enforcing
    the correct Codex official standard going forward.
    
    Refs: https://github.com/openai/codex/issues/3441
  • feat(mcp): support extended fields for Codex TOML conversion
    ## Problem
    Previously, the Codex MCP configuration used a whitelist-only approach
    for TOML conversion, which caused custom fields (like `timeout`,
    `startup_timeout_ms`, etc.) to be silently dropped during JSON → TOML
    conversion. Only Claude and Gemini (JSON format) could preserve
    arbitrary fields.
    
    ## Solution
    Implemented a three-tier field handling strategy:
    
    1. **Core fields** (type, command, args, url, headers, env, cwd)
       - Strong-typed manual processing (existing behavior preserved)
    
    2. **Extended fields** (19 common optional fields)
       - White-listed fields with automatic type conversion:
         - General: timeout, timeout_ms, startup_timeout_ms/sec,
           connection_timeout, read_timeout, debug, log_level, disabled
         - stdio: shell, encoding, working_dir, restart_on_exit,
           max_restart_count
         - http/sse: retry_count, max_retry_attempts, retry_delay,
           cache_tools_list, verify_ssl, insecure, proxy
    
    3. **Custom fields** (generic converter)
       - Automatic type inference for:
         - String → TOML String
         - Number (i64/f64) → TOML Integer/Float
         - Boolean → TOML Boolean
         - Simple arrays → TOML Array
         - Shallow objects (string values only) → TOML Inline Table
       - Unsupported types (null, mixed arrays, nested objects) are
         gracefully skipped with debug logging
    
    ## Changes
    
    ### Core Implementation
    - **json_value_to_toml_item()** (mcp.rs:843-947)
      Generic JSON → TOML value converter with smart type inference
    
    - **json_server_to_toml_table()** (mcp.rs:949-1072)
      Refactored to use three-tier strategy, processes all fields beyond
      core whitelist
    
    - **build_servers_table()** (mcp.rs:616-633)
      Now reuses the generic converter for consistency
    
    - **import_from_codex()** (mcp.rs:432-605)
      Extended with generic TOML → JSON converter for bidirectional
      field preservation
    
    ### Logging
    - DEBUG: Extended field conversions
    - INFO: Custom field conversions
    - WARN: Skipped unsupported types (with reason)
    
    ## Testing
    -  All 24 integration tests pass
    -  Compilation clean (zero errors)
    -  Backward compatible with existing configs
    
    ## Design Decision: No Auto Field Mapping
    Explicitly NOT implementing automatic field mapping (e.g., Claude's
    `timeout` → Codex's `startup_timeout_ms`) due to:
    - Unit ambiguity (seconds vs milliseconds)
    - Semantic ambiguity (same field name, different meanings)
    - Risk of data corruption (30s → 30ms causes immediate timeout)
    - Breaks user expectation of "what you see is what you get"
    
    Recommendation: Use application-specific field names as documented.
    
    ## Example
    User adds `timeout: 30` in MCP panel:
    
    **Claude/Gemini** (~/.claude.json):
    ```json
    {"mcpServers": {"srv": {"timeout": 30}}}
    ```
    
    **Codex** (~/.codex/config.toml):
    ```toml
    [mcp.servers.srv]
    timeout = 30  #  Now preserved!
    ```
    
    Fixes the whitelist limitation reported in user feedback.
  • 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" }
    }
  • style(ui): migrate color scheme to macOS native design system
    - Update primary blue from Linear style (#3498db) to macOS system blue (#0A84FF)
    - Align gray scale with macOS dark mode palette (#1C1C1E, #2C2C2E, etc.)
    - Adjust dark mode background to match macOS systemBackground (HSL 240 5% 12%)
    - Refine scrollbar colors to use native macOS gray tones
    - Remove transparent titleBarStyle for better stability
  • 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(prompt): optimize auto-import logic with unified save
    - Change auto_import_prompt_if_exists return type to Result<bool>
    - Remove redundant save() calls by introducing updated flag
    - Eliminate unnecessary clone() in app type iterations
    - Remove semantic contradiction in let _ = ...? pattern
    - Improve code semantics and maintainability
    
    Performance: Reduce disk I/O by 50%+ through unified save logic
  • fix(prompt): correct live file backfill priority in enable flow (#225)
    Fix backfill logic in prompt enable workflow:
    - Prioritize backfilling live file content to currently enabled prompt (prevent data loss)
    - Create backup only when no enabled prompt exists and content is new (avoid duplicate backups)
    - Implement staged persistence (save after backfill + save after enable)
    - Add explicit logging for backfill/backup operations
    
    Also simplify string formatting in prompt_files.rs with inline format strings.
  • test(mcp): update import tests for v3.7.0 unified structure
    - Fix import_from_claude_merges_into_config: check unified mcp.servers
    - Fix import_from_codex_adds_servers_from_mcp_servers_table: verify apps.codex enabled
    - Fix import_from_codex_merges_into_existing_entries: test smart merge preserves existing config
    - Replace cc_switch_lib::app_config:: with public exports (McpServer, McpApps)
    
    All 24 import_export_sync tests now passing.
  • fix(mcp): migrate import functions to unified v3.7.0 structure
    - Rewrite import_from_claude/codex/gemini to write directly to mcp.servers
    - Implement skip-on-error strategy for fault tolerance (single invalid item no longer aborts entire batch)
    - Smart merge logic: existing servers only enable corresponding app, preserve other configs
    - Remove deprecated markers from service layer
    - Export McpApps type for test usage
    - Update mcp_commands tests to use unified structure
    
    Fixes runtime import issue where data was written to legacy structure (mcp.claude/codex.servers)
    but unified panel reads from new structure (mcp.servers), causing "imported but invisible" bug.
  • fix(mcp): initialize McpRoot with v3.7.0 unified structure by default
    Problem:
    - On first launch, McpRoot::default() created `servers: None`
    - McpService::get_all_servers() would incorrectly return error "old structure detected"
    - This confused new users who had no legacy MCP data
    
    Root Cause:
    - Derived Default trait sets Option<T> fields to None
    - New installations should start with v3.7.0 structure immediately
    
    Solution:
    - Explicitly implement Default for McpRoot
    - Initialize `servers: Some(HashMap::new())` for v3.7.0+ structure
    - Legacy fields (claude/codex/gemini) remain empty, only used for deserializing old configs
    
    Impact:
    - First-time users get correct v3.7.0 structure immediately
    - migrate_mcp_to_unified() correctly detects already-migrated state
    - No false "old structure" errors on fresh installs
  • 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)
  • fix(mcp): resolve compilation errors and add backward compatibility
    ## Compilation Fixes
    - Add deprecated compatibility methods to McpService:
      * get_servers() - filters servers by app
      * set_enabled() - delegates to toggle_app()
      * sync_enabled() - syncs enabled servers for specific app
      * import_from_claude/codex/gemini() - wraps mcp:: functions
    - Fix toml_edit type conversion in sync_single_server_to_codex():
      * Add json_server_to_toml_table() helper function
      * Manually construct toml_edit::Table instead of invalid serde conversion
    - Fix get_codex_config_path() calls (returns PathBuf, not Result)
    - Update upsert_mcp_server_in_config() to work with unified structure:
      * Converts old per-app API to unified McpServer structure
      * Preserves existing server data when updating
      * Supports sync_other_side parameter for multi-app enable
    - Update delete_mcp_server_in_config() to ignore app parameter
    
    ## Backward Compatibility
    - All old v3.6.x commands continue to work with deprecation warnings
    - Frontend migration can be done incrementally
    - Old commands transparently use new unified backend
    
    ## Status
     Backend compiles successfully (cargo check passes)
    ⚠️ 16 warnings (8 deprecation + 8 unused functions - expected)
  • feat(mcp): implement unified MCP management for v3.7.0
    BREAKING CHANGE: Migrate from app-specific MCP storage to unified structure
    
    ## Phase 1: Data Structure Migration
    - Add McpApps struct with claude/codex/gemini boolean fields
    - Add McpServer struct for unified server definition
    - Add migration logic in MultiAppConfig::migrate_mcp_to_unified()
    - Integrate automatic migration into MultiAppConfig::load()
    - Support backward compatibility through Optional fields
    
    ## Phase 2: Backend Services Refactor
    - Completely rewrite services/mcp.rs for unified management:
      * get_all_servers() - retrieve all MCP servers
      * upsert_server() - add/update unified server
      * delete_server() - remove server
      * toggle_app() - enable/disable server for specific app
      * sync_all_enabled() - sync to all live configs
    - Add single-server sync functions to mcp.rs:
      * sync_single_server_to_claude/codex/gemini()
      * remove_server_from_claude/codex/gemini()
    - Add read_mcp_servers_map() to claude_mcp.rs and gemini_mcp.rs
    - Add new Tauri commands to commands/mcp.rs:
      * get_mcp_servers, upsert_mcp_server, delete_mcp_server
      * toggle_mcp_app, sync_all_mcp_servers
    - Register new commands in lib.rs
    
    ## Migration Strategy
    - Detects old structure (mcp.claude/codex/gemini.servers)
    - Merges into unified mcp.servers with apps markers
    - Handles conflicts by merging enabled apps
    - Clears old structures after migration
    - Saves migrated config automatically
    
    ## Known Issues
    - Old commands still need compatibility layer (WIP)
    - toml_edit type conversion needs fixing (WIP)
    - Frontend not yet implemented (Phase 3 pending)
    
    Related: v3.6.2 -> v3.7.0
  • 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: 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(prompt): improve i18n and error handling for auto-import
    Address code review feedback for PR #214:
    
    - Replace hardcoded Chinese strings with English in auto-imported prompts
      - Prompt name: "Auto-imported Prompt" instead of "初始提示词"
      - Description: "Automatically imported on first launch"
    - Remove panic risk by replacing expect() with proper error propagation
    - Use AppError::localized for bilingual error messages
    - Extract get_base_dir_with_fallback() helper to eliminate code duplication
    - Update test assertions to match new English strings
    - Suppress false-positive dead_code warning on TempHome.dir field
    
    All 5 tests passing with zero compiler warnings.
  • refactor(prompt): extract file path logic and implement auto-import on first launch (#214)
    - Extract prompt file path logic to dedicated prompt_files module
    - Refactor PromptService to use centralized path resolution
    - Implement auto-import for existing prompt files on first startup
    - Add comprehensive unit tests for auto-import functionality
  • 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
  • fix(gemini): relax validation when adding providers (#210)
    Allow users to create Gemini provider configurations without API key
    and fill it in later. Split validation into two modes:
    
    - validate_gemini_settings: Basic structure check (used when adding)
    - validate_gemini_settings_strict: Full validation (used when switching)
    
    This fixes the error 'Gemini config missing required field: GEMINI_API_KEY'
    when trying to add Gemini providers from presets like PackyCode or Google.
    
    Changes:
    - Add validate_gemini_settings_strict for switching validation
    - Update write_gemini_live to use strict validation
    - Add comprehensive tests for both validation modes
  • feat(tray): add Gemini support to system tray menu (#209)
    Refactor tray menu system to support three applications (Claude/Codex/Gemini):
    - Introduce generic TrayAppSection structure and TRAY_SECTIONS array
    - Implement append_provider_section and handle_provider_tray_event helper functions
    - Enhance Gemini provider service with .env config read/write support
    - Implement Gemini LiveSnapshot for atomic operations and rollback
    - Update README documentation to reflect Gemini tray quick switching feature