Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

A cross-platform desktop All-in-One assistant tool for Claude Code, Codex, OpenCode & Gemini CLI.

License

Notifications You must be signed in to change notification settings

ShadowHunt-yi/cc-switch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,072 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CC Switch (Fork with WebDAV Cloud Sync)

Version Upstream Platform Built with Tauri

基于 farion1231/cc-switch 的增强版本,新增 WebDAV 云同步等功能。

English | 中文 | 日本語


Fork 说明

本仓库 Fork 自 farion1231/cc-switch(原版 v3.10.3),在原版基础上进行了以下增强:

新增功能

WebDAV 云同步(v3.11.0-beta)

原版仅支持本地 SQL 文件的导入/导出,本 Fork 新增了完整的 WebDAV 云同步能力,实现真正的跨设备配置同步。

功能概述:

  • WebDAV 服务器关联 — 配置 WebDAV 服务器地址、用户名、密码、远程路径,支持一键测试连接
  • 上传备份 — 将当前数据库导出为带时间戳的 SQL 文件并上传到 WebDAV 服务器
  • 同步备份 — 从 WebDAV 服务器下载最新备份并同步到本地,支持 4 种同步模式:
同步模式 说明
覆盖模式 远程数据完全替换本地数据(等同于导入 SQL)
智能合并 合并两端数据,冲突时按时间戳保留较新记录
本地优先 冲突时保留本地版本,只新增远程独有数据
远程优先 冲突时使用远程版本,不删除本地独有数据

技术实现:

  • 后端:通过 reqwest 实现 WebDAV 协议(PROPFIND / PUT / GET / MKCOL),支持代理配置
  • 配置存储:复用 SQLite settings 表,密码 Base64 编码存储
  • 合并逻辑:独立的 webdav_sync 模块,支持 providers、mcp_servers、prompts、skills 四张表的智能合并
  • 前端:useWebDav Hook + WebDavSection 组件,完整的状态管理和错误处理
  • 国际化:中文 / 英文 / 日文三语支持

新增/修改文件:

新增:
  src-tauri/src/commands/webdav.rs       # WebDAV Tauri 命令(615 行)
  src-tauri/src/database/webdav_sync.rs  # 合并同步逻辑
  src/lib/api/webdav.ts                  # 前端 API 层
  src/hooks/useWebDav.ts                 # 状态管理 Hook
  src/components/settings/WebDavSection.tsx  # UI 组件

修改:
  src-tauri/src/commands/mod.rs          # 注册 webdav 模块
  src-tauri/src/database/mod.rs          # 注册 webdav_sync 模块
  src-tauri/src/lib.rs                   # 注册 6 个 Tauri 命令
  src/components/settings/SettingsPage.tsx  # 集成 WebDavSection
  src/i18n/locales/{zh,en,ja}.json       # 36 个翻译 key

使用方法

  1. 打开 设置高级设置数据管理
  2. 在 "SQL 导入导出" 下方找到 WebDAV 云同步 区域
  3. 填写 WebDAV 服务器信息(支持坚果云、Nextcloud、群晖等任何 WebDAV 服务)
  4. 点击 测试连接 验证配置
  5. 点击 保存配置 保存到本地
  6. 使用 上传备份 / 同步备份 进行跨设备同步

与上游的差异

方面 上游 (farion1231) 本 Fork (ShadowHunt-yi)
跨设备同步 仅支持本地 SQL 导入/导出 支持 WebDAV 云同步(4 种合并模式)
同步粒度 全量覆盖 支持表级智能合并(按时间戳/优先级)
使用场景 手动拷贝 SQL 文件 一键云端备份/恢复,真正的多设备同步

原版功能

以下为原版 farion1231/cc-switch 的功能说明。

Screenshots

Main Interface Add Provider
Main Interface Add Provider

Features

Core Capabilities

  • Provider Management: One-click switching between Claude Code, Codex, and Gemini API configurations
  • MCP Server Management: Unified MCP server panel for Claude / Codex / Gemini
  • Skills Management: Auto-scan and install Claude skills from GitHub repositories
  • Prompts Management: Multi-preset system prompt management with Markdown editor
  • Speed Testing: Measure API endpoint latency with visual quality indicators
  • Import/Export: Backup and restore configs (SQL) with auto-rotation
  • i18n Support: Chinese / English / Japanese localization
  • Deep Link Protocol: ccswitch:// one-click import provider configs

System Features

  • System tray with quick switching
  • Single instance daemon
  • Built-in auto-updater
  • Atomic writes with rollback protection
  • Auto launch on startup

Download & Installation

System Requirements

  • Windows: Windows 10+
  • macOS: macOS 10.15 (Catalina)+
  • Linux: Ubuntu 22.04+ / Debian 11+ / Fedora 34+

Windows

Download the latest .msi installer or portable .zip from the Releases page.

macOS

# Homebrew (upstream)
brew tap farion1231/ccswitch
brew install --cask cc-switch

Or download CC-Switch-v{version}-macOS.zip from Releases.

Note: You may see an "unidentified developer" warning. Go to "System Settings" → "Privacy & Security" → "Open Anyway".

Linux

Download from Releases:

  • .deb (Debian/Ubuntu)
  • .rpm (Fedora/RHEL/openSUSE)
  • .AppImage (Universal)

Quick Start

  1. Add Provider: Click "Add Provider" → Choose preset or create custom configuration
  2. Switch Provider: Select provider → Click "Enable" (or use system tray)
  3. Takes Effect: Restart your terminal or AI CLI client
  4. Back to Official: Select the "Official Login" preset, restart client, follow login flow

Configuration Files

Claude Code: ~/.claude/settings.json · MCP: ~/.claude.json Codex: ~/.codex/auth.json + config.toml · MCP: ~/.codex/config.toml Gemini: ~/.gemini/.env + settings.json · MCP: ~/.gemini/settings.json CC Switch: ~/.cc-switch/cc-switch.db (SQLite) + ~/.cc-switch/settings.json

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Frontend (React + TS)                    │
│  ┌─────────────┐  ┌──────────────┐  ┌──────────────────┐    │
│  │ Components  │  │    Hooks     │  │  TanStack Query  │    │
│  │   (UI)      │──│ (Bus. Logic) │──│   (Cache/Sync)   │    │
│  └─────────────┘  └──────────────┘  └──────────────────┘    │
└────────────────────────┬────────────────────────────────────┘
                         │ Tauri IPC
┌────────────────────────▼────────────────────────────────────┐
│                  Backend (Tauri + Rust)                     │
│  ┌─────────────┐  ┌──────────────┐  ┌──────────────────┐    │
│  │  Commands   │  │   Services   │  │  Models/Config   │    │
│  │ (API Layer) │──│ (Bus. Layer) │──│     (Data)       │    │
│  └─────────────┘  └──────────────┘  └──────────────────┘    │
└─────────────────────────────────────────────────────────────┘

Tech Stack

Frontend: React 18 · TypeScript · Vite · TailwindCSS · TanStack Query v5 · react-i18next · shadcn/ui · @dnd-kit

Backend: Tauri 2.8 · Rust · serde · tokio · reqwest · thiserror

Testing: vitest · MSW · @testing-library/react

Development

# Install dependencies
pnpm install

# Dev mode (hot reload)
pnpm dev

# Type check
pnpm typecheck

# Run frontend tests
pnpm test:unit

# Build application
pnpm build

Project Structure

├── src/                      # Frontend (React + TypeScript)
│   ├── components/           # UI components
│   ├── hooks/                # Custom hooks (business logic)
│   ├── lib/api/              # Tauri API wrappers
│   ├── i18n/locales/         # Translations (zh/en/ja)
│   └── config/               # Presets (providers/mcp)
├── src-tauri/                # Backend (Rust)
│   └── src/
│       ├── commands/         # Tauri commands (incl. webdav.rs)
│       ├── services/         # Business logic
│       ├── database/         # DAO + webdav_sync.rs
│       └── lib.rs            # App entry
└── tests/                    # Frontend tests

Contributing

Issues and PRs are welcome! Before submitting:

pnpm typecheck      # Type check
pnpm format:check   # Format check
pnpm test:unit      # Unit tests

Acknowledgments

License

MIT © Jason Young (original) · Fork maintained by ShadowHunt-yi

About

A cross-platform desktop All-in-One assistant tool for Claude Code, Codex, OpenCode & Gemini CLI.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 48.6%
  • TypeScript 47.2%
  • HTML 3.3%
  • Other 0.9%