Repository navigation
feat: Phase Separators in Worktree Creation Output - #16
Merged
Merged
Conversation
Emit labeled phase separators (Git/Init/Open) on stderr around the three phases of wt create, and an Init separator from the init runner so it prints exactly once. The Init label echoes the resolved init command's first token (e.g. "Init (fab sync)"). Separators are NO_COLOR-aware: unicode rule on a colored TTY, plain-ASCII rule otherwise, so labels survive in captured failure logs where attribution matters most. Also realign wt init's diagnostics (banner + init-script output) from stdout to stderr, matching wt create. wt init has no machine-readable result, so its diagnostics belong on stderr; this fixes a latent inconsistency. The stdout final-path contract consumed by external callers is untouched, and existing substring assertions are preserved.
There was a problem hiding this comment.
Pull request overview
Adds labeled phase separators to wt create and wt init output so users can attribute each line to the Git, Init, or Open phase. Output is stderr-only (preserving the stdout launcher contract), NO_COLOR-aware (unicode ── vs ASCII --), and fixed at 40 visible columns. As part of the change, wt init diagnostics and the init child's stdout are realigned from stdout to stderr to match wt create.
Changes:
- New
PhaseSeparator(label string) stringhelper ininternal/worktree/errors.go, with NO_COLOR detection via the existing blanked color vars and rune-counted width. wt createemitsGitandOpenseparators on stderr; theOpenseparator is gated onworktreeOpen != "skip". The Init separator is owned by the init runner (crud.go) so it prints exactly once and uses the resolved init command as its label.wt init's banner and init-script stdout/stderr realigned to parent stderr; the Init separator is added there too, but skipped on the*InitNotFoundpath.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/internal/worktree/errors.go | Adds the PhaseSeparator helper and phaseSeparatorWidth constant. |
| src/internal/worktree/errors_test.go | Adds colored, NO_COLOR, fixed-width, and multibyte-label tests plus a stripANSI helper. |
| src/internal/worktree/crud.go | Runner emits the Init phase separator before Running worktree init.... |
| src/cmd/wt/create.go | Emits Git and Open phase separators on stderr; Open gated on non-skip. |
| src/cmd/wt/init.go | Emits Init separator; realigns banner and init child stdout to stderr. |
| docs/specs/init-protocol.md | Documents stderr wiring and the phase-separator contract. |
| docs/memory/wt-cli/create-output-phases.md | New memory file capturing the contract. |
| docs/memory/wt-cli/init-failure-contract.md | Notes the stderr realignment. |
| docs/memory/index.md | Indexes the new memory file. |
| .gitignore | Ignores .uploads/. |
| fab/changes/260531-pnmi-add-phase-separators/* | Intake, spec, plan, and status artifacts for the change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Meta
Pipeline: intake ✓ → spec ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Impact: +189/−8 code (excluding
fab/,docs/) · +909/−12 totalSummary
wt createruns three distinct phases in sequence — git worktree operations, the init step (which shells out tofab syncor a user-suppliedWORKTREE_INIT_SCRIPT), and the open step — and streams their output to the terminal with no visual demarcation. When something looks wrong or a phase fails, the user cannot tell at a glance which phase owns a given line, nor wherewt's own output ends and the external init script's output begins. Labeled phase separators add visual structure without changing any existing message text, exit codes, or the stdout contract.Changes
PhaseSeparator(label string) stringhelper inerrors.go— NO_COLOR-aware (unicode──rule on a colored TTY, plain-ASCII--rule otherwise), fixed ~40-col width, reuses the existing package color vars.wt createemitsGitandOpenseparators on stderr around the deferred-summary and open phases; no change to signal handling, rollback, or stdout.crud.go/init.go) so it prints exactly once, with the label echoing the resolved init command's first token (e.g.Init (fab sync)).wt init's diagnostics (banner + init-script output) realigned from stdout to stderr, matchingwt create; the stdout final-path contract is untouched and existing substring assertions are preserved.