claudekit-cli 3.41.1 → 3.41.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/dist/index.js +62 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57632,7 +57632,7 @@ var package_default;
|
|
|
57632
57632
|
var init_package = __esm(() => {
|
|
57633
57633
|
package_default = {
|
|
57634
57634
|
name: "claudekit-cli",
|
|
57635
|
-
version: "3.41.
|
|
57635
|
+
version: "3.41.2",
|
|
57636
57636
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
57637
57637
|
type: "module",
|
|
57638
57638
|
repository: {
|
|
@@ -81798,16 +81798,53 @@ class SyncEngine {
|
|
|
81798
81798
|
}
|
|
81799
81799
|
}
|
|
81800
81800
|
}
|
|
81801
|
+
// src/shared/deletion-pattern-expander.ts
|
|
81802
|
+
var LEGACY_COMMAND_PREFIX_BY_KIT = {
|
|
81803
|
+
engineer: "ck",
|
|
81804
|
+
marketing: "mkt"
|
|
81805
|
+
};
|
|
81806
|
+
function getLegacyCommandPrefix(kitType) {
|
|
81807
|
+
if (!kitType)
|
|
81808
|
+
return null;
|
|
81809
|
+
return LEGACY_COMMAND_PREFIX_BY_KIT[kitType] ?? null;
|
|
81810
|
+
}
|
|
81811
|
+
function canExpandLegacyCommandPattern(pattern, prefix) {
|
|
81812
|
+
if (!pattern.startsWith("commands/"))
|
|
81813
|
+
return false;
|
|
81814
|
+
if (pattern.startsWith(`commands/${prefix}/`))
|
|
81815
|
+
return false;
|
|
81816
|
+
const allPrefixes = Object.values(LEGACY_COMMAND_PREFIX_BY_KIT);
|
|
81817
|
+
if (allPrefixes.some((candidate) => candidate && pattern.startsWith(`commands/${candidate}/`))) {
|
|
81818
|
+
return false;
|
|
81819
|
+
}
|
|
81820
|
+
return true;
|
|
81821
|
+
}
|
|
81822
|
+
function expandDeletionPatterns(patterns, kitType) {
|
|
81823
|
+
const prefix = getLegacyCommandPrefix(kitType);
|
|
81824
|
+
if (!prefix || patterns.length === 0) {
|
|
81825
|
+
return [...patterns];
|
|
81826
|
+
}
|
|
81827
|
+
const expanded = new Set;
|
|
81828
|
+
for (const pattern of patterns) {
|
|
81829
|
+
expanded.add(pattern);
|
|
81830
|
+
if (canExpandLegacyCommandPattern(pattern, prefix)) {
|
|
81831
|
+
expanded.add(`commands/${prefix}/${pattern.slice("commands/".length)}`);
|
|
81832
|
+
}
|
|
81833
|
+
}
|
|
81834
|
+
return [...expanded];
|
|
81835
|
+
}
|
|
81836
|
+
|
|
81801
81837
|
// src/domains/sync/deletion-path-filter.ts
|
|
81802
81838
|
init_path_resolver();
|
|
81803
81839
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
81804
|
-
function filterDeletionPaths(trackedFiles, deletions) {
|
|
81840
|
+
function filterDeletionPaths(trackedFiles, deletions, kitType) {
|
|
81805
81841
|
if (!deletions || deletions.length === 0) {
|
|
81806
81842
|
return trackedFiles;
|
|
81807
81843
|
}
|
|
81844
|
+
const expandedDeletions = expandDeletionPatterns(deletions, kitType);
|
|
81808
81845
|
const exactPaths = new Set;
|
|
81809
81846
|
const globMatchers = [];
|
|
81810
|
-
for (const pattern of
|
|
81847
|
+
for (const pattern of expandedDeletions) {
|
|
81811
81848
|
if (PathResolver.isGlobPattern(pattern)) {
|
|
81812
81849
|
globMatchers.push(import_picomatch.default(pattern));
|
|
81813
81850
|
} else {
|
|
@@ -91199,8 +91236,15 @@ function findFileInMetadata(metadata, path14) {
|
|
|
91199
91236
|
}
|
|
91200
91237
|
return null;
|
|
91201
91238
|
}
|
|
91202
|
-
function
|
|
91203
|
-
|
|
91239
|
+
function findFileInMetadataForKit(metadata, path14, kitType) {
|
|
91240
|
+
if (!metadata)
|
|
91241
|
+
return null;
|
|
91242
|
+
if (!kitType)
|
|
91243
|
+
return findFileInMetadata(metadata, path14);
|
|
91244
|
+
return metadata.kits?.[kitType]?.files?.find((file) => file.path === path14) ?? null;
|
|
91245
|
+
}
|
|
91246
|
+
function shouldDeletePath(path14, metadata, kitType) {
|
|
91247
|
+
const tracked = findFileInMetadataForKit(metadata, path14, kitType);
|
|
91204
91248
|
if (!tracked)
|
|
91205
91249
|
return true;
|
|
91206
91250
|
return tracked.ownership !== "user";
|
|
@@ -91326,8 +91370,8 @@ async function updateMetadataAfterDeletion(claudeDir2, deletedPaths) {
|
|
|
91326
91370
|
logger.debug("Failed to write updated metadata.json");
|
|
91327
91371
|
}
|
|
91328
91372
|
}
|
|
91329
|
-
async function handleDeletions(sourceMetadata, claudeDir2) {
|
|
91330
|
-
const deletionPatterns = sourceMetadata.deletions || [];
|
|
91373
|
+
async function handleDeletions(sourceMetadata, claudeDir2, kitType) {
|
|
91374
|
+
const deletionPatterns = expandDeletionPatterns(sourceMetadata.deletions || [], kitType);
|
|
91331
91375
|
if (deletionPatterns.length === 0) {
|
|
91332
91376
|
return { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
91333
91377
|
}
|
|
@@ -91343,7 +91387,7 @@ async function handleDeletions(sourceMetadata, claudeDir2) {
|
|
|
91343
91387
|
result.errors.push(path14);
|
|
91344
91388
|
continue;
|
|
91345
91389
|
}
|
|
91346
|
-
if (!shouldDeletePath(path14, userMetadata)) {
|
|
91390
|
+
if (!shouldDeletePath(path14, userMetadata, kitType)) {
|
|
91347
91391
|
result.preservedPaths.push(path14);
|
|
91348
91392
|
logger.verbose(`Preserved user file: ${path14}`);
|
|
91349
91393
|
continue;
|
|
@@ -95116,7 +95160,7 @@ async function handleMerge(ctx) {
|
|
|
95116
95160
|
}
|
|
95117
95161
|
try {
|
|
95118
95162
|
if (sourceMetadata?.deletions && sourceMetadata.deletions.length > 0) {
|
|
95119
|
-
const deletionResult = await handleDeletions(sourceMetadata, ctx.claudeDir);
|
|
95163
|
+
const deletionResult = await handleDeletions(sourceMetadata, ctx.claudeDir, ctx.kitType);
|
|
95120
95164
|
if (deletionResult.deletedPaths.length > 0) {
|
|
95121
95165
|
logger.info(`Removed ${deletionResult.deletedPaths.length} deprecated file(s)`);
|
|
95122
95166
|
for (const path15 of deletionResult.deletedPaths) {
|
|
@@ -97538,7 +97582,7 @@ async function executeSyncMerge(ctx) {
|
|
|
97538
97582
|
} catch (error) {
|
|
97539
97583
|
logger.debug(`Failed to load source metadata for deletion filtering: ${error}`);
|
|
97540
97584
|
}
|
|
97541
|
-
const filteredTrackedFiles = filterDeletionPaths(trackedFiles, deletions);
|
|
97585
|
+
const filteredTrackedFiles = filterDeletionPaths(trackedFiles, deletions, ctx.kitType);
|
|
97542
97586
|
if (deletions.length > 0) {
|
|
97543
97587
|
const filtered = trackedFiles.length - filteredTrackedFiles.length;
|
|
97544
97588
|
logger.debug(`Filtered ${filtered} files matching ${deletions.length} deletion patterns`);
|
|
@@ -98842,7 +98886,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
98842
98886
|
if (!existsSync56(claudeDir2))
|
|
98843
98887
|
return;
|
|
98844
98888
|
try {
|
|
98845
|
-
const result = await handleDeletions(sourceMetadata, claudeDir2);
|
|
98889
|
+
const result = await handleDeletions(sourceMetadata, claudeDir2, inferKitTypeFromSourceMetadata(sourceMetadata));
|
|
98846
98890
|
if (result.deletedPaths.length > 0) {
|
|
98847
98891
|
logger.verbose(`[migrate] Cleaned up ${result.deletedPaths.length} deprecated path(s): ${result.deletedPaths.join(", ")}`);
|
|
98848
98892
|
}
|
|
@@ -98850,6 +98894,13 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
98850
98894
|
logger.warning(`[migrate] Deletion cleanup failed: ${error}`);
|
|
98851
98895
|
}
|
|
98852
98896
|
}
|
|
98897
|
+
function inferKitTypeFromSourceMetadata(sourceMetadata) {
|
|
98898
|
+
if (sourceMetadata.name?.includes("marketing"))
|
|
98899
|
+
return "marketing";
|
|
98900
|
+
if (sourceMetadata.name?.includes("engineer"))
|
|
98901
|
+
return "engineer";
|
|
98902
|
+
return;
|
|
98903
|
+
}
|
|
98853
98904
|
async function migrateCommand(options2) {
|
|
98854
98905
|
console.log();
|
|
98855
98906
|
oe(import_picocolors28.default.bgMagenta(import_picocolors28.default.black(" ck migrate ")));
|