poe-code 3.0.252 → 3.0.253

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.
@@ -13625,12 +13625,27 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
13625
13625
  node.aliases.forEach((alias) => group.alias(alias));
13626
13626
  group.addHelpCommand(false);
13627
13627
  addGlobalOptions(group, presetsEnabled, controls);
13628
+ const childNames = new Set(visibleChildren.map((child) => child.name()));
13628
13629
  for (const child of visibleChildren) {
13629
13630
  const isDefaultChild = node.default !== void 0 && node.default.scope.includes("cli") && (child.name() === node.default.name || child.aliases().includes(node.default.name));
13630
- group.addCommand(child, isDefaultChild ? { isDefault: true } : void 0);
13631
+ addCommanderChild(group, child, isDefaultChild, childNames);
13631
13632
  }
13632
13633
  return group;
13633
13634
  }
13635
+ function addCommanderChild(parent, child, isDefault, siblingNames) {
13636
+ if (isDefault && child.name().length === 0) {
13637
+ let internalName = "__toolcraft_default__";
13638
+ let suffix = 2;
13639
+ while (siblingNames.has(internalName)) {
13640
+ internalName = `__toolcraft_default_${suffix}`;
13641
+ suffix += 1;
13642
+ }
13643
+ child.name(internalName);
13644
+ parent.addCommand(child, { hidden: true, isDefault: true });
13645
+ return;
13646
+ }
13647
+ parent.addCommand(child, isDefault ? { isDefault: true } : void 0);
13648
+ }
13634
13649
  function addGlobalOptions(command, presetsEnabled, controls) {
13635
13650
  const options = [];
13636
13651
  if (presetsEnabled) {
@@ -15514,6 +15529,9 @@ async function runCLI(roots, options = {}) {
15514
15529
  }
15515
15530
  );
15516
15531
  };
15532
+ const rootChildNames = new Set(
15533
+ root.children.filter((candidate) => isNodeVisibleInScope(candidate, "cli")).map((candidate) => candidate.name)
15534
+ );
15517
15535
  for (const child of root.children) {
15518
15536
  const command = createNodeCommand(
15519
15537
  child,
@@ -15527,7 +15545,7 @@ async function runCLI(roots, options = {}) {
15527
15545
  continue;
15528
15546
  }
15529
15547
  const isDefaultChild = root.default !== void 0 && root.default.scope.includes("cli") && (command.name() === root.default.name || command.aliases().includes(root.default.name));
15530
- program.addCommand(command, isDefaultChild ? { isDefault: true } : void 0);
15548
+ addCommanderChild(program, command, isDefaultChild, rootChildNames);
15531
15549
  }
15532
15550
  configureCommanderSuggestionOutput(program);
15533
15551
  const unknownCommand = findUnknownCommanderCommand(program, process.argv);