close
Skip to content

feat(cli): group the top-level help and lead with gateway/service/doctor (#5159) - #5353

Merged
kyleseaman merged 1 commit into
release/0.4.0from
cherry-pick/cli-help-5159-rel040
Aug 23, 2026
Merged

feat(cli): group the top-level help and lead with gateway/service/doctor (#5159)#5353
kyleseaman merged 1 commit into
release/0.4.0from
cherry-pick/cli-help-5159-rel040

Conversation

@bolichen97

Copy link
Copy Markdown
Collaborator

Cherry-picks #5159 onto release/0.4.0 for the next insider cut.

git cherry-pick -x 55814a8b8 — pure replay of main's squash commit, no edits. Auto-merged in docs/system-specs/modules/cli.md and src/kiro_crew/cli.py with zero conflicts; the resulting diff is byte-identical to the source commit (only blob hashes and hunk line offsets differ, because this branch's cli.py is 13 lines shorter than main's).

Groups the kirocrew --help top-level listing behind a single-source-of-truth taxonomy in src/kiro_crew/cli_help.py, leading with gateway / service install / doctor, and hides the mcp-* internal servers from the invalid-choice error without breaking their dispatch.

Tests

  • test/test_cli_help.py — 11 passed on this base. test_offered_and_grouped_sets_match is the one that matters here: it proves release/0.4.0's command set is fully covered by COMMAND_GROUPS, so no command on this branch can KeyError at import.
  • Full CLI surface on this base: pytest test/ -k cli → 3367 passed, 7 skipped.

…tor (#5159)

`kirocrew --help` listed ~40 subcommands as one flat argparse block in
registration order, headed by a `{chat,doctor,gateway,...}` choice blob
that filled the usage line, with 17 `mcp-*` internals rendered as
literal `==SUPPRESS==` rows. The three commands a new install actually
needs sat in the middle of it, and nothing said how `gateway` differs
from `service install` or what port either one opens.

The taxonomy now lives in `cli_help.py`: ordered sections, `Start here`
first with exactly gateway, service and doctor, followed by notes on the
two lifetimes (foreground vs. systemd/launchd, one at a time) and on the
single loopback dashboard port. argparse's own listing is suppressed and
the grouped listing is rendered into the epilog.

Every user-facing command registers through `cli_help.add_command`,
which refuses a name that is in no section, so a new command cannot be
added without appearing in the help; the section summary becomes the
subparser `description`, which is what `kirocrew <cmd> --help` prints.

The `mcp-*` MCP servers the agent backend spawns are dropped from the
listing and from the `invalid choice: 'x' (choose from ...)` message,
which otherwise answered a typo with all 17 of them. Their `choices`
view filters iteration only: membership and `_name_parser_map` are
untouched, so `kirocrew mcp-core` still dispatches.

(cherry picked from commit 55814a8)
@bolichen97
bolichen97 requested a review from a team as a code owner August 23, 2026 18:52
@bolichen97
bolichen97 requested review from pepmach and removed request for a team August 23, 2026 18:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of ba22bc2d85efb9e1e0feb400c684df8482cdafd4 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ba22bc2

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ba22bc2d85efb9e1e0feb400c684df8482cdafd4: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of ba22bc2d85efb9e1e0feb400c684df8482cdafd4 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Real discoverability problem, solved at the right layer: one owned taxonomy with a fail-loud registration guard and drift tests, fully reversible.

The one clever piece — _VisibleCommandChoices replacing sub.choices to filter argparse's invalid-choice message — leans on unpinned argparse internals, but the reference-backed view, complete membership, and the dispatch/hidden-listing tests pin every behavior a CPython minor bump could silently change, so a regression goes red in CI rather than in a user's terminal. Docs updated in the same commit; the cherry-pick is byte-identical to main's already-landed commit and the coverage test re-proves the taxonomy against this branch's shorter command set.

[DESIGN-REVIEWED] ba22bc2

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of ba22bc2d85efb9e1e0feb400c684df8482cdafd4 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Reading complete. I checked the contract, the intent, the full patch, and grepped the repo for consumers of every new cli_help symbol and for the port constant the help text duplicates. Emitting the review.

First-Principles-Verdict: PASS

A byte-identical release-branch replay of merged #5159; every item traces to the named argparse limit (flat, registration-ordered listing) and none duplicates an existing mechanism.

What this change ships

Intent: let a fresh install find gateway / service install / doctor in --help instead of a flat 40-command wall — an ADDITION (UX), cherry-picked verbatim onto release/0.4.0.

  1. --help shows grouped sections, "Start here" first — justified
  2. Usage line reads <command>, not the 40-name choice blob — justified
  3. Help gains gateway-vs-service and loopback-port orientation notes — justified (answers a question no existing text did)
  4. Unknown-command error drops the ~17 mcp-* names, orders suggestions help-first — justified
  5. Hidden mcp-* commands still dispatch — justified
  6. kirocrew <cmd> --help now prints the section summary as description — undeclared in PR text, declared in the same-commit spec
  7. New commands KeyError without a help-section entry — justified (cause-level: makes listing drift impossible, pinned by test_offered_and_grouped_sets_match)

Checks run: COMMAND_GROUPS names 39 commands; the diff registers 39 via add_command/register_* — sets match. Grepped every new public symbol: TOP_USAGE, render_epilog, add_command, hide_internal_commands each have 1+ real consumers in cli*.py; none is zero-consumer. _DEFAULT_PORT_TEXT duplicates config/loader.py:300's _DEFAULT_PORT, but the test pins them equal and importing the loader would break cli_help's leaf status — derived, not flagged. render_epilog(width=13) has one caller passing nothing (cli.py:936), but editing it here would break the branch's byte-identical-replay property; it fails the ships-anything filter.

[FIRST-PRINCIPLES-REVIEWED] ba22bc2

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed ba22bc2d85efb9e1e0feb400c684df8482cdafd4 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ba22bc2

Verdict parsed from the review's SHA-scoped output markers for commit ba22bc2d85efb9e1e0feb400c684df8482cdafd4.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ba22bc2d85efb9e1e0feb400c684df8482cdafd4: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Aug 23, 2026
@kyleseaman
kyleseaman merged commit b214dfc into release/0.4.0 Aug 23, 2026
17 checks passed
@kyleseaman
kyleseaman deleted the cherry-pick/cli-help-5159-rel040 branch August 23, 2026 20:05
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Aug 23, 2026
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.

2 participants