Skip to content

feat(cli): complete the gunshi migration — install/ci ports and legacy parser removal - #454

Merged
oekazuma merged 1 commit into
mainfrom
feat/gunshi-phase3
Aug 10, 2026
Merged

oekazuma merged 1 commit into
mainfrom
feat/gunshi-phase3

Conversation

@oekazuma

@oekazuma oekazuma commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Phase 3, the final phase of the gunshi migration (#448 plan): install and ci join the analyzer/docs/explain on gunshi/bone, and the legacy parsing layer is deleted. The coordinator byte-compared main's dist against this branch across 15 surfaces: every functional cell identical; the only diffs are the two declared movements.

Declared movements (changeset: svelte-vitals minor)

  1. docs/explain/install/ci --help adopt the root's hybrid format — generated OPTIONS from the define() declarations, curated prose preserved. Flag descriptions now live in one place across the entire CLI; the help-drift class is dead on every surface. (Root --help and --version are byte-identical to main.)
  2. ci <unknown-subcommand> prints its guidance to stderr instead of stdout before exiting 2 — resolving the Phase-0-discovered exception as fix-not-accept: stdout is now empty on every exit-2 path, no asterisks. A same-class grep found no other instance.

The deletion pass

ci/cli.ts and cli-args.ts are gone; docs/cli.ts/explain.ts shrink to data modules (help prose + pure renderers); the diff/baseline shadow parse absorbed its value-shape logic per the design-doc obligation. Two survivors, recorded as a deliberate interpretation in the Phase 3 addendum: parseRunArgs/parseInstallArgs remain as self-contained error-path helpers — a guard hit needs the legacy-shaped re-parse to reproduce exact error wording, and byte-parity dominates a literal reading of the deletion list.

Coverage through the transition

The 47 docs/explain parity cells (whose legacy oracle was being deleted) were converted to snapshot pins before deletion; 28 new pins cover the install/ci argv matrices; three discriminator cells pin why ci's outer dispatch stays a literal token compare (promotion/stripping there would dispatch shapes legacy never did — writing files where legacy errored). One more undocumented gunshi behavior found and neutralized: generate() force-appends a -v, --version row regardless of declarations (stripAutoVersionLine).

Verification

Full gates green: 2,670 tests (cli 1,044), e2e 7/7, smoke 8/8, check:publish 0. Contract suite: one cell deliberately updated (the ci stderr movement); help goldens: exactly the four sub-command keys.

An independent fresh-context review of the completed migration follows as a comment before merge.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added generated help for install, CI, docs, and explain commands.
    • Added CI workflows for installing and upgrading configuration, including dry-run support.
    • Improved CLI argument handling for boolean, string, positional, and comma-separated options.
  • Bug Fixes

    • Unknown CI commands now report diagnostics to stderr with the appropriate exit status.
    • Preserved existing flags, error messages, exit codes, and output behavior.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oekazuma, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 299c8cd8-3f47-4712-9675-38f5d9e328c8

📥 Commits

Reviewing files that changed from the base of the PR and between 819497b and d855a8c.

📒 Files selected for processing (10)
  • docs/src/content/docs/guides/(setup)/install.md
  • docs/src/content/docs/ja/guides/(setup)/install.md
  • packages/cli/docs/monorepo.md
  • packages/cli/src/docs/generated.ts
  • packages/cli/src/gunshi/analyze.ts
  • packages/cli/src/gunshi/ci.ts
  • packages/cli/src/gunshi/docs.ts
  • packages/cli/src/gunshi/explain.ts
  • packages/cli/src/gunshi/guard.ts
  • packages/cli/test/gunshi-analyze.test.ts
📝 Walkthrough

Walkthrough

The CLI migrates install, CI, docs, and explain commands to Gunshi. It replaces the shared parser with node:util.parseArgs, preserves selected legacy behavior, updates dispatch and help generation, and expands Gunshi-focused tests.

Changes

Gunshi CLI migration

Layer / File(s) Summary
Argument parsing and compatibility
packages/cli/src/resolve-args.ts, packages/cli/src/install/args.ts, packages/cli/src/gunshi/analyze.ts, packages/cli/src/gunshi/guard.ts
The CLI uses parseArgs with explicit flag definitions, positional handling, boolean normalization, and legacy compatibility paths.
Gunshi entrypoint wiring
packages/cli/src/cli.ts, packages/cli/src/install/cli.ts, packages/cli/src/docs/cli.ts, packages/cli/src/explain.ts
Top-level dispatch dynamically loads Gunshi handlers. Legacy docs and explain wiring is removed.
Gunshi install command
packages/cli/src/gunshi/install.ts, packages/cli/src/install/cli.ts, packages/cli/test/gunshi-install.test.ts, packages/cli/test/install/cli.test.ts
The install command defines flags, generates help, handles guarded arguments, runs installation, and preserves legacy exit and error behavior.
Gunshi CI command
packages/cli/src/gunshi/ci.ts, packages/cli/src/ci/workflow.ts, packages/cli/test/ci/*, packages/cli/test/gunshi-ci.test.ts, packages/cli/test/cli-contract.test.ts
The CI command supports workflow installation, action-pin upgrades, dry runs, filesystem writes, and stderr diagnostics for unknown commands.
Generated docs and explain help
packages/cli/src/gunshi/docs.ts, packages/cli/src/gunshi/explain.ts, packages/cli/test/docs-cli.test.ts, packages/cli/test/explain.test.ts, packages/cli/test/gunshi-*-parity.test.ts, .changeset/gunshi-migration-complete.md
Docs and explain help is generated asynchronously from Gunshi options. Tests use pinned Gunshi output and retain existing behavior assertions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as Top-level CLI
  participant Gunshi as Gunshi command handler
  participant Workflow as Install or CI workflow
  participant IO as CLI I/O
  CLI->>Gunshi: dispatch selected subcommand
  Gunshi->>Workflow: validate arguments and execute command
  Workflow->>IO: write output or workflow files
  IO-->>Gunshi: return diagnostics and status
  Gunshi-->>CLI: return exit code
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: completing the Gunshi migration, porting install and ci, and removing the legacy parser.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
packages/cli/test/gunshi-ci.test.ts (1)

37-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Name each matrix test by its asserted behavior.

Line 60 uses titles such as "install" and "--help". These titles identify argv input but not the expected result. Rename each cell to state the observable behavior, such as "install creates the workflow" or "--help prints help and exits 0".

As per coding guidelines, name tests after the behavior they verify, not the reasoning behind the implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/test/gunshi-ci.test.ts` around lines 37 - 61, Rename every title
in the `cells` matrix to describe the observable behavior asserted by its
snapshot, including success, help, error, and dispatch cases, rather than merely
echoing the argv. Preserve each `args` value and ensure names state outcomes
such as workflow creation, help with exit 0, or literal-token dispatch behavior.

Source: Coding guidelines

packages/cli/test/gunshi-install.test.ts (1)

60-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Name each generated test by its expected behavior.

The current names mostly identify argv shapes. Rename the cells[].name values to state the observable result, such as help output, a validation error, or ignored post-terminator input.

As per coding guidelines, tests must be named after the behavior they verify.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/test/gunshi-install.test.ts` around lines 60 - 63, Rename the
name values in the cells test cases to describe the observable behavior each
case verifies, such as displaying help, returning a validation error, or
ignoring input after the terminator. Keep the generated test loop and snapshot
assertions unchanged.

Source: Coding guidelines

packages/cli/src/resolve-args.ts (1)

15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the behavior-restating comment.

The comment duplicates the toList implementation. Remove it, or replace it with a constraint that the code cannot express.

As per coding guidelines, comments must explain constraints, rejected alternatives, or non-local dependencies, and must not merely restate code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/resolve-args.ts` at line 15, Remove the behavior-restating
comment immediately above toList; leave the implementation unchanged unless
replacing it with a necessary non-local constraint or design rationale that
cannot be expressed in code.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/cli/src/resolve-args.ts`:
- Line 15: Remove the behavior-restating comment immediately above toList; leave
the implementation unchanged unless replacing it with a necessary non-local
constraint or design rationale that cannot be expressed in code.

In `@packages/cli/test/gunshi-ci.test.ts`:
- Around line 37-61: Rename every title in the `cells` matrix to describe the
observable behavior asserted by its snapshot, including success, help, error,
and dispatch cases, rather than merely echoing the argv. Preserve each `args`
value and ensure names state outcomes such as workflow creation, help with exit
0, or literal-token dispatch behavior.

In `@packages/cli/test/gunshi-install.test.ts`:
- Around line 60-63: Rename the name values in the cells test cases to describe
the observable behavior each case verifies, such as displaying help, returning a
validation error, or ignoring input after the terminator. Keep the generated
test loop and snapshot assertions unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 01b085db-3e50-4d53-a8a0-329ac588f5c7

📥 Commits

Reviewing files that changed from the base of the PR and between 6d62572 and 819497b.

⛔ Files ignored due to path filters (5)
  • packages/cli/test/__snapshots__/gunshi-ci.test.ts.snap is excluded by !**/*.snap
  • packages/cli/test/__snapshots__/gunshi-docs-parity.test.ts.snap is excluded by !**/*.snap
  • packages/cli/test/__snapshots__/gunshi-explain-parity.test.ts.snap is excluded by !**/*.snap
  • packages/cli/test/__snapshots__/gunshi-install.test.ts.snap is excluded by !**/*.snap
  • packages/cli/test/__snapshots__/help-golden.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (26)
  • .changeset/gunshi-migration-complete.md
  • docs/superpowers/specs/2026-08-10-gunshi-cli-migration-design.md
  • packages/cli/src/ci/cli.ts
  • packages/cli/src/ci/workflow.ts
  • packages/cli/src/cli-args.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/docs/cli.ts
  • packages/cli/src/explain.ts
  • packages/cli/src/gunshi/analyze.ts
  • packages/cli/src/gunshi/ci.ts
  • packages/cli/src/gunshi/docs.ts
  • packages/cli/src/gunshi/explain.ts
  • packages/cli/src/gunshi/guard.ts
  • packages/cli/src/gunshi/install.ts
  • packages/cli/src/install/args.ts
  • packages/cli/src/install/cli.ts
  • packages/cli/src/resolve-args.ts
  • packages/cli/test/ci/cli.test.ts
  • packages/cli/test/cli-contract.test.ts
  • packages/cli/test/docs-cli.test.ts
  • packages/cli/test/explain.test.ts
  • packages/cli/test/gunshi-ci.test.ts
  • packages/cli/test/gunshi-docs-parity.test.ts
  • packages/cli/test/gunshi-explain-parity.test.ts
  • packages/cli/test/gunshi-install.test.ts
  • packages/cli/test/install/cli.test.ts
💤 Files with no reviewable changes (3)
  • packages/cli/src/ci/cli.ts
  • packages/cli/src/explain.ts
  • packages/cli/src/cli-args.ts

…y parser removal (#448)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@oekazuma
oekazuma force-pushed the feat/gunshi-phase3 branch from 819497b to d855a8c Compare August 10, 2026 14:42
@oekazuma

Copy link
Copy Markdown
Owner Author

Independent review rounds (fresh-context reviewer, dual oracles: current main + the pre-gunshi baseline):

  • Round 1 — request changes: the migration itself measured byte-perfect (184 argv cells × 3 dists with zero unexplained diffs; install/ci write paths tree-identical including --force overwrite and upgrade pin-rewrite; the 42 converted non-help snapshot pins all replay identically against the pre-gunshi dist; startup ~16 ms faster with clack off the hot path) — but the absorbed --diff/--baseline shadow parse had zero mutation-killing coverage: dropping its --diff=HEAD rewrite left all 1,044 tests green while the built mutant silently fell back to analyzing everything.
  • Fix: shadowParseDiffAndBaseline exported with 9 measured value-shape pins, plus a hermetic git-fixture integration test asserting the diff-scoped observable itself (findings 1 with --diff vs 2 without). The mutation now fails 3 named tests, confirmed independently by coordinator and reviewer. Nits: dead guard loops removed in all four dispatchers, comments no longer reference deleted modules, --app <app> prose aligned (en/ja + bundled topic).
  • Round 2 — APPROVE: mutation caught, integration observable verified end-to-end, 9-cell sample re-sweep byte-identical (the single new diff being the deliberate one-word docs fix).

🤖 Generated with Claude Code

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.

1 participant