claude-code-switcher 0.12.1

A CLI tool for managing Claude Code setting snapshots and templates
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# Interactive UI Reference


All interactive screens in Claude Code Switcher, organized by user flow.

## Quick Test Setup


```bash
# Build the tool

cargo build

# Create test snapshots (uses current project settings)

ccs snap test-snapshot-1
ccs snap test-snapshot-2
ccs snap test-snapshot-3

# Set a dummy env var to test env var detection flow

export DEEPSEEK_API_KEY=sk-test-dummy-key-12345

# Apply a template (creates credential + saves settings)

ccs apply deepseek
```

---

## 1. Snapshot Browser


**Trigger:** `ccs list`

### 1.1 Snapshot List


Crossterm full-screen Selector with filter and management shortcuts.

```
? Select a snapshot to manage (3 items)

❯ πŸ” Filter/Custom search...
  test-snapshot-1 (common)
  test-snapshot-2 (common)
  test-snapshot-3 (all)
βž• Create New...

Type to filter, Enter to search, ↑↓ to navigate, Esc to back
```

| Key | Action |
|-----|--------|
| Type chars | Filter items in real-time |
| ↑ / ↓ | Navigate list |
| PgUp / PgDown | Page navigation |
| Home / End | Jump to start/end |
| Enter | Select snapshot β†’ goes to **1.2** |
| β†’ | Select / forward |
| d | Delete selected snapshot directly β†’ goes to **1.3c** |
| n | Rename selected snapshot directly β†’ goes to **1.3b** |
| r | Refresh list |
| ← / Esc | Back / exit |
| Ctrl+C | Exit application |

When typing a filter (cursor on πŸ” row):

```
? Select a snapshot to manage (2 items)

❯ πŸ” test
  test-snapshot-1 (common)
  test-snapshot-2 (common)
βž• Create New...

Type to filter, Enter to search, ↑↓ to navigate, Esc to back
```

When cursor is on an item:

```
? Select a snapshot to manage (3 items)

  πŸ” Filter/Custom search...
❯ test-snapshot-2 (common)              ← yellow highlight
  test-snapshot-3 (all)
βž• Create New...

↑↓ to navigate, Enter to select, ←→ to move cursor, d: Delete, n: Rename, r: Refresh, Esc: Back
```

### 1.2 Snapshot Action Menu


inquire::Select β€” shown after selecting a snapshot from **1.1**.

```
? Action for 'test-snapshot-1':
> Apply
  Rename
  Delete
  Back

↑/↓: Navigate, Enter: Select, Esc: Back
```

### 1.3a Apply Confirmation


inquire::Confirm

```
? Apply snapshot 'test-snapshot-1'? (y/N)
```

### 1.3b Rename Input


inquire::Text β€” pre-filled with current name.

```
? Rename snapshot:
> test-snapshot-1

Enter new name, Esc to cancel
```

### 1.3c Delete Confirmation


inquire::Confirm

```
? Delete 'test-snapshot-1' snapshot? (y/N)
```

---

## 2. Snapshot Creation


**Trigger:** Select "βž• Create New..." from Snapshot List (**1.1**)

### 2.1 Config Path


inquire::Select

```
? Select configuration to snapshot:
> Local (.claude/settings.json) - Project-specific settings
  Global (~/.claude/settings.json) - User-wide settings

↑/↓: Navigate, Enter: Select
```

### 2.2 Preview

Read-only display (no interaction).

```
πŸ“‹ Current Configuration Preview:
πŸ“ Path: .claude/settings.json

  env:
    ANTHROPIC_BASE_URL: "https://api.deepseek.com"
    DEEPSEEK_API_KEY: "sk-β€’β€’β€’β€’β€’β€’β€’β€’"
    ...

πŸ€– Model: deepseek-chat
πŸ” Permissions: 8 rules
```

### 2.3 Name


inquire::Text

```
? Enter snapshot name:
>

A descriptive name (e.g., 'development-setup', 'production-config')
```

### 2.4 Description


inquire::Text β€” optional, press Enter to skip.

```
? Enter description (optional):
>

Optional description to help you remember what this snapshot is for
```

### 2.5 Scope


inquire::Select

```
? Select snapshot scope:
> common - Common settings only (model, hooks, permissions)
  env - Environment variables only
  all - All settings (common + environment)

↑/↓: Navigate, Enter: Select
```

### 2.6 Confirm


inquire::Confirm

```
πŸ“‹ Snapshot Summary:
  Name: my-new-snapshot
  Path: .claude/settings.json
  Scope: common

? Create this snapshot? (y/N)
```

If name already exists:

```
? Snapshot 'test-snapshot-1' already exists. Overwrite? (y/N)
```

---

## 3. Template Application


**Trigger:** `ccs apply <template>`

Examples: `ccs apply deepseek`, `ccs apply zai`, `ccs apply kat-coder`

### 3.1 Variant Selection


inquire::Select β€” only shown for templates with variants when using a generic name.

Skip variant selection with specific aliases:
```bash
ccs apply zai-china       # Skip directly to China
ccs apply kat-coder-pro   # Skip directly to Pro
ccs apply k2              # Skip directly to K2
ccs apply deepseek        # No variants, skipped entirely
```

**ZAI (zai / glm / zhipu):**
```
? Select ZAI region:
> ZAI China (ζ™Ίθ°±AI)
  ZAI International

↑/↓ to navigate, enter to select, esc to cancel
```

**KatCoder (kat-coder / kat):**
```
? Select KatCoder variant:
> KatCoder Pro - High-performance coding with Claude Opus 4.6 capabilities
  KatCoder Air - Lightweight and fast coding assistance
```

**Kimi (kimi):**
```
? Select Kimi service:
> K2 - Moonshot K2 model
  K2 Thinking - K2 with extended thinking
  Kimi For Coding - Kimi coding assistant
```

**AnyRouter (anyrouter / ar):**
```
? Select AnyRouter region:
> China (fast) - Fast response with China routing
  Fallback (stable) - Stable fallback routing
```

**OpenRouter (openrouter / or):**
```
? Select OpenRouter model:
> anthropic/claude-sonnet-4-6
  anthropic/claude-opus-4-6
  google/gemini-2.5-pro
  ...
```

### 3.2 API Key Source

inquire::Select β€” only shown when environment variables with API keys are detected.

```
? API key source:
> Use API key from environment variable DEEPSEEK_API_KEY
  Enter a custom API key

↑/↓ to navigate, enter to select, esc to cancel
```

If env var selected:
```
βœ“ Using API key from environment variable DEEPSEEK_API_KEY
βœ“ API key saved automatically for future use.
```

If "custom" selected β†’ goes to **3.3** or **3.4**.

### 3.3 Credential Selection


Selector β€” shown when saved credentials exist for the template.

```
? Select DeepSeek API key: (1 items)

❯ πŸ” Filter/Custom search...
  DeepSeek API Key (DeepSeek) - sk-tβ€’β€’β€’β€’β€’β€’β€’β€’
βž• Create New...

↑↓ to navigate, Enter to select, ←→ to move cursor, d: Delete, n: Rename, r: Refresh, Esc: Back
```

### 3.4 New API Key Input


inquire::Text β€” shown when no saved credentials or "Create New" selected.

```
πŸ”‘ Create New API Key

  πŸ’‘ Get your API key from: https://platform.deepseek.com/api_keys

? Enter your DeepSeek API key:
> sk-...

placeholder: sk-...
```

### 3.5 Apply Confirmation


Shown without `--yes` flag. Shows diff of changes.

```
Changes to be applied:
  + model: "deepseek-chat"
  + env: ANTHROPIC_BASE_URL = "https://api.deepseek.com"
  + env: ANTHROPIC_AUTH_TOKEN = "sk-..."
  ...

? Apply these changes? (y/N)
```

**Skip:** `ccs apply deepseek --yes`

---

## 4. Snapshot Application


**Trigger:** `ccs apply <snapshot-name>` (when name doesn't match any template)

```
ccs apply test-snapshot-1
```

### 4.1 Settings Comparison + Confirm


```
Current settings:
  env:
    ANTHROPIC_BASE_URL: "https://api.deepseek.com"
    ...

Snapshot settings:
  env:
    ANTHROPIC_BASE_URL: "https://open.bigmodel.cn/api/anthropic"
    ...

? Apply these settings? (y/N)
```

**Skip:** `ccs apply test-snapshot-1 --yes`

---

## 5. Credential Browser


**Trigger:** `ccs credentials list`

### 5.1 Credential List


Selector β€” same crossterm component as snapshot list.

```
? Select a credential to manage (1 items)

❯ πŸ” Filter/Custom search...
  DeepSeek API Key (DeepSeek) - sk-tβ€’β€’β€’β€’β€’β€’β€’β€’

↑↓ to navigate, Enter to select, ←→ to move cursor, d: Delete, n: Rename, r: Refresh, Esc: Back
```

When > 5 credentials, selecting the πŸ” filter option shows a text filter:

```
? Filter credentials:
>

Type to filter credential names, Tab: Complete, Enter: Select, Esc: Cancel
```

With autocomplete dropdown showing matching names.

### 5.2 Credential Action Menu


inquire::Select β€” shows credential details above options.

```
? Manage Credential:

  Credential: DeepSeek API Key (DeepSeek)
  API Key: sk-tβ€’β€’β€’β€’
  Env: DEEPSEEK_API_KEY (primary)

  Created: 2026-03-27 10:00:00 UTC
  Updated: 2026-03-27 10:00:00 UTC

> ✏️  Rename
  πŸ—‘οΈ  Delete
  ⬅️  Back

↑↓ to move, enter to select, esc to cancel
```

### 5.3a Rename Credential


inquire::Text β€” pre-filled with current name.

```
? Rename 'DeepSeek API Key':
> DeepSeek API Key

Enter new name, Esc to cancel
```

After input, confirmation:

```
? Rename 'DeepSeek API Key' to 'my-new-name' (y/N)
```

### 5.3b Delete Credential


inquire::Confirm

```
? Delete 'DeepSeek API Key' credential? (y/N)
```

---

## 6. Credential Clear


**Trigger:** `ccs credentials clear`

### 6.1 Clear Confirmation


inquire::Confirm

```
? Clear all saved credentials? (y/N)
```

**Skip:** `ccs credentials clear --yes`

---

## Component Reference


| Component | Library | Usage |
|-----------|---------|-------|
| **Selector** | crossterm | Full-screen filterable list with keyboard shortcuts. Used for snapshot list, credential list, API key selection. |
| **Select** | inquire | Simple option menu. Used for action menus, variant selection, scope/path selection. |
| **Text** | inquire | Text input. Used for rename, snapshot name, API key input. |
| **Confirm** | inquire | Yes/No confirmation. Used for apply/delete/overwrite confirmations. |

### Selector Key Bindings


| Key | Action |
|-----|--------|
| ↑ / ↓ | Navigate |
| PgUp / PgDown | Page navigation |
| Home / End | Jump to start/end |
| Enter | Select / View details |
| ← | Back |
| β†’ | Select / Forward |
| d | Delete (management mode) |
| n | Rename (management mode) |
| r | Refresh |
| Ctrl+C | Exit |
| Esc | Back |