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
package/package.json
CHANGED
|
@@ -17552,13 +17552,23 @@ function findUnknownCommanderCommand(program, argv) {
|
|
|
17552
17552
|
commandPath: pathSegments.join(" ")
|
|
17553
17553
|
};
|
|
17554
17554
|
}
|
|
17555
|
-
if (current.commands.length === 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;
|