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/dist/index.js +42 -2
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/terminal-pilot/dist/cli.js +41 -1
- package/packages/terminal-pilot/dist/cli.js.map +2 -2
- package/packages/terminal-pilot/dist/testing/cli-repl.js +41 -1
- package/packages/terminal-pilot/dist/testing/cli-repl.js.map +2 -2
- package/packages/terminal-pilot/dist/testing/qa-cli.js +41 -1
- package/packages/terminal-pilot/dist/testing/qa-cli.js.map +2 -2
- package/packages/toolcraft/dist/cli.js +43 -1
|
@@ -17631,13 +17631,23 @@ function findUnknownCommanderCommand(program, argv) {
|
|
|
17631
17631
|
commandPath: pathSegments.join(" ")
|
|
17632
17632
|
};
|
|
17633
17633
|
}
|
|
17634
|
-
if (current.commands.length === 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;
|