picker alt-r removal skips pre-remove and post-remove hooks
Bug
Worktree removal via alt-r in the picker (wt switch TUI) skips pre-remove and post-remove hooks entirely.
The code at src/commands/picker/mod.rs:70 explicitly notes:
No output, no hooks, no cd directives — we're inside skim's TUI.
Impact
pre-removehooks intended as safety checks (e.g., preventing removal of worktrees with uncommitted work) are bypassedpost-removecleanup hooks (e.g., stopping services, cleaning up ports) never run
Context
Running hooks inside skim's TUI event loop is architecturally constrained — the main thread blocks skim, and hooks may produce output or require user interaction. However:
pre-removehooks could run before signaling skim to reload (they're blocking by design)post-removehooks could be spawned in the background thread alongside the git operations
Suggestion
At minimum, run pre-remove hooks before the removal. If the hook fails, skip the removal and show a brief indicator. For post-remove, spawn in the background thread after execute_removal.
If hooks can't be supported, document this limitation in wt switch --help and the picker legend, not just as an inline code comment.
@worktrunk-bot fix
Fix in #1710.
The picker's background thread now runs pre-remove hooks (silently, with suppressed output) before execute_removal, and spawns post-remove hooks via spawn_background_hooks after. Pre-remove hook failure aborts the removal. Template variables match the normal wt remove flow.
Added run_hooks_silently() for TUI contexts where stderr output would corrupt skim's display — it runs each hook command, checks exit codes, and bails on first failure.