v3.2.0

farion1231/cc-switchv3.2.0Sep 13, 2025by github-actions[bot]

AI Summary

v3.2.0 introduces major architectural changes including SSOT (Single Source of Truth) to consolidate all provider configs into a single ~/.cc-switch/config.json, a built-in Tauri updater with full update flow, system tray quick switching with provider grouping, and a new UI with dark mode support.

Key Highlights

  • System tray quick switching with provider grouping (Claude/Codex) and provider-switched event broadcasting
  • Built-in Tauri Updater supporting check→download→install→restart flow with fallback to GitHub Releases
  • SSOT architecture: unified config in ~/.cc-switch/config.json, eliminating per-provider副本 files
  • One-time migration on first launch: scans old config files, merges/deduplicates, archives to ~/.cc-switch/archive/<timestamp>/
  • New UI with Tailwind v4 and dark mode with optimized contrast ratios

Breaking Changes

  • Old per-provider config files (settings-*.json, auth-*.json, config-*.toml) are no longer generated or used after migration
  • First upgrade triggers mandatory one-time migration/archiving of existing configs
  • Portable Windows version cannot use built-in updater - requires manual updates

New Features

  • System tray quick switch menu grouped by application with checked state for current provider
  • Tauri Updater with progress callbacks and graceful fallback
  • Provider categorization: Official / Domestic / Aggregator / Custom with differentiated validation
  • Preset providers: Kimi, ModelScope (GLM-4.5), PackyCode, and custom Base URL support
  • Atomic writes with automatic rollback on failure (Codex auth.json + config.toml)
  • Pre-switch fill current live config to prevent manual edits being lost
  • Settings panel shows friendly feedback for 'up to date' and new version badges
  • Rust optimizations: Thin LTO, strip symbols, panic=abort for smaller binaries
  • Build outputs: macOS .app.zip, Windows MSI + portable zip, Linux .deb + AppImage

Full Release Notes

## v3.2.0 发布说明

  - 发布日期:2025-09-13
  - 主要变化:系统托盘快速切换、内置更新器、SSOT 架构与一次性迁移/归档、原子写入与回滚、全新 UI (感谢 [TinsFox](https://github.com/TinsFox) 大佬)以及多项使用体验优化
<img width="894" height="619" alt="main" src="https://github.com/user-attachments/assets/fcd55fa4-a01b-4313-9643-14b8311ac55b" />

###  新增功能

  - 系统托盘快速切换
      - 菜单按应用分组(Claude / Codex),当前供应商以勾选态显示
      - 切换成功后向前端广播 provider-switched 事件并刷新状态
  - 内置更新器(Tauri Updater)
      - 支持“检查更新→下载→安装→重启”全流程,带进度回调
      - 若插件不可用或配置不完整,回退打开 GitHub Releases 页面
  - 全新 UI 和深色模式
      - Tailwind v4 适配,暗色策略与基础色对比度优化
  - 单一事实源(SSOT)
      - 不再写每供应商一个副本文件,统一存入 ~/.cc-switch/config.json
      - 首次升级执行一次性“扫描副本→合并→去重→归档→清理”,后续切换/编辑不再持续归档



###  数据归档与迁移(重点)

  - 背景与目标
      - 采用 SSOT 架构:供应商数据集中存于 ~/.cc-switch/config.json,不再生成 settings-*.json、auth-*.json/config-*.toml 等副本文件
      - 仅“迁移阶段”进行文件归档;日常切换/编辑不再产生日志式归档,降低磁盘占用
  - 归档目录结构
      - 根目录:~/.cc-switch/archive/<timestamp>/<category>/...
      - <category>:cc-switch(应用自身配置)、claude(Claude 旧副本)、codex(Codex 旧副本)
      - 同名冲突自动加序号(name-2.ext)
  - 一次性迁移流程(首次启动 3.2.0 触发)
      - 扫描副本
          - Claude:~/.claude/settings-*.json(排除 settings.json / 历史 claude.json)
          - Codex:~/.codex/auth-*.json + config-*.toml(按名称成对)
      - 合并与去重
          - 优先合并“当前 live 配置”为供应商项,再合并副本
          - 去重键:名称(忽略大小写)+ API Key(原文比较)
          - 若当前为空,将 live 导入项设为当前
      - 归档与清理
          - 将扫描到的副本归档到 ~/.cc-switch/archive/<timestamp>/<category>/...
          - 归档成功后删除原副本;归档失败时保留原文件(保守策略)
          - 如存在旧版 ~/.cc-switch/config.json,先归档再写新结构
      - v1 → v2 附加备份
          - 遇到 v1 结构会额外生成 ~/.cc-switch/config.v1.backup.<timestamp>.json
  - 日常行为变化(3.2.0 之后)
      - 切换供应商
          - 切换前回填当前 live 配置到“当前供应商”,避免遗失手动改动
          - 目标供应商写回 live 文件
              - Claude:原子写 ~/.claude/settings.json(历史兼容 claude.json)
              - Codex:原子写 ~/.codex/auth.json 与 config.toml,第二步失败自动回滚第一步
          - 切换/更新不再触发文件级归档
      - 编辑“当前供应商”
          - 先写 live 文件成功,再更新应用主配置,保持一致性
      - 清理策略
          - 归档目录不自动清理,如需释放空间,可手动删除 ~/.cc-switch/archive 内历史快照

 ### 体验与 UI 改进

  - 供应商表单与预设
      - 新增供应商“分类”(官方 / 国内官方 / 聚合 / 自定义),用于差异化提示和校验
      - 预设优化:Kimi、ModelScope(GLM-4.5)、PackyCode 等;自定义 Base URL;“获取 API Key”外链与样式统一
  - 更新体验
      - 设置面板“检查更新”提供“已是最新”的友好反馈与新版提示徽标
  - 生产环境静默调试日志,减少控制台噪声

###  性能、构建与日志

  - Rust 侧优化
      - Thin LTO、strip 符号、panic=abort、codegen-units=1,减小二进制体积
      - 统一使用 log::{info,warn,error},便于与 tauri-plugin-log 集成
  - 产物与 CI
      - 产物增强:macOS .app.zip,Windows MSI + 便携 zip,Linux .deb 与 AppImage
      - 提供 latest.json 以支持 Updater;固定 runner,提升可复现性

###  兼容性与升级指引

  - 直接从 v3.1.2 升级即可;首次启动会执行一次性迁移/归档
  - 迁移后不再生成/使用 settings-*.json、auth-*.json/config-*.toml 副本文件
  - 默认导入的供应商命名为 default
  - 企业网络限制 GitHub 或其他原因导致内置更新器不可用,应用会回退到打开 Releases 页面


 ### 下载与安装

  - Windows:MSI 安装包与便携 zip(便携版无法使用内置更新器,后续更新需要手动下载新版)
  - macOS:.app.zip(首次运行如提示“未知开发者”,在“系统设置 → 隐私与安全性”选择“仍要打开”)
  - Linux:.deb、AppImage

 ### 反馈与支持

  - 问题与建议:请提交 Issue 并附带系统信息、复现步骤与日志
  - 安全与隐私:应用仅在本地写入 ~/.cc-switch 与 ~/.claude 与 ~/.codex,不上传任何敏感数据