claude-switch-profile 1.0.1 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-switch-profile",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool for managing multiple Claude Code profiles",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,9 +1,8 @@
1
1
  import { mkdirSync, cpSync, existsSync, writeFileSync, readdirSync } from 'node:fs';
2
2
  import { join, resolve } from 'node:path';
3
3
  import { addProfile, getActive, setActive, profileExists, getProfileDir } from '../profile-store.js';
4
- import { saveSymlinks } from '../symlink-manager.js';
5
4
  import { saveFiles } from '../file-operations.js';
6
- import { SYMLINK_ITEMS, SOURCE_FILE } from '../constants.js';
5
+ import { SYMLINK_ITEMS, SYMLINK_DIRS, SOURCE_FILE } from '../constants.js';
7
6
  import { success, error, info, warn } from '../output-helpers.js';
8
7
 
9
8
  export const createCommand = (name, options) => {
@@ -53,11 +52,21 @@ export const createCommand = (name, options) => {
53
52
  // Also copy current mutable files
54
53
  saveFiles(profileDir);
55
54
  } else {
56
- // Create from current ~/.claude state
55
+ // Create brand new independent profile — everything fresh, nothing copied
57
56
  mkdirSync(profileDir, { recursive: true });
58
- saveSymlinks(profileDir);
59
- saveFiles(profileDir);
60
- info('Captured current Claude Code configuration');
57
+
58
+ // Create self-contained directories for each symlink directory item
59
+ const sourceMap = {};
60
+ for (const item of SYMLINK_DIRS) {
61
+ const itemDir = join(profileDir, item);
62
+ mkdirSync(itemDir, { recursive: true });
63
+ sourceMap[item] = itemDir;
64
+ }
65
+
66
+ writeFileSync(join(profileDir, SOURCE_FILE), JSON.stringify(sourceMap, null, 2) + '\n');
67
+ // Do NOT call saveFiles() — new profile should start clean
68
+ // without inheriting settings.json, .env, .ck*, etc. from current state
69
+ info('Created new independent profile (clean state)');
61
70
  }
62
71
 
63
72
  addProfile(name, { description: options.description || '' });
package/src/constants.js CHANGED
@@ -24,6 +24,9 @@ export const SYMLINK_ITEMS = [
24
24
  '.luna.json',
25
25
  ];
26
26
 
27
+ // Directory-type symlink items (auto-created in new profiles)
28
+ export const SYMLINK_DIRS = ['rules', 'agents', 'skills', 'hooks'];
29
+
27
30
  // Mutable files managed via copy
28
31
  export const COPY_ITEMS = [
29
32
  'settings.json',
package/src/safety.js CHANGED
@@ -5,7 +5,7 @@ import { PROFILES_DIR, LOCK_FILE, BACKUP_DIR, CLAUDE_DIR, COPY_ITEMS, COPY_DIRS
5
5
  import { readCurrentSymlinks } from './symlink-manager.js';
6
6
  import { warn } from './output-helpers.js';
7
7
 
8
- const MAX_BACKUPS = 5;
8
+ const MAX_BACKUPS = 2;
9
9
 
10
10
  // Acquire a lock file — atomic O_EXCL prevents TOCTOU race
11
11
  export const acquireLock = () => {