Print CLI errors as one line instead of a stack trace #121

Merged
clawbot merged 1 commits from issue-102-cli-errors into next2 2026-09-23 07:33:26 +02:00
Collaborator

Closes #102.

An error a command throws (a bad --cache-dir, no network, an expired session, a full disk) used to reach the user as a raw Node stack trace, because nothing caught it and program.parse() did not await async actions. Now it prints one quak: MESSAGE line on stderr and the CLI exits 1 once output has drained.

  • run moved from bin/quak.ts to src/cli-run.ts unchanged apart from the catch. It takes the streams and the exit function as arguments so test/cli/run.test.ts can check the printed line and the exit code without exiting the test process.
  • bin/quak.ts now awaits program.parseAsync().

Unverified item: the issue's exact repro needs a logged-in session, so it was not re-run against the built CLI; the unit test covers the same path.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/quak/issues/102. An error a command throws (a bad `--cache-dir`, no network, an expired session, a full disk) used to reach the user as a raw Node stack trace, because nothing caught it and `program.parse()` did not await async actions. Now it prints one `quak: MESSAGE` line on stderr and the CLI exits 1 once output has drained. - `run` moved from `bin/quak.ts` to `src/cli-run.ts` unchanged apart from the catch. It takes the streams and the exit function as arguments so `test/cli/run.test.ts` can check the printed line and the exit code without exiting the test process. - `bin/quak.ts` now awaits `program.parseAsync()`. Unverified item: the issue's exact repro needs a logged-in session, so it was not re-run against the built CLI; the unit test covers the same path. Model: opus-5-5
clawbot added the needs-review label 2026-09-23 07:08:34 +02:00
clawbot self-assigned this 2026-09-23 07:08:34 +02:00
Author
Collaborator

PASS on cc5b901 rebased onto next2 cda57ee.

Non-blocking: the header comment in src/cli-commands.ts:5-8 was rewrapped by hand and now breaks mid-sentence after "drained."; rewrap it to the normal line length.

Model: opus-5-5

PASS on `cc5b901` rebased onto `next2` `cda57ee`. Non-blocking: the header comment in `src/cli-commands.ts:5-8` was rewrapped by hand and now breaks mid-sentence after "drained."; rewrap it to the normal line length. Model: opus-5-5
clawbot added 1 commit 2026-09-23 07:26:08 +02:00
An error a command throws now reaches the user as one `quak: MESSAGE`
line on stderr, and the CLI exits 1 once output has drained. The wrapper
moved from bin/quak.ts to src/cli-run.ts so it can be tested, and
bin/quak.ts awaits program.parseAsync() so async actions are awaited.

Model: opus-5-5
clawbot force-pushed issue-102-cli-errors from cc5b90104f to 7ded36d680 2026-09-23 07:26:08 +02:00 Compare
clawbot merged commit 36642f4448 into next2 2026-09-23 07:33:26 +02:00
clawbot deleted branch issue-102-cli-errors 2026-09-23 07:33:26 +02:00
Sign in to join this conversation.