poe-code 3.0.372 → 3.0.374
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 +136 -65
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/terminal-pilot/dist/cli.js +135 -64
- package/packages/terminal-pilot/dist/cli.js.map +2 -2
- package/packages/terminal-pilot/dist/testing/cli-repl.js +135 -64
- package/packages/terminal-pilot/dist/testing/cli-repl.js.map +2 -2
- package/packages/terminal-pilot/dist/testing/qa-cli.js +135 -64
- package/packages/terminal-pilot/dist/testing/qa-cli.js.map +2 -2
- package/packages/toolcraft/dist/cli.js +128 -53
package/dist/index.js
CHANGED
|
@@ -90989,6 +90989,37 @@ function resolveOutput(resolvedFlags) {
|
|
|
90989
90989
|
}
|
|
90990
90990
|
return "rich";
|
|
90991
90991
|
}
|
|
90992
|
+
function resolveOutputFromArgv(argv) {
|
|
90993
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
90994
|
+
const token = argv[index] ?? "";
|
|
90995
|
+
if (token === "--json") {
|
|
90996
|
+
return "json";
|
|
90997
|
+
}
|
|
90998
|
+
if (token === "--md" || token === "--markdown") {
|
|
90999
|
+
return "md";
|
|
91000
|
+
}
|
|
91001
|
+
if (token === "--output") {
|
|
91002
|
+
const value = argv[index + 1];
|
|
91003
|
+
if (value === "rich" || value === "md" || value === "json") {
|
|
91004
|
+
return value;
|
|
91005
|
+
}
|
|
91006
|
+
if (value === "markdown") {
|
|
91007
|
+
return "md";
|
|
91008
|
+
}
|
|
91009
|
+
continue;
|
|
91010
|
+
}
|
|
91011
|
+
if (token.startsWith("--output=")) {
|
|
91012
|
+
const value = token.slice("--output=".length);
|
|
91013
|
+
if (value === "rich" || value === "md" || value === "json") {
|
|
91014
|
+
return value;
|
|
91015
|
+
}
|
|
91016
|
+
if (value === "markdown") {
|
|
91017
|
+
return "md";
|
|
91018
|
+
}
|
|
91019
|
+
}
|
|
91020
|
+
}
|
|
91021
|
+
return "rich";
|
|
91022
|
+
}
|
|
90992
91023
|
function toDesignSystemOutput(output) {
|
|
90993
91024
|
return DESIGN_SYSTEM_OUTPUT_BY_MODE[output];
|
|
90994
91025
|
}
|
|
@@ -91505,6 +91536,44 @@ function renderApprovalDeclined(error3) {
|
|
|
91505
91536
|
logger2.error(error3.message);
|
|
91506
91537
|
process.exitCode = 1;
|
|
91507
91538
|
}
|
|
91539
|
+
function renderCliErrorPattern(pattern) {
|
|
91540
|
+
const logger2 = createLogger();
|
|
91541
|
+
if (pattern.kind === "usage") {
|
|
91542
|
+
logger2.error(
|
|
91543
|
+
appendUsagePointer(pattern.message, {
|
|
91544
|
+
rootUsageName: pattern.rootUsageName,
|
|
91545
|
+
commandPath: pattern.commandPath
|
|
91546
|
+
})
|
|
91547
|
+
);
|
|
91548
|
+
process.exitCode = 1;
|
|
91549
|
+
return;
|
|
91550
|
+
}
|
|
91551
|
+
if (pattern.kind === "runtime-user") {
|
|
91552
|
+
logger2.error(pattern.message);
|
|
91553
|
+
process.exitCode = 1;
|
|
91554
|
+
return;
|
|
91555
|
+
}
|
|
91556
|
+
if (pattern.kind === "toolcraft-bug") {
|
|
91557
|
+
logger2.error(
|
|
91558
|
+
`toolcraft hit an internal invariant: ${pattern.error.message}
|
|
91559
|
+
This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv. Re-run with --debug for a stack trace and file an issue.`
|
|
91560
|
+
);
|
|
91561
|
+
if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
|
|
91562
|
+
process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
|
|
91563
|
+
`);
|
|
91564
|
+
}
|
|
91565
|
+
process.exitCode = 1;
|
|
91566
|
+
return;
|
|
91567
|
+
}
|
|
91568
|
+
logger2.error(
|
|
91569
|
+
pattern.debugStackMode !== void 0 ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
|
|
91570
|
+
);
|
|
91571
|
+
if (pattern.debugStackMode !== void 0 && pattern.stack !== void 0) {
|
|
91572
|
+
process.stderr.write(`${formatDebugStack(pattern.stack, pattern.debugStackMode)}
|
|
91573
|
+
`);
|
|
91574
|
+
}
|
|
91575
|
+
process.exitCode = 1;
|
|
91576
|
+
}
|
|
91508
91577
|
function validateServices2(services) {
|
|
91509
91578
|
for (const name of Object.keys(services)) {
|
|
91510
91579
|
if (RESERVED_SERVICE_NAMES2.has(name)) {
|
|
@@ -92425,79 +92494,79 @@ function renderHttpError(error3, options) {
|
|
|
92425
92494
|
`);
|
|
92426
92495
|
}
|
|
92427
92496
|
}
|
|
92428
|
-
function handleRunError(error3, options) {
|
|
92497
|
+
async function handleRunError(error3, options) {
|
|
92429
92498
|
const logger2 = createLogger();
|
|
92430
|
-
|
|
92431
|
-
|
|
92432
|
-
|
|
92433
|
-
|
|
92434
|
-
|
|
92435
|
-
|
|
92436
|
-
|
|
92437
|
-
|
|
92438
|
-
|
|
92439
|
-
|
|
92440
|
-
|
|
92441
|
-
|
|
92442
|
-
|
|
92443
|
-
This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv. Re-run with --debug for a stack trace and file an issue.`
|
|
92444
|
-
);
|
|
92445
|
-
if (options.debugStackMode !== void 0 && error3.stack) {
|
|
92446
|
-
process.stderr.write(`${formatDebugStack(error3.stack, options.debugStackMode)}
|
|
92447
|
-
`);
|
|
92448
|
-
}
|
|
92449
|
-
process.exitCode = 1;
|
|
92450
|
-
return;
|
|
92451
|
-
}
|
|
92452
|
-
if (error3 instanceof CommanderError2) {
|
|
92453
|
-
process.exitCode = error3.exitCode;
|
|
92454
|
-
if (error3.code === "commander.helpDisplayed" || error3.code === "commander.version") {
|
|
92499
|
+
await withOutputFormat2(options.output, async () => {
|
|
92500
|
+
if (error3 instanceof UserError) {
|
|
92501
|
+
renderCliErrorPattern(
|
|
92502
|
+
options.userErrorPattern === "usage" ? {
|
|
92503
|
+
kind: "usage",
|
|
92504
|
+
message: error3.message,
|
|
92505
|
+
rootUsageName: options.rootUsageName,
|
|
92506
|
+
commandPath: options.commandPath
|
|
92507
|
+
} : {
|
|
92508
|
+
kind: "runtime-user",
|
|
92509
|
+
message: error3.message
|
|
92510
|
+
}
|
|
92511
|
+
);
|
|
92455
92512
|
return;
|
|
92456
92513
|
}
|
|
92457
|
-
if (error3.
|
|
92458
|
-
|
|
92459
|
-
|
|
92460
|
-
|
|
92461
|
-
|
|
92462
|
-
|
|
92463
|
-
commandPath: options.commandPath
|
|
92464
|
-
}
|
|
92465
|
-
)
|
|
92466
|
-
);
|
|
92514
|
+
if (error3 instanceof Error && error3.name === "ToolcraftBugError") {
|
|
92515
|
+
renderCliErrorPattern({
|
|
92516
|
+
kind: "toolcraft-bug",
|
|
92517
|
+
error: error3,
|
|
92518
|
+
debugStackMode: options.debugStackMode
|
|
92519
|
+
});
|
|
92467
92520
|
return;
|
|
92468
92521
|
}
|
|
92469
|
-
if (error3
|
|
92470
|
-
|
|
92522
|
+
if (error3 instanceof CommanderError2) {
|
|
92523
|
+
process.exitCode = error3.exitCode;
|
|
92524
|
+
if (error3.code === "commander.helpDisplayed" || error3.code === "commander.version") {
|
|
92525
|
+
return;
|
|
92526
|
+
}
|
|
92527
|
+
if (error3.code === "commander.unknownCommand") {
|
|
92528
|
+
logger2.error(
|
|
92529
|
+
appendUsagePointer(
|
|
92530
|
+
formatUnknownCommandError(error3, options.program, options.argv ?? process.argv),
|
|
92531
|
+
{
|
|
92532
|
+
rootUsageName: options.rootUsageName,
|
|
92533
|
+
commandPath: options.commandPath
|
|
92534
|
+
}
|
|
92535
|
+
)
|
|
92536
|
+
);
|
|
92537
|
+
return;
|
|
92538
|
+
}
|
|
92539
|
+
if (error3.code === "commander.unknownOption") {
|
|
92540
|
+
const argv = options.argv ?? process.argv;
|
|
92541
|
+
logger2.error(
|
|
92542
|
+
appendUsagePointer(formatUnknownOptionError(error3, options.program, argv), {
|
|
92543
|
+
rootUsageName: options.rootUsageName,
|
|
92544
|
+
commandPath: options.commandPath.length > 0 ? options.commandPath : findCurrentCommanderCommandPath(options.program, argv)
|
|
92545
|
+
})
|
|
92546
|
+
);
|
|
92547
|
+
return;
|
|
92548
|
+
}
|
|
92471
92549
|
logger2.error(
|
|
92472
|
-
appendUsagePointer(
|
|
92550
|
+
appendUsagePointer(formatCommanderErrorMessage(error3), {
|
|
92473
92551
|
rootUsageName: options.rootUsageName,
|
|
92474
|
-
commandPath: options.commandPath.length > 0 ? options.commandPath : findCurrentCommanderCommandPath(options.program, argv)
|
|
92552
|
+
commandPath: options.commandPath.length > 0 ? options.commandPath : findCurrentCommanderCommandPath(options.program, options.argv ?? process.argv)
|
|
92475
92553
|
})
|
|
92476
92554
|
);
|
|
92477
92555
|
return;
|
|
92478
92556
|
}
|
|
92479
|
-
|
|
92480
|
-
|
|
92481
|
-
|
|
92482
|
-
|
|
92483
|
-
|
|
92484
|
-
);
|
|
92485
|
-
|
|
92486
|
-
|
|
92487
|
-
|
|
92488
|
-
|
|
92489
|
-
|
|
92490
|
-
|
|
92491
|
-
}
|
|
92492
|
-
const message2 = error3 instanceof Error ? error3.message : String(error3);
|
|
92493
|
-
logger2.error(
|
|
92494
|
-
options.debugStackMode !== void 0 ? message2 : `${message2} Use --debug for a stack trace.`
|
|
92495
|
-
);
|
|
92496
|
-
if (options.debugStackMode !== void 0 && error3 instanceof Error && error3.stack) {
|
|
92497
|
-
process.stderr.write(`${formatDebugStack(error3.stack, options.debugStackMode)}
|
|
92498
|
-
`);
|
|
92499
|
-
}
|
|
92500
|
-
process.exitCode = 1;
|
|
92557
|
+
if (isHttpErrorLike(error3)) {
|
|
92558
|
+
renderHttpError(error3, options);
|
|
92559
|
+
process.exitCode = 1;
|
|
92560
|
+
return;
|
|
92561
|
+
}
|
|
92562
|
+
const message2 = error3 instanceof Error ? error3.message : String(error3);
|
|
92563
|
+
renderCliErrorPattern({
|
|
92564
|
+
kind: "unexpected",
|
|
92565
|
+
message: message2,
|
|
92566
|
+
stack: error3 instanceof Error ? error3.stack : void 0,
|
|
92567
|
+
debugStackMode: options.debugStackMode
|
|
92568
|
+
});
|
|
92569
|
+
});
|
|
92501
92570
|
}
|
|
92502
92571
|
function formatCommanderErrorMessage(error3) {
|
|
92503
92572
|
return error3.message.startsWith("error:") ? error3.message : `error: ${error3.message}`;
|
|
@@ -92821,13 +92890,15 @@ async function runCLI(roots, options = {}) {
|
|
|
92821
92890
|
process.stderr.write(`Saved error report to ${report.displayPath}
|
|
92822
92891
|
`);
|
|
92823
92892
|
}
|
|
92824
|
-
handleRunError(error3, {
|
|
92893
|
+
await handleRunError(error3, {
|
|
92825
92894
|
debugStackMode: resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(process.argv),
|
|
92895
|
+
output: resolvedFlags !== void 0 ? resolveOutput(resolvedFlags) : resolveOutputFromArgv(process.argv),
|
|
92826
92896
|
verbose: resolvedFlags ? Boolean(resolvedFlags.verbose) : process.argv.includes("--verbose"),
|
|
92827
92897
|
program,
|
|
92828
92898
|
argv: process.argv,
|
|
92829
92899
|
rootUsageName,
|
|
92830
|
-
commandPath: resolvedCommandPath
|
|
92900
|
+
commandPath: resolvedCommandPath,
|
|
92901
|
+
userErrorPattern: errorReportContext?.params === void 0 ? "usage" : "runtime-user"
|
|
92831
92902
|
});
|
|
92832
92903
|
}
|
|
92833
92904
|
}
|
|
@@ -139290,7 +139361,7 @@ var init_package2 = __esm({
|
|
|
139290
139361
|
"package.json"() {
|
|
139291
139362
|
package_default2 = {
|
|
139292
139363
|
name: "poe-code",
|
|
139293
|
-
version: "3.0.
|
|
139364
|
+
version: "3.0.374",
|
|
139294
139365
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
139295
139366
|
type: "module",
|
|
139296
139367
|
main: "./dist/index.js",
|