Skip to content

Commit f801082

Browse files
thymikeeclaude
andcommitted
fix(cli): name the synopsis for an argument error that escapes runCli
The top-level rejection handler printed an INVALID_ARGS failure without argv, so it never named the command's synopsis. It now passes argv as the parse-failure path does. ADR 0010 says the synopsis comes with an argument error for a known command; the help-target failures have none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3bb00a6 commit f801082

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎docs/adr/0010-error-system.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Nothing documented the conventions, so each new site decided them again.
9797
closes with the same line: `Error (CODE): <message>. <dispatch fact> Next: <step>`.
9898
The dispatch fact is `Not dispatched.` or `May have reached the device.` from `details.dispatched`;
9999
an unclassified failure states none. `Next` is the hint; an ambiguous match with two or three
100-
candidates lists them instead, and `INVALID_ARGS` appends the command synopsis. When
100+
candidates lists them instead, and an `INVALID_ARGS` failure for a known command appends its synopsis. When
101101
`details.dispatched` is `unknown`, `Next` starts with an observe-first step. The formatter adds
102102
it from the final disclosure when it prints the line, because batch aggregation, the request
103103
ledger and replay projection can raise the disclosure after the hint was resolved; the hint

‎src/cli.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,10 @@ const isDirectRun = pathToFileURL(process.argv[1] ?? '').href === import.meta.ur
915915
if (isDirectRun) {
916916
runCli(process.argv.slice(2)).catch(async (error) => {
917917
const appErr = asAppError(error);
918-
await printHumanError(normalizeError(appErr), { debugTier: true });
918+
await printHumanError(normalizeError(appErr), {
919+
debugTier: true,
920+
argv: process.argv.slice(2),
921+
});
919922
await exitAfterFlush(1);
920923
});
921924
}

0 commit comments

Comments
 (0)