claude-switch-profile 1.1.0 → 1.4.2

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.
@@ -0,0 +1,41 @@
1
+ exclude_patterns:
2
+ - '**/.*'
3
+ - '**/__pycache__'
4
+ - '**/node_modules'
5
+ - '**/target'
6
+ - '**/build/assets'
7
+ - '**/dist'
8
+ - '**/vendor/*.*/*'
9
+ - '**/vendor/*'
10
+ - '**/.cocoindex_code'
11
+ include_patterns:
12
+ - '**/*.py'
13
+ - '**/*.pyi'
14
+ - '**/*.js'
15
+ - '**/*.jsx'
16
+ - '**/*.ts'
17
+ - '**/*.tsx'
18
+ - '**/*.mjs'
19
+ - '**/*.cjs'
20
+ - '**/*.rs'
21
+ - '**/*.go'
22
+ - '**/*.java'
23
+ - '**/*.c'
24
+ - '**/*.h'
25
+ - '**/*.cpp'
26
+ - '**/*.hpp'
27
+ - '**/*.cc'
28
+ - '**/*.cxx'
29
+ - '**/*.hxx'
30
+ - '**/*.hh'
31
+ - '**/*.cs'
32
+ - '**/*.sql'
33
+ - '**/*.sh'
34
+ - '**/*.bash'
35
+ - '**/*.zsh'
36
+ - '**/*.md'
37
+ - '**/*.mdx'
38
+ - '**/*.txt'
39
+ - '**/*.rst'
40
+ - '**/*.php'
41
+ - '**/*.lua'
Binary file
package/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  All notable changes to `claude-switch-profile` are documented here.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ### Changed
8
+ - _No changes yet._
9
+
10
+ ---
11
+
12
+ ## [1.4.1] - 2026-03-31
13
+
14
+ ### Changed
15
+ - `default` is now a physical profile snapshot created by `csp init` instead of a virtual pass-through.
16
+ - `csp save`, `csp use`, `csp export`, `csp launch`, and `csp uninstall` now operate on the `default` snapshot the same way they do for other profiles.
17
+ - Legacy installs missing `~/.claude-profiles/default` only backfill that snapshot when the active profile is `default` or no active profile is set; if a non-default profile is active, CSP fails closed with repair guidance.
18
+ - Protected and session/runtime files remain excluded from snapshot capture, export, isolated runtime sync, and restore flows.
19
+ - Launching `default` keeps its metadata mode as `legacy` instead of drifting to `account-session`.
20
+ - README command reference refreshed to match current CLI behavior (`select` default command, `status`, `toggle`, `create --source`, import symlink safety validation, updated project structure, and GitHub repository link).
21
+
22
+ ---
23
+
24
+ ## [1.3.0] - 2026-03-28
25
+
26
+ ### Added
27
+ - ✨ **Interactive profile selector** — Run `csp` with no arguments to get an arrow-key profile picker that launches isolated sessions. Supports ↑/↓/j/k navigation, Enter to select, Esc to cancel.
28
+ - ✨ **`csp status`** — Dashboard showing active profile, profile count, last launch info, and Claude running status at a glance.
29
+ - ✨ **`csp toggle`** — Quick-switch to the previous profile (like `cd -`). Uses isolated launch, never touches ~/.claude.
30
+ - ✨ **`csp select`** — Explicit alias for the interactive selector.
31
+
32
+ ### Changed
33
+ - 🔒 **`~/.claude` is never modified** — All profile operations now use isolated runtime (`CLAUDE_CONFIG_DIR`). The `default` profile is a virtual alias for `~/.claude` as-is.
34
+ - 🔒 **`default` profile is virtual** — `csp init` no longer creates a physical directory for the default profile. Default means "use ~/.claude directly".
35
+ - 🔒 **`csp launch default`** — Launches Claude with native `~/.claude` (no runtime dir, no `CLAUDE_CONFIG_DIR` override).
36
+ - 🔒 **`csp deactivate`** — Now simply resets active marker to `default`. No longer deletes files from `~/.claude`.
37
+ - ⚠️ **`csp use` deprecated** — Shows warning that it modifies `~/.claude` (legacy mode). Users should prefer `csp launch`.
38
+ - 🔄 **`csp toggle`** — Now uses `launch` (isolated) instead of `use` (legacy).
39
+
40
+ ### Fixed
41
+ - 🐛 Removed dead `--force` option from `csp use`.
42
+ - 🐛 Fixed double `getActive()` call in `init` command.
43
+ - 🐛 Fixed stale "symlink targets" comment in safety.js.
44
+ - 🐛 Removed unused parameter in diff.js.
45
+
46
+ ---
47
+
5
48
  ## [1.1.0] - 2026-03-13
6
49
 
7
50
  ### Added
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
  [![Node.js >= 18](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
6
 
7
- A CLI tool for managing multiple Claude Code configurations and profiles. Effortlessly switch between different development setups, each with their own rules, agents, skills, and settings.
7
+ **GitHub:** https://github.com/ThanhThi2895/claude-switch-profile
8
+
9
+ A CLI tool for managing multiple Claude Code configurations and profiles. Use legacy global switching (`csp use`) or concurrent isolated account sessions (`csp launch`) with per-profile runtime roots.
8
10
 
9
11
  ## Overview
10
12
 
@@ -46,19 +48,20 @@ csp --help
46
48
  ### Requirements
47
49
 
48
50
  - Node.js >= 18.0.0
49
- - Unix/Linux/macOS (uses symlinks and POSIX tools)
51
+ - Unix/Linux/macOS
52
+ - Windows 10+
50
53
 
51
54
  ## Quick Start
52
55
 
53
56
  ### 1. Initialize
54
57
 
55
- Capture your current Claude Code setup as the default profile:
58
+ Capture your current Claude Code setup as the physical `default` profile snapshot:
56
59
 
57
60
  ```bash
58
61
  csp init
59
62
  ```
60
63
 
61
- This creates `~/.claude-profiles/default/` containing your current configuration.
64
+ This creates `~/.claude-profiles/default/` from the current managed contents of `~/.claude`. Protected and session/runtime files remain excluded.
62
65
 
63
66
  ### 2. Create Additional Profiles
64
67
 
@@ -115,7 +118,15 @@ Output example:
115
118
 
116
119
  The `*` marks the active profile.
117
120
 
118
- ### 6. Uninstall CSP
121
+ ### 6. Launch via Interactive Selector (Default Command)
122
+
123
+ Run `csp` without a subcommand to open the interactive selector and launch a profile immediately:
124
+
125
+ ```bash
126
+ csp
127
+ ```
128
+
129
+ ### 7. Uninstall CSP
119
130
 
120
131
  Remove CSP and restore your Claude Code to its original state:
121
132
 
@@ -126,6 +137,22 @@ csp uninstall
126
137
 
127
138
  ## Commands Reference
128
139
 
140
+ ### select (default)
141
+
142
+ Open interactive profile selector (default behavior when you run `csp` without subcommand).
143
+
144
+ ```bash
145
+ csp
146
+ csp select
147
+ ```
148
+
149
+ **Behavior:**
150
+ - If TTY and multiple profiles exist: shows arrow-key menu and launches selected profile via `csp launch <name>`
151
+ - If only one profile exists: shows informational message and exits
152
+ - If non-interactive terminal: asks to use `csp launch <name>` or `csp use <name>` directly
153
+
154
+ ---
155
+
129
156
  ### init
130
157
 
131
158
  Initialize the profile system and capture current state as "default" profile.
@@ -146,7 +173,7 @@ csp init
146
173
 
147
174
  ### current
148
175
 
149
- Display the currently active profile.
176
+ Display the currently active **legacy** profile and isolated launch metadata (if present).
150
177
 
151
178
  ```bash
152
179
  csp current
@@ -154,8 +181,10 @@ csp current
154
181
 
155
182
  **Output:**
156
183
  ```
157
- ✓ Active profile: default
184
+ ✓ Active legacy profile: default
158
185
  ℹ Location: /home/user/.claude-profiles/default
186
+ ℹ Last isolated launch: 2026-03-26T14:45:00.000Z
187
+ ℹ Isolated runtime: /home/user/.claude-profiles/.runtime/default
159
188
  ```
160
189
 
161
190
  ---
@@ -171,14 +200,24 @@ csp ls
171
200
 
172
201
  **Output format:**
173
202
  ```
174
- * profile-name — optional description (YYYY-MM-DD)
175
- other-profile (YYYY-MM-DD)
203
+ * profile-name — optional description (YYYY-MM-DD) [legacy|account-session]
204
+ other-profile (YYYY-MM-DD) [account-session]
176
205
  ```
177
206
 
178
207
  The `*` marks the currently active profile.
179
208
 
180
209
  ---
181
210
 
211
+ ### status
212
+
213
+ Show CSP status dashboard (active profile, profile count, last launch, Claude process state).
214
+
215
+ ```bash
216
+ csp status
217
+ ```
218
+
219
+ ---
220
+
182
221
  ### create
183
222
 
184
223
  Create a new profile from current state or clone existing profile.
@@ -189,6 +228,7 @@ csp create <name> [options]
189
228
 
190
229
  **Options:**
191
230
  - `--from <profile>` — Clone from existing profile instead of current state
231
+ - `-s, --source <path>` — Create from a specific kit directory, then inherit missing managed items from current `~/.claude`
192
232
  - `-d, --description <text>` — Add description to profile
193
233
 
194
234
  **Examples:**
@@ -208,10 +248,16 @@ Clone from existing:
208
248
  csp create backup --from production
209
249
  ```
210
250
 
251
+ Create from kit directory:
252
+ ```bash
253
+ csp create team-kit --source ~/my-kit/.agents -d "Team baseline"
254
+ ```
255
+
211
256
  **Behavior:**
212
257
  - Creates profile directory: `~/.claude-profiles/<name>/`
213
258
  - If `--from` is specified, clones all content from source profile
214
- - Otherwise, captures current `~/.claude` state
259
+ - If `--source` is specified, copies managed items from that directory, then fills missing managed items from current `~/.claude`
260
+ - Otherwise, performs full clone of current `~/.claude` excluding protected/session items
215
261
  - If this is the first profile, automatically sets it as active
216
262
  - Saves metadata (created timestamp, description)
217
263
 
@@ -226,10 +272,11 @@ csp save
226
272
  ```
227
273
 
228
274
  **Behavior:**
229
- - Captures all managed symlinks and files from `~/.claude`
230
- - Overwrites profile's `source.json` and file copies
231
- - Useful after modifying rules, settings, or other configuration
232
- - Requires active profile (run `csp create` if none exists)
275
+ - Captures all managed items and copied files/directories from `~/.claude`
276
+ - Overwrites the active profile snapshot (`source.json` plus copied content)
277
+ - When `default` is active, updates the physical `default` snapshot like any other profile
278
+ - Protected and session/runtime files remain excluded
279
+ - Requires an active profile
233
280
 
234
281
  ---
235
282
 
@@ -244,7 +291,6 @@ csp use <name> [options]
244
291
  **Options:**
245
292
  - `--dry-run` — Show what would change without executing
246
293
  - `--no-save` — Skip saving current profile before switching
247
- - `--force` — Switch even if some symlink targets are missing
248
294
 
249
295
  **Examples:**
250
296
 
@@ -263,20 +309,30 @@ Switch without saving current state:
263
309
  csp use backup --no-save
264
310
  ```
265
311
 
266
- Force switch with missing targets:
312
+ **Behavior:**
313
+ 1. Validates target profile exists and profile structure is valid
314
+ 2. Refuses to switch while Claude Code is running (legacy/global switching mutates `~/.claude` directly)
315
+ 3. If the active profile exists and `--no-save` is not set: saves its current snapshot first
316
+ 4. Removes managed items/files from `~/.claude`
317
+ 5. Restores the target profile snapshot into `~/.claude` — including `default`
318
+ 6. Updates active marker
319
+ 7. On older installs missing `profiles/default`, CSP only backfills that snapshot when the active profile is `default` or no active profile is set; otherwise it fails closed with repair guidance
320
+ 8. **Important:** Claude Code session must be restarted for changes to apply
321
+
322
+ ---
323
+
324
+ ### toggle
325
+
326
+ Launch the previous profile (does not mutate global active profile in isolated mode).
327
+
267
328
  ```bash
268
- csp use legacy --force
329
+ csp toggle
269
330
  ```
270
331
 
271
332
  **Behavior:**
272
- 1. Validates target profile exists and is valid
273
- 2. (Optional) Validates symlink targets exist
274
- 3. If active profile exists and `--no-save` is not set: saves current state
275
- 4. Creates automatic backup at `~/.claude-profiles/.backup/`
276
- 5. Removes all managed items from `~/.claude`
277
- 6. Restores target profile's symlinks and files
278
- 7. Updates active marker
279
- 8. **Important:** Claude Code session must be restarted for changes to apply
333
+ - Reads previous profile marker from `~/.claude-profiles/.previous`
334
+ - Validates previous profile still exists
335
+ - Delegates to `csp launch <previous>`
280
336
 
281
337
  ---
282
338
 
@@ -306,10 +362,11 @@ csp delete old-setup --force
306
362
  ```
307
363
 
308
364
  **Behavior:**
309
- - Cannot delete the active profile (must switch first)
365
+ - Cannot delete `default`
310
366
  - Prompts for confirmation unless `--force` is used
311
367
  - Permanently removes profile directory and metadata
312
- - Cannot be undone (but auto-backups from `use` are preserved)
368
+ - If deleting the currently active non-default profile: clears active marker only (does not mutate `~/.claude`)
369
+ - Cannot be undone
313
370
 
314
371
  ---
315
372
 
@@ -338,8 +395,10 @@ csp export staging -o ~/backups/claude-staging.tar.gz
338
395
  ```
339
396
 
340
397
  **Behavior:**
341
- - Creates tar.gz archive of entire profile directory
342
- - Includes source.json (symlink targets) and all copied files
398
+ - Creates tar.gz archive of the profile snapshot directory
399
+ - Includes `source.json` plus copied profile files/directories
400
+ - Exporting `default` works like any other profile snapshot
401
+ - Protected and session/runtime files remain excluded from the archive
343
402
  - Useful for backup, sharing, or version control
344
403
 
345
404
  ---
@@ -372,6 +431,8 @@ csp import backup.tar.gz -n restored -d "Restored from backup"
372
431
  **Behavior:**
373
432
  - Extracts archive to `~/.claude-profiles/<name>/`
374
433
  - Uses filename as profile name if `--name` not specified
434
+ - Validates imported profile structure
435
+ - Rejects import if managed/copied items contain symlink targets outside profile directory (safety check)
375
436
  - Creates metadata entry for profile
376
437
  - Profile is ready to use immediately
377
438
 
@@ -403,7 +464,7 @@ csp diff current backup
403
464
  ```
404
465
  Comparing: staging ↔ production
405
466
 
406
- Symlink targets (source.json): identical
467
+ Managed item map (source.json): identical
407
468
 
408
469
  File differences:
409
470
  settings.json — different
@@ -412,10 +473,83 @@ File differences:
412
473
  ```
413
474
 
414
475
  **Behavior:**
415
- - Compares `source.json` (symlink targets)
476
+ - Compares `source.json` (managed item map)
416
477
  - Lists file presence and content differences
417
478
  - Shows which files differ and in which profile they exist
418
479
 
480
+ ---
481
+
482
+ ### deactivate
483
+
484
+ Deactivate the currently active non-default profile by switching back to the physical `default` snapshot.
485
+
486
+ ```bash
487
+ csp deactivate
488
+ ```
489
+
490
+ **Options:**
491
+ - `--no-save` — Skip saving current profile state before deactivation
492
+
493
+ **Behavior:**
494
+ 1. Exits early if no active profile or active profile is `default`
495
+ 2. Delegates to `csp use default`
496
+ 3. Optionally saves the current non-default profile state
497
+ 4. Restores the physical `default` snapshot into `~/.claude`
498
+ 5. Marks `default` as the active legacy profile
499
+
500
+ ---
501
+
502
+ ### launch (la)
503
+
504
+ Launch an isolated Claude session for a profile. This does **not** change global active profile. All extra arguments are forwarded to `claude`.
505
+
506
+ ```bash
507
+ csp launch <name> [claude-args...]
508
+ csp la <name> [claude-args...]
509
+ ```
510
+
511
+ **Options:**
512
+ - `--legacy-global` — Use old behavior (`csp use <name>` then launch)
513
+
514
+ **Examples:**
515
+
516
+ Launch isolated session:
517
+ ```bash
518
+ csp launch work
519
+ ```
520
+
521
+ Launch isolated with Claude flags:
522
+ ```bash
523
+ csp launch work --dangerously-skip-permissions
524
+ csp la dev --model opus
525
+ ```
526
+
527
+ Launch legacy/global mode:
528
+ ```bash
529
+ csp launch work --legacy-global
530
+ ```
531
+
532
+ **Behavior (default isolated mode):**
533
+ 1. Validates target profile exists
534
+ 2. Ensures the profile snapshot exists; for legacy installs missing `default/`, guarded backfill only runs when the active profile is `default` or no active profile is set
535
+ 3. Prepares per-profile runtime under `~/.claude-profiles/.runtime/<name>`
536
+ 4. Resolves effective allowlisted `ANTHROPIC_*` launch env (`ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL`) with precedence: `settings.json env` > profile `.env` allowlist > parent process env
537
+ 5. Strips inherited `CLAUDECODE`, inherited `CLAUDE_CONFIG_DIR`, inherited `ANTHROPIC_*`, and Claude session env vars before applying resolved allowlisted values
538
+ 6. Spawns `claude` with `CLAUDE_CONFIG_DIR=<runtimeDir>`
539
+ 7. Inherits stdin/stdout/stderr for interactive use
540
+ 8. Forwards Claude's exit code
541
+ 9. Keeps `.active` unchanged and never mutates global `~/.claude`
542
+ 10. Launching `default` preserves its `legacy` mode metadata even though it uses an isolated runtime snapshot
543
+
544
+ `ANTHROPIC_*` keys currently in isolated launch scope:
545
+ - `ANTHROPIC_AUTH_TOKEN`
546
+ - `ANTHROPIC_BASE_URL`
547
+ - `ANTHROPIC_MODEL`
548
+
549
+ Set `CSP_DEBUG_LAUNCH_ENV=1` to print extended launch diagnostics. Do not use in shared logs because it can include resolved `ANTHROPIC_*` values.
550
+
551
+ ---
552
+
419
553
  ### uninstall
420
554
 
421
555
  Remove all profiles and restore Claude Code to its pre-CSP state.
@@ -448,9 +582,10 @@ csp uninstall --force
448
582
 
449
583
  **Behavior:**
450
584
  1. Creates a final backup at `~/.claude-profiles/.backup/`
451
- 2. Restores the active profile (or `--profile` choice) to `~/.claude`
452
- 3. Removes `~/.claude-profiles/` entirely
453
- 4. Prints reminder to run `npm uninstall -g claude-switch-profile`
585
+ 2. Restores the active profile by default, or the `--profile` choice, to `~/.claude`
586
+ 3. If `default` is restored, it uses the physical `default` snapshot like any other profile
587
+ 4. Removes `~/.claude-profiles/` entirely
588
+ 5. Prints reminder to run `npm uninstall -g claude-switch-profile`
454
589
 
455
590
  ---
456
591
 
@@ -462,10 +597,13 @@ Profiles are stored in `~/.claude-profiles/`:
462
597
 
463
598
  ```
464
599
  ~/.claude-profiles/
465
- ├── .active # Current active profile name
466
- ├── profiles.json # Metadata for all profiles
600
+ ├── .active # Current active profile name (legacy use mode)
601
+ ├── profiles.json # Metadata for all profiles (v2 schema)
602
+ ├── .runtime/ # Isolated launch roots
603
+ │ ├── work/
604
+ │ └── personal/
467
605
  ├── default/
468
- │ ├── source.json # Symlink targets
606
+ │ ├── source.json # Managed item map
469
607
  │ ├── settings.json # Copied from ~/.claude
470
608
  │ ├── .env # Copied from ~/.claude
471
609
  │ ├── .ck.json # Copied from ~/.claude
@@ -480,56 +618,60 @@ Profiles are stored in `~/.claude-profiles/`:
480
618
 
481
619
  ### What Gets Managed
482
620
 
483
- **Symlinked Items** (via `source.json`):
621
+ **Managed Static Items** (via `source.json`):
484
622
  - `CLAUDE.md` — Project-specific Claude configuration
485
623
  - `rules/` — Development rules and guidelines
486
624
  - `agents/` — Agent scripts and configurations
487
625
  - `skills/` — Custom Luna skills
488
626
  - `hooks/` — Pre/post action hooks
489
- - `statusline.cjs` — Custom statusline
627
+ - `statusline.cjs`, `statusline.sh`, `statusline.ps1` — Custom statusline scripts
490
628
  - `.luna.json` — Luna configuration
491
629
 
492
630
  **Copied Files**:
493
631
  - `settings.json` — Editor settings
494
- - `.env` — Environment variables
495
- - `.ck.json` — Custom settings
496
- - `.ckignore` — Ignore patterns
632
+ - `.env`, `.env.example` — Environment variables
633
+ - `.ck.json`, `.ckignore` — Custom settings and ignore patterns
634
+ - `.mcp.json`, `.mcp.json.example` — MCP configuration
635
+ - `.gitignore` — Local ignore settings
497
636
 
498
637
  **Copied Directories**:
499
- - `commands/` — Custom commands
500
- - `plugins/` — Custom plugins
638
+ - `commands/`, `plugins/` — Custom commands/plugins
639
+ - `workflows/`, `scripts/` — Automation and workflow assets
640
+ - `output-styles/`, `schemas/` — Output and schema assets
501
641
 
502
642
  **Never Touched** (runtime/session data):
503
643
  - `.credentials.json`
504
- - `projects/`
505
- - `backups/`
506
- - `cache/`, `debug/`, `telemetry/`
507
- - `history.jsonl`
508
- - `plans/`, `todos/`, `tasks/`
509
- - `agent-memory/`, `session-env/`
510
- - All other session-specific data
644
+ - `projects/`, `sessions/`, `session-env/`, `ide/`
645
+ - `cache/`, `paste-cache/`, `downloads/`, `telemetry/`, `debug/`, `statsig/`
646
+ - `history.jsonl`, `metadata.json`, `stats-cache.json`, `active-plan`
647
+ - `backups/`, `command-archive/`, `commands-archived/`
648
+ - `plans/`, `todos/`, `tasks/`, `teams/`, `agent-memory/`, `file-history/`, `shell-snapshots/`
649
+ - All other protected or session-specific data
511
650
 
512
- ### Symlink vs. Copy Strategy
651
+ ### Legacy vs Isolated Launch Modes
513
652
 
514
- **Why symlinks for some items?**
515
- - Rules, agents, skills often live in external git repos
516
- - Multiple profiles may share the same rules/skills
517
- - Symlinks avoid duplication and keep everything in sync
653
+ CSP now supports two paths:
518
654
 
519
- **Why copies for others?**
520
- - Settings and env vars are environment-specific
521
- - Each profile needs its own independent configuration
522
- - Prevents accidental modifications from affecting other profiles
655
+ - **Legacy global mode (`csp use`)**
656
+ - Mutates `~/.claude`
657
+ - Updates `.active`
658
+ - Preserves old behavior for existing scripts
523
659
 
524
- ### Real Directory Handling
660
+ - **Isolated launch mode (`csp launch`)**
661
+ - Does not mutate `~/.claude`
662
+ - Does not change `.active`
663
+ - Creates/updates runtime root per profile at `~/.claude-profiles/.runtime/<name>`
664
+ - Launches Claude with `CLAUDE_CONFIG_DIR` pointing to that runtime root
525
665
 
526
- When `csp save` (or `csp use`) encounters a **real directory/file** in `~/.claude` for a managed item (instead of a symlink), it automatically:
666
+ ### Runtime Sync Policy (isolated launch)
527
667
 
528
- 1. **Moves** the real item into the profile directory (`~/.claude-profiles/<name>/<item>`)
529
- 2. **Replaces** it with a symlink at the original location
530
- 3. **Records** the new location in `source.json`
668
+ For each launch, CSP syncs static profile config into runtime root:
531
669
 
532
- This ensures that profiles created from a fresh `~/.claude` setup (before any symlinks exist) work correctly on first use.
670
+ - Managed items (`CLAUDE.md`, `rules`, `agents`, `skills`, `hooks`, statusline files, `.luna.json`)
671
+ - Copied files (`settings.json`, `.env`, `.ck.json`, `.ckignore`, etc.)
672
+ - Copied directories (`commands`, `plugins`, `workflows`, `scripts`, ...)
673
+
674
+ Runtime/account continuity stays isolated per runtime root and is not globally swapped.
533
675
 
534
676
  ## Safety Features
535
677
 
@@ -561,7 +703,7 @@ Every profile switch creates a timestamped backup:
561
703
  └── ...
562
704
  ```
563
705
 
564
- Backups are kept indefinitely. You can manually restore by copying from backup directory.
706
+ Backups are pruned automatically; CSP keeps only the 2 most recent backups. You can manually restore by copying from backup directory.
565
707
 
566
708
  ### Claude Process Detection
567
709
 
@@ -573,18 +715,19 @@ When switching profiles, CSP detects if Claude Code is running:
573
715
 
574
716
  **Important:** Changes only take effect after restarting Claude Code.
575
717
 
718
+ ### Windows Support
719
+
720
+ Process detection uses `tasklist` instead of `pgrep` on Windows.
721
+
722
+ Export/import commands use the built-in `tar.exe` available on Windows 10+.
723
+
576
724
  ### Validation
577
725
 
578
726
  Before switching, CSP validates:
579
727
  1. Target profile exists
580
728
  2. Profile structure is valid
581
- 3. (Optional with `--force`) Symlink targets are accessible
582
-
583
- Use `--force` to proceed even if validation fails:
584
729
 
585
- ```bash
586
- csp use legacy --force
587
- ```
730
+ During import, CSP also validates profile contents and rejects unsafe symlinks that point outside the imported profile tree.
588
731
 
589
732
  ## Configuration via Environment Variables
590
733
 
@@ -643,7 +786,7 @@ csp use personal # Switch to personal
643
786
 
644
787
  ```bash
645
788
  # Clone current profile
646
- csp create experimental --from current -d "Testing new Luna skills"
789
+ csp create experimental --from default -d "Testing new Luna skills"
647
790
 
648
791
  # Switch and experiment
649
792
  csp use experimental
@@ -707,15 +850,14 @@ csp list
707
850
  csp use production # if "production" exists
708
851
  ```
709
852
 
710
- ### Cannot delete active profile
853
+ ### Cannot delete default profile
711
854
 
712
- **Error:** `Cannot delete active profile "default". Switch to another profile first.`
855
+ **Error:** `Cannot delete the default profile.`
713
856
 
714
- **Solution:** Switch to a different profile before deleting.
857
+ **Solution:** Keep `default` and delete only non-default profiles.
715
858
 
716
859
  ```bash
717
- csp use production
718
- csp delete default
860
+ csp delete experimental
719
861
  ```
720
862
 
721
863
  ### Stale lock file
@@ -728,15 +870,11 @@ csp delete default
728
870
  rm ~/.claude-profiles/.lock
729
871
  ```
730
872
 
731
- ### Symlink targets missing
732
-
733
- **Warning:** `Some symlink targets are missing: rules/development-rules.md — missing target`
873
+ ### Invalid profile structure
734
874
 
735
- **Solution:** Either restore the missing files to their original location or use `--force`:
875
+ **Error:** `Profile "name" is invalid: Missing source.json no managed items defined`
736
876
 
737
- ```bash
738
- csp use production --force
739
- ```
877
+ **Solution:** Recreate the profile or import a valid profile archive.
740
878
 
741
879
  ### Changes not applying
742
880
 
@@ -775,17 +913,26 @@ See [CHANGELOG.md](CHANGELOG.md) for version history and migration guidance.
775
913
  │ │ ├── init.js
776
914
  │ │ ├── current.js
777
915
  │ │ ├── list.js
916
+ │ │ ├── status.js
778
917
  │ │ ├── create.js
779
918
  │ │ ├── save.js
780
919
  │ │ ├── use.js
920
+ │ │ ├── toggle.js
781
921
  │ │ ├── delete.js
782
922
  │ │ ├── export.js
783
923
  │ │ ├── import.js
784
- │ │ └── diff.js
924
+ │ │ ├── diff.js
925
+ │ │ ├── select.js
926
+ │ │ ├── launch.js
927
+ │ │ ├── deactivate.js
928
+ │ │ └── uninstall.js
785
929
  │ ├── constants.js # Configuration constants
930
+ │ ├── platform.js # Cross-platform compatibility
786
931
  │ ├── profile-store.js # Profile metadata management
787
- │ ├── symlink-manager.js # Symlink operations
932
+ │ ├── runtime-instance-manager.js # Isolated runtime sync
933
+ │ ├── item-manager.js # Managed item copy/move operations
788
934
  │ ├── file-operations.js # File copy/restore operations
935
+ │ ├── launch-effective-env-resolver.js # ANTHROPIC_* launch env resolution
789
936
  │ ├── safety.js # Locking, backups, validation
790
937
  │ ├── profile-validator.js # Profile validation
791
938
  │ └── output-helpers.js # Console output formatting