Skip to content

fix: DX copy polish — wt go stderr nav-confirmation, unified wt.Warn, list --path structured not-found, help-text + glyph fixes#24

Open
sahil-noon wants to merge 4 commits into
mainfrom
260622-log5-dx-copy-polish
Open

fix: DX copy polish — wt go stderr nav-confirmation, unified wt.Warn, list --path structured not-found, help-text + glyph fixes#24
sahil-noon wants to merge 4 commits into
mainfrom
260622-log5-dx-copy-polish

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Meta

ID Type Confidence Plan Review
log5 fix 4.7/5.0 15/15 tasks, 0/15 acceptance ✓ 1 cycle

Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr

Impact: +162/−27 code (excluding fab/, docs/) · +743/−46 total

Summary

The wt CLI copy was well-calibrated overall but had real inconsistencies surfaced by a full DX/copy audit: wt go gave no human confirmation of where it was navigating, warning output was inconsistent across commands (some color-wrapped to stderr, some bare inline, two incorrectly to stdout), and wt list --path's not-found path bypassed the structured ExitWithError form used elsewhere. This change addresses all Tier 1 and Tier 2 findings from that audit in one coherent, surgical fix.

Changes

  • wt go stderr navigation confirmation — compact-arrow form (→ {repo} / {worktree} ({branch}) + indented path) emitted to stderr on success; stdout stays byte-identical (bare path only, preserving cd "$(command wt go)" and WT_CD_FILE contracts)
  • Unified wt.Warn helper — new Warn(format, args...) in errors.go (alongside WtError/RenderWarning); all ~10 warning call sites across create.go, delete.go converted; two delete.go warnings moved from stdout to stderr (stream-discipline fix)
  • wt list --path not-found → ExitWithError — replaces ad-hoc fmt.Fprintf+os.Exit with the structured what/why/fix form used by open/go
  • wt update Short capitalization"self-update…""Self-update…" (matches all other commands)
  • Help-text clarity + glyph fix--worktree-open, --non-interactive, --delete-branch, --delete-remote flag descriptions rewritten for clarity; glyph replaced with plain English in the skipped-branch-deletion message

sahil87 added 2 commits June 22, 2026 14:30
…helper, list --path structured not-found, update Short capitalization, help-text + glyph fixes
@sahil-noon sahil-noon marked this pull request as ready for review June 22, 2026 09:02
@sahil-noon sahil-noon requested a review from Copilot June 22, 2026 09:02

Copilot AI 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.

Pull request overview

This PR polishes wt CLI UX/copy consistency by standardizing warning output, adding a human-readable navigation confirmation for wt go (on stderr only), and aligning a few commands/flags with existing structured error and help-text conventions.

Changes:

  • Add wt.Warn(...) helper and route create/delete warnings through it (including moving two delete warnings from stdout → stderr).
  • Add wt go stderr navigation confirmation while keeping stdout’s bare-path contract unchanged.
  • Use ExitWithError structured not-found output for wt list --path, plus help-text/copy tweaks and contract documentation updates.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/internal/worktree/errors.go Adds Warn(...) helper for consistent warning formatting/stream.
src/internal/worktree/errors_test.go Adds unit tests for Warn (colored + NO_COLOR).
src/cmd/wt/go.go Adds stderr navigation confirmation and threads RepoContext into navigateTo.
src/cmd/wt/go_test.go Tests that confirmation is stderr-only and stdout stays bare-path.
src/cmd/wt/list.go Switches --path not-found to structured ExitWithError.
src/cmd/wt/list_test.go Updates test to assert structured what/why/fix error shape + exit code.
src/cmd/wt/create.go Converts warnings to wt.Warn and rewrites some flag help text.
src/cmd/wt/delete.go Converts warnings to wt.Warn, moves two warnings stdout→stderr, rewrites help text + glyph message.
src/cmd/wt/delete_test.go Adds regression test ensuring uncommitted-changes warning is on stderr.
src/cmd/wt/update.go Capitalizes update command Short help text.
docs/memory/wt-cli/list-status-contract.md Documents structured not-found behavior for list --path.
docs/memory/wt-cli/go-command-contract.md Documents new wt go stderr confirmation + signature change.
docs/memory/wt-cli/create-output-phases.md Documents wt.Warn/stream-discipline updates.
fab/changes/260622-log5-dx-copy-polish/plan.md Planning/acceptance details for the change.
fab/changes/260622-log5-dx-copy-polish/intake.md Intake rationale/scope for the change.
fab/changes/260622-log5-dx-copy-polish/.status.yaml Pipeline status metadata.
fab/changes/260622-log5-dx-copy-polish/.history.jsonl Pipeline history log.

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

Comment thread src/cmd/wt/go.go Outdated
Comment on lines 130 to 134
fmt.Fprintf(os.Stderr, "→ %s / %s (%s)\n", ctx.RepoName, filepath.Base(path), getBranchForPath(path))
fmt.Fprintf(os.Stderr, " %s\n", path)

if cdFile := os.Getenv("WT_CD_FILE"); cdFile != "" {
if err := os.WriteFile(cdFile, []byte(path), 0600); err != nil {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — moved the "→ repo / …" stderr confirmation to after the WT_CD_FILE write succeeds, so a write failure no longer prints a misleading success line. (fc9ef4c)

Comment thread src/internal/worktree/errors.go Outdated
Comment on lines +112 to +115
// Warn writes a color-wrapped "Warning:" diagnostic to stderr. It is the single
// warning emitter for the CLI: all "Warning:" call sites route through it so the
// prefix, stream (stderr), and color are consistent. Respects the
// NO_COLOR-blanked package color vars (no fresh os.Getenv).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — narrowed the Warn doc comment to "single helper for one-line Warning diagnostics" (create/delete) and called out InitNotFound.RenderWarning as the multi-line exception that does not route through it. (fc9ef4c)

Comment on lines +55 to +59
### `wt.Warn` is the single warning emitter; warnings are stderr-only (`260622-log5`)

- `src/internal/worktree/errors.go` exposes `func Warn(format string, args ...any)` alongside the other output helpers (`WtError`, `PrintError`, `PhaseSeparator`, `PrintInitFailureBanner`). It is the **single** `Warning:`-diagnostic producer for the CLI — it writes `"%sWarning:%s %s\n"` (`ColorYellow` prefix, `ColorReset`, then the formatted message) to **stderr**.
- It is the warnings analogue of `PhaseSeparator`: color detection reuses the **blanked package-level color vars** (the `NO_COLOR`-blanking `init()` zeroes `ColorYellow`/`ColorReset`), so under `NO_COLOR` it emits a plain `Warning: <msg>\n` with **no** ANSI escapes. It MUST NOT call `os.Getenv` afresh.
- **All `Warning:` call sites route through `Warn`** — `create.go` (the uncommitted-changes warning and the open-phase "could not open in …" / reused-worktree-init warnings) and `delete.go` (the two `failed to remove …` warnings and the two pre-menu warnings). Call sites pass the **message text only**, never the literal `Warning: ` prefix — the helper owns the prefix, so re-including it would double it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — retitled the section to the one-line warning helper, scoped Warn to the create/delete sites, and explicitly noted InitNotFound.RenderWarning (init.go) as the exception so Warn is no longer described as the CLI's sole Warning: producer. (fc9ef4c)

Comment on lines +345 to +348
- Sibling memory: `/wt-cli/create-output-phases.md` — the canonical stdout =
machine-result / stderr = human-diagnostic stream-discipline contract this
confirmation honors; it also documents the `wt.Warn` single warning emitter
(`260622-log5`).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — reworded the cross-reference to describe wt.Warn as the shared one-line warning helper used by create/delete, with InitNotFound.RenderWarning noted as the documented exception. (fc9ef4c)

Comment thread src/cmd/wt/delete.go Outdated
cmd.Flags().StringVar(&deleteBranch, "delete-branch", "", "Delete associated branch: true, false, or auto (default: auto — deletes only when branch matches worktree name)")
cmd.Flags().StringVar(&deleteRemote, "delete-remote", "", "Delete remote branch: true (default) or false")
cmd.Flags().StringVar(&deleteBranch, "delete-branch", "", "Delete the associated branch: true (always), false (never), auto (defaultonly if branch name matches worktree name)")
cmd.Flags().StringVar(&deleteRemote, "delete-remote", "", "Delete the remote-tracking branch when the local branch is deleted (true by default)")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — updated the --delete-remote help text to say it deletes the branch on the origin remote (via git push origin --delete), matching DeleteRemoteBranch in internal/worktree/git.go rather than implying a local remote-tracking ref. (fc9ef4c)

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.

3 participants