Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

6.3 KB
Raw Blame
[package]
name = "cc-switch"
version = "4.0.48"
description = "All-in-One Assistant for Claude Code, Codex & Gemini CLI"
authors = ["Jason Young"]
license = "MIT"
repository = "https://github.com/farion1231/cc-switch"
edition = "2021"
rust-version = "1.85.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "cc_switch_lib"
# 只出 rlib:模板里的 staticlib / cdylib 只给 Tauri 移动端(iOS / Android)用,本项目只发桌面版。
# 带着它们每次构建(含 cargo test)都要多链一个 dylib、多写约 1 GB 的 .a 再复制一份到 target/。
crate-type = ["rlib"]
doctest = false

[[bin]]
name = "cc-switch"
path = "src/main.rs"
# main.rs 仅负责启动入口(0 个单元测试);关闭 test 目标避免 cargo test / nextest 多编多链一个测试二进制。
test = false

[features]
default = []
test-hooks = []

[build-dependencies]
tauri-build = { version = "2.4.0", features = [] }

[dependencies]
serde_json = { version = "1.0", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
chrono = { version = "0.4", features = ["serde"] }
tauri = { version = "2.8.2", features = ["tray-icon", "protocol-asset", "image-png", "macos-private-api"] }
tauri-plugin-log = "2"
tauri-plugin-opener = "2"
tauri-plugin-process = "2"
tauri-plugin-updater = "2"
tauri-plugin-dialog = "2"
tauri-plugin-store = "2"
tauri-plugin-deep-link = "2"
tauri-plugin-window-state = "2"
dirs = "5.0"
dunce = "1"
toml = "0.8"
toml_edit = "0.22"
reqwest = { version = "0.12", features = ["rustls-tls", "json", "stream", "socks"] }
arboard = "3.6"
flate2 = "1"
brotli = "7"
zstd = "0.13"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time", "sync", "net", "process"] }
futures = "0.3"
# Keep legacy SSE support alongside Streamable HTTP; newer SDKs removed SSE.
rmcp = { version = "0.8.5", features = ["client", "transport-async-rw", "transport-sse-client-reqwest", "transport-streamable-http-client-reqwest"] }
process-wrap = { version = "10.0.2", features = ["tokio1"] }
async-stream = "0.3"
bytes = "1.5"
prost = "0.14"
axum = "0.7"
tower = "0.4"
hyper = { version = "1.0", features = ["full"] }
hyper-util = { version = "0.1", features = ["tokio", "http1", "client-legacy"] }
hyper-rustls = { version = "0.27", features = ["http1", "tls12", "ring", "webpki-tokio"] }
http = "1"
http-body-util = "0.1"
httparse = "1"
tokio-rustls = "0.26"
rustls = "0.23"
webpki-roots = "0.26"
rustls-native-certs = "0.8"
regex = "1.10"
aho-corasick = "1.1"
rquickjs = { version = "0.8", features = ["array-buffer", "classes"] }
thiserror = "2.0"
anyhow = "1.0"
zip = "2.2"
serde_yaml = "0.9"
tempfile = "3"
url = "2.5"
auto-launch = "0.5"
base64 = "0.22"
# 校验自定义供应商图标;tauri 经 image 已依赖同一版本,不增加编译量
png = "0.18"
rusqlite = { version = "0.31", features = ["bundled", "backup", "hooks"] }
indexmap = { version = "2", features = ["serde"] }
rust_decimal = "1.33"
uuid = { version = "1.11", features = ["v4"] }
sha2 = "0.10"
hmac = "0.12"
subtle = "2.6"
ring = "0.17"
json5 = "0.4"
json-five = "0.3.1"
sys-locale = "0.3"

[target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))'.dependencies]
tauri-plugin-single-instance = "2"

[target.'cfg(target_os = "linux")'.dependencies]
webkit2gtk = { version = "2.0.1", features = ["v2_16"] }
gtk = "0.18"
secret-service = { version = "~5.1.0", features = ["rt-async-io-crypto-rust"] }

[target.'cfg(not(target_os = "windows"))'.dependencies]
libc = "0.2"

[target.'cfg(target_os = "windows")'.dependencies]
winreg = "0.52"
webview2-com = "0.38"
windows = "0.61"
windows-sys = { version = "0.61", features = [
    "Win32_Foundation",
    "Win32_Globalization",
    "Win32_Security_Credentials",
    "Win32_Storage_FileSystem",
    "Win32_Graphics_Gdi",
    "Win32_System_Threading",
    "Win32_UI_Shell",
    "Win32_UI_HiDpi",
    "Win32_UI_WindowsAndMessaging",
] }

[target.'cfg(all(target_os = "windows", target_arch = "aarch64"))'.dependencies]
rquickjs = { version = "0.8", features = ["bindgen"] }

[target.'cfg(target_os = "macos")'.dependencies]
# 托盘面板的原生玻璃:NSGlassEffectView(macOS 26)/ NSVisualEffectView
objc2 = "0.6"
block2 = "0.6"
objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSArray", "NSGeometry", "NSNotification", "NSOperation", "NSString", "block2"] }
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSAppearance", "NSGlassEffectView", "NSGraphics", "NSResponder", "NSScreen", "NSView", "NSVisualEffectView", "NSWindow"] }

# 本地 `cargo test` / `tauri dev` 只留行号表:panic 和回溯照样有文件名与行号,
# 完整调试信息(变量、类型)占测试二进制体积的九成,还拖慢编译和链接。
# CI 通过 `CARGO_PROFILE_DEV_DEBUG=0` 进一步关闭行号表以压缩编译耗时与缓存体积;
# 本地要用调试器看变量时临时设 `CARGO_PROFILE_DEV_DEBUG=full`。
[profile.dev]
debug = "line-tables-only"

# 隐私过滤器会解析 97 KB 的 gitleaks.toml 并编译 222 条正则与 Aho-Corasick 自动机;
# 在 dev/test 默认 opt-level = 0 下每次冷初始化耗时 ~12–30s,单独把这批外部解析/正则依赖
# 提到 opt-level = 2 可大幅压缩耗时,同时保持主 crate(cc_switch_lib)在 opt-level = 0
# 不影响增量编译。修改此列表后需同步升级 CI 中的 rust-cache `shared-key`(rust-cache 不按 Cargo.toml 分键)。
[profile.dev.package]
regex = { opt-level = 2 }
regex-automata = { opt-level = 2 }
regex-syntax = { opt-level = 2 }
aho-corasick = { opt-level = 2 }
memchr = { opt-level = 2 }
toml = { opt-level = 2 }
toml_edit = { opt-level = 2 }
toml_parser = { opt-level = 2 }
winnow = { opt-level = 2 }

# Optimize release binary size to help reduce AppImage footprint
[profile.release]
# 主 crate 体量大,codegen-units = 1 时 LLVM 只能单线程跑,发布编译的大头都在它身上。
# 16 让主 crate 编译快约 64%,代价是二进制体积增加约 17%(10-05 本机基准)。
codegen-units = 16
lto = "thin"
opt-level = "s"
# 使用 unwind 以便 panic hook 能捕获 backtrace(abort 会直接终止无法捕获)
panic = "unwind"
strip = "symbols"

[dev-dependencies]
serial_test = "3"
tauri = { version = "2.8.2", features = ["test"] }
tokio = { version = "1", features = ["test-util"] }