claudekit-cli 3.32.2-dev.1 → 3.32.3-dev.1
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 +51 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28329,6 +28329,16 @@ function getAllTrackedFiles(metadata) {
|
|
|
28329
28329
|
}
|
|
28330
28330
|
return metadata.files || [];
|
|
28331
28331
|
}
|
|
28332
|
+
function getTrackedFilesForKit(metadata, kitType) {
|
|
28333
|
+
if (metadata.kits?.[kitType]) {
|
|
28334
|
+
return metadata.kits[kitType].files || [];
|
|
28335
|
+
}
|
|
28336
|
+
const detectedKits = getInstalledKits(metadata);
|
|
28337
|
+
if (detectedKits.includes(kitType)) {
|
|
28338
|
+
return metadata.files || [];
|
|
28339
|
+
}
|
|
28340
|
+
return [];
|
|
28341
|
+
}
|
|
28332
28342
|
function getInstalledKits(metadata) {
|
|
28333
28343
|
if (metadata.kits) {
|
|
28334
28344
|
return Object.keys(metadata.kits);
|
|
@@ -44392,6 +44402,26 @@ function logCleanupSummary(deletedCount, preservedCount, dryRun, results) {
|
|
|
44392
44402
|
}
|
|
44393
44403
|
|
|
44394
44404
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
44405
|
+
var KIT_PREFIX_MAP = {
|
|
44406
|
+
ck: "engineer",
|
|
44407
|
+
mkt: "marketing"
|
|
44408
|
+
};
|
|
44409
|
+
function createKitSpecificMetadata(metadata, kitType) {
|
|
44410
|
+
if (metadata.kits?.[kitType]) {
|
|
44411
|
+
return {
|
|
44412
|
+
...metadata,
|
|
44413
|
+
files: metadata.kits[kitType].files,
|
|
44414
|
+
kits: {
|
|
44415
|
+
[kitType]: metadata.kits[kitType]
|
|
44416
|
+
}
|
|
44417
|
+
};
|
|
44418
|
+
}
|
|
44419
|
+
return metadata;
|
|
44420
|
+
}
|
|
44421
|
+
function isDifferentKitDirectory(dirName, currentKit) {
|
|
44422
|
+
const dirKit = KIT_PREFIX_MAP[dirName];
|
|
44423
|
+
return dirKit !== undefined && dirKit !== currentKit;
|
|
44424
|
+
}
|
|
44395
44425
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
44396
44426
|
const { dryRun = false } = options2;
|
|
44397
44427
|
validatePath(targetDir, "targetDir");
|
|
@@ -44418,17 +44448,25 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
44418
44448
|
logger.info("Checking ownership before cleanup...");
|
|
44419
44449
|
}
|
|
44420
44450
|
const metadata = await ManifestWriter.readManifest(claudeDir);
|
|
44421
|
-
const
|
|
44422
|
-
if (!metadata ||
|
|
44423
|
-
|
|
44424
|
-
|
|
44451
|
+
const trackedFiles = metadata ? options2.kitType ? getTrackedFilesForKit(metadata, options2.kitType) : getAllTrackedFiles(metadata) : [];
|
|
44452
|
+
if (!metadata || trackedFiles.length === 0) {
|
|
44453
|
+
if (options2.kitType) {
|
|
44454
|
+
logger.verbose(`No tracked files found for kit '${options2.kitType}' - skipping cleanup`);
|
|
44455
|
+
} else {
|
|
44456
|
+
logger.verbose("No ownership metadata found - skipping cleanup (legacy/fresh install)");
|
|
44457
|
+
logger.verbose("All existing files will be preserved as user-owned");
|
|
44458
|
+
}
|
|
44425
44459
|
return result;
|
|
44426
44460
|
}
|
|
44461
|
+
if (options2.kitType) {
|
|
44462
|
+
logger.verbose(`Kit-aware cleanup: only cleaning files owned by '${options2.kitType}'`);
|
|
44463
|
+
}
|
|
44427
44464
|
const entries = await readdir14(commandsDir);
|
|
44428
44465
|
if (entries.length === 0) {
|
|
44429
44466
|
logger.verbose("Commands directory is empty");
|
|
44430
44467
|
return result;
|
|
44431
44468
|
}
|
|
44469
|
+
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
44432
44470
|
for (const entry of entries) {
|
|
44433
44471
|
const entryPath = join53(commandsDir, entry);
|
|
44434
44472
|
const stats = await lstat7(entryPath);
|
|
@@ -44437,10 +44475,14 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
44437
44475
|
continue;
|
|
44438
44476
|
}
|
|
44439
44477
|
if (stats.isDirectory()) {
|
|
44440
|
-
|
|
44478
|
+
if (options2.kitType && isDifferentKitDirectory(entry, options2.kitType)) {
|
|
44479
|
+
logger.verbose(`Skipping directory from different kit: ${entry}/`);
|
|
44480
|
+
continue;
|
|
44481
|
+
}
|
|
44482
|
+
await processDirectory(entryPath, entry, claudeDir, metadataForChecks, options2, accumulator, dryRun);
|
|
44441
44483
|
} else {
|
|
44442
44484
|
const relativePath = `commands/${entry}`;
|
|
44443
|
-
await processFileOwnership(entryPath, relativePath,
|
|
44485
|
+
await processFileOwnership(entryPath, relativePath, metadataForChecks, claudeDir, options2, accumulator);
|
|
44444
44486
|
}
|
|
44445
44487
|
}
|
|
44446
44488
|
result.deletedCount = accumulator.deletedCount;
|
|
@@ -44538,7 +44580,8 @@ async function handleMerge(ctx) {
|
|
|
44538
44580
|
if (CommandsPrefix.shouldApplyPrefix(ctx.options)) {
|
|
44539
44581
|
const cleanupResult = await CommandsPrefix.cleanupCommandsDirectory(ctx.resolvedDir, ctx.options.global, {
|
|
44540
44582
|
dryRun: ctx.options.dryRun,
|
|
44541
|
-
forceOverwrite: ctx.options.forceOverwrite
|
|
44583
|
+
forceOverwrite: ctx.options.forceOverwrite,
|
|
44584
|
+
kitType: ctx.kitType
|
|
44542
44585
|
});
|
|
44543
44586
|
if (ctx.options.dryRun) {
|
|
44544
44587
|
const { OwnershipDisplay: OwnershipDisplay2 } = await Promise.resolve().then(() => (init_ownership_display(), exports_ownership_display));
|
|
@@ -49895,7 +49938,7 @@ var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
|
49895
49938
|
// package.json
|
|
49896
49939
|
var package_default = {
|
|
49897
49940
|
name: "claudekit-cli",
|
|
49898
|
-
version: "3.32.
|
|
49941
|
+
version: "3.32.3-dev.1",
|
|
49899
49942
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
49900
49943
|
type: "module",
|
|
49901
49944
|
repository: {
|