1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
use clap::{Args, Parser, Subcommand};
use std::path::PathBuf;
use crate::snapshots::SnapshotScope;
/// Main CLI parser
#[derive(Parser)]
#[command(about, version, author, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
/// Available CLI commands
#[derive(Subcommand)]
pub enum Commands {
/// List and manage snapshots [aliases: l, ls]
#[command(alias = "l", alias = "ls")]
List,
/// Apply a snapshot or template [alias: a]
#[command(alias = "a")]
Apply {
/// Snapshot name or template type
/// (deepseek, glm, k2, k2-thinking, kat-coder, kimi, longcat, fishtrip,
/// minimax, seed-code, zenmux, duojie, anyrouter, openrouter, beeapi, day77)
target: String,
/// What to include (default: common). env = only env vars; common =
/// env+model+permissions+hooks; all = everything.
#[arg(long, default_value = "common", help = "Scope of settings to include")]
scope: SnapshotScope,
/// Override model setting
#[arg(long, help = "Override model setting")]
model: Option<String>,
/// Path to settings file (default: .claude/settings.json)
#[arg(long, help = "Path to settings file (default: .claude/settings.json)")]
settings_path: Option<PathBuf>,
/// Backup current settings before applying
#[arg(long, help = "Create backup of current settings before applying")]
backup: bool,
/// Skip the confirmation prompt (apply directly)
#[arg(long, short = 'y', help = "Skip confirmation / apply directly")]
yes: bool,
/// Deprecated: non-interactive mode. Now automatic when stdin isn't a TTY.
#[arg(long, hide = true, help = "Non-interactive mode (deprecated)")]
cli: bool,
/// Effort level override (max/xhigh/high/medium/low)
#[arg(long, help = "Set effort level (overrides the default in your config)")]
effort: Option<String>,
/// Auto-compact threshold for supported 1M-context providers (896k/768k/512k/256k)
#[arg(
long = "auto-compact",
visible_alias = "compact",
alias = "context",
help = "Set auto-compact threshold for supported 1M providers (896k/768k/512k/256k)"
)]
auto_compact: Option<String>,
/// API key to use (skips interactive selection)
#[arg(
long,
visible_alias = "key",
help = "API key to use (skips interactive selection)"
)]
api_key: Option<String>,
/// Disable co-authored-by attribution in commits/PRs
#[arg(long, help = "Disable co-authored-by attribution")]
no_co_author: bool,
/// Force the API-key picker even if a key is remembered
#[arg(long, help = "Force the API-key picker (ignore remembered key)")]
switch_key: bool,
/// Preview the result without writing anything
#[arg(long, help = "Preview changes without writing settings")]
dry_run: bool,
/// Specific variant alias for generic targets (e.g. zai-china, k2, kat-coder-air)
#[arg(long, help = "Specific variant alias (e.g. zai-china, k2)")]
variant: Option<String>,
},
/// Manage saved credentials [aliases: creds, cred]
#[command(alias = "creds", alias = "cred")]
Credentials {
/// Subcommand for credential management
#[command(subcommand)]
command: CredentialCommands,
},
/// View or edit persistent preferences [alias: cfg]
#[command(alias = "cfg")]
Config(ConfigArgs),
/// Show the currently-active provider [alias: status]
#[command(alias = "status")]
Current,
}
/// Arguments for `ccs config`
#[derive(Args, Clone, Debug)]
pub struct ConfigArgs {
/// Set the default effort level (max/xhigh/high/medium/low)
#[arg(long, help = "Set default effort (max/xhigh/high/medium/low)")]
pub effort: Option<String>,
/// Enable or disable co-authored-by in commits/PRs. Pass without a value to
/// enable (`--co-author`), or `--co-author false` to disable.
#[arg(
long,
action = clap::ArgAction::Set,
num_args = 0..=1,
default_missing_value = "true",
help = "Enable/disable co-authored-by (true|false)"
)]
pub co_author: Option<bool>,
/// Set the default apply scope (env/common/all)
#[arg(long, help = "Set default apply scope (env/common/all)")]
pub scope: Option<SnapshotScope>,
/// Reset all preferences to defaults
#[arg(long, help = "Reset all preferences to defaults")]
pub reset: bool,
}
/// Credential management commands
#[derive(Subcommand)]
pub enum CredentialCommands {
/// List saved credentials [aliases: l, ls]
#[command(alias = "l", alias = "ls")]
List,
/// Clear all saved credentials
Clear {
/// Skip confirmation prompt
#[arg(long, help = "Skip confirmation prompt")]
yes: bool,
},
}