Problem
clean, prune, rm all permanently delete worktrees. If a user confirms by mistake (or the heuristic was wrong), the work is gone — they'd have to re-clone, re-create the branch, and lose any uncommitted local changes.
The existing snapshot command helps but requires prior action.
Suggested fix
- Before removing, automatically archive a lightweight snapshot of uncommitted changes (reuse the
snapshot plumbing) to ~/.bonsai/trash/<timestamp>-<branch>/.
- Add
bonsai undo to restore the most recent trashed worktree.
- Add
bonsai trash list / bonsai trash empty for management.
- Trash entries auto-expire after N days (config-driven).
Optional: make this opt-in via --keep-history initially, opt-out later once stable.
Problem
clean,prune,rmall permanently delete worktrees. If a user confirms by mistake (or the heuristic was wrong), the work is gone — they'd have to re-clone, re-create the branch, and lose any uncommitted local changes.The existing
snapshotcommand helps but requires prior action.Suggested fix
snapshotplumbing) to~/.bonsai/trash/<timestamp>-<branch>/.bonsai undoto restore the most recent trashed worktree.bonsai trash list/bonsai trash emptyfor management.Optional: make this opt-in via
--keep-historyinitially, opt-out later once stable.