@kaitranntt/ccs 3.4.6 → 4.1.0

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.
Files changed (47) hide show
  1. package/.claude/agents/ccs-delegator.md +117 -0
  2. package/.claude/commands/ccs/glm/continue.md +22 -0
  3. package/.claude/commands/ccs/glm.md +22 -0
  4. package/.claude/commands/ccs/kimi/continue.md +22 -0
  5. package/.claude/commands/ccs/kimi.md +22 -0
  6. package/.claude/skills/ccs-delegation/SKILL.md +54 -0
  7. package/.claude/skills/ccs-delegation/references/README.md +24 -0
  8. package/.claude/skills/ccs-delegation/references/delegation-guidelines.md +99 -0
  9. package/.claude/skills/ccs-delegation/references/headless-workflow.md +174 -0
  10. package/.claude/skills/ccs-delegation/references/troubleshooting.md +268 -0
  11. package/README.ja.md +470 -146
  12. package/README.md +532 -145
  13. package/README.vi.md +484 -157
  14. package/VERSION +1 -1
  15. package/bin/auth/auth-commands.js +98 -13
  16. package/bin/auth/profile-detector.js +11 -6
  17. package/bin/ccs.js +148 -2
  18. package/bin/delegation/README.md +189 -0
  19. package/bin/delegation/delegation-handler.js +212 -0
  20. package/bin/delegation/headless-executor.js +617 -0
  21. package/bin/delegation/result-formatter.js +483 -0
  22. package/bin/delegation/session-manager.js +156 -0
  23. package/bin/delegation/settings-parser.js +109 -0
  24. package/bin/management/doctor.js +94 -1
  25. package/bin/utils/claude-symlink-manager.js +238 -0
  26. package/bin/utils/delegation-validator.js +154 -0
  27. package/bin/utils/error-codes.js +59 -0
  28. package/bin/utils/error-manager.js +38 -32
  29. package/bin/utils/helpers.js +65 -1
  30. package/bin/utils/progress-indicator.js +111 -0
  31. package/bin/utils/prompt.js +134 -0
  32. package/bin/utils/shell-completion.js +234 -0
  33. package/lib/ccs +575 -25
  34. package/lib/ccs.ps1 +381 -20
  35. package/lib/error-codes.ps1 +55 -0
  36. package/lib/error-codes.sh +63 -0
  37. package/lib/progress-indicator.ps1 +120 -0
  38. package/lib/progress-indicator.sh +117 -0
  39. package/lib/prompt.ps1 +109 -0
  40. package/lib/prompt.sh +99 -0
  41. package/package.json +2 -1
  42. package/scripts/completion/README.md +308 -0
  43. package/scripts/completion/ccs.bash +81 -0
  44. package/scripts/completion/ccs.fish +92 -0
  45. package/scripts/completion/ccs.ps1 +157 -0
  46. package/scripts/completion/ccs.zsh +130 -0
  47. package/scripts/postinstall.js +35 -0
@@ -0,0 +1,130 @@
1
+ #compdef ccs
2
+
3
+ # Zsh completion for CCS (Claude Code Switch)
4
+ # Compatible with zsh 5.0+
5
+ #
6
+ # Installation:
7
+ # Add to ~/.zshrc:
8
+ # fpath=(~/.zsh/completion $fpath)
9
+ # autoload -Uz compinit && compinit
10
+ # source /path/to/ccs/scripts/completion/ccs.zsh
11
+ #
12
+ # Or install system-wide:
13
+ # sudo cp scripts/completion/ccs.zsh /usr/local/share/zsh/site-functions/_ccs
14
+
15
+ _ccs() {
16
+ local -a commands profiles settings_profiles account_profiles
17
+ local curcontext="$curcontext" state line
18
+ typeset -A opt_args
19
+
20
+ # Define top-level commands
21
+ commands=(
22
+ 'auth:Manage multiple Claude accounts'
23
+ 'doctor:Run health check and diagnostics'
24
+ )
25
+
26
+ # Load settings-based profiles from config.json
27
+ if [[ -f ~/.ccs/config.json ]]; then
28
+ settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
29
+ fi
30
+
31
+ # Load account-based profiles from profiles.json
32
+ if [[ -f ~/.ccs/profiles.json ]]; then
33
+ account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
34
+ fi
35
+
36
+ # Combine all profiles
37
+ profiles=($settings_profiles $account_profiles)
38
+
39
+ _arguments -C \
40
+ '(- *)'{-h,--help}'[Show help message]' \
41
+ '(- *)'{-v,--version}'[Show version information]' \
42
+ '1: :->command' \
43
+ '*:: :->args'
44
+
45
+ case $state in
46
+ command)
47
+ local -a all_options
48
+ all_options=($commands $profiles)
49
+ _describe -t commands 'ccs commands' all_options
50
+ ;;
51
+
52
+ args)
53
+ case $words[1] in
54
+ auth)
55
+ _ccs_auth
56
+ ;;
57
+ doctor)
58
+ _arguments \
59
+ '(- *)'{-h,--help}'[Show help for doctor command]'
60
+ ;;
61
+ *)
62
+ # For profile names, complete with Claude CLI arguments
63
+ _message 'Claude CLI arguments'
64
+ ;;
65
+ esac
66
+ ;;
67
+ esac
68
+ }
69
+
70
+ _ccs_auth() {
71
+ local curcontext="$curcontext" state line
72
+ typeset -A opt_args
73
+
74
+ local -a auth_commands account_profiles
75
+
76
+ # Define auth subcommands
77
+ auth_commands=(
78
+ 'create:Create new profile and login'
79
+ 'list:List all saved profiles'
80
+ 'show:Show profile details'
81
+ 'remove:Remove saved profile'
82
+ 'default:Set default profile'
83
+ )
84
+
85
+ # Load account profiles
86
+ if [[ -f ~/.ccs/profiles.json ]]; then
87
+ account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
88
+ fi
89
+
90
+ _arguments -C \
91
+ '(- *)'{-h,--help}'[Show help for auth commands]' \
92
+ '1: :->subcommand' \
93
+ '*:: :->subargs'
94
+
95
+ case $state in
96
+ subcommand)
97
+ _describe -t auth-commands 'auth commands' auth_commands
98
+ ;;
99
+
100
+ subargs)
101
+ case $words[1] in
102
+ create)
103
+ _message 'new profile name'
104
+ _arguments '--force[Allow overwriting existing profile]'
105
+ ;;
106
+ list)
107
+ _arguments \
108
+ '--verbose[Show additional details]' \
109
+ '--json[Output in JSON format]'
110
+ ;;
111
+ show)
112
+ _arguments \
113
+ '1:profile:($account_profiles)' \
114
+ '--json[Output in JSON format]'
115
+ ;;
116
+ remove)
117
+ _arguments \
118
+ '1:profile:($account_profiles)' \
119
+ {--yes,-y}'[Skip confirmation prompts]'
120
+ ;;
121
+ default)
122
+ _arguments '1:profile:($account_profiles)'
123
+ ;;
124
+ esac
125
+ ;;
126
+ esac
127
+ }
128
+
129
+ # Register the completion function
130
+ _ccs "$@"
@@ -103,6 +103,17 @@ function createConfigFiles() {
103
103
  }
104
104
  console.log('');
105
105
 
106
+ // Install CCS items to ~/.claude/ (v4.1.0)
107
+ try {
108
+ const ClaudeSymlinkManager = require('../bin/utils/claude-symlink-manager');
109
+ const claudeSymlinkManager = new ClaudeSymlinkManager();
110
+ claudeSymlinkManager.install();
111
+ } catch (err) {
112
+ console.warn('[!] CCS item installation warning:', err.message);
113
+ console.warn(' Run "ccs update" to retry');
114
+ }
115
+ console.log('');
116
+
106
117
  // Create config.json if missing
107
118
  const configPath = path.join(ccsDir, 'config.json');
108
119
  if (!fs.existsSync(configPath)) {
@@ -287,6 +298,30 @@ function createConfigFiles() {
287
298
  console.log('[OK] Kimi profile exists: ~/.ccs/kimi.settings.json (preserved)');
288
299
  }
289
300
 
301
+ // Copy shell completion files to ~/.ccs/completions/
302
+ const completionsDir = path.join(ccsDir, 'completions');
303
+ const scriptsCompletionDir = path.join(__dirname, '../scripts/completion');
304
+
305
+ if (!fs.existsSync(completionsDir)) {
306
+ fs.mkdirSync(completionsDir, { recursive: true, mode: 0o755 });
307
+ }
308
+
309
+ const completionFiles = ['ccs.bash', 'ccs.zsh', 'ccs.fish', 'ccs.ps1'];
310
+ completionFiles.forEach(file => {
311
+ const src = path.join(scriptsCompletionDir, file);
312
+ const dest = path.join(completionsDir, file);
313
+
314
+ if (fs.existsSync(src)) {
315
+ fs.copyFileSync(src, dest);
316
+ }
317
+ });
318
+
319
+ console.log('[OK] Installed shell completions: ~/.ccs/completions/');
320
+ console.log('');
321
+ console.log(' [i] Enable auto-completion:');
322
+ console.log(' Run: ccs --shell-completion');
323
+ console.log('');
324
+
290
325
  // Create ~/.claude/settings.json if missing (NEW)
291
326
  const claudeDir = path.join(homedir, '.claude');
292
327
  const claudeSettingsPath = path.join(claudeDir, 'settings.json');