Commit Graph

48 Commits

  • 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]
  • feat(settings): add minimal settings panel
    - Add settings icon button next to app title
    - Create SettingsModal component with:
      - Show in Dock option (macOS)
      - Version info and check for updates button
      - Config file location with open folder button
    - Add settings-related APIs in tauri-api
    - Update type definitions for new API methods
  • feat(ui): unify link/address styles and set primary header color
    - Links use primary color; removed leading icon
    - Show API address when website is missing; use secondary text color, non-monospace
    - Parse base_url from Codex TOML; change fallback copy to "未配置官网地址"
    - Use primary color for the top-left header title
    - Clean up unused imports
    
    Affected files:
    - src/components/ProviderList.tsx
    - src/App.tsx
  • feat: refactor ProviderForm component with new subcomponents (#13)
    * feat: refactor ProviderForm component with new subcomponents
    
    - Introduced PresetSelector, ApiKeyInput, ClaudeConfigEditor, and CodexConfigEditor for improved modularity and readability.
    - Simplified preset selection logic for both Claude and Codex configurations.
    - Enhanced API Key input handling with dedicated components for better user experience.
    - Removed redundant code and improved state management in the ProviderForm component.
    
    * feat: add Kimi model selection to ProviderForm component
    
    - Introduced KimiModelSelector for enhanced model configuration options.
    - Implemented state management for Kimi model selection, including initialization and updates based on preset selection.
    - Improved user experience by conditionally displaying the Kimi model selector based on the selected preset.
    - Refactored related logic to ensure proper handling of Kimi-specific settings in the ProviderForm.
    
    * feat: enhance API Key input and model selection in ProviderForm
    
    - Added toggle functionality to show/hide API Key in ApiKeyInput component for improved user experience.
    - Updated placeholder text in ProviderForm to provide clearer instructions based on the selected preset.
    - Enhanced KimiModelSelector to display a more informative message when API Key is not provided.
    - Refactored provider presets to remove hardcoded API Key values for better security practices.
    
    * fix(kimi): optimize debounce implementation in model selector
    
    - Fix initial state: use empty string instead of apiKey.trim()
    - Refactor fetchModels to fetchModelsWithKey with explicit key parameter
    - Ensure consistent behavior between auto-fetch and manual refresh
    - Eliminate mental overhead from optional parameter fallback logic
    
    * fix(api-key): remove custom masking logic, use native password input
    
    - Remove getDisplayValue function with custom star masking
    - Use native browser password input behavior for better UX consistency
    - Simplify component logic while maintaining show/hide toggle functionality
    
    * chore: format code with prettier
    
    - Apply consistent code formatting across all TypeScript files
    - Fix indentation and spacing according to project style guide
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • feat: 系统托盘 (#12)
    * feat: 系统托盘
    
    1. 添加系统托盘
    2. 托盘添加切换供应商功能
    3. 整理组件目录
    
    * feat: 优化系统托盘菜单结构
    
    - 扁平化Claude和Codex的菜单结构,直接将所有供应商添加到主菜单,简化用户交互。
    - 添加无供应商时的提示信息,提升用户体验。
    - 更新分隔符文本以增强可读性。
    
    * feat: integrate Tailwind CSS and Lucide icons
    
    - Added Tailwind CSS for styling and layout improvements.
    - Integrated Lucide icons for enhanced UI elements.
    - Updated project structure by removing unused CSS files and components.
    - Refactored configuration files to support new styling and component structure.
    - Introduced new components for managing providers with improved UI interactions.   
    
    * fix: 修复类型声明和分隔符实现问题
    
    - 修复 updateTrayMenu 返回类型不一致(Promise<void> -> Promise<boolean>)
    - 添加缺失的 UnlistenFn 类型导入
    - 使用 MenuBuilder.separator() 替代文本分隔符
    
    ---------
    
    Co-authored-by: farion1231 <farion1231@gmail.c
  • docs(cleanup): remove 'current' as special provider; align UI/messages and migration naming to 'default' and one-time import rule
    - App: update auto-import message to '默认供应商'
    - README: clarify default import only when providers are empty
    - Plan doc: replace 'current entry' wording with current pointer (manager.current)
    - Migration: name live-imported item 'default' instead of 'current'
  • feat(ui): center title and balance header layout
    Unify title to "CC Switch" to prevent text length jumping during app switching.
    Reorganize header as three-column grid with centered title.
  • feat(ui): implement pills-style AppSwitcher with consistent button widths
    Replace segmented control with pills-style switcher for better visual consistency.
  • revert: restore app/appType param compatibility and revert segmented-thumb pointer-events change
    - Restore backend commands to accept app_type/app/appType with priority app_type
    - Frontend invoke() now passes both { app_type, app } again
    - Revert CSS change that set pointer-events: none on segmented-thumb
    - Keep minor fix: open_config_folder signature uses handle + respects both names
    
    Note: warnings for non_snake_case (appType) are expected for compatibility.
  • - feat(codex): 引入 Codex 应用与供应商切换(管理 auth.json/config.toml,支持备份与恢复)
    - feat(core): 多应用配置 v2(claude/codex)与 ProviderManager;支持 v1→v2 自动迁移
    - feat(ui): 新增 Codex 页签与双编辑器表单;统一 window.api 支持 app 参数
    - feat(tauri): 新增 get_config_status/open_config_folder/open_external 命令并适配 Codex
    - fix(codex): 主配置缺失时不执行默认导入(对齐 Claude 行为)
    - chore: 配置目录展示与重启提示等细节优化
  • chore: format code and fix bundle identifier for v3.0.0 release
    - Format all TypeScript/React code with Prettier
    - Format all Rust code with cargo fmt
    - Fix bundle identifier from .app to .desktop to avoid macOS conflicts
    - Prepare codebase for v3.0.0 Tauri release
  • - fix(types): 统一导入到 src/types.ts,移除 shared/types 残留路径
    - chore(tsconfig): 将 include 扩展为 src/**/* 覆盖迁移后的源文件
    - feat(build): Vite 设置 root 为 src,并将 build.outDir 设为 ../dist 以匹配 Tauri frontendDist
    - refactor(api): 去除未使用的 plugin-shell import;统一 electronAPI 类型定义至 vite-env.d.ts
    - build: 验证 renderer 构建通过,产物输出至 dist/
  • refactor: 清理 Electron 遗留代码并优化项目结构
    - 删除 Electron 主进程代码 (src/main/)
    - 删除构建产物文件夹 (build/, dist/, release/)
    - 清理 package.json 中的 Electron 依赖和脚本
    - 删除 TypeScript 配置中的 Electron 相关文件
    - 优化前端代码结构至 Tauri 标准结构 (src/renderer → src/)
    - 删除移动端图标和不必要文件
    - 更新文档说明技术栈变更为 Tauri