Cc Switch Simple banner
kuliantnt kuliantnt

Cc Switch Simple

Development community

Description

Cross-platform Rust CLI for switching Claude Code JSON profiles and Codex config presets.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

简体中文 | [English](./README.en.md)


cc-switch

`cc-switch` 是一个 Rust 编写的跨平台 CLI,现在同时支持两种切换模式:

  • Claude Code JSON profile 切换
  • Codex config.toml / auth.json 预设切换,并支持可选的 models_catalog.json

工具保持小而直接:

  • 使用本地预设覆盖目标配置
  • 每次覆盖前自动备份
  • 不输出敏感值
  • 在 Windows / macOS / Linux 上以单文件可执行程序运行

命令

Claude Code:

cc-switch list
cc-switch current
cc-switch use 
cc-switch next
cc-switch before
cc-switch doctor

Codex:

cc-switch cx list
cc-switch cx current
cc-switch cx use 
cc-switch cx next
cc-switch cx before

也可以使用只面向 Codex 的独立命令:

cx-switch list
cx-switch current
cx-switch use 
cx-switch next
cx-switch before

行为规则:

  • Claude profile 按文件名排序,通过规范化 JSON 内容识别当前项
  • Codex profile 按目录名排序,通过 ~/.cc-switch-simple/codex/current 记录当前项
  • usenextbefore 真正切换前都会先备份现有目标文件
  • next 在当前项缺失或无法识别时,会回退到第一个 profile
  • before 使用最近一次成功切换前的 profile,不按名称排序
  • before 在没有历史记录、历史记录非法或 profile 已删除时会提示并跳过

运行时目录

默认运行时根目录:

  • Linux/macOS: ~/.cc-switch-simple/
  • Windows: 用户配置目录下的 cc-switch-simple/

Claude Code 相关文件:

  • profiles/:Claude JSON profile
  • current:当前选择记录
  • before:最近一次成功切换前的 profile 记录
  • backups/:Claude 自动备份
  • config.toml:可选配置

Claude Code 默认目标配置路径:

  • ~/.claude/settings.json

可通过 `config.toml` 覆盖:

[claude]
settings_path = "~/.claude/settings.json"

[backups]
max_files = 5

说明:

  • [backups].max_files 默认是 5
  • max_files 必须大于 0
  • 同时作用于 Claude 和 Codex 的自动备份保留数量;对于 Codex,会对 config.tomlauth.json 和存在的 models_catalog.json 分别保留 max_files 个备份
  • 如果 settings_path 是相对路径,会相对 config.toml 所在目录解析

Codex 相关文件:

  • 预设根目录:~/.cc-switch-simple/codex/
  • 预设配置:~/.cc-switch-simple/codex//config.toml
  • 预设认证:~/.cc-switch-simple/codex//auth.json
  • 当前选择记录:~/.cc-switch-simple/codex/current
  • 上一次切换记录:~/.cc-switch-simple/codex/before
  • 备份目录:~/.cc-switch-simple/backups/codex/
  • 当前生效配置:${CODEX_HOME:-$HOME/.codex}/config.toml
  • 当前生效认证:${CODEX_HOME:-$HOME/.codex}/auth.json
  • 当前生效模