claudekit-cli 3.10.0 → 3.10.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.
Files changed (2) hide show
  1. package/dist/index.js +61 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14677,7 +14677,7 @@ var cac = (name = "") => new CAC(name);
14677
14677
  // package.json
14678
14678
  var package_default = {
14679
14679
  name: "claudekit-cli",
14680
- version: "3.10.0",
14680
+ version: "3.10.1",
14681
14681
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
14682
14682
  type: "module",
14683
14683
  repository: {
@@ -27557,30 +27557,75 @@ class SettingsMerger {
27557
27557
  return merged;
27558
27558
  }
27559
27559
  static mergeHookEntries(sourceEntries, destEntries, eventName, result) {
27560
- const existingCommands = new Set;
27561
- SettingsMerger.extractCommands(destEntries, existingCommands);
27562
27560
  if (destEntries.length > 0) {
27563
27561
  result.hooksPreserved += destEntries.length;
27564
27562
  }
27565
- const merged = [...destEntries];
27563
+ const merged = destEntries.map((entry) => SettingsMerger.deepCopyEntry(entry));
27564
+ const matcherIndex = new Map;
27565
+ for (let i = 0;i < merged.length; i++) {
27566
+ const entry = merged[i];
27567
+ if ("matcher" in entry && entry.matcher) {
27568
+ matcherIndex.set(entry.matcher, i);
27569
+ }
27570
+ }
27571
+ const existingCommands = new Set;
27572
+ SettingsMerger.extractCommands(destEntries, existingCommands);
27566
27573
  for (const entry of sourceEntries) {
27574
+ const sourceMatcher = "matcher" in entry ? entry.matcher : undefined;
27567
27575
  const commands = SettingsMerger.getEntryCommands(entry);
27568
- const isFullyDuplicated = commands.length > 0 && commands.every((cmd) => existingCommands.has(cmd));
27569
- const duplicateCommands = commands.filter((cmd) => existingCommands.has(cmd));
27570
- if (duplicateCommands.length > 0) {
27571
- const summary = duplicateCommands.length === 1 ? `"${SettingsMerger.truncateCommand(duplicateCommands[0])}"` : `${duplicateCommands.length} commands`;
27572
- result.conflictsDetected.push(`${eventName}: duplicate ${summary}`);
27573
- }
27574
- if (!isFullyDuplicated) {
27575
- merged.push(entry);
27576
- result.hooksAdded++;
27577
- for (const cmd of commands) {
27578
- existingCommands.add(cmd);
27576
+ if (sourceMatcher && matcherIndex.has(sourceMatcher)) {
27577
+ const existingIdx = matcherIndex.get(sourceMatcher);
27578
+ if (existingIdx === undefined)
27579
+ continue;
27580
+ const existingEntry = merged[existingIdx];
27581
+ const newCommands = commands.filter((cmd) => !existingCommands.has(cmd));
27582
+ const duplicateCommands = commands.filter((cmd) => existingCommands.has(cmd));
27583
+ if (duplicateCommands.length > 0) {
27584
+ const summary = duplicateCommands.length === 1 ? `"${SettingsMerger.truncateCommand(duplicateCommands[0])}"` : `${duplicateCommands.length} commands`;
27585
+ result.conflictsDetected.push(`${eventName}: duplicate ${summary}`);
27586
+ }
27587
+ if (newCommands.length > 0 && "hooks" in entry && entry.hooks) {
27588
+ if (!existingEntry.hooks) {
27589
+ existingEntry.hooks = [];
27590
+ }
27591
+ for (const hook of entry.hooks) {
27592
+ if (hook.command && !existingCommands.has(hook.command)) {
27593
+ existingEntry.hooks.push(hook);
27594
+ existingCommands.add(hook.command);
27595
+ }
27596
+ }
27597
+ result.hooksAdded++;
27598
+ }
27599
+ } else {
27600
+ const isFullyDuplicated = commands.length > 0 && commands.every((cmd) => existingCommands.has(cmd));
27601
+ const duplicateCommands = commands.filter((cmd) => existingCommands.has(cmd));
27602
+ if (duplicateCommands.length > 0) {
27603
+ const summary = duplicateCommands.length === 1 ? `"${SettingsMerger.truncateCommand(duplicateCommands[0])}"` : `${duplicateCommands.length} commands`;
27604
+ result.conflictsDetected.push(`${eventName}: duplicate ${summary}`);
27605
+ }
27606
+ if (!isFullyDuplicated) {
27607
+ merged.push(entry);
27608
+ result.hooksAdded++;
27609
+ if (sourceMatcher) {
27610
+ matcherIndex.set(sourceMatcher, merged.length - 1);
27611
+ }
27612
+ for (const cmd of commands) {
27613
+ existingCommands.add(cmd);
27614
+ }
27579
27615
  }
27580
27616
  }
27581
27617
  }
27582
27618
  return merged;
27583
27619
  }
27620
+ static deepCopyEntry(entry) {
27621
+ if ("hooks" in entry) {
27622
+ return {
27623
+ ...entry,
27624
+ hooks: entry.hooks ? [...entry.hooks.map((h2) => ({ ...h2 }))] : undefined
27625
+ };
27626
+ }
27627
+ return { ...entry };
27628
+ }
27584
27629
  static extractCommands(entries, commands) {
27585
27630
  for (const entry of entries) {
27586
27631
  if ("command" in entry && entry.command) {
@@ -33648,7 +33693,7 @@ var import_compare_versions2 = __toESM(require_umd(), 1);
33648
33693
  // package.json
33649
33694
  var package_default2 = {
33650
33695
  name: "claudekit-cli",
33651
- version: "3.10.0",
33696
+ version: "3.10.1",
33652
33697
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
33653
33698
  type: "module",
33654
33699
  repository: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {