8000 refactor(cli): the preamble and the exit code, once each by dominikwozniak · Pull Request #94 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor(cli): the preamble and the exit code, once each - #94

Merged
dominikwozniak merged 1 commit into
mainfrom
refactor/85-preamble-and-exit
Sep 18, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
refactor/85-preamble-and-exit

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

Nine commands open by reading the configuration file, resolving the pull request against the repositories it registers, and merging the settings for that repository. Asking those three questions in one place is what keeps the answers the same: which repositories are registered decides what a bare 28 may name, so a command reading the file its own way could resolve a different pull request from the one beside it. The CLI's error vocabulary had the matching problem from the other end — userFacing and asUserError lived inside src/cli/sweep.ts, which twelve commands imported for nothing else.

What changes

  • src/cli/pr.ts — forPr(pr) answers with the repository, the number, the settings and the launcher. currentRun moves here too, beside swept: both read local state and both answer with a sentence, and dw-mc fix no longer imports it from dw-mc findings.
  • src/cli/exit.ts — new, and holds userFacing, asUserError, and the two tag lists that repeat verbatim: userFacingAndGit for a command that runs git, userFacingAndSession for one that cuts a worktree and opens an agent in it. sweep.ts goes back to being the sweep.
  • src/cli/resolve.ts, src/cli/fix.ts — allowed and fixable were refuse written out again, down to the error and the field. Both call refuse.
  • src/cli/comments.ts — caught ["ConfigMalformed", ...userFacing], and ConfigMalformed is already the first of userFacing.

Test plan

  • pnpm check — pass (51 files, 695 tests)
  • No test assertion changed. Every sentence and every exit code is what it was; the twelve commands' own tests are what covers pr.ts and exit.ts, neither of which has a test file of its own.

Risk

A command resolving the wrong pull request, or exiting with a stack where it used to print a sentence. Both are what the command tests read, and they are unchanged. dw-mc init keeps its own tag list, which is genuinely its own: it catches GhUnauthenticated and does not catch GhReadFailed.

Closes #85

🤖 Generated with Claude Code

Nine commands opened by reading the configuration file, resolving the pull
request against the repositories it registers and merging the settings for
that repository. Asking those three questions in one place is what keeps the
answers the same: which repositories are registered decides what a bare `28`
may name, and a command reading the file its own way could resolve a different
pull request from the one beside it.

The CLI's error vocabulary lived inside the sweep, which twelve commands
imported for nothing else. It has a file of its own, and the two tag lists
that repeat verbatim are named there rather than spelled out at both ends.

`allowed` and `fixable` were `refuse` written again, and `currentRun` sat in
one command for another to import. Both move to where they belong.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak force-pushed the refactor/85-preamble-and-exit branch from 98d4319 to 06d6a43 Compare September 18, 2026 07:35
@dominikwozniak
dominikwozniak merged commit 38d6396 into main Sep 18, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/85-preamble-and-exit branch September 18, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(cli): the preamble and the exit code, once each

1 participant

0