-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Worktree navigation via wt go, launcher via wt open #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,13 +75,16 @@ Exit codes: `ExitInvalidArgs` if `--path` is combined with `--json` or | |
| ## `wt open [name|path]` | ||
|
|
||
| Open a directory in a detected application (editor, terminal, file manager). | ||
| `wt open` is the canonical directory launcher — external callers (notably | ||
| `wt open` is the canonical directory **launcher** — external callers (notably | ||
| `hop`) MAY delegate to it via subprocess invocation. The full env-var contract | ||
| is documented in [`launcher-contract.md`](launcher-contract.md). | ||
| is documented in [`launcher-contract.md`](launcher-contract.md). Worktree | ||
| **selection** (picking which worktree) is the job of [`wt go`](#wt-go-name); | ||
| `wt open --go` composes the two (select, then launch). | ||
|
|
||
| | Flag | Default | Description | | ||
| |------|---------|-------------| | ||
| | `--app <name\|default>` | (none) | Open directly in the named app, skipping the menu. `default` selects the auto-detected default. | | ||
| | `--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`. | | ||
|
|
||
|
Comment on lines
+87
to
88
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — the |
||
| Positional arg `[name|path]`: | ||
|
|
||
|
|
@@ -98,12 +101,50 @@ Positional arg `[name|path]`: | |
| reachable when the cwd is inside a git repo. | ||
|
|
||
| Exit codes: `ExitInvalidArgs` when `--app` is used with the main-repo selection | ||
| menu; `ExitGitError` only when a git operation fails during name resolution | ||
| (not for path-only or no-args invocations from outside a repo); | ||
| menu; `ExitGitError` when a git operation fails during name resolution, or when | ||
| `--go` is invoked from a non-git cwd (the `--go` git-repo precondition) — but | ||
| not for path-only or no-args invocations from outside a repo; | ||
| `ExitByobuTabError` / `ExitTmuxWindowError` for terminal-app failures; | ||
| `ExitGeneralError` for unknown apps, unresolved targets, or name args supplied | ||
| from a non-git cwd. | ||
|
|
||
| ## `wt go [name]` | ||
|
|
||
| Select a worktree of the current repository and **navigate** there. `wt go` is | ||
| the worktree **selector** (the counterpart to `wt open`, the launcher): it | ||
| changes the shell's working directory to the chosen worktree and launches | ||
| nothing. Navigation reuses the same `WT_CD_FILE` shell-cd plumbing as the | ||
| launcher's "Open here" option — see [`launcher-contract.md`](launcher-contract.md) §3. | ||
|
|
||
| | Flag | Default | Description | | ||
| |------|---------|-------------| | ||
| | `--non-interactive` | `false` | No prompts. With no name, refuses deterministically (a no-arg selection menu has no non-interactive default) instead of prompting. | | ||
|
|
||
| Positional arg `[name]`: | ||
|
|
||
| - Omitted: shows a worktree-selection menu for the current repo (newest-first, | ||
| branch shown per entry, newest pre-selected as default). Reachable from | ||
| anywhere in the repository — the main repo **or** inside another worktree. | ||
| On selection, navigates to the chosen worktree. | ||
| - Provided: resolved as a worktree name (case-insensitive); navigates there | ||
| directly with no menu. | ||
|
|
||
| `wt go` always **requires a git repository** — worktree resolution walks the | ||
| repo's worktree list. It is scoped to the current repo's worktrees only; | ||
| cross-repo navigation is `hop`'s job. | ||
|
|
||
| Navigation mechanism: the resolved absolute path is written to `WT_CD_FILE` | ||
| (when set; mode `0600`, truncate-on-write) so the `wt shell-init` wrapper cd's | ||
| the parent shell there, **and** is printed to stdout as the last line so the | ||
| no-wrapper scripting form works: `cd "$(command wt go some-name)"`. When | ||
| `WT_CD_FILE` is unset and `WT_WRAPPER` is not `1`, the same "shell wrapper not | ||
| loaded" hint the launcher prints applies. `wt go` never cd's the parent shell | ||
| directly. | ||
|
|
||
| Exit codes: `ExitGitError` (3) when the cwd is not in a git repository or | ||
| `git worktree list` fails; `ExitGeneralError` (1) for an unknown worktree name, | ||
| or for a no-arg invocation under `--non-interactive`. | ||
|
|
||
| ## `wt delete [worktree-names...]` | ||
|
|
||
| Delete one or more worktrees with optional branch cleanup. | ||
|
|
||
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
12 changes: 12 additions & 0 deletions
12
fab/changes/260620-3pp5-open-worktree-from-worktree/.history.jsonl
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| {"action":"enter","driver":"fab-new","event":"stage-transition","stage":"intake","ts":"2026-06-20T05:44:24Z"} | ||
| {"args":"There's no easy way to open a worktree from another worktree. wt open seems like the command that should do this, but right now it opens the current folder. Thinking holistically, I am also fine transferring the responsibility of 'opening folders' to the hop command, and make wt open open a worktree and delegate to hop open","cmd":"fab-new","event":"command","ts":"2026-06-20T05:44:24Z"} | ||
| {"delta":"+4.6","event":"confidence","score":4.6,"trigger":"calc-score","ts":"2026-06-20T06:46:53Z"} | ||
| {"delta":"+0.0","event":"confidence","score":4.6,"trigger":"calc-score","ts":"2026-06-20T06:46:58Z"} | ||
| {"cmd":"fab-fff","event":"command","ts":"2026-06-20T06:47:41Z"} | ||
| {"action":"enter","driver":"fab-fff","event":"stage-transition","stage":"apply","ts":"2026-06-20T06:47:47Z"} | ||
| {"action":"enter","driver":"fab-fff","event":"stage-transition","stage":"review","ts":"2026-06-20T06:56:54Z"} | ||
| {"action":"enter","driver":"fab-fff","event":"stage-transition","stage":"hydrate","ts":"2026-06-20T07:03:18Z"} | ||
| {"event":"review","result":"passed","ts":"2026-06-20T07:03:18Z"} | ||
| {"action":"enter","driver":"fab-fff","event":"stage-transition","stage":"ship","ts":"2026-06-20T07:08:00Z"} | ||
| {"action":"enter","driver":"git-pr","event":"stage-transition","stage":"review-pr","ts":"2026-06-20T07:09:37Z"} | ||
| {"event":"review","result":"passed","ts":"2026-06-20T07:15:49Z"} |
53 changes: 53 additions & 0 deletions
53
fab/changes/260620-3pp5-open-worktree-from-worktree/.status.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| id: 3pp5 | ||
| name: 260620-3pp5-open-worktree-from-worktree | ||
| created: 2026-06-20T05:44:24Z | ||
| created_by: sahil-noon | ||
| change_type: feat | ||
| issues: [] | ||
| progress: | ||
| intake: done | ||
| apply: done | ||
| review: done | ||
| hydrate: done | ||
| ship: done | ||
| review-pr: done | ||
| plan: | ||
| generated: true | ||
| task_count: 9 | ||
| acceptance_count: 20 | ||
| acceptance_completed: 20 | ||
| confidence: | ||
| certain: 4 | ||
| confident: 4 | ||
| tentative: 0 | ||
| unresolved: 0 | ||
| score: 4.6 | ||
| fuzzy: true | ||
| dimensions: | ||
| signal: 78.1 | ||
| reversibility: 77.5 | ||
| competence: 86.9 | ||
| disambiguation: 79.4 | ||
| stage_metrics: | ||
| intake: {started_at: "2026-06-20T05:44:24Z", driver: fab-new, iterations: 1, completed_at: "2026-06-20T06:47:47Z"} | ||
| apply: {started_at: "2026-06-20T06:47:47Z", driver: fab-fff, iterations: 1, completed_at: "2026-06-20T06:56:54Z"} | ||
| review: {started_at: "2026-06-20T06:56:54Z", driver: fab-fff, iterations: 1, completed_at: "2026-06-20T07:03:18Z"} | ||
| hydrate: {started_at: "2026-06-20T07:03:18Z", driver: fab-fff, iterations: 1, completed_at: "2026-06-20T07:08:00Z"} | ||
| ship: {started_at: "2026-06-20T07:08:00Z", driver: fab-fff, iterations: 1, completed_at: "2026-06-20T07:09:37Z"} | ||
| review-pr: {started_at: "2026-06-20T07:09:37Z", driver: git-pr, iterations: 1, completed_at: "2026-06-20T07:15:49Z"} | ||
| prs: | ||
| - https://github.com/sahil87/wt/pull/23 | ||
| change_type_source: explicit | ||
| true_impact: | ||
| added: 0 | ||
| deleted: 0 | ||
| net: 0 | ||
| excluding: | ||
| added: 0 | ||
| deleted: 0 | ||
| net: 0 | ||
| computed_at: "2026-06-20T07:08:00Z" | ||
| computed_at_stage: hydrate | ||
| summary: Add wt go (current-repo worktree selection, WT_CD_FILE+stdout navigation, no launch) and wt open --go composition; extract shared selectWorktree helper | ||
| # true_impact: lazily created on first apply-finish (no placeholder here). | ||
| last_updated: 2026-06-20T07:15:49Z |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.