claude-switch-profile 1.4.14 → 1.4.16
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
name: Release on
|
|
1
|
+
name: Release on push to main
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
types: [closed]
|
|
4
|
+
push:
|
|
6
5
|
branches: [main]
|
|
7
6
|
|
|
8
7
|
permissions:
|
|
@@ -10,7 +9,6 @@ permissions:
|
|
|
10
9
|
|
|
11
10
|
jobs:
|
|
12
11
|
release:
|
|
13
|
-
if: github.event.pull_request.merged == true
|
|
14
12
|
runs-on: ubuntu-latest
|
|
15
13
|
|
|
16
14
|
steps:
|
package/package.json
CHANGED
package/src/commands/create.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { mkdirSync, cpSync, existsSync, writeFileSync
|
|
1
|
+
import { mkdirSync, cpSync, existsSync, writeFileSync } 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 { saveFiles
|
|
5
|
-
import { CLAUDE_DIR, MANAGED_ITEMS, MANAGED_DIRS,
|
|
4
|
+
import { saveFiles } from '../file-operations.js';
|
|
5
|
+
import { CLAUDE_DIR, MANAGED_ITEMS, MANAGED_DIRS, COPY_DIRS, SOURCE_FILE } from '../constants.js';
|
|
6
6
|
import { success, error, info, warn } from '../output-helpers.js';
|
|
7
7
|
|
|
8
8
|
export const createCommand = (name, options) => {
|
|
@@ -68,46 +68,36 @@ export const createCommand = (name, options) => {
|
|
|
68
68
|
// Also copy current mutable files
|
|
69
69
|
saveFiles(profileDir);
|
|
70
70
|
} else {
|
|
71
|
-
// Create new profile —
|
|
71
|
+
// Create new profile — fully stubbed so `csp use` can cleanly overwrite ~/.claude
|
|
72
72
|
mkdirSync(profileDir, { recursive: true });
|
|
73
73
|
|
|
74
74
|
const sourceMap = {};
|
|
75
|
-
let entries;
|
|
76
|
-
try {
|
|
77
|
-
entries = readdirSync(CLAUDE_DIR);
|
|
78
|
-
} catch {
|
|
79
|
-
entries = [];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (const entry of entries) {
|
|
83
|
-
if (NEVER_CLONE.includes(entry)) continue;
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
// MANAGED_DIRS → empty directories (rules, agents, skills, hooks)
|
|
77
|
+
for (const item of MANAGED_DIRS) {
|
|
78
|
+
const itemDir = join(profileDir, item);
|
|
79
|
+
mkdirSync(itemDir, { recursive: true });
|
|
80
|
+
sourceMap[item] = itemDir;
|
|
81
|
+
}
|
|
89
82
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
// MANAGED_FILES → empty file stubs (CLAUDE.md, statusline.*, .luna.json)
|
|
84
|
+
// These must exist so moveItemsToClaude can overwrite the old profile's copies
|
|
85
|
+
const managedFiles = MANAGED_ITEMS.filter((item) => !MANAGED_DIRS.includes(item));
|
|
86
|
+
for (const item of managedFiles) {
|
|
87
|
+
const dest = join(profileDir, item);
|
|
88
|
+
writeFileSync(dest, item.endsWith('.json') ? '{\n}\n' : '');
|
|
89
|
+
sourceMap[item] = dest;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
mkdirSync(itemDir, { recursive: true });
|
|
101
|
-
sourceMap[item] = itemDir;
|
|
102
|
-
}
|
|
92
|
+
// COPY_DIRS → empty directories (commands, plugins, workflows, scripts, …)
|
|
93
|
+
// These must exist so moveDirsToClaude can overwrite the old profile's dirs
|
|
94
|
+
for (const dir of COPY_DIRS) {
|
|
95
|
+
mkdirSync(join(profileDir, dir), { recursive: true });
|
|
103
96
|
}
|
|
104
97
|
|
|
105
98
|
writeFileSync(join(profileDir, SOURCE_FILE), JSON.stringify(sourceMap, null, 2) + '\n');
|
|
106
99
|
|
|
107
|
-
|
|
108
|
-
updateSettingsPaths(profileDir, 'save');
|
|
109
|
-
|
|
110
|
-
info('Created new profile (full clone of current state)');
|
|
100
|
+
info('Created new profile (empty — all stubs initialised)');
|
|
111
101
|
}
|
|
112
102
|
|
|
113
103
|
addProfile(name, { description: options.description || '', mode: 'account-session' });
|