worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

[Feature request] Add TUI to worktrunk

Open melsharnou-chwy opened this issue 9 months ago • 4 comments

I think it would be great to have a wt tui that would launch a TUI for managing worktrees

example: https://github.com/chmouel/lazyworktree

melsharnou-chwy avatar Feb 18 '26 17:02 melsharnou-chwy

Thanks for the suggestion! This is a feature request rather than a bug, so I'll leave it for a maintainer to evaluate and prioritize.

worktrunk-bot avatar Feb 18 '26 17:02 worktrunk-bot

I'm not religiously opposed, but what is the use-case for it?

my main push is that we should spend less time managing worktrees / anything like this. are folks spending lots of time on this?

max-sixty avatar Feb 19 '26 04:02 max-sixty

I find the agents sometimes forget about worktrees or cannot remove them because they have a submodule, so I have to keep doing wt switch pick the worktree wt remove --force

which would be nice with a shortcut maybe in the switch interface or in a tui interface

mohamed-rdr avatar Aug 11 '26 15:08 mohamed-rdr

@mohamed-rdr the shortcut you're describing already exists: Alt-x in the wt switch picker removes the selected worktree (or branch) in place, without leaving the picker — see the keybindings table. It's a no-op on the current worktree (the @ row), so switch away first if you're standing in the one you want gone.

The submodule part was a real bug, fixed in v0.28.0 (#1194 → #1196, then made structural in #1247). wt remove now detects initialized submodules and passes --force to git worktree remove itself — after re-verifying the worktree is clean, so it still fails closed on uncommitted work. Alt-x goes through the same removal path, so on a current version the wt remove --force step shouldn't be needed for submodules at all.

What --force still covers is a dirty worktree, and Alt-x declines that one deliberately — force-removing uncommitted work is something worktrunk requires you to ask for explicitly, so there's no force key in the picker. If the agents are leaving uncommitted changes behind, that's the case you're hitting rather than the submodule one.

If you're on ≥ v0.28 and Alt-x (or plain wt remove) still fails on a submodule worktree that's clean, that's a separate bug worth its own issue — wt --version plus the exact error would pin it down, or re-run as wt -vv remove <branch>, which prints the path of a diagnostic bundle and a ready-to-run gh gist create line right after the command output.

Sources
  • Picker keybinding: install_remove_keybinding / AltXRemover in src/commands/picker/mod.rs, documented in docs/content/switch.md.
  • Synthesized force for submodules: Repository::remove_worktree — use_force is set when has_initialized_submodules() is true even though the caller passed force: false, and it re-runs ensure_clean before the destructive command.
  • The picker prepares its removal with force_worktree: false, which is what carries into RemoveOptions and then remove_worktree(path, false) — so the submodule synthesis applies, but the clean gate is not skipped.
  • Behavior covered by test_remove_foreground_with_submodules and test_remove_worktree_submodule_dirty_fails_closed in tests/integration_tests/remove.rs.
  • Version: git tag --contains 1383845b0 (the #1196 merge) → first release is v0.28.0.

worktrunk-bot avatar Aug 11 '26 15:08 worktrunk-bot