You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): report built-in command errors instead of crashing (#363)
* fix(cli): report built-in command errors instead of crashing
`runCli` was `createProgram(...).parse()` with no error handling, so anything a
built-in command threw escaped: sync throws printed a raw Node stack trace, and
async ones surfaced as unhandled rejections. Either way the `exitCode` the error
carried was discarded.
Five commands hit this in practice:
$ webcmd adapter path hackernews/top
file:///…/dist/src/cli.js:1635
throw new ArgumentError(`Adapter source is unavailable …`);
^
ArgumentError: Adapter source is unavailable for hackernews/top.
at localAdapterPath (file:///…/dist/src/cli.js:1635:19)
…
Adapter commands never had this problem — execution.ts wraps them and renders
the shared error envelope. Use the same envelope here, so built-ins and adapters
report failures identically:
$ webcmd adapter path hackernews/top
ok: false
error:
code: ARGUMENT
message: Adapter source is unavailable for hackernews/top.
exitCode: 2
Exit codes now come from the error rather than being lost, which also settles
the taxonomy in errors.ts for these paths — `site fixture get` on a missing
fixture exits 66 (EMPTY_RESULT) instead of 1, and `session close <bad-id>`
exits 2 (USAGE_ERROR). Stacks stay off unless WEBCMD_DEBUG is set.
`parse()` -> `parseAsync()` is what lets async rejections reach the handler, and
main.ts now awaits runCli. That also keeps the daemon-run signal cancellation
installed for the real duration of a run: `parse()` returned as soon as it
kicked off an async action, so main.ts's `finally` uninstalled the SIGINT
handler while the run was still in flight, and Ctrl-C never cancelled it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test: isolate doctor profiles and unflake plugin-pr-scope
Doctor rendering was reading ~/.webcmd aliases. Windows git fixtures were hitting the 5s default timeout.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments