Switch from `toml` to `toml_edit` crate for incremental TOML editing, preserving user-written comments, whitespace, and key ordering in Codex config.toml. Changes: - Add toml_edit 0.22 dependency for preserving-style TOML editing - Refactor sync_enabled_to_codex() to use toml_edit::DocumentMut API - Implement smart style detection: inherit existing mcp.servers or mcp_servers style, with fallback to sensible defaults - Add deduplication logic to prevent both styles coexisting - Add tests for format preservation and style inheritance - Fix unused_mut and nonminimal_bool compiler warnings - Apply cargo fmt to all modified files Benefits: - User comments and formatting are no longer lost during sync - Respects user's preferred TOML structure (nested vs toplevel) - Non-MCP fields in config.toml remain untouched - Minimal surprise principle: only modifies necessary sections Testing: - All 47 tests passing (unit + integration) - Clippy clean (0 warnings, 0 errors) - Release build successful - New tests verify comment preservation and style detection
60 lines
1.6 KiB
TOML
60 lines
1.6 KiB
TOML
[package]
|
|
name = "cc-switch"
|
|
version = "3.5.1"
|
|
description = "Claude Code & Codex 供应商配置管理工具"
|
|
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"
|
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
|
|
|
[features]
|
|
default = []
|
|
test-hooks = []
|
|
|
|
[build-dependencies]
|
|
tauri-build = { version = "2.4.0", features = [] }
|
|
|
|
[dependencies]
|
|
serde_json = "1.0"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
log = "0.4"
|
|
chrono = "0.4"
|
|
tauri = { version = "2.8.2", features = ["tray-icon"] }
|
|
tauri-plugin-log = "2"
|
|
tauri-plugin-opener = "2"
|
|
tauri-plugin-process = "2"
|
|
tauri-plugin-updater = "2"
|
|
tauri-plugin-dialog = "2"
|
|
tauri-plugin-store = "2"
|
|
dirs = "5.0"
|
|
toml = "0.8"
|
|
toml_edit = "0.22"
|
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
|
|
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
|
|
futures = "0.3"
|
|
regex = "1.10"
|
|
rquickjs = { version = "0.8", features = ["array-buffer", "classes"] }
|
|
thiserror = "1.0"
|
|
|
|
[target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))'.dependencies]
|
|
tauri-plugin-single-instance = "2"
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
objc2 = "0.5"
|
|
objc2-app-kit = { version = "0.2", features = ["NSColor"] }
|
|
|
|
# Optimize release binary size to help reduce AppImage footprint
|
|
[profile.release]
|
|
codegen-units = 1
|
|
lto = "thin"
|
|
opt-level = "s"
|
|
panic = "abort"
|
|
strip = "symbols"
|