poe-code 3.0.391 → 3.0.392

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "3.0.391",
3
+ "version": "3.0.392",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17552,13 +17552,23 @@ function findUnknownCommanderCommand(program, argv) {
17552
17552
  commandPath: pathSegments.join(" ")
17553
17553
  };
17554
17554
  }
17555
- if (current.commands.length === 0 || getDefaultCommanderCommandName(current) !== void 0) {
17555
+ if (current.commands.length === 0) {
17556
17556
  return void 0;
17557
17557
  }
17558
17558
  const child = current.commands.find(
17559
17559
  (command) => command.name() === token || command.aliases().includes(token)
17560
17560
  );
17561
17561
  if (child === void 0) {
17562
+ if (getDefaultCommanderCommandName(current) !== void 0) {
17563
+ if (shouldRejectDefaultCommandToken(current, token, pathSegments)) {
17564
+ return {
17565
+ input: token,
17566
+ currentCommand: current,
17567
+ commandPath: pathSegments.join(" ")
17568
+ };
17569
+ }
17570
+ return void 0;
17571
+ }
17562
17572
  return {
17563
17573
  input: token,
17564
17574
  currentCommand: current,
@@ -17570,6 +17580,36 @@ function findUnknownCommanderCommand(program, argv) {
17570
17580
  }
17571
17581
  return void 0;
17572
17582
  }
17583
+ function shouldRejectDefaultCommandToken(command, token, pathSegments) {
17584
+ return pathSegments.length === 0 && isBareCommandLikeToken(token) && hasNonDefaultPublicChildCommand(command);
17585
+ }
17586
+ function hasNonDefaultPublicChildCommand(command) {
17587
+ const defaultName = getDefaultCommanderCommandName(command);
17588
+ return command.commands.some(
17589
+ (child) => child.name() !== defaultName && !isToolcraftHiddenCommander(child) && !getToolcraftReservedChildNames(command).includes(child.name())
17590
+ );
17591
+ }
17592
+ function isBareCommandLikeToken(token) {
17593
+ if (token.length === 0) {
17594
+ return false;
17595
+ }
17596
+ for (const character of token) {
17597
+ if (!isCommandNameCharacter(character)) {
17598
+ return false;
17599
+ }
17600
+ }
17601
+ return true;
17602
+ }
17603
+ function isCommandNameCharacter(character) {
17604
+ const code = character.codePointAt(0);
17605
+ if (code === void 0) {
17606
+ return false;
17607
+ }
17608
+ const isLowercaseLetter = code >= 97 && code <= 122;
17609
+ const isUppercaseLetter = code >= 65 && code <= 90;
17610
+ const isDigit = code >= 48 && code <= 57;
17611
+ return isLowercaseLetter || isUppercaseLetter || isDigit || character === "-" || character === "_";
17612
+ }
17573
17613
  function getDefaultCommanderCommandName(command) {
17574
17614
  const candidate = command;
17575
17615
  return typeof candidate._defaultCommandName === "string" ? candidate._defaultCommandName : void 0;