@sixsevenai/ai-dlc-installer 1.4.2 → 1.4.3

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/cli.js CHANGED
@@ -1067,6 +1067,9 @@ var INSTALL_CATEGORIES = [
1067
1067
  { id: "ai-dlc", pathPrefix: "ai-dlc/", label: "AI-DLC Core", hint: "Core AI-DLC framework files" },
1068
1068
  { id: "memory", pathPrefix: "memory/", label: "Memory", hint: "Memory templates" }
1069
1069
  ];
1070
+ var PROTECTED_FILES = /* @__PURE__ */ new Set([
1071
+ "memory/spec/constitution.md"
1072
+ ]);
1070
1073
  function filterMappingsByCategories(mappings, categories) {
1071
1074
  const prefixes = INSTALL_CATEGORIES.filter((cat) => categories.includes(cat.id)).map((cat) => cat.pathPrefix);
1072
1075
  if (prefixes.length === 0) {
@@ -1077,6 +1080,18 @@ function filterMappingsByCategories(mappings, categories) {
1077
1080
  return prefixes.some((prefix) => normalised.startsWith(prefix));
1078
1081
  });
1079
1082
  }
1083
+ function filterProtectedFiles(mappings, existingTargetFiles, protectedPaths = PROTECTED_FILES) {
1084
+ const skipped = [];
1085
+ const filtered = mappings.filter((mapping) => {
1086
+ const normalised = mapping.relativePath.replace(/\\/g, "/");
1087
+ if (protectedPaths.has(normalised) && existingTargetFiles.has(normalised)) {
1088
+ skipped.push(normalised);
1089
+ return false;
1090
+ }
1091
+ return true;
1092
+ });
1093
+ return { filtered, skipped };
1094
+ }
1080
1095
  function resolveCategories(overwriteFlags) {
1081
1096
  const validIds = INSTALL_CATEGORIES.map((cat) => cat.id);
1082
1097
  const unknown = overwriteFlags.filter((flag) => !validIds.includes(flag));
@@ -1105,6 +1120,10 @@ function renderSummary(summary, nextSteps, theme, categoryInfo) {
1105
1120
  lines.push(...renderComponentCounts(summary.componentCounts, theme));
1106
1121
  lines.push("");
1107
1122
  }
1123
+ if (summary.protectedFilesPreserved && summary.protectedFilesPreserved.length > 0) {
1124
+ lines.push(...renderProtectedFiles(summary.protectedFilesPreserved, theme));
1125
+ lines.push("");
1126
+ }
1108
1127
  lines.push(...renderFileStatistics(summary, theme));
1109
1128
  lines.push("");
1110
1129
  lines.push(` Total time: ${theme.bold(summary.totalDuration.formatted)}`);
@@ -1197,6 +1216,15 @@ function renderInstalledCategories(categoryInfo, theme) {
1197
1216
  }
1198
1217
  return lines;
1199
1218
  }
1219
+ function renderProtectedFiles(protectedPaths, theme) {
1220
+ const bullet = theme.symbolSet.bullet;
1221
+ const lines = [];
1222
+ lines.push(` ${theme.bold(theme.colorize("Protected files preserved:", "header"))}`);
1223
+ for (const filePath of protectedPaths) {
1224
+ lines.push(` ${bullet} ${theme.colorize(filePath, "accent")} (not overwritten)`);
1225
+ }
1226
+ return lines;
1227
+ }
1200
1228
  function renderFileStatistics(summary, theme) {
1201
1229
  const lines = [];
1202
1230
  lines.push(` ${theme.bold(theme.colorize("File statistics:", "header"))}`);
@@ -3616,7 +3644,8 @@ function createInitialContext(sourceDirectory) {
3616
3644
  validationReport: null,
3617
3645
  fileMappings: [],
3618
3646
  overwriteMode: null,
3619
- selectedCategories: []
3647
+ selectedCategories: [],
3648
+ protectedFilesSkipped: []
3620
3649
  };
3621
3650
  }
3622
3651
  function buildTerminalCapabilities(env) {
@@ -4354,6 +4383,20 @@ async function executeInstallFiles(ctx, options, theme) {
4354
4383
  );
4355
4384
  }
4356
4385
  }
4386
+ if (ctx.conflictReport) {
4387
+ const existingSet = new Set(
4388
+ ctx.conflictReport.existingFiles.map((p) => p.replace(/\\/g, "/"))
4389
+ );
4390
+ const { filtered: protectedFiltered, skipped: protectedSkipped } = filterProtectedFiles(ctx.fileMappings, existingSet);
4391
+ if (protectedSkipped.length > 0) {
4392
+ ctx.fileMappings = protectedFiltered;
4393
+ ctx.protectedFilesSkipped = protectedSkipped;
4394
+ verboseLog(
4395
+ options.verbose,
4396
+ `Protected files preserved (not overwritten): ${protectedSkipped.join(", ")}`
4397
+ );
4398
+ }
4399
+ }
4357
4400
  if (options.dryRun) {
4358
4401
  return {
4359
4402
  data: { dryRun: true, fileCount: ctx.fileMappings.length },
@@ -4535,7 +4578,8 @@ async function executeShowSummary(ctx, options, theme) {
4535
4578
  totalFilesCopied: ctx.installationResult?.copiedCount ?? 0,
4536
4579
  totalFilesSkipped: ctx.installationResult?.skippedCount ?? 0,
4537
4580
  totalFilesFailed: ctx.installationResult?.errors.length ?? 0,
4538
- installerVersion: INSTALLER_VERSION
4581
+ installerVersion: INSTALLER_VERSION,
4582
+ protectedFilesPreserved: ctx.protectedFilesSkipped.length > 0 ? ctx.protectedFilesSkipped : void 0
4539
4583
  };
4540
4584
  const nextSteps = getDefaultNextSteps(summary.success);
4541
4585
  if (theme && !options.quiet) {