feat: Worktree navigation via wt go, launcher via wt open#23
Merged
Conversation
There was a problem hiding this comment.
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 viaWT_CD_FILE+ stdout. - Add
--goflag towt opento select a worktree first (menu or name) and then launch it (optionally composing with--app). - Extract shared worktree-selection logic into
selectWorktree(...)soopen,go, andopen --gouse 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 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`. | | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
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)
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 ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Impact: +531/−56 code (excluding
fab/,docs/) · +1455/−66 totalSummary
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 openfrom 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 overloadedopenverb, blocking the clean division of labor the toolchain is built around. This change introduceswt goas the dedicated worktree-selection verb, narrowswt opentoward a pure launcher, and addswt open --goas an ergonomic composition of both — reusing the existingWT_CD_FILEshell-cd mechanism with no new plumbing.Changes
wt go [name]subcommand — current-repo worktree selection (Act 2); no-arg shows a menu, positional arg resolves directly; navigates viaWT_CD_FILEand prints the resolved path to stdout for scriptingwt opennarrowed toward pure launcher (Act 1) — all existing invocations preserved, behavior unchanged forhopconsumers--goflag onwt open— select-then-launch composition;wt open --goshows the worktree menu then launches,wt open --go <name>resolves then launches,--go --appcomposesselectWorktreehelper extracted fromselectAndOpenso bothwt goandwt open --goshare a single selection source of truthcli-surface.md,launcher-contract.md, newgo-command-contract.mdmemory file