Commit Graph

70 Commits

  • 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)
  • 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)
  • feat(prompts+i18n): add prompt management and improve prompt editor i18n (#193)
    * feat(prompts): add prompt management across Tauri service and React UI
    
    - backend: add commands/prompt.rs, services/prompt.rs, register in commands/mod.rs and lib.rs, refine app_config.rs
    - frontend: add PromptPanel, PromptFormModal, PromptListItem, MarkdownEditor, usePromptActions, integrate in App.tsx
    - api: add src/lib/api/prompts.ts
    - i18n: update src/i18n/locales/{en,zh}.json
    - build: update package.json and pnpm-lock.yaml
    
    * feat(i18n): improve i18n for prompts and Markdown editor
    
    - update src/i18n/locales/{en,zh}.json keys and strings
    - apply i18n in PromptFormModal, PromptPanel, and MarkdownEditor
    - align prompt text with src-tauri/src/services/prompt.rs
    
    * feat(prompts): add enable/disable toggle and simplify panel UI
    
    - Add PromptToggle component and integrate in prompt list items
    - Implement toggleEnabled with optimistic update; enable via API, disable via upsert with enabled=false;
      reload after success
    - Simplify PromptPanel: remove file import and current-file preview to keep CRUD flow focused
    - Tweak header controls style (use mcp variant) and minor copy: rename “Prompt Management” to “Prompts”
    - i18n: add disableSuccess/disableFailed messages
    - Backend (Tauri): prevent duplicate backups when importing original prompt content
    
    * style: unify code formatting with trailing commas
    
    * feat(prompts): add Gemini filename support to PromptFormModal
    
    Update filename mapping to use Record<AppId, string> pattern, supporting
    GEMINI.md alongside CLAUDE.md and AGENTS.md.
    
    * fix(prompts): sync enabled prompt to file when updating
    
    When updating a prompt that is currently enabled, automatically sync
    the updated content to the corresponding live file (CLAUDE.md/AGENTS.md/GEMINI.md).
    
    This ensures the active prompt file always reflects the latest content
    when editing enabled prompts.
  • refactor(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`.
  • fix: insert duplicated provider next to original provider
    Fix the issue where duplicated providers were being sorted to the end of the list instead of appearing directly below the original provider.
    
    - Calculate new sortIndex as original sortIndex + 1
    - Batch update sortIndex of subsequent providers to make room for the new provider
    - Only perform sortIndex manipulation if the original provider has a sortIndex
    - Add error handling for sortIndex update failures
    - Abort duplication if sortIndex update fails to maintain consistency
    
    The duplicated provider will now appear immediately below the original provider in the list, maintaining the expected user experience.
  • feat: add provider duplicate functionality in edit mode
    Add a duplicate button next to the drag handle in edit mode that allows users to quickly copy existing provider configurations.
    
    - Add Copy icon button in ProviderCard next to drag handle
    - Implement handleDuplicateProvider in App.tsx with deep cloning
    - Copy all provider settings (settingsConfig, websiteUrl, category, meta)
    - Auto-generate new ID and timestamp, omit sortIndex for natural sorting
    - Append " copy" to duplicated provider name
    - Add i18n support (zh: "复制", en: "Duplicate")
    - Wire onDuplicate callback through ProviderList to ProviderCard
    
    The duplicated provider will appear below the original provider in the list, sorted by creation time.
  • refine: improve UI consistency and spacing in header and provider cards
    - Reduce header spacing (gap-4 → gap-2, gap-1.5 → gap-1) for more compact layout
    - Unify provider link colors with main title (blue-500/blue-400)
    - Standardize action button styles to use size="icon" for consistent hover effects
    - Add proper hover backgrounds to provider action buttons matching header buttons
  • feat: add edit mode toggle to show/hide drag handles
    - Add edit mode button next to settings in header
    - Edit button turns blue when active
    - Drag handles fade in/out with edit mode toggle
    - Add smooth 200ms transition animation
    - Add i18n support for edit mode (en/zh)
    - Maintain consistent spacing between header elements
  • i18n: complete internationalization for provider and usage query panels
    - Add 45+ new translation keys for usage query and usage script features
    - Fix duplicate provider object in translation files that caused missing translations
    - Remove all hardcoded Chinese text and defaultValue fallbacks from components
    - Add proper translations for:
      * Usage footer (query status, plan usage display)
      * Usage script modal (script editor, validation, test controls)
      * Provider forms (basic fields, endpoints, model selectors)
      * Provider dialogs (add/edit hints and titles)
    
    Modified 16 files:
    - 2 translation files (zh.json, en.json)
    - 14 component files (removed defaultValue, added t() calls)
    
    All UI text now properly supports Chinese/English switching.
  • 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
  • feat: move theme toggle to settings dialog
    Move the theme toggle from the main header to the settings dialog for a
    cleaner UI and better organization. The new theme selector uses a
    button group design consistent with the language settings.
    
    Changes:
    - Created ThemeSettings component with three options: Light, Dark, System
    - Added ThemeSettings to the General tab in settings dialog
    - Removed ModeToggle component from main header
    - Added theme-related i18n keys for all options
    - Theme selection takes effect immediately without requiring save
    
    Design:
    - Uses button group style matching LanguageSettings
    - Icons for each theme option (Sun, Moon, Monitor)
    - Consistent with app's blue theme for active state
    - Smooth transitions and hover effects
    
    This change simplifies the main header and consolidates all appearance
    settings in one place, improving the overall user experience.
  • fix: eliminate layout shift when switching between Claude and Codex
    Fixed dual-source jitter issue:
    1. Horizontal shift: Use overflow-y-scroll to force scrollbar gutter
    2. Vertical jump: Use keepPreviousData to maintain content during app switch
  • 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: migrate UsageScriptModal to shadcn/ui Dialog component
    Migrate the usage script configuration modal from custom modal implementation to shadcn/ui Dialog component to maintain consistent styling across the entire application.
    
    ## Changes
    
    ### UsageScriptModal.tsx
    - Replace custom modal structure (fixed positioning, backdrop) with Dialog component
    - Remove X icon import (Dialog includes built-in close button)
    - Add Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter imports
    - Add Button component import for action buttons
    - Update props interface to include isOpen boolean prop
    - Restructure component layout:
      - Use DialogHeader with DialogTitle for header section
      - Apply -mx-6 px-6 pattern for full-width scrollable content
      - Use DialogFooter with flex-col sm:flex-row sm:justify-between layout
    - Convert custom buttons to Button components:
      - Test/Format buttons: variant="outline" size="sm"
      - Cancel button: variant="ghost" size="sm"
      - Save button: variant="default" size="sm"
    - Maintain all existing functionality (preset templates, JSON editor, validation, testing, formatting)
    
    ### App.tsx
    - Update UsageScriptModal usage to pass isOpen prop
    - Use Boolean(usageProvider) to control dialog open state
    
    ## Benefits
    - **Consistent styling**: All dialogs now use the same shadcn/ui Dialog component
    - **Better accessibility**: Automatic focus management, ESC key handling, ARIA attributes
    - **Code maintainability**: Reduced custom modal boilerplate, easier to update styling globally
    - **User experience**: Unified look and feel across settings, providers, MCP, and usage script dialogs
    
    All TypeScript type checks and Prettier formatting checks pass.
  • 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.
  • refactor: consolidate provider form components
    This commit completes Stage 2.5-2.6 of the refactoring plan by:
    
    - Consolidating 8 provider form files (1941+ lines) into a single
      unified ProviderForm component (353 lines), reducing code by ~82%
    - Implementing modern form management with react-hook-form and zod
    - Adding preset provider categorization with grouped select UI
    - Supporting dual-mode operation for both Claude and Codex configs
    - Removing redundant subcomponents:
      - ApiKeyInput.tsx (72 lines)
      - ClaudeConfigEditor.tsx (205 lines)
      - CodexConfigEditor.tsx (667 lines)
      - EndpointSpeedTest.tsx (636 lines)
      - KimiModelSelector.tsx (195 lines)
      - PresetSelector.tsx (119 lines)
    
    Key improvements:
    - Type-safe form values with ProviderFormValues extension
    - Automatic template value application for presets
    - Better internationalization coverage
    - Cleaner separation of concerns
    - Enhanced UX with categorized preset groups
    
    Updates AddProviderDialog and EditProviderDialog to pass appType prop
    and handle preset category metadata.
  • 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: add provider usage query with JavaScript scripting support (#101)
    * feat: add provider usage query functionality
    
    - Updated `Cargo.toml` to include `regex` and `rquickjs` dependencies for usage script execution.
    - Implemented `query_provider_usage` command in `commands.rs` to handle usage queries.
    - Created `UsageScript` and `UsageData` structs in `provider.rs` for managing usage script configurations and results.
    - Added `execute_usage_script` function in `usage_script.rs` to run user-defined scripts for querying usage.
    - Enhanced `ProviderList` component to include a button for configuring usage scripts and a modal for editing scripts.
    - Introduced `UsageFooter` component to display usage information and status.
    - Added `UsageScriptModal` for editing and testing usage scripts with preset templates.
    - Updated Tauri API to support querying provider usage.
    - Modified types in `types.ts` to include structures for usage scripts and results.
    
    * feat(usage): support multi-plan usage display for providers
    
    - 【Feature】
      - Update `UsageResult` to support an array of `UsageData` for displaying multiple usage plans per provider.
      - Refactor `query_provider_usage` command to parse both single `UsageData` objects (for backward compatibility) and arrays of `UsageData`.
      - Enhance `usage_script` validation to accept either a single usage object or an array of usage objects.
    - 【Frontend】
      - Redesign `UsageFooter` to iterate and display details for all available usage plans, introducing `UsagePlanItem` for individual plan rendering.
      - Improve usage display with color-coded remaining balance and clear plan information.
      - Update `UsageScriptModal` test notification to summarize all returned plans.
      - Remove redundant `isCurrent` prop from `UsageFooter` in `ProviderList`.
    - 【Build】
      - Change frontend development server port from `3000` to `3005` in `tauri.conf.json` and `vite.config.mts`.
    
    * feat(usage): enhance query flexibility and display
    - 【`src/types.ts`, `src-tauri/src/provider.rs`】Make `UsageData` fields optional and introduce `extra` and `invalidMessage` for more flexible reporting.
      - `expiresAt` replaced by generic `extra` field.
      - `isValid`, `remaining`, `unit` are now optional.
      - Added `invalidMessage` to provide specific reasons for invalid status.
    - 【`src-tauri/src/usage_script.rs`】Relax usage script result validation to accommodate optional fields in `UsageData`.
    - 【`src/components/UsageFooter.tsx`】Update UI to display `extra` field and `invalidMessage`, and conditionally render `remaining` and `unit` based on availability.
    - 【`src/components/UsageScriptModal.tsx`】
      - Add a new `NewAPI` preset template demonstrating advanced extractor logic for complex API responses.
      - Update script instructions to reflect optional fields and new variable syntax (`{{apiKey}}`).
      - Remove old "DeepSeek" and "OpenAI" templates.
      - Remove basic syntax check for `return` statement.
    - 【`.vscode/settings.json`】Add `dish-ai-commit.base.language` setting.
    - 【`src-tauri/src/commands.rs`】Adjust usage logging to handle optional `remaining` and `unit` fields.
    
    * chore(config): remove VS Code settings from version control
    
    - delete .vscode/settings.json to remove editor-specific configurations
    - add /.vscode to .gitignore to prevent tracking of local VS Code settings
    - ensure personalized editor preferences are not committed to the repository
    
    * fix(provider): preserve usage script during provider update
    
    - When updating a provider, the `usage_script` configuration within `ProviderMeta` was not explicitly merged.
    - This could lead to the accidental loss of `usage_script` settings if the incoming `provider` object in the update request did not contain this field.
    - Ensure `usage_script` is cloned from the existing provider's meta when merging `ProviderMeta` during an update.
    
    * refactor(provider): enforce base_url for usage scripts and update dev ports
    - 【Backend】
        - `src-tauri/src/commands.rs`: Made `ANTHROPIC_BASE_URL` a required field for Claude providers and `base_url` a required field in `config.toml` for Codex providers when extracting credentials for usage script execution. This improves error handling by explicitly failing if these critical URLs are missing or malformed.
    - 【Frontend】
        - `src/App.tsx`, `src/components/ProviderList.tsx`: Passed `appType` prop to `ProviderList` component to ensure `updateProvider` calls within `handleSaveUsageScript` correctly identify the application type.
    - 【Config】
        - `src-tauri/tauri.conf.json`, `vite.config.mts`: Updated development server ports from `3005` to `3000` to standardize local development environment.
    
    * refactor(usage): improve usage data fetching logic
    
    - Prevent redundant API calls by tracking last fetched parameters in `useEffect`.
    - Avoid concurrent API requests by adding a guard in `fetchUsage`.
    - Clear usage data and last fetch parameters when usage query is disabled.
    - Add `queryProviderUsage` API declaration to `window.api` interface.
    
    * fix(usage-script): ensure usage script updates and improve reactivity
    
    - correctly update `usage_script` from new provider meta during updates
    - replace full page reload with targeted provider data refresh after saving usage script settings
    - trigger usage data fetch or clear when `usageEnabled` status changes in `UsageFooter`
    - reduce logging verbosity for usage script execution in backend commands and script execution
    
    * style(usage-footer): adjust usage plan item layout
    
    - Decrease width of extra field column from 35% to 30%
    - Increase width of usage information column from 40% to 45%
    - Improve visual balance and readability of usage plan items
  • - feat(mcp): unify notifications via onNotify in form and wizard
    - refactor(mcp): remove HTML5 required to avoid native popups
    
    - refactor(ui): propagate onNotify from App → McpPanel → McpFormModal → McpWizardModal
    
    - feat(settings): use onNotify for export and file-selection feedback
    
    - fix(ui): notify link-open failures via onNotify; remove unused appType prop from ProviderList
    
    - chore: format codebase and ensure typecheck passes
  • feat(settings): add 'Apply to Claude Code extension' toggle
    - Apply immediately on save (write or remove primaryApiKey)
    - Honor setting on provider switch (enabled: write for non-official, remove for official; disabled: no auto writes)
    - Remove per-provider Claude plugin buttons from ProviderList
    - Upsert primaryApiKey=any preserving other fields; respect override dir
    - Add zh/en i18n for the new setting
  • feat(mcp): import Codex MCP from ~/.codex/config.toml
    - Support both TOML schemas: [mcp.servers.<id>] and [mcp_servers.<id>]
    - Non-destructive merge of imported servers (enabled=true only)
    - Preserve existing TOML schema when syncing (prefer mcp_servers)
    - Remove both mcp and mcp_servers when no enabled items
    
    feat(ui): auto-import Codex MCP on panel init (app=codex)
    
    chore(tauri): add import_mcp_from_codex command and register
    
    chore(types): expose window.api.importMcpFromCodex and typings
    
    fix(ui): remove unused variable for typecheck
  • feat(mcp): app-aware MCP panel and Codex MCP sync to config.toml
    - Make MCP panel app-aware; pass appType from App and call APIs with current app
    - Show active app in title: “MCP Management · Claude Code/Codex”
    - Add sync_enabled_to_codex: project enabled servers from SSOT to ~/.codex/config.toml as [mcp.servers.*]
    - Sync on enable/disable, delete, and provider switch (post live write)
    - Add Tauri command sync_enabled_mcp_to_codex and expose window.api.syncEnabledMcpToCodex()
    - Fix Rust borrow scopes in switch_provider to avoid E0502
    - Add TS declarations for new Codex sync API
  • refactor(mcp): improve UI consistency and i18n
    - Add MCP-specific green button style (buttonStyles.mcp)
    - Unify MCP panel and form buttons with emerald theme
    - Adjust MCP entry button width to match AppSwitcher (px-3)
    - Reduce JSON editor height from h-64 to h-48
    - Update translations: "Add/Edit Server" → "Add/Edit MCP"
    - Change form label to "MCP Title (Unique)" for clarity
    - Move config wizard button to right side of JSON label
    - Fix McpListItem enabled state check (explicit true check)
  • fix(mcp): improve error handling and notification visibility
    - Increase notification z-index to z-[80] to prevent overlay issues
    - Make MCP save operation async with proper error propagation
    - Display specific backend error messages in form validation
    - Ensure errors are visible in both form and panel layers
  • refactor(mcp): redesign MCP management panel UI
    - Redesign MCP panel to match main interface style
    - Add toggle switch for each MCP server to enable/disable
    - Use emerald theme color consistent with MCP button
    - Create card-based layout with one MCP per row
    - Add dedicated form modal for add/edit operations
    - Implement proper empty state with friendly prompts
    - Add comprehensive i18n support (zh/en)
    - Extend McpServer type to support enabled field
    - Backend already supports enabled field via serde_json::Value
    
    Components:
    - McpPanel: Main panel container with header and list
    - McpListItem: Card-based list item with toggle and actions
    - McpFormModal: Independent modal for add/edit forms
    - McpToggle: Emerald-themed toggle switch component
    
    All changes passed TypeScript type checking and production build.
  • feat(mcp): implement MCP management panel (list, form, templates)
    - Add McpPanel with enable toggle, server list and add/edit form
    - Quick template: mcp-fetch (uvx mcp-server-fetch)
    - Command validation UI and open ~/.claude shortcut
    - Wire MCP button in App to open panel
  • refactor: improve error handling and code formatting
    - Enhanced error messages in Rust backend to include file paths
    - Improved provider switching error handling with detailed messages
    - Added MCP button placeholder in UI (functionality TODO)
    - Applied code formatting across frontend components
    - Extended error notification duration to 6s for better readability
  • add: local config import and export (#84)
    * add: local config import and export
    
    * Fix import refresh flow and typings
    
    * Clarify import refresh messaging
    
    * Limit stored import backups
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • feat: integrate language switcher into settings with modern segment control UI
    - Move language switcher from header to settings modal for better organization
    - Implement modern segment control UI instead of radio buttons for language selection
    - Add language preference persistence in localStorage and backend settings
    - Support instant language preview with cancel/revert functionality
    - Remove standalone LanguageSwitcher component
    - Improve initial language detection logic (localStorage -> browser -> default)
    - Add proper i18n keys for language settings UI text
  • feat: integrate i18next for internationalization support (#65)
    * feat: integrate i18next for internationalization support
    
    - Added i18next and react-i18next dependencies for localization.
    - Updated various components to utilize translation functions for user-facing text.
    - Enhanced user experience by providing multilingual support across the application.
    
    * feat: improve i18n implementation with better translations and accessibility
    
    - Add proper i18n keys for language switcher tooltips and aria-labels
    - Replace hardcoded Chinese console error messages with i18n keys
    - Add missing translation keys for new UI elements
    - Improve accessibility with proper aria-label attributes
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • - feat(vscode-sync): restore auto-sync logic and enable by default
    - refactor(settings): remove the VS Code auto-sync toggle from Settings UI
    - feat(provider-list): enable auto-sync after "Apply to VS Code"; disable after "Remove"
    - chore(prettier): run Prettier on changed files
    - verify: typecheck and renderer build pass
    
    - Files
      - added: src/hooks/useVSCodeAutoSync.ts
      - modified: src/App.tsx
      - modified: src/components/ProviderList.tsx
      - modified: src/components/SettingsModal.tsx
    
    - Notes
      - Auto-sync now defaults to enabled for new users (stored in localStorage; existing saved state is respected).
      - No settings toggle is shown; manual Apply/Remove in the list still works as before.
  • - refactor(utils): extract Codex base_url parsing into shared helpers
    - refactor(ProviderList): use shared base_url helpers
    - refactor(App): reuse shared base_url helpers for VS Code sync
    - fix(auto-sync): global shared VS Code auto-apply state (localStorage + event broadcast)
    - feat(tray): auto-apply to VS Code on Codex provider-switched when enabled
    - behavior: manual Apply enables auto-sync; manual Remove disables; official providers clear managed keys only
    - chore(typecheck): pass pnpm typecheck
  • refactor: extract VS Code sync logic to separate function
    - Extract syncCodexToVSCode as a standalone function for better code organization
    - Fix VS Code button state not updating after provider switch
    - Add loadProviders() call after sync to trigger UI state refresh
    - Improve error handling and variable naming
  • - feat(codex): Add “Apply to VS Code/Remove from VS Code” button on current Codex provider card
    - feat(tauri): Add commands to read/write VS Code settings.json with cross-variant detection (Code/Insiders/VSCodium/OSS)
    - fix(vscode): Use top-level keys “chatgpt.apiBase” and “chatgpt.config.preferred_auth_method”
    - fix(vscode): Handle empty settings.json (skip deletes, direct write) to avoid “Can not delete in empty document”
    - fix(windows): Make atomic writes robust by removing target before rename
    - ui(provider-list): Improve error surfacing when applying/removing
    - chore(types): Extend window.api typings and tauri-api wrappers for VS Code commands
    - deps: Add jsonc-parser
  • refactor: extract error message handling to utils module
    - Move extractErrorMessage function from App.tsx to utils/errorUtils.ts
    - Improve code organization and reusability
    - Enhance error notification with dynamic message extraction and timeout
  • feat(ui): convert title to GitHub link
    - Make "CC Switch" title clickable link to GitHub repository
    - Remove separate GitHub icon for cleaner design
    - Add hover effects for better user interaction
    - Update repository URL to farion1231/cc-switch
  • fix(ui): refactor layout with fixed header and prevent layout shift
    - Convert layout to flexbox with fixed header and scrollable content area
    - Use overflow-y-scroll to always show scrollbar track
    - Prevents content width changes when switching between apps
    - Ensures consistent 12px spacing between header and content
  • feat(updater): 优化更新体验与 UI
    - ui: UpdateBadge 使用 Tailwind 内置过渡,支持点击打开设置,保留图标动画
    
    - updater: 新增 UpdateContext 首启延迟检查,忽略版本键名命名空间化(含旧键迁移),并发保护
    
    - settings: 去除版本硬编码回退;检测到更新时复用 updateHandle 下载并安装,并新增常显“更新日志”入口
    
    - a11y: 更新徽标支持键盘触达(Enter/Space)
    
    - refactor: 移除未使用的 runUpdateFlow 导出
    
    - chore: 类型检查通过,整体行为与权限边界未改变
  • feat(ui): implement dark mode with system preference support
    - Add useDarkMode hook for managing theme state and persistence
    - Integrate dark mode toggle button in app header
    - Update all components with dark variant styles using Tailwind v4
    - Create centralized style utilities for consistent theming
    - Support system color scheme preference as fallback
    - Store user preference in localStorage for persistence
  • refactor(styles): migrate from CSS variables to Tailwind classes
    - Replace all CSS custom properties with Tailwind utility classes
    - Add tailwind.config.js with custom color palette matching Linear design
    - Reduce index.css from 89 to 37 lines (58% reduction)
    - Maintain consistent visual appearance with semantic color usage
    - Update all components to use Tailwind classes instead of CSS variables
  • refactor(ui): remove config file path display module
    Remove the configuration file path information section from the main page footer, including:
    - configStatus state and related functions
    - loadConfigStatus function
    - handleOpenConfigFolder function
    - UI component showing config file path and folder open button
    
    This simplifies the interface while preserving all core functionality.
  • feat(providers): add timestamp-based sorting for provider list
    - Add createdAt timestamp field to Provider interface
    - Implement sorting logic: old providers without timestamp first, then by creation time
    - Providers without timestamps are sorted alphabetically by name
    - New providers are automatically timestamped on creation
  • refactor(types): introduce Settings and apply in API
    - style(prettier): format src files
    - style(rustfmt): format Rust sources
    - refactor(tauri-api): type-safe getSettings/saveSettings
    - refactor(d.ts): declare window.api with Settings
    
    [skip ci]