claude-switch-profile 1.4.13 → 1.4.15
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,45 @@
|
|
|
1
|
+
name: Release on merge to main
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [closed]
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
if: github.event.pull_request.merged == true
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout main
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
ref: main
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: 20
|
|
27
|
+
cache: npm
|
|
28
|
+
|
|
29
|
+
- name: Configure git user
|
|
30
|
+
run: |
|
|
31
|
+
git config user.name "github-actions[bot]"
|
|
32
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
33
|
+
|
|
34
|
+
- name: Configure npm auth
|
|
35
|
+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
36
|
+
env:
|
|
37
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: npm ci
|
|
41
|
+
|
|
42
|
+
- name: Run release script
|
|
43
|
+
run: npm run release
|
|
44
|
+
env:
|
|
45
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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, SOURCE_FILE
|
|
4
|
+
import { saveFiles } from '../file-operations.js';
|
|
5
|
+
import { CLAUDE_DIR, MANAGED_ITEMS, MANAGED_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,21 @@ 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 — empty by default
|
|
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
|
-
|
|
85
|
-
const src = join(CLAUDE_DIR, entry);
|
|
86
|
-
try {
|
|
87
|
-
const dest = join(profileDir, entry);
|
|
88
|
-
cpSync(src, dest, { recursive: true, verbatimSymlinks: true });
|
|
89
75
|
|
|
90
|
-
|
|
91
|
-
sourceMap[entry] = dest;
|
|
92
|
-
}
|
|
93
|
-
} catch { /* skip unreadable items */ }
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Ensure empty dirs for any missing MANAGED_DIRS
|
|
76
|
+
// Ensure empty dirs for MANAGED_DIRS
|
|
97
77
|
for (const item of MANAGED_DIRS) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
sourceMap[item] = itemDir;
|
|
102
|
-
}
|
|
78
|
+
const itemDir = join(profileDir, item);
|
|
79
|
+
mkdirSync(itemDir, { recursive: true });
|
|
80
|
+
sourceMap[item] = itemDir;
|
|
103
81
|
}
|
|
104
82
|
|
|
105
83
|
writeFileSync(join(profileDir, SOURCE_FILE), JSON.stringify(sourceMap, null, 2) + '\n');
|
|
106
84
|
|
|
107
|
-
|
|
108
|
-
updateSettingsPaths(profileDir, 'save');
|
|
109
|
-
|
|
110
|
-
info('Created new profile (full clone of current state)');
|
|
85
|
+
info('Created new profile (empty by default)');
|
|
111
86
|
}
|
|
112
87
|
|
|
113
88
|
addProfile(name, { description: options.description || '', mode: 'account-session' });
|