Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,578 changes: 20 additions & 1,558 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version = "0.2.0"
crate-type = ["cdylib"]

[dependencies]
cc-switch = { path = "vendor/cc-switch-cli/src-tauri" }
cc-switch = { path = "vendor/cc-switch-cli/src-tauri", default-features = false }
napi = { version = "3.0.0", features = ["serde-json", "tokio_rt"] }
napi-derive = "3.0.0"
serde = { version = "1", features = ["derive"] }
Expand Down
10 changes: 6 additions & 4 deletions vendor/cc-switch-cli/UPSTREAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

- Project: `SaladDay/cc-switch-cli`
- Source: <https://github.com/SaladDay/cc-switch-cli>
- Revision: `bae5cab0be63b951270cfb50bd7e39756c6596d6`
- Revision: `55751b8e1b7844574267a62bf5ab97c27316ed7b`
- Upstream PR: <https://github.com/SaladDay/cc-switch-cli/pull/421>
- License: MIT; see `LICENSE` in this directory.
- Vendored path: `src-tauri/`, consumed as the Cargo path dependency
`cc-switch`.

The vendored source is intentionally kept unchanged. Update it by replacing
`src-tauri/` from a reviewed upstream revision, then update this file and run
the Rust and Node test suites.
The vendored source is kept semantically unchanged; repository formatters may
normalize TOML and JSON files. Update it by replacing `src-tauri/` from a
reviewed upstream revision, then update this file and run the Rust and Node test
suites.
76 changes: 52 additions & 24 deletions vendor/cc-switch-cli/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,68 @@ crate-type = ["rlib"]
name = "cc_switch_lib"

[[bin]]
name = "cc-switch"
path = "src/main.rs"
name = "cc-switch"
path = "src/main.rs"
required-features = ["cli"]

[features]
default = []
cli = [
"dep:clap",
"dep:clap_complete",
"dep:colored",
"dep:comfy-table",
"dep:console",
"dep:crossterm",
"dep:env_logger",
"dep:indicatif",
"dep:inquire",
"dep:minisign-verify",
"dep:ratatui",
"dep:self-replace",
"dep:semver",
"dep:shlex",
"dep:tachyonfx",
"dep:tar",
"dep:unicode-width",
"dep:which",
"dep:windows-sys",
"dep:winreg",
]
default = ["cli"]
test-hooks = []

[dependencies]
# Core dependencies
anyhow = "1.0"
chrono = { version = "0.4", features = ["serde"] }
libc = "0.2"
log = "0.4"
log = { version = "0.4", features = ["std"] }
once_cell = "1.21.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
thiserror = "1.0"

# CLI dependencies
clap = { version = "4.5", features = ["derive", "cargo", "env", "wrap_help"] }
clap_complete = "4.5"
colored = "2.1"
comfy-table = "7.1"
console = "0.15"
crossterm = { version = "0.29", features = ["osc52"] }
env_logger = "0.11"
indicatif = "0.17"
inquire = { version = "0.9", features = ["fuzzy"] }
ratatui = "0.30"
clap = { version = "4.5", features = [
"derive",
"cargo",
"env",
"wrap_help",
], optional = true }
clap_complete = { version = "4.5", optional = true }
colored = { version = "2.1", optional = true }
comfy-table = { version = "7.1", optional = true }
console = { version = "0.15", optional = true }
crossterm = { version = "0.29", features = ["osc52"], optional = true }
env_logger = { version = "0.11", optional = true }
indicatif = { version = "0.17", optional = true }
inquire = { version = "0.9", features = ["fuzzy"], optional = true }
ratatui = { version = "0.30", optional = true }

# File and path utilities
dirs = "5.0"
tempfile = "3"
which = "6.0"
which = { version = "6.0", optional = true }

# Serialization
base64 = "0.22"
Expand Down Expand Up @@ -93,28 +121,28 @@ uuid = { version = "1.11", features = ["v4"] }
brotli = "7"
flate2 = "1.0"
hmac = "0.12"
minisign-verify = "0.2.4"
minisign-verify = { version = "0.2.4", optional = true }
regex = "1.10"
rquickjs = { version = "0.8", features = ["array-buffer", "classes"] }
semver = "1.0"
semver = { version = "1.0", optional = true }
sha2 = "0.10"
shlex = "1.3"
tachyonfx = "0.25"
tar = "0.4"
unicode-width = "0.1"
shlex = { version = "1.3", optional = true }
tachyonfx = { version = "0.25", optional = true }
tar = { version = "0.4", optional = true }
unicode-width = { version = "0.1", optional = true }
url = "2.5"
zip = "2.2"

[target.'cfg(target_os = "windows")'.dependencies]
self-replace = "1"
windows-sys = { version = "0.61", features = [
self-replace = { version = "1", optional = true }
windows-sys = { version = "0.61", optional = true, features = [
"Win32_Foundation",
"Win32_Security",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_JobObjects",
"Win32_System_Threading",
] }
winreg = "0.52"
winreg = { version = "0.52", optional = true }

# Optimize release binary size to help reduce AppImage footprint
[profile.release]
Expand Down
3 changes: 2 additions & 1 deletion vendor/cc-switch-cli/src-tauri/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ use crate::error::AppError;
use crate::provider::ProviderManager;

/// 应用类型
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, clap::ValueEnum)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
#[serde(rename_all = "lowercase")]
pub enum AppType {
Claude,
Expand Down
4 changes: 3 additions & 1 deletion vendor/cc-switch-cli/src-tauri/src/cli/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn is_chinese() -> bool {
#[macro_export]
macro_rules! t {
($en:expr, $zh:expr) => {
if $crate::cli::i18n::is_chinese() {
if $crate::i18n::is_chinese() {
$zh
} else {
$en
Expand Down Expand Up @@ -4747,6 +4747,7 @@ pub mod texts {
}
}

#[cfg(feature = "cli")]
pub fn tui_settings_theme_mode_name(mode: crate::cli::tui::theme::ThemeMode) -> &'static str {
use crate::cli::tui::theme::ThemeMode;
if is_chinese() {
Expand Down Expand Up @@ -4780,6 +4781,7 @@ pub mod texts {
}
}

#[cfg(feature = "cli")]
pub fn tui_settings_icon_mode_name(mode: crate::cli::tui::icons::IconMode) -> &'static str {
use crate::cli::tui::icons::IconMode;
if is_chinese() {
Expand Down
2 changes: 1 addition & 1 deletion vendor/cc-switch-cli/src-tauri/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod codex_temp_launch;
pub mod commands;
pub mod editor;
pub(crate) mod failover_policy;
pub mod i18n;
pub use crate::i18n;
pub mod interactive;
pub(crate) mod openclaw_form_normalization;
pub(crate) mod provider_quota;
Expand Down
2 changes: 1 addition & 1 deletion vendor/cc-switch-cli/src-tauri/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::fs;
use std::io::Write;
use std::path::{Component, Path, PathBuf};

use crate::cli::i18n::texts;
use crate::error::AppError;
use crate::i18n::texts;

pub(crate) fn home_dir() -> Option<PathBuf> {
#[cfg(test)]
Expand Down
5 changes: 5 additions & 0 deletions vendor/cc-switch-cli/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ mod usage_script;
#[cfg(test)]
pub(crate) mod test_support;

// Localized validation text is also used by the library-only build.
#[path = "cli/i18n.rs"]
pub mod i18n;

// CLI module
#[cfg(feature = "cli")]
pub mod cli;

// Public exports
Expand Down
4 changes: 4 additions & 0 deletions vendor/cc-switch-cli/src-tauri/src/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ pub mod codex_oauth_models;
pub mod coding_plan;
pub mod config;
pub mod copilot_auth;
#[cfg(feature = "cli")]
pub mod env_checker;
#[allow(dead_code)]
#[cfg(feature = "cli")]
pub mod env_manager;
#[cfg(feature = "cli")]
pub mod local_env_check;
pub mod mcp;
pub mod model_fetch;
Expand All @@ -31,6 +34,7 @@ pub mod stream_check;
pub mod subscription;
pub(crate) mod sync_protocol;
pub mod usage_stats;
#[cfg(feature = "cli")]
pub mod visible_apps;
pub mod webdav;
pub mod webdav_sync;
Expand Down
3 changes: 3 additions & 0 deletions vendor/cc-switch-cli/src-tauri/src/services/provider/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3136,6 +3136,7 @@ fn provider_add_strips_common_snippet_before_claude_snapshot_persist() {
}

#[test]
#[cfg(feature = "cli")]
#[serial]
fn tui_claude_quick_config_round_trip_crosses_storage_normalization() {
let temp_home = TempDir::new().expect("create temp home");
Expand Down Expand Up @@ -3209,6 +3210,7 @@ fn tui_claude_quick_config_round_trip_crosses_storage_normalization() {
}

#[test]
#[cfg(feature = "cli")]
#[serial]
fn tui_claude_quick_edit_persists_legacy_inferred_common_config() {
let temp_home = TempDir::new().expect("create temp home");
Expand Down Expand Up @@ -3281,6 +3283,7 @@ fn tui_claude_quick_edit_persists_legacy_inferred_common_config() {
}

#[test]
#[cfg(feature = "cli")]
#[serial]
fn tui_codex_conflicting_quick_edit_preserves_storage_only_settings() {
let temp_home = TempDir::new().expect("create temp home");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use std::time::{Duration, Instant};
use rusqlite::{params, Connection};

use crate::database::Database;
use crate::services::sql_helpers::{INPUT_TOKEN_SEMANTICS_FRESH, INPUT_TOKEN_SEMANTICS_TOTAL};
use crate::services::sql_helpers::INPUT_TOKEN_SEMANTICS_FRESH;
#[cfg(feature = "cli")]
use crate::services::sql_helpers::INPUT_TOKEN_SEMANTICS_TOTAL;
use crate::session_manager::SessionUsageSummary;

use super::{project_main_connection, project_page, QueryControl, SessionCostIdentity};
Expand Down Expand Up @@ -608,6 +610,7 @@ fn duplicate_visible_source_paths_are_ambiguous_and_receive_no_overlay() {
}

#[test]
#[cfg(feature = "cli")]
fn session_projection_matches_usage_page_bucket_and_cost_semantics() {
let db = Database::memory().expect("memory database");
let conn = db.conn.lock().expect("database lock");
Expand Down
3 changes: 2 additions & 1 deletion vendor/cc-switch-cli/src-tauri/src/services/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ impl Default for SkillStore {
// ============================================================================

/// Skill sync method (upstream-aligned).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default, clap::ValueEnum)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[cfg_attr(feature = "cli", derive(clap::ValueEnum))]
#[serde(rename_all = "lowercase")]
pub enum SyncMethod {
/// Auto choose: prefer symlink, fallback to copy.
Expand Down
4 changes: 2 additions & 2 deletions vendor/cc-switch-cli/src-tauri/src/services/visible_apps.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::app_config::AppType;
use crate::cli::i18n::texts;
use crate::error::AppError;
use crate::i18n::{self, texts, Language};
use crate::settings::{self, VisibleApps, VisibleAppsMode};
use std::collections::HashMap;

Expand Down Expand Up @@ -174,7 +174,7 @@ pub fn notice_message(notice: &VisibleAppsNotice) -> String {
}

fn list_separator() -> &'static str {
if crate::cli::i18n::current_language() == crate::cli::i18n::Language::Chinese {
if i18n::current_language() == Language::Chinese {
"、"
} else {
", "
Expand Down
Loading