CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

farion1231/cc-switch

Scanned commit 09c5d39d8c dated 2026-09-22 — last upstream commit. Generated by codevetter 1.12.0 on 2026-09-22.

github.com/farion1231/cc-switch ↗ · 1070 files · 17.9 MB

CC Switch The All-in-One Manager for Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes Agent, MiniMax Code 🌐 The Only Official Website: ccswitch.io English | 中文 | 日本語 | Deutsch | Changelog ❤️Sponsor Want to appear here? Cl

Deep analysis by cli:grok via the grok CLI on 2026-09-22 (408s) — every claim below links to its cited source files.

Overview

CC Switch 3.20.3 is a Tauri 2 desktop app (React/Vite renderer, Rust library crate cc_switch_lib) that stores AI-coding-tool provider configs in a local SQLite database and writes them into each tool's live config files. It targets people who switch among Claude Code, Claude Desktop, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes, Pi, and MiniMax Code, plus MCP servers, Skills, prompts, and a local HTTP proxy with failover. Distinctive pieces are exclusive-vs-additive live writes, proxy takeover that rewrites CLI base URLs to 127.0.0.1 while keeping a restore backup, and ccswitch:// deep-link import. Device UI settings stay in ~/.cc-switch/settings.json and are intentionally not part of WebDAV/S3 database sync.

System map

The process entry is src-tauri/src/main.rs, which only adjusts Linux WebKit environment variables and calls cc_switch_lib::run(). lib.rs owns the Tauri builder: single-instance, deep-link, dialog, updater, window-state, and a very large invoke_handler. Shared state is AppState { db, proxy_service, usage_cache, codex_oauth_manager }. Durable app data is rusqlite at ~/.cc-switch/cc-switch.db (SCHEMA_VERSION 19); device settings are a separate JSON file. The renderer is Vite rooted at src/, dev server port 3000, production output ../dist. CI splits frontend (pnpm) and backend (cargo on three OSes plus a Windows+WSL2 job). Tagged v* pushes build Windows, macOS, and Linux artifacts, including arm64, with a signed updater.

Feature catalog

The shell in App.tsx is a single window with an app switcher and views for providers, settings, prompts, skills, MCP, agents, universal providers, sessions, workspace files, OpenClaw env/tools/agent defaults, and Hermes memory. Provider management is the primary surface: presets, add/edit/delete, drag sort, tray switching, and per-provider terminals. Four apps can be taken over by a local proxy with failover and circuit breaking. Cross-tool panels cover MCP, Skills, and prompts. Extra utilities include usage scripts, subscription and coding-plan quotas, session browsing, WebDAV and S3 sync, deep-link import, env-conflict checks, and Claude Desktop direct versus proxy routing.

All 15 feature catalog claims →

Data flow

The renderer never writes CLI configs itself. It calls invoke(); command wrappers parse AppType and delegate to services, which lock the rusqlite connection, update SQLite, and atomically rewrite live files under the user home directory. Exclusive apps backfill the outgoing provider from the live file before the new provider is written. Additive apps keep every provider in one native document. When proxy takeover is active, live files point at the local listener and the real upstream config sits in a live backup. Request bodies hit Axum routes, ProviderRouter, format adapters, then reqwest/hyper upstream. Usage scripts are data: QuickJS builds a request descriptor, Rust performs HTTP, QuickJS extracts the result. SQLite mutations wake WebDAV and S3 auto-sync.

Behavior traces

Three flows dominate daily use: process startup (DB open, crash recovery, proxy restore, then the React shell), an exclusive provider switch (backfill then atomic live write, or a proxy hot-switch), and proxy takeover (backup live config, point the CLI at localhost, route through ProviderRouter). Deep-link import and usage-script execution are the two untrusted-input paths that still end in the same database and live-file writers.

Testing signals

Frontend tests are Vitest 2 with jsdom, Testing Library, and MSW, configured in vitest.config.ts and rooted in tests/. Backend tests are cargo test: large module-level Rust tests plus integration binaries in src-tauri/tests that drive the library through test-hooks. CI runs both on pull requests when the matching paths change, and always on pushes to main. There is no browser or Tauri-driver end-to-end job. Coverage exists as a Vitest reporter option but is not a CI gate.

Risk map

The trust boundary is documented in SECURITY.md: the bundled renderer is trusted, but deep links, proxy listeners, sync payloads, imports, and upstream responses are not. The highest-impact code is the local proxy (optionally non-loopback), QuickJS usage scripts, and shell launches for terminals and session resume. Live config writes sit outside the repo and can brick Claude, Codex, Gemini, or Grok sessions if a takeover backup is mishandled. A few docs and defaults disagree with the code (i18n paths, Hermes visibility, AppType error text).

Extension points

New coding tools plug in through AppType plus a live-config module and a frontend preset file. New proxy vendors plug in through ProviderAdapter and a route on the Axum router. New UI features plug in as a Tauri command in commands/, a line in invoke_handler, and a wrapper in src/lib/api. Deep links, MCP/Skill app flags, and the settings KV table are the other registries. Schema changes must bump SCHEMA_VERSION and add a migration.

Contributor handoff

Read the AppType dispatch, the switch function, and the live-path module for the tool you are touching before editing. Keep frontend AppId lists and Rust enums in lockstep, and update all four locale files for UI strings. Run the narrow Vitest file plus cargo test for the module; home-dir tests must set CC_SWITCH_TEST_HOME. Do not rewrite live CLI files while a takeover backup exists, do not relax CSP, and do not log raw provider settings. CONTRIBUTING.md is partly stale.

Languages

LanguageFilesShare of source
TypeScript48566%
Rust24533%
Markdown209docs/config
YAML17docs/config
JSON14docs/config
JavaScript41%
HTML2docs/config
TOML20%

Start reading here

Probable source entrypoint: src/ — inferred from the directory tree and manifest, not the upstream docs.

Source roots

src/ (433 files)

Repository structure

Top-level pathFiles
src/433
src-tauri/256
docs/197
tests/133
.github/17
flatpak/4
assets/3
scripts/2

Docs found: CONTRIBUTING.mdREADME.mddocs/guides/claude-codex-routing-guide-en.mddocs/guides/claude-codex-routing-guide-ja.mddocs/guides/claude-codex-routing-guide-zh.mddocs/guides/codex-claude-routing-guide-en.mddocs/guides/codex-claude-routing-guide-ja.mddocs/guides/codex-claude-routing-guide-zh.mddocs/guides/codex-deepseek-routing-guide-en.mddocs/guides/codex-deepseek-routing-guide-ja.md

Package

package.json — cc-switch v3.20.3, 67 declared dependencies.

@codemirror/lang-javascript@codemirror/lang-json@codemirror/lang-markdown@codemirror/lint@codemirror/state@codemirror/theme-one-dark@codemirror/view@dnd-kit/core@dnd-kit/sortable@dnd-kit/utilities@hookform/resolvers@radix-ui/react-accordion

CI & config entrypoints

Structural health signals

Average score 5.3/10 across 96 analyzed source files; 86 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history