poe-code 3.0.391 → 3.0.393

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.
@@ -17631,13 +17631,23 @@ function findUnknownCommanderCommand(program, argv) {
17631
17631
  commandPath: pathSegments.join(" ")
17632
17632
  };
17633
17633
  }
17634
- if (current.commands.length === 0 || getDefaultCommanderCommandName(current) !== void 0) {
17634
+ if (current.commands.length === 0) {
17635
17635
  return void 0;
17636
17636
  }
17637
17637
  const child = current.commands.find(
17638
17638
  (command) => command.name() === token || command.aliases().includes(token)
17639
17639
  );
17640
17640
  if (child === void 0) {
17641
+ if (getDefaultCommanderCommandName(current) !== void 0) {
17642
+ if (shouldRejectDefaultCommandToken(current, token, pathSegments)) {
17643
+ return {
17644
+ input: token,
17645
+ currentCommand: current,
17646
+ commandPath: pathSegments.join(" ")
17647
+ };
17648
+ }
17649
+ return void 0;
17650
+ }
17641
17651
  return {
17642
17652
  input: token,
17643
17653
  currentCommand: current,
@@ -17649,6 +17659,36 @@ function findUnknownCommanderCommand(program, argv) {
17649
17659
  }
17650
17660
  return void 0;
17651
17661
  }
17662
+ function shouldRejectDefaultCommandToken(command, token, pathSegments) {
17663
+ return pathSegments.length === 0 && isBareCommandLikeToken(token) && hasNonDefaultPublicChildCommand(command);
17664
+ }
17665
+ function hasNonDefaultPublicChildCommand(command) {
17666
+ const defaultName = getDefaultCommanderCommandName(command);
17667
+ return command.commands.some(
17668
+ (child) => child.name() !== defaultName && !isToolcraftHiddenCommander(child) && !getToolcraftReservedChildNames(command).includes(child.name())
17669
+ );
17670
+ }
17671
+ function isBareCommandLikeToken(token) {
17672
+ if (token.length === 0) {
17673
+ return false;
17674
+ }
17675
+ for (const character of token) {
17676
+ if (!isCommandNameCharacter(character)) {
17677
+ return false;
17678
+ }
17679
+ }
17680
+ return true;
17681
+ }
17682
+ function isCommandNameCharacter(character) {
17683
+ const code = character.codePointAt(0);
17684
+ if (code === void 0) {
17685
+ return false;
17686
+ }
17687
+ const isLowercaseLetter = code >= 97 && code <= 122;
17688
+ const isUppercaseLetter = code >= 65 && code <= 90;
17689
+ const isDigit = code >= 48 && code <= 57;
17690
+ return isLowercaseLetter || isUppercaseLetter || isDigit || character === "-" || character === "_";
17691
+ }
17652
17692
  function getDefaultCommanderCommandName(command) {
17653
17693
  const candidate = command;
17654
17694
  return typeof candidate._defaultCommandName === "string" ? candidate._defaultCommandName : void 0;