@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.
- package/.claude/agents/ccs-delegator.md +117 -0
- package/.claude/commands/ccs/glm/continue.md +22 -0
- package/.claude/commands/ccs/glm.md +22 -0
- package/.claude/commands/ccs/kimi/continue.md +22 -0
- package/.claude/commands/ccs/kimi.md +22 -0
- package/.claude/skills/ccs-delegation/SKILL.md +54 -0
- package/.claude/skills/ccs-delegation/references/README.md +24 -0
- package/.claude/skills/ccs-delegation/references/delegation-guidelines.md +99 -0
- package/.claude/skills/ccs-delegation/references/headless-workflow.md +174 -0
- package/.claude/skills/ccs-delegation/references/troubleshooting.md +268 -0
- package/README.ja.md +470 -146
- package/README.md +532 -145
- package/README.vi.md +484 -157
- package/VERSION +1 -1
- package/bin/auth/auth-commands.js +98 -13
- package/bin/auth/profile-detector.js +11 -6
- package/bin/ccs.js +148 -2
- package/bin/delegation/README.md +189 -0
- package/bin/delegation/delegation-handler.js +212 -0
- package/bin/delegation/headless-executor.js +617 -0
- package/bin/delegation/result-formatter.js +483 -0
- package/bin/delegation/session-manager.js +156 -0
- package/bin/delegation/settings-parser.js +109 -0
- package/bin/management/doctor.js +94 -1
- package/bin/utils/claude-symlink-manager.js +238 -0
- package/bin/utils/delegation-validator.js +154 -0
- package/bin/utils/error-codes.js +59 -0
- package/bin/utils/error-manager.js +38 -32
- package/bin/utils/helpers.js +65 -1
- package/bin/utils/progress-indicator.js +111 -0
- package/bin/utils/prompt.js +134 -0
- package/bin/utils/shell-completion.js +234 -0
- package/lib/ccs +575 -25
- package/lib/ccs.ps1 +381 -20
- package/lib/error-codes.ps1 +55 -0
- package/lib/error-codes.sh +63 -0
- package/lib/progress-indicator.ps1 +120 -0
- package/lib/progress-indicator.sh +117 -0
- package/lib/prompt.ps1 +109 -0
- package/lib/prompt.sh +99 -0
- package/package.json +2 -1
- package/scripts/completion/README.md +308 -0
- package/scripts/completion/ccs.bash +81 -0
- package/scripts/completion/ccs.fish +92 -0
- package/scripts/completion/ccs.ps1 +157 -0
- package/scripts/completion/ccs.zsh +130 -0
- package/scripts/postinstall.js +35 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Shell Completion for CCS
|
|
2
|
+
|
|
3
|
+
Tab completion for CCS commands, subcommands, profiles, and flags.
|
|
4
|
+
|
|
5
|
+
**Supported Shells:** Bash, Zsh, Fish, PowerShell
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Complete profile names (both settings-based and account-based)
|
|
10
|
+
- Complete `ccs auth` subcommands (create, list, show, remove, default)
|
|
11
|
+
- Complete flags (`--help`, `--version`, `--json`, `--verbose`, `--yes`)
|
|
12
|
+
- Complete profile names for auth subcommands
|
|
13
|
+
- Context-aware: suggests relevant options based on current command
|
|
14
|
+
|
|
15
|
+
## Quick Install (Recommended)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ccs --shell-completion
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This will:
|
|
22
|
+
- Auto-detect your shell
|
|
23
|
+
- Copy completion files to `~/.ccs/completions/`
|
|
24
|
+
- Configure your shell profile with proper comment markers
|
|
25
|
+
- Show instructions to activate
|
|
26
|
+
|
|
27
|
+
**Manual shell selection:**
|
|
28
|
+
```bash
|
|
29
|
+
ccs --shell-completion --bash # Force bash
|
|
30
|
+
ccs --shell-completion --zsh # Force zsh
|
|
31
|
+
ccs --shell-completion --fish # Force fish
|
|
32
|
+
ccs --shell-completion --powershell # Force PowerShell
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Manual Installation
|
|
36
|
+
|
|
37
|
+
Completion files are installed to `~/.ccs/completions/` during `npm install`.
|
|
38
|
+
|
|
39
|
+
### Bash
|
|
40
|
+
|
|
41
|
+
Add to `~/.bashrc` or `~/.bash_profile`:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# CCS shell completion
|
|
45
|
+
source ~/.ccs/completions/ccs.bash
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then reload:
|
|
49
|
+
```bash
|
|
50
|
+
source ~/.bashrc
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Zsh
|
|
54
|
+
|
|
55
|
+
1. Create completion directory:
|
|
56
|
+
```zsh
|
|
57
|
+
mkdir -p ~/.zsh/completion
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
2. Copy completion file:
|
|
61
|
+
```zsh
|
|
62
|
+
cp ~/.ccs/completions/ccs.zsh ~/.zsh/completion/_ccs
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. Add to `~/.zshrc`:
|
|
66
|
+
```zsh
|
|
67
|
+
# CCS shell completion
|
|
68
|
+
fpath=(~/.zsh/completion $fpath)
|
|
69
|
+
autoload -Uz compinit && compinit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
4. Reload:
|
|
73
|
+
```zsh
|
|
74
|
+
source ~/.zshrc
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### PowerShell
|
|
78
|
+
|
|
79
|
+
Add to your PowerShell profile (`$PROFILE`):
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
# CCS shell completion
|
|
83
|
+
. "$HOME\.ccs\completions\ccs.ps1"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Then reload:
|
|
87
|
+
```powershell
|
|
88
|
+
. $PROFILE
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Fish
|
|
92
|
+
|
|
93
|
+
**User installation (recommended)**
|
|
94
|
+
|
|
95
|
+
Fish automatically loads completions from `~/.config/fish/completions/`:
|
|
96
|
+
|
|
97
|
+
```fish
|
|
98
|
+
# Create completion directory if it doesn't exist
|
|
99
|
+
mkdir -p ~/.config/fish/completions
|
|
100
|
+
|
|
101
|
+
# Copy completion script
|
|
102
|
+
cp scripts/completion/ccs.fish ~/.config/fish/completions/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
That's it! Fish will automatically load the completion on demand. No need to source or reload.
|
|
106
|
+
|
|
107
|
+
**System-wide installation (requires sudo)**
|
|
108
|
+
|
|
109
|
+
```fish
|
|
110
|
+
sudo cp scripts/completion/ccs.fish /usr/share/fish/vendor_completions.d/
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Usage Examples
|
|
114
|
+
|
|
115
|
+
### Basic Completion
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ ccs <TAB>
|
|
119
|
+
auth doctor glm glmt kimi work personal --help --version
|
|
120
|
+
|
|
121
|
+
$ ccs auth <TAB>
|
|
122
|
+
create list show remove default --help
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Profile Completion
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
$ ccs auth show <TAB>
|
|
129
|
+
work personal team --json
|
|
130
|
+
|
|
131
|
+
$ ccs auth remove <TAB>
|
|
132
|
+
work personal team --yes -y
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Flag Completion
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
$ ccs auth list <TAB>
|
|
139
|
+
--verbose --json
|
|
140
|
+
|
|
141
|
+
$ ccs auth show work <TAB>
|
|
142
|
+
--json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Completion Behavior
|
|
146
|
+
|
|
147
|
+
### Top-level (after `ccs`)
|
|
148
|
+
- Built-in commands: `auth`, `doctor`
|
|
149
|
+
- Flags: `--help`, `--version`, `-h`, `-v`
|
|
150
|
+
- Settings-based profiles: from `~/.ccs/config.json`
|
|
151
|
+
- Account-based profiles: from `~/.ccs/profiles.json`
|
|
152
|
+
|
|
153
|
+
### After `ccs auth`
|
|
154
|
+
- Subcommands: `create`, `list`, `show`, `remove`, `default`
|
|
155
|
+
- Flags: `--help`, `-h`
|
|
156
|
+
|
|
157
|
+
### After `ccs auth <subcommand>`
|
|
158
|
+
- **create**: No completion (user enters new profile name)
|
|
159
|
+
- Flags: `--force`
|
|
160
|
+
- **list**: No profile completion
|
|
161
|
+
- Flags: `--verbose`, `--json`
|
|
162
|
+
- **show**: Account profiles only
|
|
163
|
+
- Flags: `--json`
|
|
164
|
+
- **remove**: Account profiles only
|
|
165
|
+
- Flags: `--yes`, `-y`
|
|
166
|
+
- **default**: Account profiles only
|
|
167
|
+
|
|
168
|
+
### After `ccs <profile>`
|
|
169
|
+
- No completion (Claude CLI arguments are free-form)
|
|
170
|
+
|
|
171
|
+
## Troubleshooting
|
|
172
|
+
|
|
173
|
+
### Bash: Completion not working
|
|
174
|
+
|
|
175
|
+
1. Check if bash-completion is installed:
|
|
176
|
+
```bash
|
|
177
|
+
# macOS
|
|
178
|
+
brew install bash-completion
|
|
179
|
+
|
|
180
|
+
# Ubuntu/Debian
|
|
181
|
+
sudo apt install bash-completion
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
2. Verify jq is installed (required for profile completion):
|
|
185
|
+
```bash
|
|
186
|
+
command -v jq
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
3. Check if completion is loaded:
|
|
190
|
+
```bash
|
|
191
|
+
complete -p ccs
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Should output:
|
|
195
|
+
```
|
|
196
|
+
complete -F _ccs_completion ccs
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Zsh: Completion not working
|
|
200
|
+
|
|
201
|
+
1. Verify completion system is enabled in `~/.zshrc`:
|
|
202
|
+
```zsh
|
|
203
|
+
autoload -Uz compinit && compinit
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
2. Check if completion is loaded:
|
|
207
|
+
```zsh
|
|
208
|
+
which _ccs
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
3. Rebuild completion cache:
|
|
212
|
+
```zsh
|
|
213
|
+
rm ~/.zcompdump && compinit
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### PowerShell: Completion not working
|
|
217
|
+
|
|
218
|
+
1. Check PowerShell version (5.1+ required):
|
|
219
|
+
```powershell
|
|
220
|
+
$PSVersionTable.PSVersion
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
2. Verify profile is loaded:
|
|
224
|
+
```powershell
|
|
225
|
+
Test-Path $PROFILE
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
3. Check if completion is registered:
|
|
229
|
+
```powershell
|
|
230
|
+
(Get-ArgumentCompleter).CommandName | Select-String ccs
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Fish: Completion not working
|
|
234
|
+
|
|
235
|
+
1. Check Fish version (3.0+ required):
|
|
236
|
+
```fish
|
|
237
|
+
fish --version
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. Verify completion file is in the right location:
|
|
241
|
+
```fish
|
|
242
|
+
ls ~/.config/fish/completions/ccs.fish
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
3. Verify jq is installed (required for profile completion):
|
|
246
|
+
```fish
|
|
247
|
+
which jq
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
4. Test completion manually:
|
|
251
|
+
```fish
|
|
252
|
+
complete -C'ccs '
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
5. If needed, rebuild completions:
|
|
256
|
+
```fish
|
|
257
|
+
fish_update_completions
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Technical Details
|
|
261
|
+
|
|
262
|
+
### Bash Implementation
|
|
263
|
+
- Uses `complete -F` for programmable completion
|
|
264
|
+
- Compatible with bash 3.2+ (macOS default)
|
|
265
|
+
- Reads profiles dynamically using `jq`
|
|
266
|
+
- Context-aware based on `COMP_CWORD` and `COMP_WORDS`
|
|
267
|
+
|
|
268
|
+
### Zsh Implementation
|
|
269
|
+
- Uses `_arguments` and `_describe` for rich completion
|
|
270
|
+
- Compatible with zsh 5.0+
|
|
271
|
+
- Supports completion descriptions
|
|
272
|
+
- Context-aware using `$state` and `$words`
|
|
273
|
+
|
|
274
|
+
### PowerShell Implementation
|
|
275
|
+
- Uses `Register-ArgumentCompleter`
|
|
276
|
+
- Compatible with PowerShell 5.1+
|
|
277
|
+
- Reads profiles dynamically using `ConvertFrom-Json`
|
|
278
|
+
- Provides `CompletionResult` objects
|
|
279
|
+
|
|
280
|
+
### Fish Implementation
|
|
281
|
+
- Uses declarative `complete` command
|
|
282
|
+
- Compatible with Fish 3.0+
|
|
283
|
+
- Automatic loading from `~/.config/fish/completions/`
|
|
284
|
+
- Helper functions for dynamic profile loading
|
|
285
|
+
- Context-aware using `__fish_seen_subcommand_from`
|
|
286
|
+
- No manual sourcing required
|
|
287
|
+
|
|
288
|
+
## Dependencies
|
|
289
|
+
|
|
290
|
+
- **jq**: Required for reading profiles from JSON files
|
|
291
|
+
- Install: `brew install jq` (macOS) or `apt install jq` (Ubuntu)
|
|
292
|
+
- Already required by CCS core functionality
|
|
293
|
+
|
|
294
|
+
## Contributing
|
|
295
|
+
|
|
296
|
+
When adding new commands or flags:
|
|
297
|
+
1. Update all four completion scripts (bash, zsh, fish, PowerShell)
|
|
298
|
+
2. Test on each shell
|
|
299
|
+
3. Update this README with new completion examples
|
|
300
|
+
4. Maintain cross-shell parity
|
|
301
|
+
|
|
302
|
+
## See Also
|
|
303
|
+
|
|
304
|
+
- [CCS Documentation](https://github.com/kaitranntt/ccs)
|
|
305
|
+
- [Bash Programmable Completion](https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html)
|
|
306
|
+
- [Zsh Completion System](http://zsh.sourceforge.net/Doc/Release/Completion-System.html)
|
|
307
|
+
- [Fish Completion Tutorial](https://fishshell.com/docs/current/completions.html)
|
|
308
|
+
- [PowerShell Argument Completers](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/register-argumentcompleter)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Bash completion for CCS (Claude Code Switch)
|
|
2
|
+
# Compatible with bash 3.2+
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Add to ~/.bashrc or ~/.bash_profile:
|
|
6
|
+
# source /path/to/ccs/scripts/completion/ccs.bash
|
|
7
|
+
#
|
|
8
|
+
# Or install system-wide (requires sudo):
|
|
9
|
+
# sudo cp scripts/completion/ccs.bash /etc/bash_completion.d/ccs
|
|
10
|
+
|
|
11
|
+
_ccs_completion() {
|
|
12
|
+
local cur prev words cword
|
|
13
|
+
COMPREPLY=()
|
|
14
|
+
|
|
15
|
+
# Get current word and previous word
|
|
16
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
17
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
18
|
+
|
|
19
|
+
# Top-level completion (first argument)
|
|
20
|
+
if [[ ${COMP_CWORD} -eq 1 ]]; then
|
|
21
|
+
local commands="auth doctor"
|
|
22
|
+
local flags="--help --version -h -v"
|
|
23
|
+
local profiles=""
|
|
24
|
+
|
|
25
|
+
# Add profiles from config.json (settings-based profiles)
|
|
26
|
+
if [[ -f ~/.ccs/config.json ]]; then
|
|
27
|
+
profiles="$profiles $(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null || true)"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Add profiles from profiles.json (account-based profiles)
|
|
31
|
+
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
32
|
+
profiles="$profiles $(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null || true)"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Combine all options
|
|
36
|
+
local opts="$commands $flags $profiles"
|
|
37
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
38
|
+
return 0
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# auth subcommands
|
|
42
|
+
if [[ ${prev} == "auth" ]]; then
|
|
43
|
+
local auth_commands="create list show remove default --help -h"
|
|
44
|
+
COMPREPLY=( $(compgen -W "${auth_commands}" -- ${cur}) )
|
|
45
|
+
return 0
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Completion for auth subcommands that need profile names
|
|
49
|
+
if [[ ${COMP_WORDS[1]} == "auth" ]]; then
|
|
50
|
+
case "${prev}" in
|
|
51
|
+
show|remove|default)
|
|
52
|
+
# Complete with account profile names only
|
|
53
|
+
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
54
|
+
local profiles=$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null || true)
|
|
55
|
+
COMPREPLY=( $(compgen -W "${profiles}" -- ${cur}) )
|
|
56
|
+
fi
|
|
57
|
+
return 0
|
|
58
|
+
;;
|
|
59
|
+
create)
|
|
60
|
+
# No completion for create (user enters new name)
|
|
61
|
+
return 0
|
|
62
|
+
;;
|
|
63
|
+
list)
|
|
64
|
+
# Complete with list flags
|
|
65
|
+
COMPREPLY=( $(compgen -W "--verbose --json" -- ${cur}) )
|
|
66
|
+
return 0
|
|
67
|
+
;;
|
|
68
|
+
esac
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# Flags for doctor command
|
|
72
|
+
if [[ ${COMP_WORDS[1]} == "doctor" ]]; then
|
|
73
|
+
COMPREPLY=( $(compgen -W "--help -h" -- ${cur}) )
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
return 0
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Register completion function
|
|
81
|
+
complete -F _ccs_completion ccs
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Fish completion for CCS (Claude Code Switch)
|
|
2
|
+
# Compatible with fish 3.0+
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Copy to ~/.config/fish/completions/:
|
|
6
|
+
# mkdir -p ~/.config/fish/completions
|
|
7
|
+
# cp scripts/completion/ccs.fish ~/.config/fish/completions/
|
|
8
|
+
#
|
|
9
|
+
# Fish will automatically load completions from this directory.
|
|
10
|
+
# No need to source or reload - completions are loaded on demand.
|
|
11
|
+
|
|
12
|
+
# Helper function to get profiles
|
|
13
|
+
function __fish_ccs_get_profiles
|
|
14
|
+
set -l config_path ~/.ccs/config.json
|
|
15
|
+
set -l profiles_path ~/.ccs/profiles.json
|
|
16
|
+
|
|
17
|
+
# Get settings-based profiles from config.json
|
|
18
|
+
if test -f $config_path
|
|
19
|
+
jq -r '.profiles | keys[]' $config_path 2>/dev/null
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get account-based profiles from profiles.json
|
|
23
|
+
if test -f $profiles_path
|
|
24
|
+
jq -r '.profiles | keys[]' $profiles_path 2>/dev/null
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Helper function to get account profiles only
|
|
29
|
+
function __fish_ccs_get_account_profiles
|
|
30
|
+
set -l profiles_path ~/.ccs/profiles.json
|
|
31
|
+
|
|
32
|
+
if test -f $profiles_path
|
|
33
|
+
jq -r '.profiles | keys[]' $profiles_path 2>/dev/null
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Helper function to check if we're in auth context
|
|
38
|
+
function __fish_ccs_using_auth
|
|
39
|
+
__fish_seen_subcommand_from auth
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Helper function to check specific auth subcommand
|
|
43
|
+
function __fish_ccs_using_auth_subcommand
|
|
44
|
+
set -l subcommand $argv[1]
|
|
45
|
+
__fish_ccs_using_auth; and __fish_seen_subcommand_from $subcommand
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Disable file completion for ccs
|
|
49
|
+
complete -c ccs -f
|
|
50
|
+
|
|
51
|
+
# Top-level flags
|
|
52
|
+
complete -c ccs -s h -l help -d 'Show help message'
|
|
53
|
+
complete -c ccs -s v -l version -d 'Show version information'
|
|
54
|
+
|
|
55
|
+
# Top-level commands
|
|
56
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'auth' -d 'Manage multiple Claude accounts'
|
|
57
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a 'doctor' -d 'Run health check and diagnostics'
|
|
58
|
+
|
|
59
|
+
# Top-level profile completion (all profiles)
|
|
60
|
+
complete -c ccs -n 'not __fish_seen_subcommand_from auth doctor' -a '(__fish_ccs_get_profiles)' -d 'Switch to profile'
|
|
61
|
+
|
|
62
|
+
# auth subcommands
|
|
63
|
+
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'
|
|
64
|
+
complete -c ccs -n '__fish_ccs_using_auth; and not __fish_seen_subcommand_from create list show remove default' -a 'list' -d 'List all saved profiles'
|
|
65
|
+
complete -c ccs -n '__fish_ccs_using_auth; and not __fish_seen_subcommand_from create list show remove default' -a 'show' -d 'Show profile details'
|
|
66
|
+
complete -c ccs -n '__fish_ccs_using_auth; and not __fish_seen_subcommand_from create list show remove default' -a 'remove' -d 'Remove saved profile'
|
|
67
|
+
complete -c ccs -n '__fish_ccs_using_auth; and not __fish_seen_subcommand_from create list show remove default' -a 'default' -d 'Set default profile'
|
|
68
|
+
|
|
69
|
+
# auth command flags
|
|
70
|
+
complete -c ccs -n '__fish_ccs_using_auth' -s h -l help -d 'Show help for auth commands'
|
|
71
|
+
|
|
72
|
+
# auth create flags
|
|
73
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand create' -l force -d 'Allow overwriting existing profile'
|
|
74
|
+
|
|
75
|
+
# auth list flags
|
|
76
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand list' -l verbose -d 'Show additional details'
|
|
77
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand list' -l json -d 'Output in JSON format'
|
|
78
|
+
|
|
79
|
+
# auth show - profile names and flags
|
|
80
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand show' -a '(__fish_ccs_get_account_profiles)' -d 'Account profile'
|
|
81
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand show' -l json -d 'Output in JSON format'
|
|
82
|
+
|
|
83
|
+
# auth remove - profile names and flags
|
|
84
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand remove' -a '(__fish_ccs_get_account_profiles)' -d 'Account profile'
|
|
85
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand remove' -l yes -d 'Skip confirmation prompts'
|
|
86
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand remove' -s y -d 'Skip confirmation prompts'
|
|
87
|
+
|
|
88
|
+
# auth default - profile names only
|
|
89
|
+
complete -c ccs -n '__fish_ccs_using_auth_subcommand default' -a '(__fish_ccs_get_account_profiles)' -d 'Account profile'
|
|
90
|
+
|
|
91
|
+
# doctor command flags
|
|
92
|
+
complete -c ccs -n '__fish_seen_subcommand_from doctor' -s h -l help -d 'Show help for doctor command'
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# PowerShell completion for CCS (Claude Code Switch)
|
|
2
|
+
# Compatible with PowerShell 5.1+
|
|
3
|
+
#
|
|
4
|
+
# Installation:
|
|
5
|
+
# Add to your PowerShell profile ($PROFILE):
|
|
6
|
+
# . /path/to/ccs/scripts/completion/ccs.ps1
|
|
7
|
+
#
|
|
8
|
+
# Or install for current user:
|
|
9
|
+
# Copy-Item scripts/completion/ccs.ps1 ~\Documents\PowerShell\Scripts\
|
|
10
|
+
# Add to profile: . ~\Documents\PowerShell\Scripts\ccs.ps1
|
|
11
|
+
|
|
12
|
+
Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
13
|
+
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
14
|
+
|
|
15
|
+
$commands = @('auth', 'doctor', '--help', '--version', '-h', '-v')
|
|
16
|
+
$authCommands = @('create', 'list', 'show', 'remove', 'default', '--help', '-h')
|
|
17
|
+
$listFlags = @('--verbose', '--json')
|
|
18
|
+
$removeFlags = @('--yes', '-y')
|
|
19
|
+
$showFlags = @('--json')
|
|
20
|
+
|
|
21
|
+
# Get current position in command
|
|
22
|
+
$words = $commandAst.ToString() -split '\s+' | Where-Object { $_ -ne '' }
|
|
23
|
+
$position = $words.Count
|
|
24
|
+
|
|
25
|
+
# Helper function to get profiles
|
|
26
|
+
function Get-CcsProfiles {
|
|
27
|
+
param([string]$Type = 'all')
|
|
28
|
+
|
|
29
|
+
$profiles = @()
|
|
30
|
+
|
|
31
|
+
# Settings-based profiles
|
|
32
|
+
if ($Type -in @('all', 'settings')) {
|
|
33
|
+
$configPath = "$env:USERPROFILE\.ccs\config.json"
|
|
34
|
+
if (Test-Path $configPath) {
|
|
35
|
+
try {
|
|
36
|
+
$config = Get-Content $configPath -Raw | ConvertFrom-Json
|
|
37
|
+
$profiles += $config.profiles.PSObject.Properties.Name
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Account-based profiles
|
|
43
|
+
if ($Type -in @('all', 'account')) {
|
|
44
|
+
$profilesPath = "$env:USERPROFILE\.ccs\profiles.json"
|
|
45
|
+
if (Test-Path $profilesPath) {
|
|
46
|
+
try {
|
|
47
|
+
$data = Get-Content $profilesPath -Raw | ConvertFrom-Json
|
|
48
|
+
$profiles += $data.profiles.PSObject.Properties.Name
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return $profiles | Sort-Object -Unique
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Top-level completion
|
|
57
|
+
if ($position -eq 2) {
|
|
58
|
+
$allOptions = $commands + (Get-CcsProfiles)
|
|
59
|
+
$allOptions | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
60
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
61
|
+
$_,
|
|
62
|
+
$_,
|
|
63
|
+
'ParameterValue',
|
|
64
|
+
$_
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# auth subcommand completion
|
|
71
|
+
if ($words[1] -eq 'auth') {
|
|
72
|
+
if ($position -eq 3) {
|
|
73
|
+
# auth subcommands
|
|
74
|
+
$authCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
75
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
76
|
+
$_,
|
|
77
|
+
$_,
|
|
78
|
+
'ParameterValue',
|
|
79
|
+
$_
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
} elseif ($position -eq 4) {
|
|
83
|
+
# Profile names or flags for auth subcommands
|
|
84
|
+
switch ($words[2]) {
|
|
85
|
+
'show' {
|
|
86
|
+
$options = (Get-CcsProfiles -Type account) + $showFlags
|
|
87
|
+
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
88
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
89
|
+
$_,
|
|
90
|
+
$_,
|
|
91
|
+
'ParameterValue',
|
|
92
|
+
$_
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
'remove' {
|
|
97
|
+
$options = (Get-CcsProfiles -Type account) + $removeFlags
|
|
98
|
+
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
99
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
100
|
+
$_,
|
|
101
|
+
$_,
|
|
102
|
+
'ParameterValue',
|
|
103
|
+
$_
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
'default' {
|
|
108
|
+
Get-CcsProfiles -Type account | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
109
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
110
|
+
$_,
|
|
111
|
+
$_,
|
|
112
|
+
'ParameterValue',
|
|
113
|
+
$_
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
'list' {
|
|
118
|
+
$listFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
119
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
120
|
+
$_,
|
|
121
|
+
$_,
|
|
122
|
+
'ParameterValue',
|
|
123
|
+
$_
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
'create' {
|
|
128
|
+
# No completion for create (user types new name)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} elseif ($position -eq 5) {
|
|
132
|
+
# Flags after profile name
|
|
133
|
+
switch ($words[2]) {
|
|
134
|
+
'show' {
|
|
135
|
+
$showFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
136
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
137
|
+
$_,
|
|
138
|
+
$_,
|
|
139
|
+
'ParameterValue',
|
|
140
|
+
$_
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
'remove' {
|
|
145
|
+
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
146
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
147
|
+
$_,
|
|
148
|
+
$_,
|
|
149
|
+
'ParameterValue',
|
|
150
|
+
$_
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|