What
lua/config/worktree.lua covers listing/switching (M.list, bound to :Worktrees/<leader>sw) and diffing against a base branch (M.diff_base, :WorktreeDiff/<leader>gm), but there's no cleanup path. In a worktree-heavy flow, worktrees for branches that are long since merged accumulate, and removing one today means dropping to a shell for git worktree remove — a context switch the rest of this module is specifically designed to avoid.
Where
lua/config/worktree.lua — a new M.prune() alongside the existing list_worktrees()/default_base_branch() helpers (currently lines 10-52), surfaced the same way M.list surfaces its picker (lua/config/worktree.lua:69-122, fzf-lua with a vim.ui.select fallback).
Why it matters
default_base_branch() (worktree.lua:41-52) already encodes "what's the trunk branch to compare against" for diffing; the exact same information identifies prune candidates — a worktree whose branch is fully merged into that base is almost always done being worked on. Reusing that logic rather than introducing a new concept keeps the module's surface small, and gives the existing :Worktrees picker an actual way to shrink the list it shows instead of only ever growing it.
Recommended action
Add M.prune() / :WorktreePrune that cross-references git worktree list --porcelain output (already parsed by list_worktrees()) against git branch --merged <base>, lists the matches through the same fzf-lua/vim.ui.select pattern M.list uses, and on confirmation runs git worktree remove — mirroring the confirm-then-act shape already used for killing a server in lua/config/server.lua's kill_entry().
What
lua/config/worktree.luacovers listing/switching (M.list, bound to:Worktrees/<leader>sw) and diffing against a base branch (M.diff_base,:WorktreeDiff/<leader>gm), but there's no cleanup path. In a worktree-heavy flow, worktrees for branches that are long since merged accumulate, and removing one today means dropping to a shell forgit worktree remove— a context switch the rest of this module is specifically designed to avoid.Where
lua/config/worktree.lua— a newM.prune()alongside the existinglist_worktrees()/default_base_branch()helpers (currently lines 10-52), surfaced the same wayM.listsurfaces its picker (lua/config/worktree.lua:69-122, fzf-lua with avim.ui.selectfallback).Why it matters
default_base_branch()(worktree.lua:41-52) already encodes "what's the trunk branch to compare against" for diffing; the exact same information identifies prune candidates — a worktree whose branch is fully merged into that base is almost always done being worked on. Reusing that logic rather than introducing a new concept keeps the module's surface small, and gives the existing:Worktreespicker an actual way to shrink the list it shows instead of only ever growing it.Recommended action
Add
M.prune()/:WorktreePrunethat cross-referencesgit worktree list --porcelainoutput (already parsed bylist_worktrees()) againstgit branch --merged <base>, lists the matches through the same fzf-lua/vim.ui.selectpatternM.listuses, and on confirmation runsgit worktree remove— mirroring the confirm-then-act shape already used for killing a server inlua/config/server.lua'skill_entry().