@kaitranntt/ccs 5.8.0 → 5.9.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/VERSION +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +5 -3
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts +12 -0
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +31 -12
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-config.d.ts +5 -2
- package/dist/cliproxy/model-config.d.ts.map +1 -1
- package/dist/cliproxy/model-config.js +27 -7
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/commands/api-command.d.ts.map +1 -1
- package/dist/commands/api-command.js +4 -0
- package/dist/commands/api-command.js.map +1 -1
- package/dist/commands/cliproxy-command.d.ts +7 -4
- package/dist/commands/cliproxy-command.d.ts.map +1 -1
- package/dist/commands/cliproxy-command.js +483 -21
- package/dist/commands/cliproxy-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +1 -0
- package/dist/commands/help-command.js.map +1 -1
- package/package.json +1 -1
- package/scripts/completion/ccs.bash +69 -10
- package/scripts/completion/ccs.fish +128 -47
- package/scripts/completion/ccs.ps1 +179 -14
- package/scripts/completion/ccs.zsh +107 -28
|
@@ -12,14 +12,20 @@
|
|
|
12
12
|
Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
13
13
|
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
14
14
|
|
|
15
|
-
$commands = @('auth', '
|
|
15
|
+
$commands = @('auth', 'api', 'cliproxy', 'doctor', 'sync', 'update', '--help', '--version', '--shell-completion', '-h', '-v', '-sc')
|
|
16
|
+
$cliproxyProfiles = @('gemini', 'codex', 'agy', 'qwen')
|
|
16
17
|
$authCommands = @('create', 'list', 'show', 'remove', 'default', '--help', '-h')
|
|
17
|
-
$
|
|
18
|
-
$
|
|
18
|
+
$apiCommands = @('create', 'list', 'remove', '--help', '-h')
|
|
19
|
+
$cliproxyCommands = @('create', 'list', 'remove', '--install', '--latest', '--help', '-h')
|
|
20
|
+
$apiCreateFlags = @('--base-url', '--api-key', '--model', '--force', '--yes', '-y')
|
|
21
|
+
$cliproxyCreateFlags = @('--provider', '--model', '--force', '--yes', '-y')
|
|
22
|
+
$providerFlags = @('--auth', '--config', '--logout', '--headless', '--help', '-h')
|
|
23
|
+
$updateFlags = @('--force', '--beta', '--dev', '--help', '-h')
|
|
19
24
|
$shellCompletionFlags = @('--bash', '--zsh', '--fish', '--powershell')
|
|
20
25
|
$listFlags = @('--verbose', '--json')
|
|
21
26
|
$removeFlags = @('--yes', '-y')
|
|
22
27
|
$showFlags = @('--json')
|
|
28
|
+
$providers = @('gemini', 'codex', 'agy', 'qwen')
|
|
23
29
|
|
|
24
30
|
# Get current position in command
|
|
25
31
|
$words = $commandAst.ToString() -split '\s+' | Where-Object { $_ -ne '' }
|
|
@@ -53,12 +59,25 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
|
|
62
|
+
# CLIProxy variants
|
|
63
|
+
if ($Type -in @('all', 'cliproxy')) {
|
|
64
|
+
$configPath = "$env:USERPROFILE\.ccs\config.json"
|
|
65
|
+
if (Test-Path $configPath) {
|
|
66
|
+
try {
|
|
67
|
+
$config = Get-Content $configPath -Raw | ConvertFrom-Json
|
|
68
|
+
if ($config.cliproxy) {
|
|
69
|
+
$profiles += $config.cliproxy.PSObject.Properties.Name
|
|
70
|
+
}
|
|
71
|
+
} catch {}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
return $profiles | Sort-Object -Unique
|
|
57
76
|
}
|
|
58
77
|
|
|
59
78
|
# Top-level completion
|
|
60
79
|
if ($position -eq 2) {
|
|
61
|
-
$allOptions = $commands + (Get-CcsProfiles)
|
|
80
|
+
$allOptions = $commands + $cliproxyProfiles + (Get-CcsProfiles)
|
|
62
81
|
$allOptions | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
63
82
|
[System.Management.Automation.CompletionResult]::new(
|
|
64
83
|
$_,
|
|
@@ -85,10 +104,35 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
85
104
|
return
|
|
86
105
|
}
|
|
87
106
|
|
|
107
|
+
# CLIProxy provider flags (gemini, codex, agy, qwen)
|
|
108
|
+
if ($words[1] -in $cliproxyProfiles) {
|
|
109
|
+
$providerFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
110
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
111
|
+
$_,
|
|
112
|
+
$_,
|
|
113
|
+
'ParameterValue',
|
|
114
|
+
$_
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# update command completion
|
|
121
|
+
if ($words[1] -eq 'update') {
|
|
122
|
+
$updateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
123
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
124
|
+
$_,
|
|
125
|
+
$_,
|
|
126
|
+
'ParameterValue',
|
|
127
|
+
$_
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
88
133
|
# auth subcommand completion
|
|
89
134
|
if ($words[1] -eq 'auth') {
|
|
90
135
|
if ($position -eq 3) {
|
|
91
|
-
# auth subcommands
|
|
92
136
|
$authCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
93
137
|
[System.Management.Automation.CompletionResult]::new(
|
|
94
138
|
$_,
|
|
@@ -98,7 +142,6 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
98
142
|
)
|
|
99
143
|
}
|
|
100
144
|
} elseif ($position -eq 4) {
|
|
101
|
-
# Profile names or flags for auth subcommands
|
|
102
145
|
switch ($words[2]) {
|
|
103
146
|
'show' {
|
|
104
147
|
$options = (Get-CcsProfiles -Type account) + $showFlags
|
|
@@ -143,11 +186,17 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
143
186
|
}
|
|
144
187
|
}
|
|
145
188
|
'create' {
|
|
146
|
-
|
|
189
|
+
@('--force') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
190
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
191
|
+
$_,
|
|
192
|
+
$_,
|
|
193
|
+
'ParameterValue',
|
|
194
|
+
$_
|
|
195
|
+
)
|
|
196
|
+
}
|
|
147
197
|
}
|
|
148
198
|
}
|
|
149
199
|
} elseif ($position -eq 5) {
|
|
150
|
-
# Flags after profile name
|
|
151
200
|
switch ($words[2]) {
|
|
152
201
|
'show' {
|
|
153
202
|
$showFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
@@ -171,13 +220,130 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
171
220
|
}
|
|
172
221
|
}
|
|
173
222
|
}
|
|
223
|
+
return
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
# api subcommand completion
|
|
227
|
+
if ($words[1] -eq 'api') {
|
|
228
|
+
if ($position -eq 3) {
|
|
229
|
+
$apiCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
230
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
231
|
+
$_,
|
|
232
|
+
$_,
|
|
233
|
+
'ParameterValue',
|
|
234
|
+
$_
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
} elseif ($position -eq 4) {
|
|
238
|
+
switch ($words[2]) {
|
|
239
|
+
'remove' {
|
|
240
|
+
$options = (Get-CcsProfiles -Type settings) + $removeFlags
|
|
241
|
+
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
242
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
243
|
+
$_,
|
|
244
|
+
$_,
|
|
245
|
+
'ParameterValue',
|
|
246
|
+
$_
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
'create' {
|
|
251
|
+
$apiCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
252
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
253
|
+
$_,
|
|
254
|
+
$_,
|
|
255
|
+
'ParameterValue',
|
|
256
|
+
$_
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
} elseif ($position -eq 5) {
|
|
262
|
+
switch ($words[2]) {
|
|
263
|
+
'remove' {
|
|
264
|
+
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
265
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
266
|
+
$_,
|
|
267
|
+
$_,
|
|
268
|
+
'ParameterValue',
|
|
269
|
+
$_
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
# cliproxy subcommand completion
|
|
279
|
+
if ($words[1] -eq 'cliproxy') {
|
|
280
|
+
if ($position -eq 3) {
|
|
281
|
+
$cliproxyCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
282
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
283
|
+
$_,
|
|
284
|
+
$_,
|
|
285
|
+
'ParameterValue',
|
|
286
|
+
$_
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
} elseif ($position -eq 4) {
|
|
290
|
+
switch ($words[2]) {
|
|
291
|
+
'remove' {
|
|
292
|
+
$options = (Get-CcsProfiles -Type cliproxy) + $removeFlags
|
|
293
|
+
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
294
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
295
|
+
$_,
|
|
296
|
+
$_,
|
|
297
|
+
'ParameterValue',
|
|
298
|
+
$_
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
'create' {
|
|
303
|
+
$cliproxyCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
304
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
305
|
+
$_,
|
|
306
|
+
$_,
|
|
307
|
+
'ParameterValue',
|
|
308
|
+
$_
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
} elseif ($position -eq 5) {
|
|
314
|
+
switch ($words[2]) {
|
|
315
|
+
'remove' {
|
|
316
|
+
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
317
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
318
|
+
$_,
|
|
319
|
+
$_,
|
|
320
|
+
'ParameterValue',
|
|
321
|
+
$_
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
'create' {
|
|
326
|
+
# After --provider, complete with provider names
|
|
327
|
+
if ($words[3] -eq '--provider') {
|
|
328
|
+
$providers | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
329
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
330
|
+
$_,
|
|
331
|
+
$_,
|
|
332
|
+
'ParameterValue',
|
|
333
|
+
$_
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return
|
|
174
341
|
}
|
|
175
342
|
|
|
176
|
-
# profile subcommand completion
|
|
343
|
+
# profile subcommand completion (legacy)
|
|
177
344
|
if ($words[1] -eq 'profile') {
|
|
178
345
|
if ($position -eq 3) {
|
|
179
|
-
|
|
180
|
-
$profileCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
346
|
+
@('create', 'list', 'remove', '--help', '-h') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
181
347
|
[System.Management.Automation.CompletionResult]::new(
|
|
182
348
|
$_,
|
|
183
349
|
$_,
|
|
@@ -186,7 +352,6 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
186
352
|
)
|
|
187
353
|
}
|
|
188
354
|
} elseif ($position -eq 4) {
|
|
189
|
-
# Profile names or flags for profile subcommands
|
|
190
355
|
switch ($words[2]) {
|
|
191
356
|
'remove' {
|
|
192
357
|
$options = (Get-CcsProfiles -Type settings) + $removeFlags
|
|
@@ -200,7 +365,7 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
200
365
|
}
|
|
201
366
|
}
|
|
202
367
|
'create' {
|
|
203
|
-
$
|
|
368
|
+
$apiCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
204
369
|
[System.Management.Automation.CompletionResult]::new(
|
|
205
370
|
$_,
|
|
206
371
|
$_,
|
|
@@ -211,7 +376,6 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
211
376
|
}
|
|
212
377
|
}
|
|
213
378
|
} elseif ($position -eq 5) {
|
|
214
|
-
# Flags after profile name
|
|
215
379
|
switch ($words[2]) {
|
|
216
380
|
'remove' {
|
|
217
381
|
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
@@ -225,5 +389,6 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
225
389
|
}
|
|
226
390
|
}
|
|
227
391
|
}
|
|
392
|
+
return
|
|
228
393
|
}
|
|
229
394
|
}
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
# sudo cp scripts/completion/ccs.zsh /usr/local/share/zsh/site-functions/_ccs
|
|
14
14
|
|
|
15
15
|
# Set up completion styles for better formatting and colors
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# The leading '=' means no color for whole match, then each '=' assigns to each group
|
|
19
|
-
zstyle ':completion:*:*:ccs:*:commands' list-colors '=(#b)(auth|profile|doctor|sync|update)([[:space:]]#--[[:space:]]#*)==0\;34=2\;37'
|
|
16
|
+
zstyle ':completion:*:*:ccs:*:commands' list-colors '=(#b)(auth|api|cliproxy|doctor|sync|update)([[:space:]]#--[[:space:]]#*)==0\;34=2\;37'
|
|
17
|
+
zstyle ':completion:*:*:ccs:*:proxy-profiles' list-colors '=(#b)(gemini|codex|agy|qwen)([[:space:]]#--[[:space:]]#*)==0\;35=2\;37'
|
|
20
18
|
zstyle ':completion:*:*:ccs:*:model-profiles' list-colors '=(#b)(default|glm|glmt|kimi|[^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;32=2\;37'
|
|
21
19
|
zstyle ':completion:*:*:ccs:*:account-profiles' list-colors '=(#b)([^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;33=2\;37'
|
|
22
20
|
zstyle ':completion:*:*:ccs:*' group-name ''
|
|
@@ -26,20 +24,29 @@ zstyle ':completion:*:*:ccs:*' list-rows-first true
|
|
|
26
24
|
zstyle ':completion:*:*:ccs:*' menu select
|
|
27
25
|
|
|
28
26
|
_ccs() {
|
|
29
|
-
local -a commands settings_profiles_described account_profiles_described
|
|
27
|
+
local -a commands proxy_profiles settings_profiles_described account_profiles_described cliproxy_variants_described
|
|
30
28
|
local curcontext="$curcontext" state line
|
|
31
29
|
typeset -A opt_args
|
|
32
30
|
|
|
33
|
-
# Define top-level commands
|
|
31
|
+
# Define top-level commands
|
|
34
32
|
commands=(
|
|
35
33
|
'auth:Manage multiple Claude accounts'
|
|
36
|
-
'
|
|
34
|
+
'api:Manage API profiles (create/remove)'
|
|
35
|
+
'cliproxy:Manage CLIProxy variants and binary'
|
|
37
36
|
'doctor:Run health check and diagnostics'
|
|
38
37
|
'sync:Sync delegation commands and skills'
|
|
39
38
|
'update:Update CCS to latest version'
|
|
40
39
|
)
|
|
41
40
|
|
|
42
|
-
# Define
|
|
41
|
+
# Define CLIProxy hardcoded profiles (OAuth providers)
|
|
42
|
+
proxy_profiles=(
|
|
43
|
+
'gemini:Google Gemini (OAuth)'
|
|
44
|
+
'codex:OpenAI Codex (OAuth)'
|
|
45
|
+
'agy:Antigravity (OAuth)'
|
|
46
|
+
'qwen:Qwen Code (OAuth)'
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Define known settings profiles with descriptions
|
|
43
50
|
local -A profile_descriptions
|
|
44
51
|
profile_descriptions=(
|
|
45
52
|
'default' 'Default Claude Sonnet 4.5'
|
|
@@ -53,7 +60,6 @@ _ccs() {
|
|
|
53
60
|
local -a raw_settings_profiles
|
|
54
61
|
raw_settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
|
|
55
62
|
|
|
56
|
-
# Add descriptions to settings profiles
|
|
57
63
|
for profile in $raw_settings_profiles; do
|
|
58
64
|
local desc="${profile_descriptions[$profile]:-Settings-based profile}"
|
|
59
65
|
settings_profiles_described+=("${profile}:${desc}")
|
|
@@ -65,12 +71,21 @@ _ccs() {
|
|
|
65
71
|
local -a raw_account_profiles
|
|
66
72
|
raw_account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
|
|
67
73
|
|
|
68
|
-
# Add descriptions to account profiles
|
|
69
74
|
for profile in $raw_account_profiles; do
|
|
70
75
|
account_profiles_described+=("${profile}:Account-based profile")
|
|
71
76
|
done
|
|
72
77
|
fi
|
|
73
78
|
|
|
79
|
+
# Load cliproxy variants from config.json
|
|
80
|
+
if [[ -f ~/.ccs/config.json ]]; then
|
|
81
|
+
local -a raw_cliproxy_variants
|
|
82
|
+
raw_cliproxy_variants=(${(f)"$(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null)"})
|
|
83
|
+
|
|
84
|
+
for variant in $raw_cliproxy_variants; do
|
|
85
|
+
cliproxy_variants_described+=("${variant}:CLIProxy variant")
|
|
86
|
+
done
|
|
87
|
+
fi
|
|
88
|
+
|
|
74
89
|
_arguments -C \
|
|
75
90
|
'(- *)'{-h,--help}'[Show help message]' \
|
|
76
91
|
'(- *)'{-v,--version}'[Show version information]' \
|
|
@@ -80,10 +95,11 @@ _ccs() {
|
|
|
80
95
|
|
|
81
96
|
case $state in
|
|
82
97
|
command)
|
|
83
|
-
# Describe commands and profiles with proper tagging for colors
|
|
84
98
|
_describe -t commands 'commands' commands
|
|
99
|
+
_describe -t proxy-profiles 'CLIProxy profiles' proxy_profiles
|
|
85
100
|
_describe -t model-profiles 'model profiles' settings_profiles_described
|
|
86
101
|
_describe -t account-profiles 'account profiles' account_profiles_described
|
|
102
|
+
_describe -t cliproxy-variants 'CLIProxy variants' cliproxy_variants_described
|
|
87
103
|
;;
|
|
88
104
|
|
|
89
105
|
args)
|
|
@@ -91,14 +107,32 @@ _ccs() {
|
|
|
91
107
|
auth)
|
|
92
108
|
_ccs_auth
|
|
93
109
|
;;
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
api)
|
|
111
|
+
_ccs_api
|
|
112
|
+
;;
|
|
113
|
+
cliproxy)
|
|
114
|
+
_ccs_cliproxy
|
|
115
|
+
;;
|
|
116
|
+
update)
|
|
117
|
+
_arguments \
|
|
118
|
+
'--force[Force reinstall current version]' \
|
|
119
|
+
'--beta[Install from dev channel]' \
|
|
120
|
+
'--dev[Install from dev channel]' \
|
|
121
|
+
'(- *)'{-h,--help}'[Show help]'
|
|
96
122
|
;;
|
|
97
123
|
doctor)
|
|
98
124
|
_arguments \
|
|
99
125
|
'(- *)'{-h,--help}'[Show help for doctor command]'
|
|
100
126
|
;;
|
|
101
|
-
|
|
127
|
+
gemini|codex|agy|qwen)
|
|
128
|
+
_arguments \
|
|
129
|
+
'--auth[Authenticate only]' \
|
|
130
|
+
'--config[Change model configuration]' \
|
|
131
|
+
'--logout[Clear authentication]' \
|
|
132
|
+
'--headless[Headless auth (for SSH)]' \
|
|
133
|
+
'(- *)'{-h,--help}'[Show help]'
|
|
134
|
+
;;
|
|
135
|
+
--shell-completion|-sc)
|
|
102
136
|
_arguments \
|
|
103
137
|
'--bash[Install for bash]' \
|
|
104
138
|
'--zsh[Install for zsh]' \
|
|
@@ -106,7 +140,6 @@ _ccs() {
|
|
|
106
140
|
'--powershell[Install for PowerShell]'
|
|
107
141
|
;;
|
|
108
142
|
*)
|
|
109
|
-
# For profile names, complete with Claude CLI arguments
|
|
110
143
|
_message 'Claude CLI arguments'
|
|
111
144
|
;;
|
|
112
145
|
esac
|
|
@@ -114,32 +147,30 @@ _ccs() {
|
|
|
114
147
|
esac
|
|
115
148
|
}
|
|
116
149
|
|
|
117
|
-
|
|
150
|
+
_ccs_api() {
|
|
118
151
|
local curcontext="$curcontext" state line
|
|
119
152
|
typeset -A opt_args
|
|
120
153
|
|
|
121
|
-
local -a
|
|
154
|
+
local -a api_commands settings_profiles
|
|
122
155
|
|
|
123
|
-
|
|
124
|
-
profile_commands=(
|
|
156
|
+
api_commands=(
|
|
125
157
|
'create:Create new API profile (interactive)'
|
|
126
|
-
'list:List all profiles'
|
|
127
|
-
'remove:Remove
|
|
158
|
+
'list:List all API profiles'
|
|
159
|
+
'remove:Remove an API profile'
|
|
128
160
|
)
|
|
129
161
|
|
|
130
|
-
# Load settings profiles for remove command
|
|
131
162
|
if [[ -f ~/.ccs/config.json ]]; then
|
|
132
163
|
settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
|
|
133
164
|
fi
|
|
134
165
|
|
|
135
166
|
_arguments -C \
|
|
136
|
-
'(- *)'{-h,--help}'[Show help for
|
|
167
|
+
'(- *)'{-h,--help}'[Show help for api commands]' \
|
|
137
168
|
'1: :->subcommand' \
|
|
138
169
|
'*:: :->subargs'
|
|
139
170
|
|
|
140
171
|
case $state in
|
|
141
172
|
subcommand)
|
|
142
|
-
_describe -t
|
|
173
|
+
_describe -t api-commands 'api commands' api_commands
|
|
143
174
|
;;
|
|
144
175
|
|
|
145
176
|
subargs)
|
|
@@ -154,7 +185,6 @@ _ccs_profile() {
|
|
|
154
185
|
{--yes,-y}'[Skip prompts]'
|
|
155
186
|
;;
|
|
156
187
|
list)
|
|
157
|
-
# No arguments
|
|
158
188
|
;;
|
|
159
189
|
remove|delete|rm)
|
|
160
190
|
_arguments \
|
|
@@ -166,13 +196,64 @@ _ccs_profile() {
|
|
|
166
196
|
esac
|
|
167
197
|
}
|
|
168
198
|
|
|
199
|
+
_ccs_cliproxy() {
|
|
200
|
+
local curcontext="$curcontext" state line
|
|
201
|
+
typeset -A opt_args
|
|
202
|
+
|
|
203
|
+
local -a cliproxy_commands cliproxy_variants providers
|
|
204
|
+
|
|
205
|
+
cliproxy_commands=(
|
|
206
|
+
'create:Create new CLIProxy variant profile'
|
|
207
|
+
'list:List all CLIProxy variant profiles'
|
|
208
|
+
'remove:Remove a CLIProxy variant profile'
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
providers=(gemini codex agy qwen)
|
|
212
|
+
|
|
213
|
+
if [[ -f ~/.ccs/config.json ]]; then
|
|
214
|
+
cliproxy_variants=(${(f)"$(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null)"})
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
_arguments -C \
|
|
218
|
+
'(- *)'{-h,--help}'[Show help for cliproxy commands]' \
|
|
219
|
+
'--install[Install specific version]:version:' \
|
|
220
|
+
'--latest[Install latest version]' \
|
|
221
|
+
'1: :->subcommand' \
|
|
222
|
+
'*:: :->subargs'
|
|
223
|
+
|
|
224
|
+
case $state in
|
|
225
|
+
subcommand)
|
|
226
|
+
_describe -t cliproxy-commands 'cliproxy commands' cliproxy_commands
|
|
227
|
+
;;
|
|
228
|
+
|
|
229
|
+
subargs)
|
|
230
|
+
case $words[1] in
|
|
231
|
+
create)
|
|
232
|
+
_arguments \
|
|
233
|
+
'1:variant name:' \
|
|
234
|
+
'--provider[Provider name]:provider:($providers)' \
|
|
235
|
+
'--model[Model name]:model:' \
|
|
236
|
+
'--force[Overwrite existing variant]' \
|
|
237
|
+
{--yes,-y}'[Skip prompts]'
|
|
238
|
+
;;
|
|
239
|
+
list|ls)
|
|
240
|
+
;;
|
|
241
|
+
remove|delete|rm)
|
|
242
|
+
_arguments \
|
|
243
|
+
'1:variant:($cliproxy_variants)' \
|
|
244
|
+
{--yes,-y}'[Skip confirmation]'
|
|
245
|
+
;;
|
|
246
|
+
esac
|
|
247
|
+
;;
|
|
248
|
+
esac
|
|
249
|
+
}
|
|
250
|
+
|
|
169
251
|
_ccs_auth() {
|
|
170
252
|
local curcontext="$curcontext" state line
|
|
171
253
|
typeset -A opt_args
|
|
172
254
|
|
|
173
255
|
local -a auth_commands account_profiles
|
|
174
256
|
|
|
175
|
-
# Define auth subcommands
|
|
176
257
|
auth_commands=(
|
|
177
258
|
'create:Create new profile and login'
|
|
178
259
|
'list:List all saved profiles'
|
|
@@ -181,7 +262,6 @@ _ccs_auth() {
|
|
|
181
262
|
'default:Set default profile'
|
|
182
263
|
)
|
|
183
264
|
|
|
184
|
-
# Load account profiles
|
|
185
265
|
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
186
266
|
account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
|
|
187
267
|
fi
|
|
@@ -225,5 +305,4 @@ _ccs_auth() {
|
|
|
225
305
|
esac
|
|
226
306
|
}
|
|
227
307
|
|
|
228
|
-
# Register the completion function
|
|
229
308
|
_ccs "$@"
|