IW-679: Shared subcommand runner for six commands #746

Merged
mph merged 20 commits from IW-679 into main 2026-10-08 06:23:05 +00:00
Member

Summary

The six commands with subcommands — service, server, config, gate, review-state and issue — now run through one shared runner, core/commands/Subcommand.scala, in place of six hand-written copies of the same dispatch code. Behaviour does not change: help text, error messages and output stay the same.

Changes

  • Subcommand[A] binds a subcommand declaration to its action with the same type A. Subcommand.dispatch parses, prints help, rejects bad input and runs the action for all six commands. Subcommand.runParsed holds the parse/help/reject/act sequence for one declaration.
  • DispatchOutcome in core/model takes a type parameter, so ToSubcommand returns the binding itself. The eq arms and the unreachable internal: unexpected subcommand fallbacks are gone.
  • Each command declares one subcommands list and builds its parent declaration from it, so the help cannot list a subcommand that has no action.
  • review-state write and update keep reading raw argv after parse (a recorded earlier decision); they use the readingArgv form of the binding.
  • The current behaviour of every affected command was pinned by harness tests before the move.

Phase PR: #743. Review packet: project-management/issues/IW-679/review-packet.md.

Known differences kept on purpose

  • iw review-state --bogus still reports Missing subcommand, while the other dispatchers report Unknown flag. Filed in #744.

Follow-ups filed

  • #744 — one parent-level handler for every command, and a check that the parent declares the dispatched subcommands.
  • #745 — 15 commands without subcommands repeat the sequence that Subcommand.runParsed holds.

Testing

  • Unit / harness tests in core/test (SubcommandTest plus harness tests per command); CI ran the full suite on the phase PR #743.

Release notes (CZ)

Tato změna je čistě vnitřní úprava nástroje iw-cli a pro uživatele nepřináší žádnou novou funkci ani viditelnou změnu chování. Příkazy service, server, config, gate, review-state a issue se ovládají přesně stejně jako dosud; nyní ale sdílejí jedno společné místo pro zpracování podpříkazů. Viz project-management/issues/IW-679/release-notes.md.

🤖 Generated with Claude Code

Closes #679

## Summary The six commands with subcommands — `service`, `server`, `config`, `gate`, `review-state` and `issue` — now run through one shared runner, `core/commands/Subcommand.scala`, in place of six hand-written copies of the same dispatch code. Behaviour does not change: help text, error messages and output stay the same. ## Changes - `Subcommand[A]` binds a subcommand declaration to its action with the same type `A`. `Subcommand.dispatch` parses, prints help, rejects bad input and runs the action for all six commands. `Subcommand.runParsed` holds the parse/help/reject/act sequence for one declaration. - `DispatchOutcome` in `core/model` takes a type parameter, so `ToSubcommand` returns the binding itself. The `eq` arms and the unreachable `internal: unexpected subcommand` fallbacks are gone. - Each command declares one `subcommands` list and builds its parent declaration from it, so the help cannot list a subcommand that has no action. - `review-state write` and `update` keep reading raw argv after parse (a recorded earlier decision); they use the `readingArgv` form of the binding. - The current behaviour of every affected command was pinned by harness tests before the move. Phase PR: #743. Review packet: `project-management/issues/IW-679/review-packet.md`. ## Known differences kept on purpose - `iw review-state --bogus` still reports `Missing subcommand`, while the other dispatchers report `Unknown flag`. Filed in #744. ## Follow-ups filed - #744 — one parent-level handler for every command, and a check that the parent declares the dispatched subcommands. - #745 — 15 commands without subcommands repeat the sequence that `Subcommand.runParsed` holds. ## Testing - Unit / harness tests in `core/test` (`SubcommandTest` plus harness tests per command); CI ran the full suite on the phase PR #743. ## Release notes (CZ) Tato změna je čistě vnitřní úprava nástroje iw-cli a pro uživatele nepřináší žádnou novou funkci ani viditelnou změnu chování. Příkazy `service`, `server`, `config`, `gate`, `review-state` a `issue` se ovládají přesně stejně jako dosud; nyní ale sdílejí jedno společné místo pro zpracování podpříkazů. Viz `project-management/issues/IW-679/release-notes.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes #679
Subcommand dispatch boilerplate is repeated across seven commands

Artifacts:
- analysis.md
- issue.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B8ZD5foFWAE2zV1xYojPMa
Subcommand dispatch boilerplate is repeated across seven commands

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B8ZD5foFWAE2zV1xYojPMa
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B8ZD5foFWAE2zV1xYojPMa
Issue: IW-679
Phase: 1 - Shared subcommand runner + migrate six commands

This commit marks the checkpoint for phase 1 context generation.
Use wf-implement IW-679 to return to this point.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shared subcommand runner + migrate six commands

Artifacts:
- phase-01-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(IW-679): review packet and release notes
All checks were successful
CI / format (pull_request) Successful in 10s
CI / compile (pull_request) Successful in 1m40s
CI / dashboard-build (pull_request) Successful in 1m29s
CI / test (pull_request) Successful in 18m24s
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / lint (pull_request) Successful in 11s
430c0695aa
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mph requested changes 2026-10-07 07:33:27 +00:00
mph left a comment

There are conflicts after merging other branches.

There are conflicts after merging other branches.
docs(IW-679): rework for final PR review 17
Some checks failed
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 10s
CI / lint (pull_request) Successful in 11s
CI / compile (pull_request) Successful in 1m36s
CI / dashboard-build (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
ccbffb2773
Issue: IW-679
Phase: 2 - Rework for final PR review 17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
workflow(wf): Generate Phase 2 tasks for IW-679
Some checks failed
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / format (pull_request) Successful in 10s
CI / compile (pull_request) Successful in 1m42s
CI / dashboard-build (pull_request) Failing after 8s
CI / test (pull_request) Failing after 8s
981c2cb65e
Rework for final PR review 17

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 2: Rework for final PR review 17 (#751)
Some checks failed
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 12s
CI / compile (pull_request) Successful in 1m35s
CI / dashboard-build (pull_request) Successful in 1m26s
CI / test (pull_request) Has been cancelled
7d862467d4
Phase 2 PR #751 was squash-merged, which dropped the parent link of
merge 4421a10b to origin/main d9e76182. The tree already held that
merge's resolution, so this merge keeps the branch side of
core/commands/Issue.scala and leaves the tree unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(IW-679): record ancestry repair in log and review packet
All checks were successful
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 12s
CI / compile (pull_request) Successful in 1m38s
CI / dashboard-build (pull_request) Successful in 1m27s
CI / test (pull_request) Successful in 18m17s
1b5e5f48c7
Author
Member

Implement: rework for review 17
The rework phase merged into IW-679 through #751; this pull request carries it.

Implement: rework for review 17 The rework phase merged into IW-679 through #751; this pull request carries it.
mph merged commit 7add7a709f into main 2026-10-08 06:23:05 +00:00
Sign in to join this conversation.
No description provided.