@kaitranntt/ccs 7.65.3-dev.1 → 7.65.3-dev.11
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 +88 -783
- package/dist/auth/auth-commands.d.ts +1 -0
- package/dist/auth/auth-commands.d.ts.map +1 -1
- package/dist/auth/auth-commands.js +11 -0
- package/dist/auth/auth-commands.js.map +1 -1
- package/dist/auth/commands/backup-command.d.ts +3 -0
- package/dist/auth/commands/backup-command.d.ts.map +1 -0
- package/dist/auth/commands/backup-command.js +126 -0
- package/dist/auth/commands/backup-command.js.map +1 -0
- package/dist/auth/commands/index.d.ts +1 -0
- package/dist/auth/commands/index.d.ts.map +1 -1
- package/dist/auth/commands/index.js +3 -1
- package/dist/auth/commands/index.js.map +1 -1
- package/dist/auth/profile-continuity-inheritance.d.ts +1 -0
- package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
- package/dist/auth/profile-continuity-inheritance.js +10 -6
- package/dist/auth/profile-continuity-inheritance.js.map +1 -1
- package/dist/auth/profile-detector.d.ts +9 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +35 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/resume-lane-diagnostics.d.ts +21 -0
- package/dist/auth/resume-lane-diagnostics.d.ts.map +1 -0
- package/dist/auth/resume-lane-diagnostics.js +146 -0
- package/dist/auth/resume-lane-diagnostics.js.map +1 -0
- package/dist/auth/resume-lane-warning.d.ts +9 -0
- package/dist/auth/resume-lane-warning.d.ts.map +1 -0
- package/dist/auth/resume-lane-warning.js +60 -0
- package/dist/auth/resume-lane-warning.js.map +1 -0
- package/dist/ccs.js +47 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts +10 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.js +122 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +1 -0
- package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.js +133 -92
- package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota-types.d.ts +8 -0
- package/dist/cliproxy/quota-types.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +10 -1
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.d.ts +39 -0
- package/dist/commands/command-catalog.d.ts.map +1 -0
- package/dist/commands/command-catalog.js +298 -0
- package/dist/commands/command-catalog.js.map +1 -0
- package/dist/commands/completion-backend.d.ts +14 -0
- package/dist/commands/completion-backend.d.ts.map +1 -0
- package/dist/commands/completion-backend.js +208 -0
- package/dist/commands/completion-backend.js.map +1 -0
- package/dist/commands/cursor-command-display.d.ts.map +1 -1
- package/dist/commands/cursor-command-display.js +25 -5
- package/dist/commands/cursor-command-display.js.map +1 -1
- package/dist/commands/cursor-command.d.ts +1 -3
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +3 -15
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/help-command.d.ts +4 -3
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +155 -507
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/root-command-router.d.ts +2 -0
- package/dist/commands/root-command-router.d.ts.map +1 -1
- package/dist/commands/root-command-router.js +13 -13
- package/dist/commands/root-command-router.js.map +1 -1
- package/dist/commands/shell-completion-command.d.ts +1 -0
- package/dist/commands/shell-completion-command.d.ts.map +1 -1
- package/dist/commands/shell-completion-command.js +27 -11
- package/dist/commands/shell-completion-command.js.map +1 -1
- package/dist/cursor/constants.d.ts +3 -0
- package/dist/cursor/constants.d.ts.map +1 -0
- package/dist/cursor/constants.js +20 -0
- package/dist/cursor/constants.js.map +1 -0
- package/dist/cursor/cursor-models.d.ts.map +1 -1
- package/dist/cursor/cursor-models.js +2 -0
- package/dist/cursor/cursor-models.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.d.ts +10 -0
- package/dist/cursor/cursor-profile-executor.d.ts.map +1 -0
- package/dist/cursor/cursor-profile-executor.js +158 -0
- package/dist/cursor/cursor-profile-executor.js.map +1 -0
- package/dist/cursor/cursor-translator.d.ts +22 -11
- package/dist/cursor/cursor-translator.d.ts.map +1 -1
- package/dist/cursor/cursor-translator.js +254 -75
- package/dist/cursor/cursor-translator.js.map +1 -1
- package/dist/cursor/index.d.ts +1 -0
- package/dist/cursor/index.d.ts.map +1 -1
- package/dist/cursor/index.js +4 -1
- package/dist/cursor/index.js.map +1 -1
- package/dist/shared/claude-extension-setup.d.ts.map +1 -1
- package/dist/shared/claude-extension-setup.js +36 -16
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/targets/target-runtime-compatibility.d.ts.map +1 -1
- package/dist/targets/target-runtime-compatibility.js +6 -0
- package/dist/targets/target-runtime-compatibility.js.map +1 -1
- package/dist/types/profile.d.ts +1 -1
- package/dist/types/profile.d.ts.map +1 -1
- package/dist/ui/assets/accounts-BjfPKR8m.js +1 -0
- package/dist/ui/assets/{alert-dialog-C5RdUHi9.js → alert-dialog-Dh2NUFdm.js} +1 -1
- package/dist/ui/assets/{api-C0ROFLme.js → api-C-3mQCFf.js} +1 -1
- package/dist/ui/assets/{auth-section-M2azTP3G.js → auth-section-Dp10_YyD.js} +1 -1
- package/dist/ui/assets/{backups-section-DIDUVa0t.js → backups-section-C0jF8MP1.js} +1 -1
- package/dist/ui/assets/{channels-D_5uerEp.js → channels-CkXuK5i7.js} +1 -1
- package/dist/ui/assets/{checkbox-CgMg7fDH.js → checkbox-tA5FH8Ol.js} +1 -1
- package/dist/ui/assets/{claude-extension-DA9wMzPz.js → claude-extension-Bg2ZkzMz.js} +1 -1
- package/dist/ui/assets/{cliproxy-4yUL1fQw.js → cliproxy-1qRVSbVC.js} +2 -2
- package/dist/ui/assets/{cliproxy-ai-providers-DedMcdcc.js → cliproxy-ai-providers-DBSXTTyw.js} +1 -1
- package/dist/ui/assets/cliproxy-control-panel-Da-sGGyI.js +1 -0
- package/dist/ui/assets/{codex-CAWw4ZNl.js → codex-ooWKOPa2.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-Ds0PYz2R.js → confirm-dialog-CKjwhn9j.js} +1 -1
- package/dist/ui/assets/{copilot-m6i00mFy.js → copilot-GA7EPiK1.js} +1 -1
- package/dist/ui/assets/{cursor-COeD0Dgq.js → cursor-B6c8CyHG.js} +1 -1
- package/dist/ui/assets/{droid-CznUyiRx.js → droid-CPRHOIX2.js} +1 -1
- package/dist/ui/assets/{globalenv-section-FgK1eGWk.js → globalenv-section-Czgnw_GV.js} +1 -1
- package/dist/ui/assets/{health-Cpu6bD6K.js → health-CXLOMk8n.js} +1 -1
- package/dist/ui/assets/icons-B9oTjo-t.js +1 -0
- package/dist/ui/assets/index-BMHPMj0j.js +69 -0
- package/dist/ui/assets/{index-DgnxlKNk.js → index-BceMcbCR.js} +1 -1
- package/dist/ui/assets/{index-C7sG68Mi.js → index-Boa5e-GY.js} +1 -1
- package/dist/ui/assets/index-CknHGRYp.css +1 -0
- package/dist/ui/assets/{index-DampXntj.js → index-CvfzKRSH.js} +1 -1
- package/dist/ui/assets/{index-Bhz6T039.js → index-D2v_-6AW.js} +1 -1
- package/dist/ui/assets/{index-rTSyskt3.js → index-v-DY6Zby.js} +1 -1
- package/dist/ui/assets/{masked-input-B_l4FMkE.js → masked-input-B1_asiUI.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-C7wSbfPC.js → proxy-status-widget-Ci1JpStj.js} +1 -1
- package/dist/ui/assets/{radix-ui-C98W0NRG.js → radix-ui-Zb8sVEtn.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-CViWFt6t.js → raw-json-settings-editor-panel-DMbTkxWw.js} +1 -1
- package/dist/ui/assets/{searchable-select-7-yJbbw2.js → searchable-select-HbP2PXl3.js} +1 -1
- package/dist/ui/assets/{separator-DApM4Wa5.js → separator-CdaalG0K.js} +1 -1
- package/dist/ui/assets/{shared-Blmm7sMd.js → shared-BiFB-et0.js} +1 -1
- package/dist/ui/assets/{table-BwM4zncv.js → table-BPwgFXLQ.js} +1 -1
- package/dist/ui/assets/{tanstack-CfKik0yL.js → tanstack-DWm6aJ-G.js} +1 -1
- package/dist/ui/assets/{updates-DJ0ofB67.js → updates-l8Co9uve.js} +1 -1
- package/dist/ui/index.html +5 -5
- package/dist/utils/config-manager.d.ts +5 -0
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js +10 -1
- package/dist/utils/config-manager.js.map +1 -1
- package/dist/utils/hooks/image-analysis-backend-resolver.d.ts.map +1 -1
- package/dist/utils/hooks/image-analysis-backend-resolver.js +8 -0
- package/dist/utils/hooks/image-analysis-backend-resolver.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +14 -2
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +80 -6
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +37 -2
- package/package.json +1 -1
- package/scripts/completion/README.md +55 -131
- package/scripts/completion/ccs.bash +22 -190
- package/scripts/completion/ccs.fish +19 -245
- package/scripts/completion/ccs.ps1 +37 -427
- package/scripts/completion/ccs.zsh +27 -305
- package/dist/ui/assets/accounts-Dh95PibK.js +0 -1
- package/dist/ui/assets/cliproxy-control-panel-B0kwxgNi.js +0 -1
- package/dist/ui/assets/icons-CeH5899d.js +0 -1
- package/dist/ui/assets/index-B6SrL1O-.css +0 -1
- package/dist/ui/assets/index-CcKb4PL_.js +0 -69
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Tab completion for CCS commands, subcommands, profiles, and flags.
|
|
4
4
|
|
|
5
|
+
The completion scripts are thin adapters over the hidden `ccs __complete` backend so
|
|
6
|
+
all supported shells stay aligned with the same command graph.
|
|
7
|
+
|
|
5
8
|
**Supported Shells:** Bash, Zsh, Fish, PowerShell
|
|
6
9
|
|
|
7
10
|
## Features
|
|
8
11
|
|
|
9
12
|
- Complete profile names (both settings-based and account-based)
|
|
10
|
-
- Complete
|
|
11
|
-
- Complete
|
|
12
|
-
- Complete profile names for auth subcommands
|
|
13
|
+
- Complete root commands, help topics, provider shortcuts, and command flags
|
|
14
|
+
- Complete `ccs auth` and `ccs api` lifecycle subcommands
|
|
13
15
|
- Context-aware: suggests relevant options based on current command
|
|
14
16
|
|
|
15
17
|
## Quick Install (Recommended)
|
|
@@ -32,6 +34,12 @@ ccs --shell-completion --fish # Force fish
|
|
|
32
34
|
ccs --shell-completion --powershell # Force PowerShell
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
**Help and verification:**
|
|
38
|
+
```bash
|
|
39
|
+
ccs help completion
|
|
40
|
+
ccs --shell-completion --force
|
|
41
|
+
```
|
|
42
|
+
|
|
35
43
|
## Manual Installation
|
|
36
44
|
|
|
37
45
|
Completion files are installed to `~/.ccs/completions/` during `npm install`.
|
|
@@ -116,188 +124,104 @@ sudo cp scripts/completion/ccs.fish /usr/share/fish/vendor_completions.d/
|
|
|
116
124
|
|
|
117
125
|
```bash
|
|
118
126
|
$ ccs <TAB>
|
|
119
|
-
auth doctor
|
|
127
|
+
auth api cliproxy config doctor docker help
|
|
120
128
|
|
|
121
|
-
$ ccs
|
|
122
|
-
|
|
129
|
+
$ ccs help <TAB>
|
|
130
|
+
profiles providers completion targets
|
|
123
131
|
```
|
|
124
132
|
|
|
125
|
-
###
|
|
133
|
+
### Context Completion
|
|
126
134
|
|
|
127
135
|
```bash
|
|
128
136
|
$ ccs auth show <TAB>
|
|
129
137
|
work personal team --json
|
|
130
138
|
|
|
131
|
-
$ ccs
|
|
132
|
-
|
|
139
|
+
$ ccs api <TAB>
|
|
140
|
+
create list discover copy export import remove
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
###
|
|
143
|
+
### Backend Contract
|
|
136
144
|
|
|
137
145
|
```bash
|
|
138
|
-
$ ccs
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
$ ccs auth show work <TAB>
|
|
142
|
-
--json
|
|
146
|
+
$ ccs __complete --shell bash --current do
|
|
147
|
+
doctor
|
|
148
|
+
docker
|
|
143
149
|
```
|
|
144
150
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
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)
|
|
151
|
+
Shell adapters now call the shared CCS completion backend instead of maintaining their own
|
|
152
|
+
copy of the command graph. That means:
|
|
153
|
+
- top-level commands, help topics, and provider shortcuts come from CCS itself
|
|
154
|
+
- dynamic profiles and CLIProxy variants resolve through the real config loaders
|
|
155
|
+
- bash, zsh, fish, and PowerShell stay aligned with the same completion logic
|
|
170
156
|
|
|
171
157
|
## Troubleshooting
|
|
172
158
|
|
|
173
|
-
### Bash
|
|
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
|
-
```
|
|
159
|
+
### Bash
|
|
188
160
|
|
|
189
|
-
|
|
161
|
+
1. Check if completion is loaded:
|
|
190
162
|
```bash
|
|
191
163
|
complete -p ccs
|
|
192
164
|
```
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
complete -F _ccs_completion ccs
|
|
165
|
+
2. Verify the backend directly:
|
|
166
|
+
```bash
|
|
167
|
+
ccs __complete --shell bash --current "" -- help
|
|
197
168
|
```
|
|
198
169
|
|
|
199
|
-
### Zsh
|
|
170
|
+
### Zsh
|
|
200
171
|
|
|
201
|
-
1. Verify completion system is enabled
|
|
172
|
+
1. Verify completion system is enabled:
|
|
202
173
|
```zsh
|
|
203
174
|
autoload -Uz compinit && compinit
|
|
204
175
|
```
|
|
205
|
-
|
|
206
|
-
2. Check if completion is loaded:
|
|
176
|
+
2. Rebuild the cache if needed:
|
|
207
177
|
```zsh
|
|
208
|
-
|
|
178
|
+
rm ~/.zcompdump && compinit
|
|
209
179
|
```
|
|
210
|
-
|
|
211
|
-
3. Rebuild completion cache:
|
|
180
|
+
3. Verify the backend directly:
|
|
212
181
|
```zsh
|
|
213
|
-
|
|
182
|
+
ccs __complete --shell zsh --current "" -- help
|
|
214
183
|
```
|
|
215
184
|
|
|
216
|
-
### PowerShell
|
|
217
|
-
|
|
218
|
-
1. Check PowerShell version (5.1+ required):
|
|
219
|
-
```powershell
|
|
220
|
-
$PSVersionTable.PSVersion
|
|
221
|
-
```
|
|
185
|
+
### PowerShell
|
|
222
186
|
|
|
223
|
-
|
|
187
|
+
1. Check that the profile exists:
|
|
224
188
|
```powershell
|
|
225
189
|
Test-Path $PROFILE
|
|
226
190
|
```
|
|
227
|
-
|
|
228
|
-
3. Check if completion is registered:
|
|
191
|
+
2. Verify the backend directly:
|
|
229
192
|
```powershell
|
|
230
|
-
|
|
193
|
+
ccs __complete --shell powershell --current "" -- help
|
|
231
194
|
```
|
|
232
195
|
|
|
233
|
-
### Fish
|
|
234
|
-
|
|
235
|
-
1. Check Fish version (3.0+ required):
|
|
236
|
-
```fish
|
|
237
|
-
fish --version
|
|
238
|
-
```
|
|
196
|
+
### Fish
|
|
239
197
|
|
|
240
|
-
|
|
198
|
+
1. Verify completion file location:
|
|
241
199
|
```fish
|
|
242
200
|
ls ~/.config/fish/completions/ccs.fish
|
|
243
201
|
```
|
|
244
|
-
|
|
245
|
-
3. Verify jq is installed (required for profile completion):
|
|
246
|
-
```fish
|
|
247
|
-
which jq
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
4. Test completion manually:
|
|
202
|
+
2. Test completion manually:
|
|
251
203
|
```fish
|
|
252
204
|
complete -C'ccs '
|
|
253
205
|
```
|
|
254
|
-
|
|
255
|
-
5. If needed, rebuild completions:
|
|
206
|
+
3. Verify the backend directly:
|
|
256
207
|
```fish
|
|
257
|
-
|
|
208
|
+
ccs __complete --shell fish --current "" -- help
|
|
258
209
|
```
|
|
259
210
|
|
|
260
211
|
## Technical Details
|
|
261
212
|
|
|
262
|
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
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
|
|
213
|
+
- Bash uses `complete -F`
|
|
214
|
+
- Zsh uses a custom `_ccs` completion function
|
|
215
|
+
- Fish uses `complete -a` with backend command substitution
|
|
216
|
+
- PowerShell uses `Register-ArgumentCompleter`
|
|
217
|
+
- All four shells now delegate suggestion logic to `ccs __complete`
|
|
293
218
|
|
|
294
219
|
## Contributing
|
|
295
220
|
|
|
296
|
-
When adding
|
|
297
|
-
1. Update
|
|
298
|
-
2.
|
|
299
|
-
3.
|
|
300
|
-
4. Maintain cross-shell parity
|
|
221
|
+
When adding or changing command surfaces:
|
|
222
|
+
1. Update the shared TypeScript command/completion catalog
|
|
223
|
+
2. Run `bun run validate`
|
|
224
|
+
3. Smoke-check at least one installed shell adapter plus the backend directly
|
|
301
225
|
|
|
302
226
|
## See Also
|
|
303
227
|
|
|
@@ -1,210 +1,42 @@
|
|
|
1
1
|
# Bash completion for CCS (Claude Code Switch)
|
|
2
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
3
|
|
|
11
4
|
_ccs_completion() {
|
|
12
|
-
local cur
|
|
5
|
+
local cur
|
|
13
6
|
COMPREPLY=()
|
|
14
|
-
|
|
15
|
-
# Get current word and previous word
|
|
16
7
|
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 api cliproxy config doctor env persist sync update"
|
|
22
|
-
local flags="--help --version --shell-completion -h -v -sc"
|
|
23
|
-
local cliproxy_profiles="gemini codex agy qwen"
|
|
24
|
-
local profiles=""
|
|
25
|
-
|
|
26
|
-
# Add profiles from config.json (settings-based profiles)
|
|
27
|
-
if [[ -f ~/.ccs/config.json ]]; then
|
|
28
|
-
profiles="$profiles $(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null || true)"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Add profiles from profiles.json (account-based profiles)
|
|
32
|
-
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
33
|
-
profiles="$profiles $(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null || true)"
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Add cliproxy variants from config.json
|
|
37
|
-
if [[ -f ~/.ccs/config.json ]]; then
|
|
38
|
-
profiles="$profiles $(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null || true)"
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
# Combine all options
|
|
42
|
-
local opts="$commands $flags $cliproxy_profiles $profiles"
|
|
43
|
-
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
44
|
-
return 0
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
# CLIProxy provider flags (gemini, codex, agy, qwen)
|
|
48
|
-
if [[ ${COMP_WORDS[1]} =~ ^(gemini|codex|agy|qwen)$ ]]; then
|
|
49
|
-
local provider_flags="--auth --config --logout --headless --help -h"
|
|
50
|
-
COMPREPLY=( $(compgen -W "${provider_flags}" -- ${cur}) )
|
|
51
|
-
return 0
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# auth subcommands
|
|
55
|
-
if [[ ${prev} == "auth" ]]; then
|
|
56
|
-
local auth_commands="create list show remove default --help -h"
|
|
57
|
-
COMPREPLY=( $(compgen -W "${auth_commands}" -- ${cur}) )
|
|
58
|
-
return 0
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# api subcommands
|
|
62
|
-
if [[ ${prev} == "api" ]]; then
|
|
63
|
-
local api_commands="create list remove --help -h"
|
|
64
|
-
COMPREPLY=( $(compgen -W "${api_commands}" -- ${cur}) )
|
|
65
|
-
return 0
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# cliproxy subcommands
|
|
69
|
-
if [[ ${prev} == "cliproxy" ]]; then
|
|
70
|
-
local cliproxy_commands="create list remove --install --latest --help -h"
|
|
71
|
-
COMPREPLY=( $(compgen -W "${cliproxy_commands}" -- ${cur}) )
|
|
72
|
-
return 0
|
|
73
|
-
fi
|
|
74
8
|
|
|
75
|
-
|
|
76
|
-
if [[ ${
|
|
77
|
-
|
|
78
|
-
remove|delete|rm)
|
|
79
|
-
# Complete with cliproxy variant names
|
|
80
|
-
if [[ -f ~/.ccs/config.json ]]; then
|
|
81
|
-
local variants=$(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null || true)
|
|
82
|
-
COMPREPLY=( $(compgen -W "${variants}" -- ${cur}) )
|
|
83
|
-
fi
|
|
84
|
-
return 0
|
|
85
|
-
;;
|
|
86
|
-
create)
|
|
87
|
-
# Complete with create flags
|
|
88
|
-
COMPREPLY=( $(compgen -W "--provider --model --force --yes -y" -- ${cur}) )
|
|
89
|
-
return 0
|
|
90
|
-
;;
|
|
91
|
-
--provider)
|
|
92
|
-
# Complete with provider names
|
|
93
|
-
COMPREPLY=( $(compgen -W "gemini codex agy qwen" -- ${cur}) )
|
|
94
|
-
return 0
|
|
95
|
-
;;
|
|
96
|
-
list|ls)
|
|
97
|
-
# No flags for list
|
|
98
|
-
return 0
|
|
99
|
-
;;
|
|
100
|
-
--install)
|
|
101
|
-
# User enters version number
|
|
102
|
-
return 0
|
|
103
|
-
;;
|
|
104
|
-
esac
|
|
9
|
+
local tokens_before_current=()
|
|
10
|
+
if [[ ${COMP_CWORD} -gt 1 ]]; then
|
|
11
|
+
tokens_before_current=("${COMP_WORDS[@]:1:COMP_CWORD-1}")
|
|
105
12
|
fi
|
|
106
13
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
remove|delete|rm)
|
|
111
|
-
# Complete with settings profile names
|
|
112
|
-
if [[ -f ~/.ccs/config.json ]]; then
|
|
113
|
-
local profiles=$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null || true)
|
|
114
|
-
COMPREPLY=( $(compgen -W "${profiles}" -- ${cur}) )
|
|
115
|
-
fi
|
|
116
|
-
return 0
|
|
117
|
-
;;
|
|
118
|
-
create)
|
|
119
|
-
# Complete with create flags
|
|
120
|
-
COMPREPLY=( $(compgen -W "--base-url --api-key --model --force --yes -y" -- ${cur}) )
|
|
121
|
-
return 0
|
|
122
|
-
;;
|
|
123
|
-
list)
|
|
124
|
-
# No flags for list
|
|
125
|
-
return 0
|
|
126
|
-
;;
|
|
127
|
-
esac
|
|
128
|
-
fi
|
|
14
|
+
while IFS= read -r line; do
|
|
15
|
+
[[ -n "${line}" ]] && COMPREPLY+=("${line}")
|
|
16
|
+
done < <(__ccs_completion_run "${cur}" "${tokens_before_current[@]}")
|
|
129
17
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
case "${prev}" in
|
|
133
|
-
show|remove|default)
|
|
134
|
-
# Complete with account profile names only
|
|
135
|
-
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
136
|
-
local profiles=$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null || true)
|
|
137
|
-
COMPREPLY=( $(compgen -W "${profiles}" -- ${cur}) )
|
|
138
|
-
fi
|
|
139
|
-
return 0
|
|
140
|
-
;;
|
|
141
|
-
create)
|
|
142
|
-
# Complete with create flags
|
|
143
|
-
COMPREPLY=( $(compgen -W "--force" -- ${cur}) )
|
|
144
|
-
return 0
|
|
145
|
-
;;
|
|
146
|
-
list)
|
|
147
|
-
# Complete with list flags
|
|
148
|
-
COMPREPLY=( $(compgen -W "--verbose --json" -- ${cur}) )
|
|
149
|
-
return 0
|
|
150
|
-
;;
|
|
151
|
-
esac
|
|
152
|
-
fi
|
|
18
|
+
return 0
|
|
19
|
+
}
|
|
153
20
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
env)
|
|
158
|
-
# Complete with profile names and flags (inline profiles since $cliproxy_profiles is out of scope)
|
|
159
|
-
local env_opts="--format --shell --ide --help -h gemini codex agy qwen iflow kiro ghcp claude default"
|
|
160
|
-
if [[ -f ~/.ccs/config.json ]]; then
|
|
161
|
-
env_opts="$env_opts $(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null || true)"
|
|
162
|
-
fi
|
|
163
|
-
if [[ -f ~/.ccs/profiles.json ]]; then
|
|
164
|
-
env_opts="$env_opts $(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null || true)"
|
|
165
|
-
fi
|
|
166
|
-
COMPREPLY=( $(compgen -W "${env_opts}" -- ${cur}) )
|
|
167
|
-
return 0
|
|
168
|
-
;;
|
|
169
|
-
--format)
|
|
170
|
-
COMPREPLY=( $(compgen -W "openai anthropic raw claude-extension" -- ${cur}) )
|
|
171
|
-
return 0
|
|
172
|
-
;;
|
|
173
|
-
--shell)
|
|
174
|
-
COMPREPLY=( $(compgen -W "auto bash zsh fish powershell" -- ${cur}) )
|
|
175
|
-
return 0
|
|
176
|
-
;;
|
|
177
|
-
--ide)
|
|
178
|
-
COMPREPLY=( $(compgen -W "vscode cursor windsurf" -- ${cur}) )
|
|
179
|
-
return 0
|
|
180
|
-
;;
|
|
181
|
-
*)
|
|
182
|
-
COMPREPLY=( $(compgen -W "--format --shell --ide --help -h" -- ${cur}) )
|
|
183
|
-
return 0
|
|
184
|
-
;;
|
|
185
|
-
esac
|
|
186
|
-
fi
|
|
21
|
+
__ccs_completion_run() {
|
|
22
|
+
local current="$1"
|
|
23
|
+
shift || true
|
|
187
24
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
25
|
+
local script_dir repo_root repo_cli
|
|
26
|
+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
27
|
+
repo_root="$(cd "${script_dir}/../.." && pwd)"
|
|
28
|
+
repo_cli="${repo_root}/dist/ccs.js"
|
|
29
|
+
if [[ ! -f "${repo_cli}" ]]; then
|
|
30
|
+
repo_cli="${repo_root}/bin/ccs.js"
|
|
192
31
|
fi
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if [[ ${COMP_WORDS[1]} == "update" ]]; then
|
|
196
|
-
COMPREPLY=( $(compgen -W "--force --beta --dev --help -h" -- ${cur}) )
|
|
32
|
+
if [[ -f "${repo_cli}" ]]; then
|
|
33
|
+
node "${repo_cli}" __complete --shell bash --current "${current}" -- "$@" 2>/dev/null
|
|
197
34
|
return 0
|
|
198
35
|
fi
|
|
199
36
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
COMPREPLY=( $(compgen -W "--bash --zsh --fish --powershell" -- ${cur}) )
|
|
203
|
-
return 0
|
|
37
|
+
if command -v ccs >/dev/null 2>&1; then
|
|
38
|
+
ccs __complete --shell bash --current "${current}" -- "$@" 2>/dev/null
|
|
204
39
|
fi
|
|
205
|
-
|
|
206
|
-
return 0
|
|
207
40
|
}
|
|
208
41
|
|
|
209
|
-
# Register completion function
|
|
210
42
|
complete -F _ccs_completion ccs
|