@kaitranntt/ccs 4.1.2 → 4.1.4
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/VERSION +1 -1
- package/bin/ccs.js +9 -18
- package/bin/management/doctor.js +5 -10
- package/bin/utils/shell-completion.js +34 -12
- package/lib/ccs +9 -18
- package/lib/ccs.ps1 +11 -15
- package/package.json +1 -1
- package/scripts/completion/ccs.bash +7 -1
- package/scripts/completion/ccs.fish +46 -11
- package/scripts/completion/ccs.ps1 +17 -1
- package/scripts/completion/ccs.zsh +51 -10
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.1.
|
|
1
|
+
4.1.4
|
package/bin/ccs.js
CHANGED
|
@@ -126,9 +126,9 @@ function handleHelpCommand() {
|
|
|
126
126
|
|
|
127
127
|
// Description
|
|
128
128
|
console.log(colored('Description:', 'cyan'));
|
|
129
|
-
console.log(' Switch between multiple Claude accounts
|
|
130
|
-
console.log('
|
|
131
|
-
console.log(' auto-recovery. Zero downtime.');
|
|
129
|
+
console.log(' Switch between multiple Claude accounts and alternative models');
|
|
130
|
+
console.log(' (GLM, Kimi) instantly. Run different Claude CLI sessions concurrently');
|
|
131
|
+
console.log(' with auto-recovery. Zero downtime.');
|
|
132
132
|
console.log('');
|
|
133
133
|
|
|
134
134
|
// Model Switching
|
|
@@ -144,17 +144,13 @@ function handleHelpCommand() {
|
|
|
144
144
|
// Account Management
|
|
145
145
|
console.log(colored('Account Management:', 'cyan'));
|
|
146
146
|
console.log(` ${colored('ccs auth --help', 'yellow')} Manage multiple Claude accounts`);
|
|
147
|
-
console.log(` ${colored('ccs work', 'yellow')} Switch to work account`);
|
|
148
|
-
console.log(` ${colored('ccs personal', 'yellow')} Switch to personal account`);
|
|
149
147
|
console.log('');
|
|
150
148
|
|
|
151
|
-
// Delegation (
|
|
152
|
-
console.log(colored('Delegation (
|
|
153
|
-
console.log(` ${colored('/ccs:glm "task"', 'yellow')} Delegate to GLM-4.6
|
|
149
|
+
// Delegation (inside Claude Code CLI)
|
|
150
|
+
console.log(colored('Delegation (inside Claude Code CLI):', 'cyan'));
|
|
151
|
+
console.log(` ${colored('/ccs:glm "task"', 'yellow')} Delegate to GLM-4.6 for simple tasks`);
|
|
154
152
|
console.log(` ${colored('/ccs:kimi "task"', 'yellow')} Delegate to Kimi for long context`);
|
|
155
|
-
console.log(
|
|
156
|
-
console.log(' Use delegation to save tokens on simple tasks');
|
|
157
|
-
console.log(' Commands work inside Claude Code sessions only');
|
|
153
|
+
console.log(' Save tokens by delegating simple tasks to cost-optimized models');
|
|
158
154
|
console.log('');
|
|
159
155
|
|
|
160
156
|
// Diagnostics
|
|
@@ -189,13 +185,8 @@ function handleHelpCommand() {
|
|
|
189
185
|
|
|
190
186
|
// Examples
|
|
191
187
|
console.log(colored('Examples:', 'cyan'));
|
|
192
|
-
console.log('
|
|
193
|
-
console.log(`
|
|
194
|
-
console.log(` ${colored('$ ccs glm "implement API"', 'yellow')} # Cost-optimized model`);
|
|
195
|
-
console.log('');
|
|
196
|
-
console.log(' Multi-account workflow:');
|
|
197
|
-
console.log(` ${colored('$ ccs auth create work', 'yellow')} # Create work profile`);
|
|
198
|
-
console.log(` ${colored('$ ccs work "review PR"', 'yellow')} # Use work account`);
|
|
188
|
+
console.log(` ${colored('$ ccs', 'yellow')} # Use default account`);
|
|
189
|
+
console.log(` ${colored('$ ccs glm "implement API"', 'yellow')} # Cost-optimized model`);
|
|
199
190
|
console.log('');
|
|
200
191
|
console.log(` For more: ${colored('https://github.com/kaitranntt/ccs#usage', 'cyan')}`);
|
|
201
192
|
console.log('');
|
package/bin/management/doctor.js
CHANGED
|
@@ -276,17 +276,12 @@ class Doctor {
|
|
|
276
276
|
checkDelegation() {
|
|
277
277
|
process.stdout.write('[?] Checking delegation... ');
|
|
278
278
|
|
|
279
|
-
// Check if delegation
|
|
280
|
-
const
|
|
281
|
-
const
|
|
279
|
+
// Check if delegation commands exist in ~/.ccs/.claude/commands/ccs/
|
|
280
|
+
const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands', 'ccs');
|
|
281
|
+
const hasGlmCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'glm.md'));
|
|
282
|
+
const hasKimiCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'kimi.md'));
|
|
282
283
|
|
|
283
|
-
|
|
284
|
-
const sharedCommandsDir = path.join(this.ccsDir, 'shared', 'commands', 'ccs');
|
|
285
|
-
const hasGlmCommand = fs.existsSync(path.join(sharedCommandsDir, 'glm.md'));
|
|
286
|
-
const hasKimiCommand = fs.existsSync(path.join(sharedCommandsDir, 'kimi.md'));
|
|
287
|
-
const hasCreateCommand = fs.existsSync(path.join(sharedCommandsDir, 'create.md'));
|
|
288
|
-
|
|
289
|
-
if (!hasGlmCommand || !hasKimiCommand || !hasCreateCommand) {
|
|
284
|
+
if (!hasGlmCommand || !hasKimiCommand) {
|
|
290
285
|
console.log(colored('[!]', 'yellow'), '(not installed)');
|
|
291
286
|
this.results.addCheck(
|
|
292
287
|
'Delegation',
|
|
@@ -52,6 +52,34 @@ class ShellCompletionInstaller {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Safely create directory, checking for file conflicts
|
|
57
|
+
* @param {string} dirPath - Path to create
|
|
58
|
+
* @throws {Error} If path exists but is a file
|
|
59
|
+
*/
|
|
60
|
+
ensureDirectory(dirPath) {
|
|
61
|
+
if (fs.existsSync(dirPath)) {
|
|
62
|
+
const stat = fs.statSync(dirPath);
|
|
63
|
+
if (!stat.isDirectory()) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`Cannot create directory: ${dirPath} exists but is a file.\n` +
|
|
66
|
+
`Please remove or rename this file and try again.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
// Directory exists, nothing to do
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Check parent directories recursively
|
|
74
|
+
const parentDir = path.dirname(dirPath);
|
|
75
|
+
if (parentDir !== dirPath) {
|
|
76
|
+
this.ensureDirectory(parentDir);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Create the directory
|
|
80
|
+
fs.mkdirSync(dirPath);
|
|
81
|
+
}
|
|
82
|
+
|
|
55
83
|
/**
|
|
56
84
|
* Install bash completion
|
|
57
85
|
*/
|
|
@@ -97,10 +125,8 @@ class ShellCompletionInstaller {
|
|
|
97
125
|
throw new Error('Completion file not found. Please reinstall CCS.');
|
|
98
126
|
}
|
|
99
127
|
|
|
100
|
-
// Create zsh completion directory
|
|
101
|
-
|
|
102
|
-
fs.mkdirSync(zshCompDir, { recursive: true });
|
|
103
|
-
}
|
|
128
|
+
// Create zsh completion directory (with file conflict checking)
|
|
129
|
+
this.ensureDirectory(zshCompDir);
|
|
104
130
|
|
|
105
131
|
// Copy to zsh completion directory
|
|
106
132
|
const destFile = path.join(zshCompDir, '_ccs');
|
|
@@ -142,10 +168,8 @@ class ShellCompletionInstaller {
|
|
|
142
168
|
throw new Error('Completion file not found. Please reinstall CCS.');
|
|
143
169
|
}
|
|
144
170
|
|
|
145
|
-
// Create fish completion directory
|
|
146
|
-
|
|
147
|
-
fs.mkdirSync(fishCompDir, { recursive: true });
|
|
148
|
-
}
|
|
171
|
+
// Create fish completion directory (with file conflict checking)
|
|
172
|
+
this.ensureDirectory(fishCompDir);
|
|
149
173
|
|
|
150
174
|
// Copy to fish completion directory (fish auto-loads from here)
|
|
151
175
|
const destFile = path.join(fishCompDir, 'ccs.fish');
|
|
@@ -178,11 +202,9 @@ class ShellCompletionInstaller {
|
|
|
178
202
|
const sourceCmd = `. "${completionPath.replace(/\\/g, '\\\\')}"`;
|
|
179
203
|
const block = `\n${marker}\n${sourceCmd}\n`;
|
|
180
204
|
|
|
181
|
-
// Create profile directory if needed
|
|
205
|
+
// Create profile directory if needed (with file conflict checking)
|
|
182
206
|
const profileDir = path.dirname(profilePath);
|
|
183
|
-
|
|
184
|
-
fs.mkdirSync(profileDir, { recursive: true });
|
|
185
|
-
}
|
|
207
|
+
this.ensureDirectory(profileDir);
|
|
186
208
|
|
|
187
209
|
// Check if already installed
|
|
188
210
|
if (fs.existsSync(profilePath)) {
|
package/lib/ccs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# Version (updated by scripts/bump-version.sh)
|
|
5
|
-
CCS_VERSION="4.1.
|
|
5
|
+
CCS_VERSION="4.1.4"
|
|
6
6
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
7
|
readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
|
|
8
8
|
readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
|
|
@@ -171,9 +171,9 @@ show_help() {
|
|
|
171
171
|
echo -e " ${YELLOW}ccs${RESET} [flags]"
|
|
172
172
|
echo ""
|
|
173
173
|
echo -e "${CYAN}Description:${RESET}"
|
|
174
|
-
echo -e " Switch between multiple Claude accounts
|
|
175
|
-
echo -e "
|
|
176
|
-
echo -e " auto-recovery. Zero downtime."
|
|
174
|
+
echo -e " Switch between multiple Claude accounts and alternative models"
|
|
175
|
+
echo -e " (GLM, Kimi) instantly. Run different Claude CLI sessions concurrently"
|
|
176
|
+
echo -e " with auto-recovery. Zero downtime."
|
|
177
177
|
echo ""
|
|
178
178
|
echo -e "${CYAN}Model Switching:${RESET}"
|
|
179
179
|
echo -e " ${YELLOW}ccs${RESET} Use default Claude account"
|
|
@@ -184,15 +184,11 @@ show_help() {
|
|
|
184
184
|
echo ""
|
|
185
185
|
echo -e "${CYAN}Account Management:${RESET}"
|
|
186
186
|
echo -e " ${YELLOW}ccs auth --help${RESET} Manage multiple Claude accounts"
|
|
187
|
-
echo -e " ${YELLOW}ccs work${RESET} Switch to work account"
|
|
188
|
-
echo -e " ${YELLOW}ccs personal${RESET} Switch to personal account"
|
|
189
187
|
echo ""
|
|
190
|
-
echo -e "${CYAN}Delegation (
|
|
191
|
-
echo -e " ${YELLOW}/ccs:glm \"task\"${RESET} Delegate to GLM-4.6
|
|
188
|
+
echo -e "${CYAN}Delegation (inside Claude Code CLI):${RESET}"
|
|
189
|
+
echo -e " ${YELLOW}/ccs:glm \"task\"${RESET} Delegate to GLM-4.6 for simple tasks"
|
|
192
190
|
echo -e " ${YELLOW}/ccs:kimi \"task\"${RESET} Delegate to Kimi for long context"
|
|
193
|
-
echo -e "
|
|
194
|
-
echo -e " Use delegation to save tokens on simple tasks"
|
|
195
|
-
echo -e " Commands work inside Claude Code sessions only"
|
|
191
|
+
echo -e " Save tokens by delegating simple tasks to cost-optimized models"
|
|
196
192
|
echo ""
|
|
197
193
|
echo -e "${CYAN}Diagnostics:${RESET}"
|
|
198
194
|
echo -e " ${YELLOW}ccs doctor${RESET} Run health check and diagnostics"
|
|
@@ -214,13 +210,8 @@ show_help() {
|
|
|
214
210
|
echo -e " Note: Commands, skills, and agents are symlinked across all profiles"
|
|
215
211
|
echo ""
|
|
216
212
|
echo -e "${CYAN}Examples:${RESET}"
|
|
217
|
-
echo -e "
|
|
218
|
-
echo -e "
|
|
219
|
-
echo -e " ${YELLOW}\$ ccs glm \"implement API\"${RESET} # Cost-optimized model"
|
|
220
|
-
echo ""
|
|
221
|
-
echo -e " Multi-account workflow:"
|
|
222
|
-
echo -e " ${YELLOW}\$ ccs auth create work${RESET} # Create work profile"
|
|
223
|
-
echo -e " ${YELLOW}\$ ccs work \"review PR\"${RESET} # Use work account"
|
|
213
|
+
echo -e " ${YELLOW}\$ ccs${RESET} # Use default account"
|
|
214
|
+
echo -e " ${YELLOW}\$ ccs glm \"implement API\"${RESET} # Cost-optimized model"
|
|
224
215
|
echo ""
|
|
225
216
|
echo -e " For more: ${CYAN}https://github.com/kaitranntt/ccs#usage${RESET}"
|
|
226
217
|
echo ""
|
package/lib/ccs.ps1
CHANGED
|
@@ -12,7 +12,7 @@ param(
|
|
|
12
12
|
$ErrorActionPreference = "Stop"
|
|
13
13
|
|
|
14
14
|
# Version (updated by scripts/bump-version.sh)
|
|
15
|
-
$CcsVersion = "4.1.
|
|
15
|
+
$CcsVersion = "4.1.4"
|
|
16
16
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
17
17
|
$ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
|
|
18
18
|
$ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
|
|
@@ -218,9 +218,9 @@ function Show-Help {
|
|
|
218
218
|
Write-ColorLine " ccs [flags]" "Yellow"
|
|
219
219
|
Write-Host ""
|
|
220
220
|
Write-ColorLine "Description:" "Cyan"
|
|
221
|
-
Write-Host " Switch between multiple Claude accounts
|
|
222
|
-
Write-Host "
|
|
223
|
-
Write-Host " auto-recovery. Zero downtime."
|
|
221
|
+
Write-Host " Switch between multiple Claude accounts and alternative models"
|
|
222
|
+
Write-Host " (GLM, Kimi) instantly. Run different Claude CLI sessions concurrently"
|
|
223
|
+
Write-Host " with auto-recovery. Zero downtime."
|
|
224
224
|
Write-Host ""
|
|
225
225
|
Write-ColorLine "Model Switching:" "Cyan"
|
|
226
226
|
Write-ColorLine " ccs Use default Claude account" "Yellow"
|
|
@@ -230,22 +230,18 @@ function Show-Help {
|
|
|
230
230
|
Write-ColorLine " ccs glm 'debug this code' Use GLM and run command" "Yellow"
|
|
231
231
|
Write-Host ""
|
|
232
232
|
Write-ColorLine "Examples:" "Cyan"
|
|
233
|
-
Write-
|
|
234
|
-
Write-ColorLine " `$ ccs" "Yellow" -NoNewline
|
|
233
|
+
Write-ColorLine " `$ ccs" "Yellow" -NoNewline
|
|
235
234
|
Write-Host " # Use default account"
|
|
236
|
-
Write-ColorLine "
|
|
235
|
+
Write-ColorLine " `$ ccs glm `"implement API`"" "Yellow" -NoNewline
|
|
237
236
|
Write-Host " # Cost-optimized model"
|
|
238
237
|
Write-Host ""
|
|
239
|
-
Write-Host " Profile usage:"
|
|
240
|
-
Write-ColorLine " `$ ccs work `"debug code`"" "Yellow" -NoNewline
|
|
241
|
-
Write-Host " # Switch to work profile"
|
|
242
|
-
Write-ColorLine " `$ ccs personal" "Yellow" -NoNewline
|
|
243
|
-
Write-Host " # Open personal account"
|
|
244
|
-
Write-Host ""
|
|
245
238
|
Write-ColorLine "Account Management:" "Cyan"
|
|
246
239
|
Write-ColorLine " ccs auth --help Manage multiple Claude accounts" "Yellow"
|
|
247
|
-
Write-
|
|
248
|
-
Write-ColorLine "
|
|
240
|
+
Write-Host ""
|
|
241
|
+
Write-ColorLine "Delegation (inside Claude Code CLI):" "Cyan"
|
|
242
|
+
Write-ColorLine " /ccs:glm `"task`" Delegate to GLM-4.6 for simple tasks" "Yellow"
|
|
243
|
+
Write-ColorLine " /ccs:kimi `"task`" Delegate to Kimi for long context" "Yellow"
|
|
244
|
+
Write-Host " Save tokens by delegating simple tasks to cost-optimized models"
|
|
249
245
|
Write-Host ""
|
|
250
246
|
Write-ColorLine "Diagnostics:" "Cyan"
|
|
251
247
|
Write-ColorLine " ccs doctor Run health check and diagnostics" "Yellow"
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ _ccs_completion() {
|
|
|
19
19
|
# Top-level completion (first argument)
|
|
20
20
|
if [[ ${COMP_CWORD} -eq 1 ]]; then
|
|
21
21
|
local commands="auth doctor"
|
|
22
|
-
local flags="--help --version -h -v"
|
|
22
|
+
local flags="--help --version --shell-completion -h -v"
|
|
23
23
|
local profiles=""
|
|
24
24
|
|
|
25
25
|
# Add profiles from config.json (settings-based profiles)
|
|
@@ -74,6 +74,12 @@ _ccs_completion() {
|
|
|
74
74
|
return 0
|
|
75
75
|
fi
|
|
76
76
|
|
|
77
|
+
# Flags for shell-completion command
|
|
78
|
+
if [[ ${prev} == "--shell-completion" ]]; then
|
|
79
|
+
COMPREPLY=( $(compgen -W "--bash --zsh --fish --powershell" -- ${cur}) )
|
|
80
|
+
return 0
|
|
81
|
+
fi
|
|
82
|
+
|
|
77
83
|
return 0
|
|
78
84
|
}
|
|
79
85
|
|
|
@@ -9,22 +9,41 @@
|
|
|
9
9
|
# Fish will automatically load completions from this directory.
|
|
10
10
|
# No need to source or reload - completions are loaded on demand.
|
|
11
11
|
|
|
12
|
-
# Helper function to get profiles
|
|
13
|
-
function
|
|
12
|
+
# Helper function to get settings profiles
|
|
13
|
+
function __fish_ccs_get_settings_profiles
|
|
14
14
|
set -l config_path ~/.ccs/config.json
|
|
15
|
-
set -l profiles_path ~/.ccs/profiles.json
|
|
16
15
|
|
|
17
16
|
# Get settings-based profiles from config.json
|
|
18
17
|
if test -f $config_path
|
|
19
18
|
jq -r '.profiles | keys[]' $config_path 2>/dev/null
|
|
20
19
|
end
|
|
20
|
+
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
# Helper function to get custom/unknown settings profiles
|
|
23
|
+
# (profiles not in the hardcoded known list)
|
|
24
|
+
function __fish_ccs_get_custom_settings_profiles
|
|
25
|
+
set -l config_path ~/.ccs/config.json
|
|
26
|
+
set -l known_profiles default glm glmt kimi
|
|
27
|
+
|
|
28
|
+
# Get all settings profiles
|
|
29
|
+
if test -f $config_path
|
|
30
|
+
set -l all_profiles (jq -r '.profiles | keys[]' $config_path 2>/dev/null)
|
|
31
|
+
|
|
32
|
+
# Filter out known profiles
|
|
33
|
+
for profile in $all_profiles
|
|
34
|
+
if not contains $profile $known_profiles
|
|
35
|
+
echo $profile
|
|
36
|
+
end
|
|
37
|
+
end
|
|
25
38
|
end
|
|
26
39
|
end
|
|
27
40
|
|
|
41
|
+
# Helper function to get profiles with all types
|
|
42
|
+
function __fish_ccs_get_profiles
|
|
43
|
+
__fish_ccs_get_settings_profiles
|
|
44
|
+
__fish_ccs_get_account_profiles
|
|
45
|
+
end
|
|
46
|
+
|
|
28
47
|
# Helper function to get account profiles only
|
|
29
48
|
function __fish_ccs_get_account_profiles
|
|
30
49
|
set -l profiles_path ~/.ccs/profiles.json
|
|
@@ -51,13 +70,29 @@ complete -c ccs -f
|
|
|
51
70
|
# Top-level flags
|
|
52
71
|
complete -c ccs -s h -l help -d 'Show help message'
|
|
53
72
|
complete -c ccs -s v -l version -d 'Show version information'
|
|
73
|
+
complete -c ccs -l shell-completion -d 'Install shell completion'
|
|
74
|
+
|
|
75
|
+
# Top-level commands (blue color for commands)
|
|
76
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'auth' -d (set_color blue)'Manage multiple Claude accounts'(set_color normal)
|
|
77
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'doctor' -d (set_color blue)'Run health check and diagnostics'(set_color normal)
|
|
78
|
+
|
|
79
|
+
# Top-level known settings profiles (green color for model profiles)
|
|
80
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'default' -d (set_color green)'Default Claude Sonnet 4.5'(set_color normal)
|
|
81
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'glm' -d (set_color green)'GLM-4.6 (cost-optimized)'(set_color normal)
|
|
82
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'glmt' -d (set_color green)'GLM-4.6 with thinking mode'(set_color normal)
|
|
83
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'kimi' -d (set_color green)'Kimi for Coding (long-context)'(set_color normal)
|
|
84
|
+
|
|
85
|
+
# Top-level custom settings profiles (dynamic, with generic description in green)
|
|
86
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a '(__fish_ccs_get_custom_settings_profiles)' -d (set_color green)'Settings-based profile'(set_color normal)
|
|
54
87
|
|
|
55
|
-
# Top-level
|
|
56
|
-
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a '
|
|
57
|
-
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'doctor' -d 'Run health check and diagnostics'
|
|
88
|
+
# Top-level account profiles (dynamic, yellow color for account profiles)
|
|
89
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a '(__fish_ccs_get_account_profiles)' -d (set_color yellow)'Account profile'(set_color normal)
|
|
58
90
|
|
|
59
|
-
#
|
|
60
|
-
complete -c ccs -n '
|
|
91
|
+
# shell-completion subflags
|
|
92
|
+
complete -c ccs -n '__fish_seen_argument -l shell-completion' -l bash -d 'Install for bash'
|
|
93
|
+
complete -c ccs -n '__fish_seen_argument -l shell-completion' -l zsh -d 'Install for zsh'
|
|
94
|
+
complete -c ccs -n '__fish_seen_argument -l shell-completion' -l fish -d 'Install for fish'
|
|
95
|
+
complete -c ccs -n '__fish_seen_argument -l shell-completion' -l powershell -d 'Install for PowerShell'
|
|
61
96
|
|
|
62
97
|
# auth subcommands
|
|
63
98
|
complete -c ccs -n '__fish_ccs_using_auth; and not __fish_seen_subcommand_from create list show remove default' -a 'create' -d 'Create new profile and login'
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
13
13
|
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
14
14
|
|
|
15
|
-
$commands = @('auth', 'doctor', '--help', '--version', '-h', '-v')
|
|
15
|
+
$commands = @('auth', 'doctor', '--help', '--version', '--shell-completion', '-h', '-v')
|
|
16
16
|
$authCommands = @('create', 'list', 'show', 'remove', 'default', '--help', '-h')
|
|
17
|
+
$shellCompletionFlags = @('--bash', '--zsh', '--fish', '--powershell')
|
|
17
18
|
$listFlags = @('--verbose', '--json')
|
|
18
19
|
$removeFlags = @('--yes', '-y')
|
|
19
20
|
$showFlags = @('--json')
|
|
@@ -67,6 +68,21 @@ Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
|
67
68
|
return
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
# shell-completion flag completion
|
|
72
|
+
if ($words[1] -eq '--shell-completion') {
|
|
73
|
+
if ($position -eq 3) {
|
|
74
|
+
$shellCompletionFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
75
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
76
|
+
$_,
|
|
77
|
+
$_,
|
|
78
|
+
'ParameterValue',
|
|
79
|
+
$_
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
70
86
|
# auth subcommand completion
|
|
71
87
|
if ($words[1] -eq 'auth') {
|
|
72
88
|
if ($position -eq 3) {
|
|
@@ -12,41 +12,75 @@
|
|
|
12
12
|
# Or install system-wide:
|
|
13
13
|
# sudo cp scripts/completion/ccs.zsh /usr/local/share/zsh/site-functions/_ccs
|
|
14
14
|
|
|
15
|
+
# Set up completion styles for better formatting and colors
|
|
16
|
+
# Color codes: 0;34=blue, 0;32=green, 0;33=yellow, 2;37=dim white
|
|
17
|
+
# Pattern format: =(#b)(group1)(group2)==color_for_group1=color_for_group2
|
|
18
|
+
# The leading '=' means no color for whole match, then each '=' assigns to each group
|
|
19
|
+
zstyle ':completion:*:*:ccs:*:commands' list-colors '=(#b)(auth|doctor)([[:space:]]#--[[:space:]]#*)==0\;34=2\;37'
|
|
20
|
+
zstyle ':completion:*:*:ccs:*:model-profiles' list-colors '=(#b)(default|glm|glmt|kimi|[^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;32=2\;37'
|
|
21
|
+
zstyle ':completion:*:*:ccs:*:account-profiles' list-colors '=(#b)([^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;33=2\;37'
|
|
22
|
+
zstyle ':completion:*:*:ccs:*' group-name ''
|
|
23
|
+
zstyle ':completion:*:*:ccs:*:descriptions' format $'\n%B%F{yellow}── %d ──%f%b'
|
|
24
|
+
zstyle ':completion:*:*:ccs:*' list-separator ' -- '
|
|
25
|
+
zstyle ':completion:*:*:ccs:*' list-rows-first true
|
|
26
|
+
zstyle ':completion:*:*:ccs:*' menu select
|
|
27
|
+
|
|
15
28
|
_ccs() {
|
|
16
|
-
local -a commands
|
|
29
|
+
local -a commands settings_profiles_described account_profiles_described
|
|
17
30
|
local curcontext="$curcontext" state line
|
|
18
31
|
typeset -A opt_args
|
|
19
32
|
|
|
20
|
-
# Define top-level commands
|
|
33
|
+
# Define top-level commands (padded for alignment)
|
|
21
34
|
commands=(
|
|
22
35
|
'auth:Manage multiple Claude accounts'
|
|
23
36
|
'doctor:Run health check and diagnostics'
|
|
24
37
|
)
|
|
25
38
|
|
|
39
|
+
# Define known settings profiles with descriptions (consistent padding)
|
|
40
|
+
local -A profile_descriptions
|
|
41
|
+
profile_descriptions=(
|
|
42
|
+
'default' 'Default Claude Sonnet 4.5'
|
|
43
|
+
'glm' 'GLM-4.6 (cost-optimized)'
|
|
44
|
+
'glmt' 'GLM-4.6 with thinking mode'
|
|
45
|
+
'kimi' 'Kimi for Coding (long-context)'
|
|
46
|
+
)
|
|
47
|
+
|
|
26
48
|
# Load settings-based profiles from config.json
|
|
27
49
|
if [[ -f ~/.ccs/config.json ]]; then
|
|
28
|
-
|
|
50
|
+
local -a raw_settings_profiles
|
|
51
|
+
raw_settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
|
|
52
|
+
|
|
53
|
+
# Add descriptions to settings profiles
|
|
54
|
+
for profile in $raw_settings_profiles; do
|
|
55
|
+
local desc="${profile_descriptions[$profile]:-Settings-based profile}"
|
|
56
|
+
settings_profiles_described+=("${profile}:${desc}")
|
|
57
|
+
done
|
|
29
58
|
fi
|
|
30
59
|
|
|
31
60
|
# Load account-based profiles from profiles.json
|
|
32
61
|
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
33
|
-
|
|
34
|
-
|
|
62
|
+
local -a raw_account_profiles
|
|
63
|
+
raw_account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
|
|
35
64
|
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
# Add descriptions to account profiles
|
|
66
|
+
for profile in $raw_account_profiles; do
|
|
67
|
+
account_profiles_described+=("${profile}:Account-based profile")
|
|
68
|
+
done
|
|
69
|
+
fi
|
|
38
70
|
|
|
39
71
|
_arguments -C \
|
|
40
72
|
'(- *)'{-h,--help}'[Show help message]' \
|
|
41
73
|
'(- *)'{-v,--version}'[Show version information]' \
|
|
74
|
+
'(- *)--shell-completion[Install shell completion]' \
|
|
42
75
|
'1: :->command' \
|
|
43
76
|
'*:: :->args'
|
|
44
77
|
|
|
45
78
|
case $state in
|
|
46
79
|
command)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_describe -t
|
|
80
|
+
# Describe commands and profiles with proper tagging for colors
|
|
81
|
+
_describe -t commands 'commands' commands
|
|
82
|
+
_describe -t model-profiles 'model profiles' settings_profiles_described
|
|
83
|
+
_describe -t account-profiles 'account profiles' account_profiles_described
|
|
50
84
|
;;
|
|
51
85
|
|
|
52
86
|
args)
|
|
@@ -58,6 +92,13 @@ _ccs() {
|
|
|
58
92
|
_arguments \
|
|
59
93
|
'(- *)'{-h,--help}'[Show help for doctor command]'
|
|
60
94
|
;;
|
|
95
|
+
--shell-completion)
|
|
96
|
+
_arguments \
|
|
97
|
+
'--bash[Install for bash]' \
|
|
98
|
+
'--zsh[Install for zsh]' \
|
|
99
|
+
'--fish[Install for fish]' \
|
|
100
|
+
'--powershell[Install for PowerShell]'
|
|
101
|
+
;;
|
|
61
102
|
*)
|
|
62
103
|
# For profile names, complete with Claude CLI arguments
|
|
63
104
|
_message 'Claude CLI arguments'
|