Commit Graph

74 Commits

  • style: format template literals for better readability
    Improve code formatting for conditional className expressions.
    - Break long template literals across multiple lines
    - Maintain consistent formatting in MCP form and endpoint test components
  • style: unify list item styles with semantic colors
    Apply consistent styling to list items across components.
    - Replace hardcoded colors with semantic tokens in MCP and Prompt list items
    - Add glass effect container to EndpointSpeedTest panel
    - Format code for better readability
  • refactor(mcp): improve form modal layout with adaptive height editor
    Restructure MCP form modal for better space utilization.
    - Split form into upper form fields and lower JSON editor sections
    - Add full-height mode support for JsonEditor component
    - Use flex layout for editor to fill available space
    - Update PromptFormPanel to use full-height editor
    - Fix locale text formatting
  • refactor(ui): unify dialog styles and improve layout consistency
    Standardize dialog and panel components across the application.
    - Update dialog background to use semantic color tokens
    - Adjust FullScreenPanel max-width to 56rem for better alignment
    - Add drag region and prevent body scroll in full-screen panels
    - Optimize button sizes and spacing in panel headers
    - Apply consistent styling to all dialog-based components
  • 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): unify layout system with 60rem max-width and consistent spacing
    - Standardize container max-width across all panels:
      * Replace max-w-4xl and max-w-5xl with unified max-w-[60rem]
      * Apply to SettingsPage, UnifiedMcpPanel, SkillsPage, and FullScreenPanel
      * Ensures consistent reading width and visual balance on wide screens
    
    - Optimize padding hierarchy and structure:
      * Move px-6 from parent elements to content containers
      * FullScreenPanel: Add max-w-[60rem] wrapper to header, content, and footer
      * Add border separators (border-t/border-b) to header and footer sections
      * Consolidate nested padding in MCP, Skills, and Prompts panels
      * Remove redundant padding layers for cleaner CSS
    
    - Simplify component styling:
      * MCP list items: Replace card-based layout with modern group-based design
      * Remove unnecessary wrapper divs and flatten DOM structure
      * Update card hover effects with smooth transitions
      * Simplify icon selection dialog (remove description text in BasicFormFields)
    
    - Benefits:
      * Consistent 60rem max-width provides optimal readability
      * Unified spacing rules reduce maintenance complexity
      * Cleaner component hierarchy improves performance
      * Better responsive behavior across different screen sizes
      * More cohesive visual design language throughout the app
    
    This creates a maintainable, scalable design system foundation.
  • style(ui): refine component layouts and improve visual consistency
    Comprehensive UI polish across multiple components to enhance visual
    design, improve user experience, and maintain consistency.
    
    UsageScriptModal Component (1302 lines refactored):
    - Complete layout overhaul for better usability
    - Improved script editor with syntax highlighting
    - Better template selection interface
    - Enhanced test/preview panels with clearer separation
    - Improved error feedback and validation messages
    - Better modal sizing and responsiveness
    - Cleaner tab navigation between sections
    - Enhanced code formatting and readability
    - Improved loading states for async operations
    - Better integration with parent components
    
    MCP Components:
    - McpFormModal (42 lines):
      * Streamlined form layout
      * Better server type selection (stdio/http)
      * Improved field grouping and labels
      * Enhanced validation feedback
    - UnifiedMcpPanel (14 lines):
      * Minor layout adjustments
      * Better list item spacing
      * Improved server status indicators
      * Enhanced action button placement
    
    Provider Components:
    - ProviderCard (11 lines):
      * Refined card layout and spacing
      * Better visual hierarchy
      * Improved badge placement
      * Enhanced hover effects
    - ProviderList (5 lines):
      * Minor grid layout adjustments
      * Better drag-and-drop visual feedback
    - GeminiConfigSections (4 lines):
      * Field label alignment
      * Improved spacing consistency
    
    Editor & Footer Components:
    - JsonEditor (13 lines):
      * Better editor height management
      * Improved error display
      * Enhanced syntax highlighting
    - UsageFooter (10 lines):
      * Refined footer layout
      * Better quota display
      * Improved refresh button placement
    
    Settings & Environment:
    - ImportExportSection (24 lines):
      * Better button layout
      * Improved action grouping
      * Enhanced visual feedback
    - EnvWarningBanner (4 lines):
      * Refined alert styling
      * Better dismiss button placement
    
    Global Styles (index.css):
    - Added 11 lines of utility classes
    - Improved transition timing
    - Better focus indicators
    - Enhanced scrollbar styling
    - Refined spacing utilities
    
    Design Improvements:
    - Consistent spacing using design tokens
    - Unified color palette application
    - Better typography hierarchy
    - Improved shadow system for depth
    - Enhanced interactive states (hover, active, focus)
    - Better border radius consistency
    - Refined animation timings
    
    Accessibility:
    - Improved focus indicators
    - Better keyboard navigation
    - Enhanced screen reader support
    - Improved color contrast ratios
    
    Code Quality:
    - Net increase of 68 lines due to UsageScriptModal improvements
    - Better component organization
    - Cleaner style application
    - Reduced style duplication
    
    These visual refinements create a more polished and professional
    interface while maintaining excellent usability and accessibility
    standards across all components.
  • 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.
  • 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.
  • 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(-)
  • 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" }
    }
  • 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.
  • 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
  • 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(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): resolve sync-to-other-side functionality failure
    This commit implements a three-layer fix to restore the "Sync to other side"
    feature when adding or editing MCP servers across Claude and Codex.
    
    Root Cause Analysis:
    1. Frontend issue: New MCP entries had their `enabled` field deleted
    2. Backend issue: Default value was `false` when `enabled` was missing
    3. Core issue: MCP entries were never copied to the other app's servers
    
    Changes:
    
    Frontend (McpFormModal.tsx):
    - Set `enabled=true` by default for new MCP entries
    - Preserve existing `enabled` state when editing
    
    Backend (services/mcp.rs):
    - Change default value from `unwrap_or(false)` to `unwrap_or(true)`
    - Implement cross-app MCP replication when `sync_other_side=true`
    - Clone MCP entry to other app's servers before syncing to live files
    
    Impact:
    - "Sync to Codex" checkbox now correctly adds MCP to both Claude and Codex
    - "Sync to Claude" checkbox now correctly adds MCP to both Codex and Claude
    - Both config.json and live files (~/.claude.json, ~/.codex/config.toml) are updated
    - Fixes regression introduced during project restructure
    
    Tested:
    - TypeScript type checking passed
    - Rust clippy linting passed
    - Manual testing: MCP sync works bidirectionally
  • refactor(types): rename AppType to AppId for semantic clarity
    Rename `AppType` to `AppId` across the entire frontend codebase to better
    reflect its purpose as an application identifier rather than a type category.
    This aligns frontend naming with backend command parameter conventions.
    
    Changes:
    - Rename type `AppType` to `AppId` in src/lib/api/types.ts
    - Remove `AppType` export from src/lib/api/index.ts
    - Update all component props from `appType` to `appId` (43 files)
    - Update all variable names from `appType` to `appId`
    - Synchronize documentation (CHANGELOG, refactoring plans)
    - Update test files and MSW mocks
    
    BREAKING CHANGE: `AppType` type is no longer exported. Use `AppId` instead.
    All component props have been renamed from `appType` to `appId`.
  • refactor: implement unified border design system
    - Define custom border utilities in @layer utilities for consistent theming
    - Add border-default (1px gray), border-active (2px primary), border-hover (40% primary), and border-dragging (60% primary) classes
    - Update all UI components (Input, Select, TextArea, Button, Dialog, Dropdown) to use unified border classes
    - Replace hardcoded border colors (gray-200/300/600/700) with theme-responsive border-border-default
    - Update provider cards, MCP components, settings, and forms with new border system
    - Remove dark mode border overrides to simplify CSS and improve maintainability
    - Ensure all borders automatically adapt to light/dark themes via CSS variables
  • fix: standardize MCP panel button font sizes to match app-wide consistency
    Remove size="sm" from MCP panel buttons to use default text-sm instead of text-xs, ensuring visual consistency with buttons throughout the application.
  • refine: improve MCP panel spacing and add icon consistency
    Enhance visual consistency across MCP dialogs with better spacing
    and appropriate icons for add/edit actions.
    
    Changes:
    - McpFormModal: Use Plus icon for "Add" button, Save icon for "Edit" button
    - McpPanel: Balance spacing around server info line (py-4 for info section,
      pb-4 for content area) to create equal visual weight between header and
      server list
    
    The MCP panel now has consistent vertical rhythm with 1rem spacing above
    and below the server count info line.
  • refactor: standardize dialog components to use consistent DialogFooter styling
    Remove custom styling from DialogFooter components across the application
    to ensure consistent appearance and behavior. All dialogs now follow the
    unified layout pattern defined in the base Dialog component.
    
    Changes:
    - Remove custom className overrides from DialogFooter in:
      - EndpointSpeedTest.tsx
      - CodexQuickWizardModal.tsx
      - CodexCommonConfigModal.tsx
      - ClaudeConfigEditor.tsx
    - Fix McpWizardModal content area padding (remove -mx-6 negative margin)
    - Fix McpPanel to use DialogFooter component instead of custom div
    
    All dialogs now consistently use:
    - DialogHeader: px-6 pt-6 pb-4 with border and background (built-in)
    - Content area: flex-1 overflow-y-auto px-6 py-4
    - DialogFooter: px-6 pb-6 pt-4 with border and background (built-in)
    
    This ensures proper spacing, alignment, and visual consistency across
    all modal dialogs in the application.
  • fix: unify dialog layout and fix content padding issues
    - Fix negative margin overflow in all dialog content areas
    - Standardize dialog structure with flex-col layout
    - Add consistent py-4 spacing to all content areas
    - Ensure proper spacing between header, content, and footer
    
    Affected components:
    - AddProviderDialog, EditProviderDialog
    - McpFormModal, McpPanel
    - UsageScriptModal
    - SettingsDialog
    
    All dialogs now follow unified layout pattern:
    - DialogContent: flex flex-col max-h-[90vh]
    - Content area: flex-1 overflow-y-auto px-6 py-4
    - No negative margins that cause content overflow
  • refactor: extract MCP business logic to useMcpActions hook
    Before optimization:
    - McpPanel.tsx: 298 lines (component + business logic)
    
    After optimization:
    - McpPanel.tsx: 234 lines (-21%, UI focused)
    - useMcpActions.ts: 137 lines (business logic)
    
    Benefits:
     Separation of concerns: UI vs business logic
     Reusability: MCP operations can be used in other components
     Testability: business logic can be tested independently
     Consistency: follows same pattern as useProviderActions
     Optimistic updates: toggle enabled status with rollback on error
     Unified error handling: all MCP errors use toast notifications
    
    Technical details:
    - Extract reload, toggleEnabled, saveServer, deleteServer
    - Implement optimistic UI updates for toggle
    - Centralize error handling and toast messages
    - Remove duplicate error handling code from component
  • refactor: extract business logic to useProviderActions hook
    Major improvements:
    - Create `src/hooks/useProviderActions.ts` (147 lines)
      - Consolidate provider operations (add, update, delete, switch)
      - Extract Claude plugin sync logic
      - Extract usage script save logic
    
    - Simplify `App.tsx` (347 → 226 lines, -35%)
      - Remove 8 callback functions
      - Remove Claude plugin sync logic
      - Remove usage script save logic
      - Cleaner and more maintainable
    
    - Replace `onNotify` prop with `toast` in:
      - `UsageScriptModal.tsx`
      - `McpPanel.tsx`
      - `McpFormModal.tsx`
      - `McpWizardModal.tsx`
      - Unified notification system using sonner
    
    Benefits:
    - Reduced coupling and improved maintainability
    - Business logic isolated in hooks, easier to test
    - Consistent notification system across the app
  • refactor: cleanup and minor improvements
    - Remove unused useDarkMode hook (now using shadcn theme-provider)
    - Clean up MCP components (remove redundant code)
    - Add restart API to settings
    - Minor type improvements
  • refactor: extract validation logic into useMcpValidation hook
    Extract all MCP form validation logic into a reusable custom hook to
    improve code organization and enable reuse across components.
    
    Changes:
    - Create useMcpValidation hook with 4 validation functions:
      * validateJson: basic JSON structure validation
      * formatTomlError: unified TOML error formatting with i18n
      * validateTomlConfig: complete TOML validation with required fields
      * validateJsonConfig: complete JSON validation with structure checks
    
    - Update McpFormModal to use the hook instead of inline validation
    - Simplify validation calls throughout the component
    - Reduce code duplication while maintaining all functionality
    
    Benefits:
    - Validation logic can be reused in other MCP-related components
    - Easier to test validation in isolation
    - Better separation of concerns
    - McpFormModal remains at 699 lines (original: 767), kept cohesive
    
    The component stays as one piece since its 700 lines represent a
    single, cohesive form feature rather than multiple unrelated concerns.
  • refactor: migrate all MCP dialogs to shadcn/ui Dialog component
    Convert all MCP-related modal windows to use the unified shadcn/ui Dialog
    component for consistency with the rest of the application.
    
    Changes:
    - McpPanel: Replace custom modal with Dialog component
      - Update props from onClose to open/onOpenChange pattern
      - Use DialogContent, DialogHeader, DialogTitle components
      - Remove custom backdrop and close button (handled by Dialog)
    
    - McpFormModal: Migrate form modal to Dialog
      - Wrap entire form in Dialog component structure
      - Use DialogFooter for action buttons
      - Apply variant="mcp" to maintain green button styling
      - Remove unused X icon import
    
    - McpWizardModal: Convert wizard to Dialog
      - Replace custom modal structure with Dialog components
      - Use Button component with variant="mcp" for consistency
      - Remove unused isLinux and X icon imports
    
    - App.tsx: Update McpPanel usage
      - Remove conditional rendering wrapper
      - Pass open and onOpenChange props directly
    
    - dialog.tsx: Fix dialog overlay and content styling
      - Change overlay from bg-background/80 to bg-black/50 for consistency
      - Change content from bg-background to explicit bg-white dark:bg-gray-900
      - Ensures opaque backgrounds matching MCP panel style
    
    Benefits:
    - Unified dialog behavior across the application
    - Consistent styling and animations
    - Better accessibility with Radix UI primitives
    - Reduced code duplication
    - Maintains MCP-specific green color scheme
    
    All dialogs now share the same base styling while preserving their unique
    content and functionality.
  • style: restore original color scheme to shadcn/ui components
    Restore the vibrant color palette from the pre-refactoring version while
    maintaining shadcn/ui component architecture and modern design patterns.
    
    ## Color Scheme Restoration
    
    ### Button Component
    - **default variant**: Blue primary (`bg-blue-500`) - matches old `primary`
    - **destructive variant**: Red (`bg-red-500`) - matches old `danger`
    - **secondary variant**: Gray text (`text-gray-500`) - matches old `secondary`
    - **ghost variant**: Transparent hover (`hover:bg-gray-100`) - matches old `ghost`
    - **mcp variant**: Emerald green (`bg-emerald-500`) - matches old `mcp`
    - Updated border-radius to `rounded-lg` for consistency
    
    ### CSS Variables
    - Set `--primary` to blue (`hsl(217 91% 60%)` ≈ `bg-blue-500`)
    - Added complete shadcn/ui theme variables for light/dark modes
    - Maintained semantic color tokens for maintainability
    
    ### Component-Specific Colors
    - **"Currently Using" badge**: Green (`bg-green-500/10 text-green-500`)
    - **Delete button hover**: Red (`hover:text-red-500 hover:bg-red-100`)
    - **MCP button**: Emerald green with minimum width (`min-w-[80px]`)
    - **Links/URLs**: Blue (`text-blue-500`)
    
    ## Benefits
    
    -  Restored original vibrant UI (blue, green, red accents)
    -  Maintained shadcn/ui component system (accessibility, animations)
    -  Easy global theming via CSS variables
    -  Consistent design language across all components
    -  Code formatted with Prettier (shadcn/ui standards)
    
    ## Files Changed
    
    - `src/index.css`: Added shadcn/ui theme variables with blue primary
    - `src/components/ui/button.tsx`: Restored all original button color variants
    - `src/components/providers/ProviderCard.tsx`: Green badge for current provider
    - `src/components/providers/ProviderActions.tsx`: Red hover for delete button
    - `src/components/mcp/McpPanel.tsx`: Use `mcp` variant for consistency
    - `src/App.tsx`: MCP button with emerald color and wider width
    
    The UI now matches the original colorful design while leveraging modern
    shadcn/ui components for better maintainability and user experience.
  • feat: complete stage 4 cleanup and code formatting
    This commit completes stage 4 of the refactoring plan, focusing on cleanup
    and optimization of the modernized codebase.
    
    ## Key Changes
    
    ### Code Cleanup
    - Remove legacy `src/lib/styles.ts` (no longer needed)
    - Remove old modal components (`ImportProgressModal.tsx`, `ProviderList.tsx`)
    - Streamline `src/lib/tauri-api.ts` from 712 lines to 17 lines (-97.6%)
      - Remove global `window.api` pollution
      - Keep only event listeners (`tauriEvents.onProviderSwitched`)
      - All API calls now use modular `@/lib/api/*` layer
    
    ### Type System
    - Clean up `src/vite-env.d.ts` (remove 156 lines of outdated types)
    - Remove obsolete global type declarations
    - All TypeScript checks pass with zero errors
    
    ### Code Formatting
    - Format all source files with Prettier (82 files)
    - Fix formatting issues in 15 files:
      - App.tsx and core components
      - MCP management components
      - Settings module components
      - Provider management components
      - UI components
    
    ### Documentation Updates
    - Update `REFACTORING_CHECKLIST.md` with stage 4 progress
    - Mark completed tasks in `REFACTORING_MASTER_PLAN.md`
    
    ## Impact
    
    **Code Reduction:**
    - Total: -1,753 lines, +384 lines (net -1,369 lines)
    - tauri-api.ts: 712 → 17 lines (-97.6%)
    - Removed styles.ts: -82 lines
    - Removed vite-env.d.ts declarations: -156 lines
    
    **Quality Improvements:**
    -  Zero TypeScript errors
    -  Zero TODO/FIXME comments
    -  100% Prettier compliant
    -  Zero `window.api` references
    -  Fully modular API layer
    
    ## Testing
    - [x] TypeScript compilation passes
    - [x] Code formatting validated
    - [x] No linting errors
    
    Stage 4 completion: 100%
    Ready for stage 5 (testing and bug fixes)
  • feat(mcp): add overwrite warning and improve sync option visibility
    - Move sync checkbox to footer alongside save/cancel buttons for better visibility
    - Add real-time conflict detection to check for duplicate MCP IDs on other side
    - Display amber warning icon when sync would overwrite existing config
    - Add i18n keys for overwrite warning (zh: "将覆盖 {{target}} 中的同名配置")
    - Update UI layout to use justify-between for better spacing
  • feat(mcp): add option to mirror MCP config to other app
    - Add syncOtherSide parameter to upsert_mcp_server_in_config command
    - Implement checkbox UI in McpFormModal for cross-app sync
    - Automatically sync enabled MCP servers to both Claude and Codex when option is checked
    - Add i18n support for sync option labels and hints
  • feat(mcp): pre-fill wizard with existing configuration
    Allow MCP wizard to load and edit existing server configuration:
    - Parse current config (JSON/TOML) and pass to wizard as initial data
    - Auto-detect server type (stdio/http) and populate form fields
    - Convert objects (env/headers) to multi-line text format for editing
    - Improves UX by avoiding manual re-entry of existing settings
  • refactor: improve code quality and fix linting issues
    - Derive Default trait instead of manual implementation for McpRoot and ProviderManager
    - Remove redundant closures in codex_config.rs and config.rs
    - Simplify match statements to if let patterns in migration.rs and lib.rs
    - Remove unnecessary type conversions and borrows in lib.rs
    - Fix i18n key inconsistency: sequentialThinking → sequential-thinking
    - Format TypeScript files to match Prettier style
    
    All clippy warnings resolved, code passes all quality checks.
  • feat(i18n): complete internationalization for MCP preset descriptions
    - Add i18n keys for all 5 MCP preset descriptions (fetch, time, memory, sequential-thinking, context7)
    - Refactor mcpPresets.ts to use i18n keys instead of hardcoded Chinese descriptions
    - Add getMcpPresetWithDescription() helper function for dynamic translation
    - Update McpFormModal to use translated descriptions when applying presets
    - Fix inconsistent key naming: sequentialThinking -> sequential-thinking
    
    This ensures MCP preset descriptions automatically switch language based on user's locale setting.
  • feat(mcp): add enabled count to panel info section
    - Add enabledCount calculation using useMemo for performance
    - Display format: "X MCP server(s) configured · Y enabled"
    - Add i18n keys: mcp.enabledCount for zh and en
    - Real-time updates when toggling server enabled status
  • feat(mcp): add collapsible additional info section in form modal
    Improves UX by collapsing optional metadata fields (description, tags, homepage, docs) behind an expandable "Additional Info" section.
    
    Changes:
    - Add collapsible section with ChevronUp/ChevronDown icons
    - Smart default state: collapsed for new entries, expanded for existing entries with metadata
    - Add i18n keys: mcp.form.additionalInfo (zh: "附加信息", en: "Additional Info")
    - Keep core fields (ID, name, config) always visible for better focus
    
    Benefits:
    - Cleaner, less cluttered form interface
    - Users can focus on essential configuration first
    - Optional metadata easily accessible when needed
  • refactor(mcp): improve data structure with metadata/spec separation
    - Separate MCP server metadata from connection spec for cleaner architecture
    - Add comprehensive server entry fields: name, description, tags, homepage, docs
    - Remove legacy format compatibility logic from extract_server_spec
    - Implement data validation and filtering in get_servers_snapshot_for
    - Add strict id consistency check in upsert_in_config_for
    - Enhance import logic with defensive programming for corrupted data
    - Simplify frontend by removing normalization logic (moved to backend)
    - Improve error messages with contextual information
    - Add comprehensive i18n support for new metadata fields
  • fix(mcp): improve error message internationalization
    - Add translateMcpBackendError utility to map backend errors to i18n keys
    - Update error handling in McpPanel, McpFormModal, and McpWizardModal
    - Internationalize stdio/http type selectors in Wizard
    - Implement three-tier fallback strategy: translation → raw error → default message
    - No backend changes required, fully frontend-based i18n implementation