worktree-runner-tui is a terminal UI for running and managing Git worktree sessions from inside a repository.
It keeps one active runtime session per namespace, lets you switch worktrees with the keyboard, and keeps logs/process cleanup tied to the repo's shared Git state.
- Discover worktrees from the current repository even when launched from a subdirectory
- Start, switch, or restart the active worktree session with
Enter - Stop the active session and clean up recorded orphan processes with
s - Run an optional per-worktree setup command with
i - Open the selected worktree in your editor with
e - Open the selected branch's pull request in a browser with
o - Delete a non-root worktree from the TUI with
d, then confirm - Inspect branch, upstream, working tree, and pull request metadata in the detail pane
- Tail ANSI-colored logs inline or in a full-screen log view
- Generate and load JSONC config with comments and trailing commas
- Node.js
>=20 - Git
- A Git repository (additional linked worktrees optional)
- Optional: GitHub CLI (
gh) and a GitHub origin remote for pull request metadata ando/ Open PR
npm install -g @ohzw/worktree-runner-tuiInstalled binary: wtr
The renamed npm package is published separately. Replace the old global installation:
npm uninstall -g @ohzw/worktree-command-tui
npm install -g @ohzw/worktree-runner-tuiExisting .worktree-command-tui.jsonc and .worktree-command-tui.json files remain supported. New configuration is written as .worktree-runner-tui.jsonc.
Session records and logs keep their existing Git common-dir location so an in-flight session remains controllable after upgrading.
Run this from the repo root or any subdirectory inside the repo:
wtr initThis writes .worktree-runner-tui.jsonc at the repository root.
To overwrite an existing config:
wtr init --forcewtrIf config is missing, the CLI exits with a message telling you to run wtr init.
Primary shortcuts in the footer:
↑↓/jk— move selectionEnter— start, switch to, or restart the selected worktreei— runsetupCommandwhen configurede— open the selected worktree in the configured editor wheneditorCommandis configuredo— open the selected worktree's pull request when GitHub metadata is availabled— arm worktree deletionL— open full-screen logss— stop active sessionr— refresh worktree metadata?— show helpq— quit
Additional shortcuts from the help window:
g/G— jump to first / last worktree[/]— scroll logsPageUp/PageDn— page the selection list- Mouse wheel — scroll the pane under the cursor
d/y— confirm delete after arming itEsc/n/q— cancel delete confirmation
wtr executes the argv commands stored in the selected configuration file when you press the matching keys. Treat repository config as trusted code:
Enterstartscommandin the selected worktree; pressing it on the active worktree restarts that session.irunssetupCommand; package-manager install commands may run dependency lifecycle scripts.erunseditorCommandwith the selected worktree path appended.
Review config before using those actions in an untrusted repository or worktree.
The TUI also reads pull request metadata with the GitHub CLI when remote.origin.url points at github.com. This uses gh api, your existing gh authentication, and a short timeout. Non-GitHub remote hosts are ignored by default.
The tool looks for config in this order:
.worktree-runner-tui.jsonc.worktree-runner-tui.json.worktree-command-tui.jsonc(legacy).worktree-command-tui.json(legacy)
Example config:
Notes:
setupCommandis optional and never runs automatically;ionly appears when it is configured. It accepts one argv array or an array of argv arrays executed in order. The built-in["copy-root-file", "source", "destination"]copies from the repo root into the selected worktree.editorCommandis optional; when set, the selected worktree path is appended to the argv andebecomes available- Use
portsfor every backend/frontend/dev-server port the command may bind; legacy singleportconfigs still load - The generated default config auto-detects package manager hints from
packageManageror common lockfiles and chooses a default script such asdev,start, orserve - Session records and logs are stored under the repository's Git common dir, so they are shared across worktrees in the same repo
npm install
npm test
npm run typecheck
npm run buildMIT
{ // Session namespace used for git-common-dir state files and logs. "namespace": "worktree-runner-tui", // Command launched in the selected worktree. "command": ["npm", "run", "dev"], // Optional command run manually with the setup key in the selected worktree. "setupCommand": ["npm", "install"], // Optional command that opens the selected worktree path in an editor. // The selected worktree path is appended as the final argv entry. "editorCommand": ["code"], // TCP ports owned by the command, used when stopping stale/orphaned processes. "ports": [3000], // Files that must exist in a worktree before the command can be started there. "requiredFiles": ["package.json"], // Extra process command-line substrings treated as orphans for cleanup. "orphanMatchers": [] }