claudekit-cli 4.3.1-dev.18 → 4.3.1-dev.19
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/bin/postinstall-hook-restore.cjs +151 -0
- package/bin/postinstall-self-heal.cjs +13 -1
- package/cli-manifest.json +2 -2
- package/dist/index.js +53 -52
- package/package.json +2 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const os = require("node:os");
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
const { spawnSync } = require("node:child_process");
|
|
8
|
+
|
|
9
|
+
const MAX_SETTINGS_BYTES = 5 * 1024 * 1024;
|
|
10
|
+
const SAFE_KIT_NAMES = new Set(["engineer", "marketing"]);
|
|
11
|
+
|
|
12
|
+
function getHomeDir() {
|
|
13
|
+
return process.env.CK_TEST_HOME || os.homedir();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function readJsonFile(filePath) {
|
|
17
|
+
try {
|
|
18
|
+
if (!filePath || !fs.existsSync(filePath)) return null;
|
|
19
|
+
const stat = fs.statSync(filePath);
|
|
20
|
+
if (!stat.isFile() || stat.size > MAX_SETTINGS_BYTES) return null;
|
|
21
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8").replace(/^\uFEFF/, ""));
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalizeCommand(command) {
|
|
28
|
+
if (!command) return "";
|
|
29
|
+
let normalized = String(command).replace(/"/g, "");
|
|
30
|
+
normalized = normalized.replace(/~\//g, "$HOME/");
|
|
31
|
+
normalized = normalized.replace(/\$\{HOME\}/g, "$HOME");
|
|
32
|
+
normalized = normalized.replace(/\$CLAUDE_PROJECT_DIR/g, "$HOME");
|
|
33
|
+
normalized = normalized.replace(/%USERPROFILE%/g, "$HOME");
|
|
34
|
+
normalized = normalized.replace(/%CLAUDE_PROJECT_DIR%/g, "$HOME");
|
|
35
|
+
normalized = normalized.replace(/(^|\s)(?:\.\/)?\.claude\//g, "$1$HOME/.claude/");
|
|
36
|
+
normalized = normalized.replace(/\\/g, "/");
|
|
37
|
+
return normalized.replace(/\s+/g, " ").trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function collectHookCommands(settings) {
|
|
41
|
+
const commands = new Set();
|
|
42
|
+
for (const entries of Object.values(settings?.hooks || {})) {
|
|
43
|
+
if (!Array.isArray(entries)) continue;
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
if (typeof entry?.command === "string") commands.add(normalizeCommand(entry.command));
|
|
46
|
+
if (!Array.isArray(entry?.hooks)) continue;
|
|
47
|
+
for (const hook of entry.hooks) {
|
|
48
|
+
if (typeof hook?.command === "string") commands.add(normalizeCommand(hook.command));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return commands;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function extractCkHookName(command) {
|
|
56
|
+
if (!String(command || "").trim().startsWith("node ")) return null;
|
|
57
|
+
const normalized = String(command).replace(/\\/g, "/");
|
|
58
|
+
const match = normalized.match(/\/hooks\/([^/"'\s]+)\.(?:cjs|mjs|js)(?:["'\s]|$)/);
|
|
59
|
+
return match?.[1] || null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function installedHookCommands(config) {
|
|
63
|
+
return Object.values(config?.kits || {}).flatMap((entry) =>
|
|
64
|
+
Array.isArray(entry?.installedSettings?.hooks) ? entry.installedSettings.hooks : [],
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function countMissingCkHookRegistrations(claudeDir) {
|
|
69
|
+
const settings = readJsonFile(path.join(claudeDir, "settings.json"));
|
|
70
|
+
const config = readJsonFile(path.join(claudeDir, ".ck.json"));
|
|
71
|
+
if (!settings || !config) return 0;
|
|
72
|
+
|
|
73
|
+
const existingCommands = collectHookCommands(settings);
|
|
74
|
+
const disabledHooks = new Set(
|
|
75
|
+
Object.entries(config.hooks || {})
|
|
76
|
+
.filter(([, enabled]) => enabled === false)
|
|
77
|
+
.map(([name]) => name),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
let missing = 0;
|
|
81
|
+
for (const command of installedHookCommands(config)) {
|
|
82
|
+
const hookName = extractCkHookName(command);
|
|
83
|
+
if (hookName && disabledHooks.has(hookName)) continue;
|
|
84
|
+
if (!existingCommands.has(normalizeCommand(command))) missing++;
|
|
85
|
+
}
|
|
86
|
+
return missing;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function normalizeKitName(name) {
|
|
90
|
+
const normalized = String(name || "").toLowerCase();
|
|
91
|
+
if (normalized.includes("engineer")) return "engineer";
|
|
92
|
+
if (normalized.includes("marketing")) return "marketing";
|
|
93
|
+
return SAFE_KIT_NAMES.has(normalized) ? normalized : null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getInstalledKit(claudeDir) {
|
|
97
|
+
const metadata = readJsonFile(path.join(claudeDir, "metadata.json"));
|
|
98
|
+
const metadataKit = normalizeKitName(Object.keys(metadata?.kits || {})[0] || metadata?.name);
|
|
99
|
+
if (metadataKit) {
|
|
100
|
+
const kitVersion = metadata?.kits?.[metadataKit]?.version || metadata?.version || "";
|
|
101
|
+
return { kit: metadataKit, isBeta: String(kitVersion).includes("beta") };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const config = readJsonFile(path.join(claudeDir, ".ck.json"));
|
|
105
|
+
const configKit = normalizeKitName(Object.keys(config?.kits || {})[0]);
|
|
106
|
+
return configKit ? { kit: configKit, isBeta: false } : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function collectCandidateClaudeDirs(settingsFiles) {
|
|
110
|
+
const dirs = new Set();
|
|
111
|
+
for (const settingsFile of settingsFiles) dirs.add(path.dirname(settingsFile));
|
|
112
|
+
return [...dirs];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function resolveCkEntrypoint() {
|
|
116
|
+
return process.env.CK_POSTINSTALL_CK_BIN || path.join(__dirname, "ck.js");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function restoreMissingHookRegistrations(settingsFiles) {
|
|
120
|
+
if (process.env.CK_POSTINSTALL_SKIP_RESTORE_CK_HOOKS === "1") return 0;
|
|
121
|
+
|
|
122
|
+
let restored = 0;
|
|
123
|
+
for (const claudeDir of collectCandidateClaudeDirs(settingsFiles)) {
|
|
124
|
+
const missing = countMissingCkHookRegistrations(claudeDir);
|
|
125
|
+
if (missing <= 0) continue;
|
|
126
|
+
|
|
127
|
+
const installedKit = getInstalledKit(claudeDir);
|
|
128
|
+
if (!installedKit?.kit) continue;
|
|
129
|
+
|
|
130
|
+
const homeDir = getHomeDir();
|
|
131
|
+
const globalClaudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(homeDir, ".claude");
|
|
132
|
+
const isGlobal = path.resolve(claudeDir) === path.resolve(globalClaudeDir);
|
|
133
|
+
const args = [resolveCkEntrypoint(), "init"];
|
|
134
|
+
if (isGlobal) args.push("-g");
|
|
135
|
+
args.push("--kit", installedKit.kit, "--yes", "--restore-ck-hooks", "--install-skills");
|
|
136
|
+
if (installedKit.isBeta) args.push("--beta");
|
|
137
|
+
|
|
138
|
+
const result = spawnSync(process.execPath, args, {
|
|
139
|
+
env: { ...process.env, CK_POSTINSTALL_SKIP_RESTORE_CK_HOOKS: "1" },
|
|
140
|
+
stdio: process.env.CK_POSTINSTALL_DEBUG === "1" ? "inherit" : "ignore",
|
|
141
|
+
});
|
|
142
|
+
if (result.status === 0) restored += missing;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return restored;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module.exports = {
|
|
149
|
+
countMissingCkHookRegistrations,
|
|
150
|
+
restoreMissingHookRegistrations,
|
|
151
|
+
};
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const os = require("node:os");
|
|
6
6
|
const path = require("node:path");
|
|
7
|
+
const {
|
|
8
|
+
countMissingCkHookRegistrations,
|
|
9
|
+
restoreMissingHookRegistrations,
|
|
10
|
+
} = require("./postinstall-hook-restore.cjs");
|
|
7
11
|
|
|
8
12
|
const MAX_SETTINGS_BYTES = 5 * 1024 * 1024;
|
|
9
13
|
|
|
@@ -124,20 +128,28 @@ function collectCandidateSettingsFiles() {
|
|
|
124
128
|
|
|
125
129
|
function main() {
|
|
126
130
|
let pruned = 0;
|
|
127
|
-
|
|
131
|
+
const settingsFiles = collectCandidateSettingsFiles();
|
|
132
|
+
for (const filePath of settingsFiles) {
|
|
128
133
|
pruned += pruneSettingsFile(filePath);
|
|
129
134
|
}
|
|
130
135
|
|
|
136
|
+
const restored = restoreMissingHookRegistrations(settingsFiles);
|
|
137
|
+
|
|
131
138
|
if (pruned > 0 && process.env.CK_POSTINSTALL_DEBUG === "1") {
|
|
132
139
|
console.warn(`[claudekit-cli] Pruned ${pruned} legacy hook prompt(s)`);
|
|
133
140
|
}
|
|
141
|
+
if (restored > 0 && process.env.CK_POSTINSTALL_DEBUG === "1") {
|
|
142
|
+
console.warn(`[claudekit-cli] Restored ${restored} missing hook registration(s)`);
|
|
143
|
+
}
|
|
134
144
|
}
|
|
135
145
|
|
|
136
146
|
main();
|
|
137
147
|
|
|
138
148
|
module.exports = {
|
|
139
149
|
collectCandidateSettingsFiles,
|
|
150
|
+
countMissingCkHookRegistrations,
|
|
140
151
|
isLegacyDescriptiveNamePrompt,
|
|
141
152
|
pruneHooks,
|
|
142
153
|
pruneSettingsFile,
|
|
154
|
+
restoreMissingHookRegistrations,
|
|
143
155
|
};
|
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -12941,8 +12941,8 @@ function getCliVersion() {
|
|
|
12941
12941
|
return "unknown";
|
|
12942
12942
|
}
|
|
12943
12943
|
}
|
|
12944
|
-
async function migrateLegacyRegistry() {
|
|
12945
|
-
const { legacyRegistryPath } =
|
|
12944
|
+
async function migrateLegacyRegistry(paths = getPortableRegistryPaths()) {
|
|
12945
|
+
const { legacyRegistryPath } = paths;
|
|
12946
12946
|
try {
|
|
12947
12947
|
const content = await readFile2(legacyRegistryPath, "utf-8");
|
|
12948
12948
|
const data = JSON.parse(content);
|
|
@@ -13051,15 +13051,15 @@ async function repairStaleRegistryV3(registry) {
|
|
|
13051
13051
|
appliedManifestVersion: registry.appliedManifestVersion
|
|
13052
13052
|
});
|
|
13053
13053
|
}
|
|
13054
|
-
async function persistCurrentStaleRegistryV3Repair(preparedRepair) {
|
|
13055
|
-
return withRegistryLock(async () => {
|
|
13056
|
-
const { registryPath } =
|
|
13054
|
+
async function persistCurrentStaleRegistryV3Repair(preparedRepair, paths = getPortableRegistryPaths()) {
|
|
13055
|
+
return withRegistryLock(async (lockedPaths) => {
|
|
13056
|
+
const { registryPath } = lockedPaths;
|
|
13057
13057
|
let content;
|
|
13058
13058
|
try {
|
|
13059
13059
|
content = await readFile2(registryPath, "utf-8");
|
|
13060
13060
|
} catch (error) {
|
|
13061
13061
|
if (isErrnoCode(error, "ENOENT")) {
|
|
13062
|
-
return readPortableRegistryInternal({ persistStaleV3Repair: false });
|
|
13062
|
+
return readPortableRegistryInternal({ persistStaleV3Repair: false }, lockedPaths);
|
|
13063
13063
|
}
|
|
13064
13064
|
throw error;
|
|
13065
13065
|
}
|
|
@@ -13075,20 +13075,20 @@ async function persistCurrentStaleRegistryV3Repair(preparedRepair) {
|
|
|
13075
13075
|
}
|
|
13076
13076
|
const repairableV3Result = RepairablePortableRegistrySchemaV3.safeParse(data);
|
|
13077
13077
|
if (!repairableV3Result.success) {
|
|
13078
|
-
return readPortableRegistryInternal({ persistStaleV3Repair: false });
|
|
13078
|
+
return readPortableRegistryInternal({ persistStaleV3Repair: false }, lockedPaths);
|
|
13079
13079
|
}
|
|
13080
13080
|
const repairedRegistry = preparedRepair && preparedRepair.sourceContent === content ? preparedRepair.repairedRegistry : await repairStaleRegistryV3(repairableV3Result.data);
|
|
13081
|
-
if (await isMigrationLocked()) {
|
|
13081
|
+
if (await isMigrationLocked(lockedPaths)) {
|
|
13082
13082
|
logger.verbose("Migration in progress by another process, using repaired v3 view");
|
|
13083
13083
|
return repairedRegistry;
|
|
13084
13084
|
}
|
|
13085
13085
|
logger.verbose("Repairing stale portable registry v3.0 fields");
|
|
13086
|
-
await writePortableRegistry(repairedRegistry);
|
|
13086
|
+
await writePortableRegistry(repairedRegistry, lockedPaths);
|
|
13087
13087
|
return repairedRegistry;
|
|
13088
|
-
});
|
|
13088
|
+
}, paths);
|
|
13089
13089
|
}
|
|
13090
|
-
async function isMigrationLocked() {
|
|
13091
|
-
const { migrationLockPath } =
|
|
13090
|
+
async function isMigrationLocked(paths = getPortableRegistryPaths()) {
|
|
13091
|
+
const { migrationLockPath } = paths;
|
|
13092
13092
|
try {
|
|
13093
13093
|
const lockContent = await readFile2(migrationLockPath, "utf-8");
|
|
13094
13094
|
const lockTime = Number.parseInt(lockContent, 10);
|
|
@@ -13112,16 +13112,16 @@ async function isMigrationLocked() {
|
|
|
13112
13112
|
return true;
|
|
13113
13113
|
}
|
|
13114
13114
|
}
|
|
13115
|
-
async function createMigrationLock() {
|
|
13116
|
-
const { migrationLockPath } =
|
|
13115
|
+
async function createMigrationLock(paths = getPortableRegistryPaths()) {
|
|
13116
|
+
const { migrationLockPath } = paths;
|
|
13117
13117
|
const lockDir = dirname(migrationLockPath);
|
|
13118
13118
|
if (!existsSync3(lockDir)) {
|
|
13119
13119
|
await mkdir(lockDir, { recursive: true });
|
|
13120
13120
|
}
|
|
13121
13121
|
await writeFile(migrationLockPath, Date.now().toString(), "utf-8");
|
|
13122
13122
|
}
|
|
13123
|
-
async function removeMigrationLock() {
|
|
13124
|
-
const { migrationLockPath } =
|
|
13123
|
+
async function removeMigrationLock(paths = getPortableRegistryPaths()) {
|
|
13124
|
+
const { migrationLockPath } = paths;
|
|
13125
13125
|
try {
|
|
13126
13126
|
await unlink(migrationLockPath);
|
|
13127
13127
|
} catch {}
|
|
@@ -13129,8 +13129,8 @@ async function removeMigrationLock() {
|
|
|
13129
13129
|
async function readPortableRegistry() {
|
|
13130
13130
|
return readPortableRegistryInternal({ persistStaleV3Repair: true });
|
|
13131
13131
|
}
|
|
13132
|
-
async function readPortableRegistryInternal(options2) {
|
|
13133
|
-
const { registryPath } =
|
|
13132
|
+
async function readPortableRegistryInternal(options2, paths = getPortableRegistryPaths()) {
|
|
13133
|
+
const { registryPath } = paths;
|
|
13134
13134
|
try {
|
|
13135
13135
|
const content = await readFile2(registryPath, "utf-8");
|
|
13136
13136
|
let data;
|
|
@@ -13149,59 +13149,59 @@ async function readPortableRegistryInternal(options2) {
|
|
|
13149
13149
|
if (!options2.persistStaleV3Repair) {
|
|
13150
13150
|
return repairedRegistry;
|
|
13151
13151
|
}
|
|
13152
|
-
if (await isMigrationLocked()) {
|
|
13152
|
+
if (await isMigrationLocked(paths)) {
|
|
13153
13153
|
logger.verbose("Migration in progress by another process, using repaired v3 view");
|
|
13154
13154
|
return repairedRegistry;
|
|
13155
13155
|
}
|
|
13156
13156
|
return persistCurrentStaleRegistryV3Repair({
|
|
13157
13157
|
sourceContent: content,
|
|
13158
13158
|
repairedRegistry
|
|
13159
|
-
});
|
|
13159
|
+
}, paths);
|
|
13160
13160
|
}
|
|
13161
13161
|
const v2Result = PortableRegistrySchema.safeParse(data);
|
|
13162
13162
|
if (!v2Result.success) {
|
|
13163
13163
|
throw new Error("portable-registry.json has unsupported schema/version");
|
|
13164
13164
|
}
|
|
13165
|
-
if (await isMigrationLocked()) {
|
|
13165
|
+
if (await isMigrationLocked(paths)) {
|
|
13166
13166
|
logger.verbose("Migration in progress by another process, using in-memory v2→v3 view");
|
|
13167
13167
|
return normalizePortableRegistryChecksums(await migrateRegistryV2ToV3(v2Result.data));
|
|
13168
13168
|
}
|
|
13169
13169
|
logger.verbose("Auto-migrating registry from v2.0 to v3.0");
|
|
13170
|
-
await createMigrationLock();
|
|
13170
|
+
await createMigrationLock(paths);
|
|
13171
13171
|
try {
|
|
13172
13172
|
const v3Registry = normalizePortableRegistryChecksums(await migrateRegistryV2ToV3(v2Result.data));
|
|
13173
|
-
await writePortableRegistry(v3Registry);
|
|
13173
|
+
await writePortableRegistry(v3Registry, paths);
|
|
13174
13174
|
return v3Registry;
|
|
13175
13175
|
} finally {
|
|
13176
|
-
await removeMigrationLock();
|
|
13176
|
+
await removeMigrationLock(paths);
|
|
13177
13177
|
}
|
|
13178
13178
|
} catch (error) {
|
|
13179
13179
|
if (!isErrnoCode(error, "ENOENT")) {
|
|
13180
13180
|
throw error;
|
|
13181
13181
|
}
|
|
13182
13182
|
}
|
|
13183
|
-
const migratedV2 = await migrateLegacyRegistry();
|
|
13183
|
+
const migratedV2 = await migrateLegacyRegistry(paths);
|
|
13184
13184
|
if (migratedV2) {
|
|
13185
|
-
if (await isMigrationLocked()) {
|
|
13185
|
+
if (await isMigrationLocked(paths)) {
|
|
13186
13186
|
logger.verbose("Migration in progress by another process, using in-memory v2→v3 view");
|
|
13187
13187
|
return normalizePortableRegistryChecksums(await migrateRegistryV2ToV3(migratedV2));
|
|
13188
13188
|
}
|
|
13189
|
-
await createMigrationLock();
|
|
13189
|
+
await createMigrationLock(paths);
|
|
13190
13190
|
try {
|
|
13191
13191
|
const v3Registry = normalizePortableRegistryChecksums(await migrateRegistryV2ToV3(migratedV2));
|
|
13192
|
-
await writePortableRegistry(v3Registry);
|
|
13192
|
+
await writePortableRegistry(v3Registry, paths);
|
|
13193
13193
|
return v3Registry;
|
|
13194
13194
|
} finally {
|
|
13195
|
-
await removeMigrationLock();
|
|
13195
|
+
await removeMigrationLock(paths);
|
|
13196
13196
|
}
|
|
13197
13197
|
}
|
|
13198
13198
|
return { version: "3.0", installations: [] };
|
|
13199
13199
|
}
|
|
13200
|
-
async function readPortableRegistryWithinRegistryLock() {
|
|
13201
|
-
return readPortableRegistryInternal({ persistStaleV3Repair: false });
|
|
13200
|
+
async function readPortableRegistryWithinRegistryLock(paths) {
|
|
13201
|
+
return readPortableRegistryInternal({ persistStaleV3Repair: false }, paths);
|
|
13202
13202
|
}
|
|
13203
|
-
async function writePortableRegistry(registry) {
|
|
13204
|
-
const { registryPath } =
|
|
13203
|
+
async function writePortableRegistry(registry, paths = getPortableRegistryPaths()) {
|
|
13204
|
+
const { registryPath } = paths;
|
|
13205
13205
|
const dir = dirname(registryPath);
|
|
13206
13206
|
if (!existsSync3(dir)) {
|
|
13207
13207
|
await mkdir(dir, { recursive: true });
|
|
@@ -13218,8 +13218,8 @@ async function writePortableRegistry(registry) {
|
|
|
13218
13218
|
throw error;
|
|
13219
13219
|
}
|
|
13220
13220
|
}
|
|
13221
|
-
async function withRegistryLock(operation) {
|
|
13222
|
-
const { registryLockPath } =
|
|
13221
|
+
async function withRegistryLock(operation, paths = getPortableRegistryPaths()) {
|
|
13222
|
+
const { registryLockPath } = paths;
|
|
13223
13223
|
const lockDir = dirname(registryLockPath);
|
|
13224
13224
|
if (!existsSync3(lockDir)) {
|
|
13225
13225
|
await mkdir(lockDir, { recursive: true });
|
|
@@ -13237,14 +13237,14 @@ async function withRegistryLock(operation) {
|
|
|
13237
13237
|
}
|
|
13238
13238
|
});
|
|
13239
13239
|
try {
|
|
13240
|
-
return await operation();
|
|
13240
|
+
return await operation(paths);
|
|
13241
13241
|
} finally {
|
|
13242
13242
|
await release();
|
|
13243
13243
|
}
|
|
13244
13244
|
}
|
|
13245
13245
|
async function addPortableInstallation(item, type, provider, global2, path2, sourcePath, options2) {
|
|
13246
|
-
await withRegistryLock(async () => {
|
|
13247
|
-
const registry = await readPortableRegistryWithinRegistryLock();
|
|
13246
|
+
await withRegistryLock(async (lockedPaths) => {
|
|
13247
|
+
const registry = await readPortableRegistryWithinRegistryLock(lockedPaths);
|
|
13248
13248
|
registry.installations = registry.installations.filter((i) => !(i.item === item && i.type === type && i.provider === provider && i.global === global2));
|
|
13249
13249
|
registry.installations.push({
|
|
13250
13250
|
item,
|
|
@@ -13260,17 +13260,17 @@ async function addPortableInstallation(item, type, provider, global2, path2, sou
|
|
|
13260
13260
|
installSource: options2?.installSource || "kit",
|
|
13261
13261
|
ownedSections: options2?.ownedSections
|
|
13262
13262
|
});
|
|
13263
|
-
await writePortableRegistry(registry);
|
|
13263
|
+
await writePortableRegistry(registry, lockedPaths);
|
|
13264
13264
|
});
|
|
13265
13265
|
}
|
|
13266
13266
|
async function removePortableInstallation(item, type, provider, global2, options2) {
|
|
13267
|
-
return withRegistryLock(async () => {
|
|
13268
|
-
const registry = await readPortableRegistryWithinRegistryLock();
|
|
13267
|
+
return withRegistryLock(async (lockedPaths) => {
|
|
13268
|
+
const registry = await readPortableRegistryWithinRegistryLock(lockedPaths);
|
|
13269
13269
|
const index = registry.installations.findIndex((i) => i.item === item && i.type === type && i.provider === provider && i.global === global2 && (!options2?.path || resolve2(i.path) === resolve2(options2.path)));
|
|
13270
13270
|
if (index === -1)
|
|
13271
13271
|
return null;
|
|
13272
13272
|
const [removed] = registry.installations.splice(index, 1);
|
|
13273
|
-
await writePortableRegistry(registry);
|
|
13273
|
+
await writePortableRegistry(registry, lockedPaths);
|
|
13274
13274
|
return removed;
|
|
13275
13275
|
});
|
|
13276
13276
|
}
|
|
@@ -13288,15 +13288,15 @@ function findPortableInstallations(registry, item, type, provider, global2) {
|
|
|
13288
13288
|
});
|
|
13289
13289
|
}
|
|
13290
13290
|
async function updateAppliedManifestVersion(version) {
|
|
13291
|
-
await withRegistryLock(async () => {
|
|
13292
|
-
const registry = await readPortableRegistryWithinRegistryLock();
|
|
13291
|
+
await withRegistryLock(async (lockedPaths) => {
|
|
13292
|
+
const registry = await readPortableRegistryWithinRegistryLock(lockedPaths);
|
|
13293
13293
|
registry.appliedManifestVersion = version;
|
|
13294
|
-
await writePortableRegistry(registry);
|
|
13294
|
+
await writePortableRegistry(registry, lockedPaths);
|
|
13295
13295
|
});
|
|
13296
13296
|
}
|
|
13297
13297
|
async function removeInstallationsByFilter(predicate) {
|
|
13298
|
-
return withRegistryLock(async () => {
|
|
13299
|
-
const registry = await readPortableRegistryWithinRegistryLock();
|
|
13298
|
+
return withRegistryLock(async (lockedPaths) => {
|
|
13299
|
+
const registry = await readPortableRegistryWithinRegistryLock(lockedPaths);
|
|
13300
13300
|
const removed = [];
|
|
13301
13301
|
registry.installations = registry.installations.filter((entry) => {
|
|
13302
13302
|
if (predicate(entry)) {
|
|
@@ -13306,14 +13306,14 @@ async function removeInstallationsByFilter(predicate) {
|
|
|
13306
13306
|
return true;
|
|
13307
13307
|
});
|
|
13308
13308
|
if (removed.length > 0) {
|
|
13309
|
-
await writePortableRegistry(registry);
|
|
13309
|
+
await writePortableRegistry(registry, lockedPaths);
|
|
13310
13310
|
}
|
|
13311
13311
|
return removed;
|
|
13312
13312
|
});
|
|
13313
13313
|
}
|
|
13314
13314
|
async function syncPortableRegistry() {
|
|
13315
|
-
return withRegistryLock(async () => {
|
|
13316
|
-
const registry = await readPortableRegistryWithinRegistryLock();
|
|
13315
|
+
return withRegistryLock(async (lockedPaths) => {
|
|
13316
|
+
const registry = await readPortableRegistryWithinRegistryLock(lockedPaths);
|
|
13317
13317
|
const removed = [];
|
|
13318
13318
|
registry.installations = registry.installations.filter((i) => {
|
|
13319
13319
|
if (!existsSync3(i.path)) {
|
|
@@ -13323,7 +13323,7 @@ async function syncPortableRegistry() {
|
|
|
13323
13323
|
return true;
|
|
13324
13324
|
});
|
|
13325
13325
|
if (removed.length > 0) {
|
|
13326
|
-
await writePortableRegistry(registry);
|
|
13326
|
+
await writePortableRegistry(registry, lockedPaths);
|
|
13327
13327
|
}
|
|
13328
13328
|
return { removed };
|
|
13329
13329
|
});
|
|
@@ -63852,7 +63852,7 @@ var package_default;
|
|
|
63852
63852
|
var init_package = __esm(() => {
|
|
63853
63853
|
package_default = {
|
|
63854
63854
|
name: "claudekit-cli",
|
|
63855
|
-
version: "4.3.1-dev.
|
|
63855
|
+
version: "4.3.1-dev.19",
|
|
63856
63856
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63857
63857
|
type: "module",
|
|
63858
63858
|
repository: {
|
|
@@ -63868,6 +63868,7 @@ var init_package = __esm(() => {
|
|
|
63868
63868
|
},
|
|
63869
63869
|
files: [
|
|
63870
63870
|
"bin/ck.js",
|
|
63871
|
+
"bin/postinstall-hook-restore.cjs",
|
|
63871
63872
|
"bin/postinstall-self-heal.cjs",
|
|
63872
63873
|
"dist/index.js",
|
|
63873
63874
|
"dist/ui/",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudekit-cli",
|
|
3
|
-
"version": "4.3.1-dev.
|
|
3
|
+
"version": "4.3.1-dev.19",
|
|
4
4
|
"description": "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"bin/ck.js",
|
|
19
|
+
"bin/postinstall-hook-restore.cjs",
|
|
19
20
|
"bin/postinstall-self-heal.cjs",
|
|
20
21
|
"dist/index.js",
|
|
21
22
|
"dist/ui/",
|