Skip to content

feat(cli): make plan --complete-rollout automatable with --yes + honest exit (rc.2 M2)#686

Merged
coderdan merged 2 commits into
mainfrom
feat/plan-complete-rollout-automatable
Jul 17, 2026
Merged

feat(cli): make plan --complete-rollout automatable with --yes + honest exit (rc.2 M2)#686
coderdan merged 2 commits into
mainfrom
feat/plan-complete-rollout-automatable

Conversation

@coderdan

@coderdan coderdan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem (rc.2 M2)

stash plan --complete-rollout skips the production-deploy gate, so it asks for confirmation. But that was an interactive p.confirm (default-no) with no bypass — so a non-interactive run (CI, agent, piped stdin) auto-cancelled and exited 0 via CancelledError. Automation asked for a complete-rollout plan, got exit 0, and had to assume a plan existed when none was drafted. Two gaps: not automatable, and a dishonest exit code.

Fix

  • --yes confirms the gate-skip without a prompt (the automation path). It still logs the two safety warnings first, so the record shows what was skipped.
  • Honest exit: a non-interactive --complete-rollout without --yes now refuses with a non-zero exit (CliExit(1)) and points at --yes, instead of silently cancelling with 0. An interactive decline stays exit 0 — a deliberate "no" isn't a failure.
  • isInteractive is computed once up front (the confirm needs it, and so does the downstream agent-target gate).
# CI / agent
stash plan --complete-rollout --yes --target claude-code
# without consent, non-interactive:
stash plan --complete-rollout   →  exits 1, "needs explicit confirmation … re-run with --yes"

Scope notes

  • --yes only governs the complete-rollout gate; it has no effect otherwise (documented). The no---target non-interactive path keeps its existing "here's how to proceed" hint + exit 0 — that's the established pattern across plan/init, not what M2 is about.
  • Registry, per-command help, and the stash-cli skill updated (incl. correcting the "no global --yes" line to note the scoped one). messages.plan.* leaders added for e2e stability.

Verification

  • 2 new pty-less e2e (refuses + exit 1 without --yes; --yes confirms and proceeds past the refusal), in a temp dir with a minimal .cipherstash/context.json — no DB/network.
  • stash manifest --json resolves the new --yes flag on plan.
  • Suite: 540 unit / 64 e2e green, code:check clean. Changeset: stash minor.

https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

Summary by CodeRabbit

  • New Features

    • Added a scoped --yes option for non-interactive plan --complete-rollout to confirm skipping the production-deploy gate.
  • Bug Fixes

    • Non-interactive plan --complete-rollout runs without --yes now exit non-zero and refuse to proceed, rather than silently succeeding without drafting a plan.
  • Documentation

    • Updated command help, examples, and CLI guidance to clarify interactive vs automated behavior.
  • Tests

    • Added end-to-end coverage for the --complete-rollout --yes consent flow.

…nest exit (rc.2 M2)

`--complete-rollout` skips the production-deploy gate, so it requires explicit
consent. Previously that was an interactive p.confirm with no bypass: a
non-interactive run auto-cancelled (default-no) and exited 0 via CancelledError
— so CI/agents got exit 0 but no plan was drafted, and would assume one existed.

- New `--yes` flag confirms the gate-skip without a prompt (automation path).
- Non-interactive `--complete-rollout` WITHOUT `--yes` now refuses with a
  non-zero exit (CliExit(1)) and points at --yes, instead of silently
  cancelling with exit 0. An interactive decline stays exit 0 (a deliberate
  'no' is not a failure).
- isInteractive is computed once up front (the confirm needs it too).
- Registry + help + `stash-cli` skill updated; messages.plan.* leaders added
  for e2e stability.

Tests: 2 pty-less e2e (refuses+exit-1 without --yes; --yes confirms + proceeds),
plus manifest resolves the new flag. Suite 540 unit / 64 e2e green, code:check
clean. Changeset: stash minor.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
@coderdan
coderdan requested a review from a team as a code owner July 17, 2026 08:33
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9aa6ec7

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

This PR includes changesets to release 11 packages
Name Type
stash Minor
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/stack Minor
@cipherstash/stack-drizzle Minor
@cipherstash/stack-supabase Minor
@cipherstash/prisma-next Minor
@cipherstash/wizard Minor
@cipherstash/bench Patch
@cipherstash/test-kit Patch
@cipherstash/prisma-next-example 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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3857a12e-80c4-411d-9212-cf30f5c3dab0

📥 Commits

Reviewing files that changed from the base of the PR and between 2dc3981 and 9aa6ec7.

📒 Files selected for processing (1)
  • packages/cli/src/commands/plan/index.ts

📝 Walkthrough

Walkthrough

stash plan --complete-rollout now requires scoped --yes consent in non-interactive mode, returning exit code 1 without it and exit code 0 with it. Interactive default-no prompting remains unchanged. Help text, automation guidance, stable messages, and end-to-end tests were updated.

Changes

Complete-rollout consent

Layer / File(s) Summary
Consent flow and command wiring
packages/cli/src/commands/plan/index.ts, packages/cli/src/messages.ts
planCommand passes interactivity and --yes state to confirmation logic, which logs stable messages and exits non-zero when non-interactive consent is missing.
End-to-end consent validation
packages/cli/tests/e2e/plan-complete-rollout.e2e.test.ts
Tests verify refusal without --yes and successful confirmation with --yes.
Help and automation documentation
.changeset/..., packages/cli/src/cli/registry.ts, packages/cli/src/commands/plan/index.ts, skills/stash-cli/SKILL.md
Command help, changeset text, and skill guidance document interactive and non-interactive consent behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Automation
  participant planCommand
  participant confirmCompleteRollout
  participant messages

  Automation->>planCommand: Run --complete-rollout
  planCommand->>confirmCompleteRollout: Pass --yes and interactivity state
  alt Non-interactive without --yes
    confirmCompleteRollout->>messages: Emit needs --yes error
    confirmCompleteRollout-->>Automation: Exit 1 without drafting
  else With --yes
    confirmCompleteRollout->>messages: Emit confirmation
    confirmCompleteRollout-->>Automation: Continue with exit 0
  end
Loading

Possibly related PRs

Suggested reviewers: auxesis

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding scoped --yes automation support and a non-interactive non-zero exit for plan --complete-rollout.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plan-complete-rollout-automatable

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an explicit non-interactive consent path for stash plan --complete-rollout, so automation can safely request a complete-rollout plan and reliably detect when no plan was drafted.

Changes:

  • Add --yes to confirm --complete-rollout gate-skip without prompting, and refuse non-interactive runs without --yes with a non-zero exit.
  • Centralize new user-facing leaders in messages.plan.* and assert them in new non-PTY E2E coverage.
  • Update CLI registry help/examples and the shipped skills/stash-cli documentation to reflect the new scoped --yes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
skills/stash-cli/SKILL.md Documents the scoped plan --complete-rollout --yes escape hatch and the non-interactive refusal behavior.
packages/cli/tests/e2e/plan-complete-rollout.e2e.test.ts Adds piped-stdio E2E tests for refusal (exit 1) without --yes and success path with --yes.
packages/cli/src/messages.ts Adds stable message leaders for complete-rollout refusal/confirmation output.
packages/cli/src/commands/plan/index.ts Implements --yes consent + non-interactive refusal for --complete-rollout; computes interactivity once for downstream gating.
packages/cli/src/cli/registry.ts Registers plan --yes flag and updates examples/descriptions accordingly.
.changeset/plan-complete-rollout-yes.md Records a minor CLI change for the new flag + exit-code behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/src/commands/plan/index.ts Outdated
Review follow-up on the M2 complete-rollout change (finding #1 + #3; also
Copilot's sole inline comment):

- plan's interactivity gate re-inlined `process.stdin.isTTY && CI !== 'true'`,
  which only matches exact lowercase `true` — it misses `CI=1`/`CI=TRUE` and so
  diverged from the shared `isInteractive()` (config/tty.ts, whose `isCiEnv()`
  matches `/^(1|true)$/i`) and from the case-insensitive contract the stash-cli
  skill documents. Swap the inline for `isInteractiveTty()` (compute-once
  preserved) so a CI=1 runner with a TTY takes the non-interactive path.
- Drop the unused `cli` parameter from `confirmCompleteRollout`'s opts (the
  refusal hardcodes the `--yes` hint; `cli` was threaded but never read).

No behaviour change on the documented CI=true / TTY paths. plan-complete-rollout
e2e 2/2 and plan unit 22/22 green; build + biome clean.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
@coderdan

Copy link
Copy Markdown
Contributor Author

Human and AI review (Copilot and Claude/Opus 4.8).

@coderdan
coderdan merged commit b0634df into main Jul 17, 2026
10 checks passed
@coderdan
coderdan deleted the feat/plan-complete-rollout-automatable branch July 17, 2026 11:15
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