- Extract common TOML read/validation logic into dedicated helper functions
- Add graceful degradation for corrupted config files during migration
- Centralize Codex config.toml processing to ensure consistency across operations
- Improve error handling: log warnings for invalid files but continue processing
- Eliminate code duplication between migration, import, and runtime operations
This makes the system more resilient to user configuration issues while maintaining data integrity through unified validation logic.
- Fix operation order: write live files first, then save config.json for consistency
- Implement short-lock pattern: read state quickly, release lock before I/O operations
- Add atomic Codex dual-file writes with rollback on failure
- Simplify add_provider and update_provider logic with consistent structure
- Remove unnecessary duplicate code and improve error handling reliability
This ensures data consistency when operations fail and significantly improves concurrency by minimizing lock holding time during file I/O.
- Remove file archiving when switching providers or updating current provider
- Keep archive functionality only for initial migration (one-time operation)
- Retain simple .bak backup for config.json on each save
- Simplify code by removing unnecessary archive operations from daily workflows
This change prevents unlimited archive growth while maintaining data safety through:
1. Initial migration archives for historical data preservation
2. Single .bak file for basic rollback capability
3. All provider configs stored in SSOT (config.json)
- 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'
- Remove special handling for 'current' entry
- Import default only when manager.providers is empty
- Name/id the initial entry 'default' and mark it current
- Remove per-startup dedupe; keep it limited to migration
- Call dedupe at end of migrate_copies_into_config, then write marker
- Avoid unintended changes on every app launch
- During copies→config migration, delete original legacy files only if archived
- Applies to Claude settings-* and Codex auth-*/config-* pairs
- Keep archive_file non-destructive for live backups
- Use case-insensitive compare for name + API key in migration
- Add runtime uniqueness checks in add/update commands
- Startup dedupe prefers current provider; archives others
- Keep original display casing; only normalize for comparisons
- Validate Codex config.toml as before; archive before overwrite
- Add explicit "Custom" button in preset selection
- Set "Custom" as default selection when adding new provider
- Update label from "One-click import" to "Choose configuration type"
- Add contextual hints for different configuration modes:
- Custom mode: "Manually configure provider, complete configuration required"
- Official preset: "Official login, no API Key required"
- Other presets: "Use preset configuration, only API Key required"
- Remove redundant "(optional)" text from Codex config.toml hint
- Improve clarity for users who were confused about adding custom providers
- Add timestamped backup at `~/.cc-switch/config.v1.backup.<ts>.json`
- Keep provider files untouched; only cc-switch metadata is backed up
- Remove UI notification plan; backup only as requested
- Update CHANGELOG with migration backup notes
- 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.