Skip to content

feat: Worktree navigation via wt go, launcher via wt open#23

Merged
sahil-noon merged 4 commits into
mainfrom
260620-3pp5-open-worktree-from-worktree
Jun 20, 2026
Merged

feat: Worktree navigation via wt go, launcher via wt open#23
sahil-noon merged 4 commits into
mainfrom
260620-3pp5-open-worktree-from-worktree

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Meta

ID Type Confidence Plan Review
3pp5 feat 4.6/5.0 9/9 tasks, 20/20 acceptance ✓ ✓ 1 cycle

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

Impact: +531/−56 code (excluding fab/, docs/) · +1455/−66 total

Summary

From inside a worktree, there is no low-friction way to discover and jump to a sibling worktree — the selection menu is locked to the main repo, and the no-arg wt open from within a worktree opens the current folder. The acts of "pick which worktree" and "launch a directory in a tool" are fused into a single overloaded open verb, blocking the clean division of labor the toolchain is built around. This change introduces wt go as the dedicated worktree-selection verb, narrows wt open toward a pure launcher, and adds wt open --go as an ergonomic composition of both — reusing the existing WT_CD_FILE shell-cd mechanism with no new plumbing.

Changes

  • New wt go [name] subcommand — current-repo worktree selection (Act 2); no-arg shows a menu, positional arg resolves directly; navigates via WT_CD_FILE and prints the resolved path to stdout for scripting
  • wt open narrowed toward pure launcher (Act 1) — all existing invocations preserved, behavior unchanged for hop consumers
  • New --go flag on wt open — select-then-launch composition; wt open --go shows the worktree menu then launches, wt open --go <name> resolves then launches, --go --app composes
  • Shared selectWorktree helper extracted from selectAndOpen so both wt go and wt open --go share a single selection source of truth
  • Docs and specs: cli-surface.md, launcher-contract.md, new go-command-contract.md memory file

@sahil-noon sahil-noon marked this pull request as ready for review June 20, 2026 07:10
@sahil-noon sahil-noon requested a review from Copilot June 20, 2026 07:11

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 introduces a clearer split between worktree selection/navigation and directory launching by adding a dedicated wt go selector command, narrowing wt open toward launcher behavior, and enabling an ergonomic composition via wt open --go.

Changes:

  • Add wt go [name] for current-repo worktree selection and navigation via WT_CD_FILE + stdout.
  • Add --go flag to wt open to select a worktree first (menu or name) and then launch it (optionally composing with --app).
  • Extract shared worktree-selection logic into selectWorktree(...) so open, go, and open --go use one menu implementation.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/cmd/wt/open.go Adds --go composition path, extracts shared selectWorktree, and refactors --app handling into openInNamedApp.
src/cmd/wt/main.go Registers the new go subcommand on the root CLI.
src/cmd/wt/go.go Implements wt go selector + navigateTo (WT_CD_FILE + stdout) behavior.
src/cmd/wt/go_test.go Adds unit-style binary tests for wt go behavior and exit codes.
src/cmd/wt/integration_test.go Adds end-to-end coverage for sibling-worktree navigation and wt open --go composition.
src/cmd/wt/help_dump_test.go Updates visible-subcommand expectations to include go.
docs/specs/cli-surface.md Documents wt go and wt open --go (note: exit-code summary needs alignment—comment left).
docs/specs/launcher-contract.md Notes wt go reuses WT_CD_FILE semantics without changing the contract.
docs/memory/wt-cli/go-command-contract.md Adds a memory/contract capture for wt go + wt open --go.
docs/memory/wt-cli/index.md Adds entry for the new memory file (note: “Last Updated” placeholder needs fixing—comment left).
docs/memory/wt-cli/recency-ordering-contract.md Updates recency-ordering memory to include wt go as a consumer via selectWorktree.
docs/memory/wt-cli/menu-navigation-contract.md Updates menu-navigation memory to include wt go / open --go call paths.
fab/changes/260620-3pp5-open-worktree-from-worktree/* Captures planning/intake/status/history artifacts for this change.

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

Comment thread docs/specs/cli-surface.md
Comment on lines +87 to 88
| `--go` | `false` | Select a worktree first (via `wt go`'s menu when no name is given, or resolve-by-name when one is), then launch it. Requires a git repository; composes with `--app`. From a non-git cwd, exits `ExitGitError`. |

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 — the wt open exit-code summary now lists ExitGitError for the --go non-git-cwd precondition, alongside the name-resolution git-op case. (08e0a1f)

Comment thread docs/memory/wt-cli/index.md
@sahil-noon sahil-noon merged commit 7539fbf into main Jun 20, 2026
2 checks passed
@sahil-noon sahil-noon deleted the 260620-3pp5-open-worktree-from-worktree branch June 20, 2026 10:13
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