fix(scripts): emit 'Copied plan template' status in setup-plan.ps1 (parity with bash)#3198
Merged
mnriem merged 1 commit intoJun 29, 2026
Conversation
…arity with bash) setup-plan.sh prints 'Copied plan template to $IMPL_PLAN' after copying the template (to stderr in --json mode, stdout otherwise), but the PowerShell twin emitted nothing on the successful-copy path -- only the 'Plan already exists' skip message and the 'Plan template not found' warning existed. So the two scripts had a divergent status-output contract on a fresh run. Emit the same message after WriteAllText, routed like the sibling skip message ([Console]::Error.WriteLine in -Json so stdout stays pure JSON, Write-Output in text mode). Mirrors the bash wording and stream routing exactly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the PowerShell setup-plan.ps1 status-output behavior with the bash setup-plan.sh twin by emitting a “Copied plan template …” message on first-run successful template copy, while preserving “pure JSON on stdout” behavior in -Json mode.
Changes:
- Emit “Copied plan template to …” after writing
plan.mdfrom the template insetup-plan.ps1, routed to stderr in-Jsonmode and stdout in text mode. - Add a regression test ensuring PowerShell
-Jsonfirst-run output remains parseable JSON on stdout while the “Copied plan template” status message is emitted on stderr.
Show a summary per file
| File | Description |
|---|---|
| tests/test_setup_plan_no_overwrite.py | Adds a PowerShell parity regression test for “Copied plan template” stderr status in -Json mode while keeping stdout JSON-only. |
| scripts/powershell/setup-plan.ps1 | Emits the “Copied plan template …” status message after a successful template copy with stream routing matching the bash script’s contract. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Low
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
setup-plan.shprints a status message after copying the plan template on a fresh run:The PowerShell twin
setup-plan.ps1emitted nothing on the successful-copy path — only thePlan already existsskip message and thePlan template not foundwarning had equivalents. So on a first run the two scripts had a divergent status-output contract (the bash behavior is even covered by a test,test_setup_plan_json_parseable_on_first_run, which assertsCopied plan templateon stderr).Fix
Emit the same message after
WriteAllText, routed exactly like the siblingPlan already existsmessage —[Console]::Error.WriteLinein-Jsonmode so stdout stays pure JSON,Write-Outputin text mode. Mirrors the bash wording and stream routing. One source file.Testing
uvx ruff checkclean;tests/test_ps1_encoding.pygreen (edited.ps1stays ASCII / PowerShell 5.1-safe).test_ps_setup_plan_copied_message_on_stderr_in_json_modemirrors the existing bashtest_setup_plan_json_parseable_on_first_run: asserts-Jsonfirst-run stdout is parseable JSON andCopied plan templateis on stderr.{...,"BRANCH":""}). Existing setup-plan tests still pass.AI Disclosure
Found and fixed with Claude Code (Claude Opus 4.8) under my direction. AI located the missing status message across the bash/PowerShell twins and drafted the fix plus a mirroring regression test; I confirmed the bash wording/stream routing, verified fail-before/pass-after under Windows PowerShell 5.1 (stdout stays pure JSON), and reviewed the diff before submitting.