Add /undo and /redo commands like OpenCode - #944
Conversation
|
Thanks for taking a look! Since this mirror doesn't run public CI, here's how the change was validated and how to try it. Automated tests (2 new files, ~264 lines): bun test cli/src/state/__tests__/undo-store.test.ts cli/src/utils/__tests__/undo-snapshot.test.ts
# or the full CLI suite: cd cli && bun run testAlso validated locally with Manual walkthrough:
Notes:
|
|
This is clearly a serious effort — isolated snapshot git repo, per-chat undo/redo journal, a full-screen picker modeled on the existing /history UI, colored diff-stat rendering, and unit tests for both Concerns that keep this from being a clean port:
Given the size and the coupling to |
Closes #907
Adds snapshot-based
/undoand/redocommands modeled after OpenCode's snapshot service, with a native full-screen picker.What
cli/src/utils/undo-snapshot.ts— isolated per-project git snapshot repo (track / restore / revert / diff) that never touches the real.gitcli/src/state/undo-store.ts— per-chat undo journal with jump-back semantics: undoing a turn reverts that turn plus everything newer/undoand/redoopen a/history-style picker: searchable, keyboard and mouse, with a live files panel (modified / created / deleted)Why
Users currently have no way to revert the agent's changes without manual git surgery. This is the safety net that makes it safe to let the agent edit code freely.
Notes