Skip to content

feat: add --dry-run plan output and post-apply summary to stanza add#28

Merged
jakejarvis merged 2 commits into
mainfrom
feat/add-dry-run
Jun 13, 2026
Merged

feat: add --dry-run plan output and post-apply summary to stanza add#28
jakejarvis merged 2 commits into
mainfrom
feat/add-dry-run

Conversation

@jakejarvis

@jakejarvis jakejarvis commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Adds a detailed plan preview to stanza add --dry-run and a one-line post-apply summary to stanza add. Dry runs now execute codemods in memory to list edits and surface blockers while writing nothing.

  • New Features
    • stanza add --dry-run prints a grouped plan for each file action (create/modify/skip) with paths, detail labels, and skip reasons (e.g. dependency already pinned higher); includes templates, dependencies, scripts, env vars, and codemods.
    • Real stanza add prints a one-line tally after completion (e.g. "1 created, 3 modified, 1 skipped"); dry runs show the same tally with "no files were written (dry run)".
    • The plan is built alongside the same walk that stages writes, so previews can’t drift from actual applies; dependency skips mirror writer logic; codemods are run against source in dry run to enumerate edits and surface blockers without persisting.

Written for commit 62bfe7c. Summary will update on new commits.

Review in cubic

- Introduce `PlanAction` type and accumulate a `plan: PlanAction[]` in `applyModule` alongside the deferred writes so the preview can never drift from what a real apply does; each template, dep, script, env var, and codemod step pushes a `create`/`modify`/`skip` entry with a human label and optional skip reason
- Add `plan-format.ts` with `formatPlanLines` (grouped, detail list for `--dry-run`) and `summarizePlan` (single-line tally shown after every apply)
- Print the full plan on `--dry-run` and the one-line tally (dimmed) on a real apply; dry-run now reads source files to detect blockers (e.g. missing root layout) before touching anything, still writes nothing
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 62bfe7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
stanza-cli Minor
create-stanza Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stanza-web Canceled Canceled Jun 9, 2026 11:28pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jakejarvis, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 13 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d75c3943-fb18-4a6f-bc7d-d40814fcc7ba

📥 Commits

Reviewing files that changed from the base of the PR and between e357a27 and 62bfe7c.

📒 Files selected for processing (5)
  • apps/cli/src/commands/commands.test.ts
  • apps/cli/src/lib/codemod-runner.test.ts
  • apps/cli/src/lib/codemod-runner.ts
  • apps/web/content/docs/cli.mdx
  • skills/stanza-cli/SKILL.md

Walkthrough

This PR enriches the stanza add --dry-run command to output a detailed grouped plan of file operations (create/modify/skip with reasons) before any writes, replacing the previous "no files were written" message. The real add command now also displays a summary tally.

Changes

Dry-run preview plan feature

Layer / File(s) Summary
Plan type contract and accumulation infrastructure
apps/cli/src/lib/codemod-runner.ts
Introduces PlanAction type with op, path, detail, optional reason; extends RunResult with plan: PlanAction[]; adds internal helpers to decide create/modify/skip based on file existence and semver-aware pinning rules.
Plan accumulation during module application
apps/cli/src/lib/codemod-runner.ts, apps/cli/src/lib/codemod-runner.test.ts
Accumulates plan entries as templates, dependencies, scripts, env vars, and app-overlay edits are processed; includes codemod-reported touched files; returns plan in both dry-run and real apply; includes dry-run test asserting correct plan classification and no filesystem writes.
Plan formatting for terminal output
apps/cli/src/lib/plan-format.ts, apps/cli/src/lib/plan-format.test.ts
Exports formatPlanLines() for colorized aligned column output per action and summarizePlan() to count and tally create/modify/skip; includes styling helpers and tests for output format, skip reasons, and empty cases.
CLI output integration
apps/cli/src/commands/add.ts, apps/cli/src/commands/commands.test.ts
Wires plan formatting into add command: spinner shows "planned" vs "added", dry-run prints formatted plan with app-aware title, bootstrapped-package messaging is skipped during dry-run, end-of-command prints plan summary with dry-run suffix or dim styling; includes new command-level dry-run test.
User-facing documentation
.changeset/cli-dry-run-preview.md, apps/web/content/docs/cli.mdx, skills/stanza-cli/SKILL.md
Documents the new grouped plan output with create/modify/skip tallies, skip reasons, and source file references; notes that dry-run reads source to enumerate codemod edits and surface blockers before apply.

Poem

A plan takes shape before the pen,
Each file accounted now—create, skip, and mend.
Dry-run reads the source with care,
And shows the dance the code will dare. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% 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
Title check ✅ Passed The title clearly and specifically describes the main change: adding dry-run plan output and post-apply summary functionality to the stanza add command.
Description check ✅ Passed The description comprehensively explains the changeset, detailing new features, implementation approach, and the scope of changes across the codebase.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/add-dry-run

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 and usage tips.

@jakejarvis jakejarvis merged commit dc34c92 into main Jun 13, 2026
6 checks passed
@jakejarvis jakejarvis deleted the feat/add-dry-run branch June 13, 2026 16:06
@github-actions github-actions Bot mentioned this pull request Jun 13, 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.

1 participant