17 Commits

  • refactor: consolidate chatgpt.config cleanup logic
    Merged duplicate try-catch blocks that handle invalid chatgpt.config values.
    Now handles all edge cases (scalar values, arrays, empty objects) in a single
    unified check, reducing code duplication and improving performance by parsing
    JSON only once.
  • - 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
  • - 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: simplify TOML common config handling by removing markers
    - Remove COMMON_CONFIG_MARKER_START/END constants
    - Simplify config snippet addition/removal logic
    - Use natural append/replace approach instead of markers
    - Fix unused variable warning
    - Improve user experience with cleaner config output
  • fix: improve VS Code config synchronization and code formatting
    - Add automatic VS Code config sync when base_url changes in TOML
    - Improve error handling for VS Code configuration writes
    - Enhance state management with ref tracking to prevent duplicate API calls
    - Fix code formatting issues and improve readability across components
    - Optimize common configuration handling for both Claude and Codex providers
  • fix: improve JSON validation with unified validation function
    - Extract common validateJsonConfig function for reuse
    - Apply unified validation to both main config and common config snippets
    - Add real-time JSON validation to JsonEditor component using CodeMirror linter
    - Simplify error handling without over-engineering error position extraction
  • 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: add common config support for Codex with TOML format
    - Added separate common config state and storage for Codex
    - Implemented TOML-based common config merging with markers
    - Created UI components for Codex common config editor
    - Added toggle and edit functionality similar to Claude config
    - Store Codex common config in localStorage separately
    - Support appending/removing common TOML snippets to config.toml
  • refactor: replace co-authored setting with flexible common config snippet feature
    - Replace single "disable co-authored" checkbox with universal "common config snippet" functionality
    - Add localStorage persistence for common config snippets
    - Implement deep merge/remove operations for complex JSON structures
    - Add modal editor for managing common config snippets
    - Optimize performance with custom deepClone function instead of JSON.parse/stringify
    - Fix deep remove logic to only delete matching values
    - Improve error handling and validation for JSON snippets
  • 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: JsonEditor for inputting JSON content (#4)
    * feat(editor): add JsonEditor component for JSON configuration editing
    
    * fix(provider): update API Key visibility logic in ProviderForm component
    
    * fix(editor): stabilize JsonEditor height and restore API Key logic
    
    - Revert API Key visibility to preset-based rule and injection to non-custom preset only.
    - Reduce JsonEditor min-height from rows*22px to rows*18px to lessen layout jitter when switching presets.
    - Keep fonts/size consistent with the previous textarea for visual parity.
    
    * - fix(form): remove websiteUrl auto-extraction from JSON to prevent incorrect overrides
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • 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
  • - feat(form): Support API Key ⇄ JSON two-way binding in edit modal
    - feat(utils): Add helpers to read/write/detect API Key in config
    - refactor(form): Reuse unified linking logic for preset and edit flows
    - chore: Preserve website URL extraction and signature-disable behaviors
    - build: Verify renderer build locally
  • refactor: 清理 Electron 遗留代码并优化项目结构
    - 删除 Electron 主进程代码 (src/main/)
    - 删除构建产物文件夹 (build/, dist/, release/)
    - 清理 package.json 中的 Electron 依赖和脚本
    - 删除 TypeScript 配置中的 Electron 相关文件
    - 优化前端代码结构至 Tauri 标准结构 (src/renderer → src/)
    - 删除移动端图标和不必要文件
    - 更新文档说明技术栈变更为 Tauri