CC-Switch TUI
Command-Line Management Tool for Claude Code, Codex, Gemini, OpenCode & OpenClaw
Unified management for Claude Code, Codex, Gemini, OpenCode, and OpenClaw provider configurations, plus app-specific support for MCP servers, skills, prompts, local proxy routes, and environment checks.
English | δΈζ
π About
This project is a TUI fork whose upstream repository is SaladDay/cc-switch-cli.
π The WebDAV sync feature is fully compatible with the upstream project.
Credits: Original architecture and core functionality from farion1231/cc-switch
Changelog: docs/cc-switch-tui/CHANGELOG.md
πΈ Screenshots
π Quick Start
Interactive Mode (Recommended)
π€© Follow on-screen menus to explore features.
Command-Line Mode
# Use the global `--app` flag to target specific applications:
# Supported apps: `claude` (default), `codex`, `gemini`, `opencode`, `openclaw`
See the "Features" section for full command list.
π₯ Installation
Method 1: Quick Install (macOS / Linux)
Windows users: see Manual Installation below.
|
This installs to ~/.local/bin. Set CC_SWITCH_INSTALL_DIR to change the target directory.
- If the target already exists, the installer prompts in TTY and refuses to overwrite in non-interactive shells unless
CC_SWITCH_FORCE=1is set. - On Linux, set
CC_SWITCH_LINUX_LIBC=glibcif you need the glibc build.
macOS
# Download Universal Binary (recommended, supports Apple Silicon + Intel)
VERSION=""
# Extract
# Add execute permission
# Move to PATH
# If you encounter "cannot be verified" warning
Linux (x64)
# Download
VERSION=""
# Extract
# Add execute permission
# Move to PATH
Linux (ARM64)
# For Raspberry Pi or ARM servers
VERSION=""
Windows
# Download the zip file
# https://github.com/handy-sun/cc-switch-tui/releases/download/vX.Y.Z/cc-switch-tui-vX.Y.Z-windows-x64.zip
# After extracting, move cc-switch-tui.exe to a PATH directory, e.g.:
move cc-switch-tui.exe C:\Windows\System32\
# Or run directly
.\cc-switch-tui.exe
Method 2: Nix Flake
Use the package from this repository in another flake:
{
inputs.cc-switch-tui = {
url = "github:handy-sun/cc-switch-tui";
inputs.nixpkgs.follows = "nixpkgs";
};
}
inputs.nixpkgs.follows = "nixpkgs" is recommended for normal NixOS or Home Manager setups. The package is built with pkgs.rustPlatform.buildRustPackage, so following your top-level nixpkgs means the Rust compiler, Cargo, linker inputs, and system libraries come from the same nixpkgs revision as the rest of your system.
If you omit follows, this project uses the nixpkgs revision pinned in its own flake.lock, which can be useful when you want to reproduce the upstream build environment exactly. In either case, Rust crate dependency versions still come from src-tauri/Cargo.lock; follows changes the Nix toolchain and package set, not the locked Cargo dependency graph.
If a build only fails with follows enabled, try removing it to check whether the issue is caused by a nixpkgs version difference.
Method 3: Build from Source
Prerequisites:
- Rust 1.85+ (install via rustup)
Build:
# Binary location: ./target/release/cc-switch
Install to System:
# macOS/Linux
# Windows
β¨ Features
π Provider Management
Manage API configurations for Claude Code, Codex, Gemini, OpenCode, and OpenClaw.
Features: One-click switching, standalone Claude settings export, multi-endpoint support, API key management, remote model discovery, and per-app diagnostics such as speed testing or stream health checks where supported.
π οΈ MCP Server Management
Manage Model Context Protocol servers across Claude, Codex, Gemini, and OpenCode.
Features: Unified management, multi-app support, three transport types (stdio/http/sse), automatic sync, and live-config adapters for TOML and JSON targets.
π¬ Prompts Management
Manage system prompt presets for AI coding assistants.
Cross-app support: Claude (CLAUDE.md), Codex (AGENTS.md), Gemini (GEMINI.md), OpenCode (AGENTS.md), OpenClaw (AGENTS.md).
π― Skills Management
Manage and extend Claude Code/Codex/Gemini/OpenCode capabilities with community skills.
Features: SSOT-based skills store, multi-app enable/disable, sync to app directories, unmanaged scan/import, repo discovery.
βοΈ Configuration Management
Manage configuration backups, imports, and exports.
Features: Custom backup naming, interactive backup selection, automatic rotation (keep 10), import/export, common snippets, WebDAV sync.
# Common snippet (shared settings across providers)
# Tries to refresh live config when applicable (`--apply` is kept only as a compatibility flag)
# Backup
# Restore
# Import/Export
# WebDAV sync
π Proxy Management
Inspect and control the local multi-app proxy used by supported apps.
Features: Persisted enable/disable switch, current route inspection, dashboard telemetry, and foreground serve mode for debugging.
π§ͺ Environment & Local Tools
Inspect environment conflicts and whether required local CLIs are installed.
π Multi-language Support
Interactive mode supports English and Chinese, language settings are automatically saved.
- Default language: English
- Go to
βοΈ Settingsmenu to switch language
π§ Utilities
Shell completions, environment management, and other utilities.
# Shell completions
# Environment management
# Self-update
Automated install/activation currently targets bash and zsh only. Other shells remain available through the raw generator path, for example cc-switch-tui completions fish.
ποΈ Architecture
Core Design
- SQLite-backed state: Core data lives in
~/.cc-switch-tui/cc-switch.dbby default (or under$CC_SWITCH_TUI_CONFIG_DIR/when set); legacyconfig.jsonis kept only for older import and migration paths - Skills SSOT: Skill source files live in
~/.cc-switch-tui/skills/by default (or under$CC_SWITCH_TUI_CONFIG_DIR/skills/when set), while install state and app enablement stay in the database - Safe Live Sync (Default): Skip writing live files for apps that haven't been initialized yet (prevents creating
~/.claude,~/.codex,~/.gemini,~/.config/opencode, or~/.openclawunexpectedly) - Atomic Writes: Temp file + rename pattern prevents corruption
- Service Layer Reuse: 100% reused from original GUI version
- Concurrency Safe: RwLock with scoped guards
Configuration Files
CC-Switch Storage (default: ~/.cc-switch-tui, override: CC_SWITCH_TUI_CONFIG_DIR):
~/.cc-switch-tui/cc-switch.db- Main database for providers, MCP, prompts, and app state~/.cc-switch-tui/settings.json- Settings~/.cc-switch-tui/skills/- Installed skill sources (SSOT)~/.cc-switch-tui/backups/- Auto-rotation (keep 10)~/.cc-switch-tui/config.json- Legacy JSON kept for compatibility and import flows
When CC_SWITCH_TUI_CONFIG_DIR is set, CC-Switch uses that directory as its config root; existing data under ~/.cc-switch-tui is not migrated automatically.
Live Configs:
- Claude:
~/.claude/settings.json(provider/common config),~/.claude.json(MCP),~/.claude/CLAUDE.md(prompts) - Codex:
~/.codex/auth.json(auth state),~/.codex/config.toml(provider/common config + MCP),~/.codex/AGENTS.md(prompts) - Gemini:
~/.gemini/.env(provider env),~/.gemini/settings.json(settings + MCP),~/.gemini/GEMINI.md(prompts) - OpenCode:
~/.config/opencode/opencode.json(providers + MCP + runtime config),~/.config/opencode/AGENTS.md(prompts) - OpenClaw:
~/.openclaw/openclaw.json(providers + env/tools/agents defaults),~/.openclaw/AGENTS.md(prompts)
β FAQ (Frequently Asked Questions)
First, make sure the target CLI has been initialized at least once (i.e. its config directory exists). CC-Switch may skip live sync for uninitialized apps; you will see a warning. Run the target CLI once (e.g. claude --help, codex --help, gemini --help, opencode --help, openclaw --help), then switch again.
This is usually caused by environment variable conflicts. If you have API keys set in system environment variables (like ANTHROPIC_API_KEY, OPENAI_API_KEY), they will override CC-Switch's configuration.
Solution:
-
Check for conflicts:
-
List all related environment variables:
-
If conflicts are found, manually remove them:
- macOS/Linux: Edit your shell config file (
~/.bashrc,~/.zshrc, etc.)# Find and delete the line with the environment variable # Or use your preferred text editor: vim, code, etc. - Windows: Open System Properties β Environment Variables and delete the conflicting variables
- macOS/Linux: Edit your shell config file (
-
Restart your terminal for changes to take effect.
CC-Switch currently supports five AI coding assistants:
- Claude Code (
--app claude, default) - Codex (
--app codex) - Gemini (
--app gemini) - OpenCode (
--app opencode) - OpenClaw (
--app openclaw)
Use the global --app flag to specify which app to manage:
Please open an issue on our GitHub Issues page with:
- Detailed description of the problem or feature request
- Steps to reproduce (for bugs)
- Your system information (OS, version)
- Relevant logs or error messages
π οΈ Development
Requirements
- Rust: 1.85+ (rustup)
- Cargo: Bundled with Rust
Commands
Code Structure
src-tauri/src/
βββ cli/
β βββ commands/ # CLI subcommands (provider, mcp, prompts, skills, proxy, env, ...)
β βββ tui/ # Interactive TUI mode (ratatui)
β βββ interactive/ # Interactive entrypoint / TTY gate
β βββ ui/ # UI utilities (tables, colors)
βββ services/ # Business logic (provider, mcp, prompt, webdav, ...)
βββ database/ # SQLite storage, migrations, backup
βββ main.rs # CLI entry point
βββ ... # App-specific configs, proxy, error handling
π€ Contributing
Contributions welcome! This fork focuses on CLI functionality.
Before submitting PRs:
- β
Pass format check:
cargo fmt --check - β
Pass linter:
cargo clippy - β
Pass tests:
cargo test - π‘ Open an issue for discussion first
π License
- MIT Β© Original Author: Jason Young
- CLI Fork Maintainer: saladday