Skip to content

Add /undo and /redo commands like OpenCode - #944

Closed
KazenDev wants to merge 8105 commits into
CodebuffAI:mainfrom
KazenDev:feat/undo-command
Closed

KazenDev wants to merge 8105 commits into
CodebuffAI:mainfrom
KazenDev:feat/undo-command

Conversation

@KazenDev

@KazenDev KazenDev commented Aug 5, 2026

Copy link
Copy Markdown

Closes #907

Adds snapshot-based /undo and /redo commands 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 .git
  • cli/src/state/undo-store.ts — per-chat undo journal with jump-back semantics: undoing a turn reverts that turn plus everything newer
  • /undo and /redo open a /history-style picker: searchable, keyboard and mouse, with a live files panel (modified / created / deleted)
  • Colored, detailed confirmations with the diff stat (git-style colors)

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

  • Snapshots reuse the source repo's object database (alternates) for speed
  • Best-effort: failures disable undo for that turn rather than breaking the chat
  • The user's real git history is never touched

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:triaged Classified by the community triage bot pr:needs-work Right idea, not mergeable as written

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add /undo action

4 participants