Documentation
¶
Overview ¶
Package snapshot checkpoints the workspace for /undo in a shadow git repo outside the project, with the workspace as its work tree. Snapshots are whole-workspace trees, so they capture changes from any source (tools, bash, manual edits) and never touch the user's own .git.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSnapshotExpired = errors.New("the checkpoint has expired (checkpoints are reclaimed after 7 days) and can no longer be restored")
ErrSnapshotExpired means gc pruned the snapshot. The expired entry is already dropped from the stack.
var ErrTrackerClosed = errors.New("snapshot tracker closed")
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker records one snapshot per turn: Track runs at each turn boundary and Undo reverts the most recent turn's file changes.
func (*Tracker) Close ¶
func (t *Tracker) Close()
Close waits for the background gc, so cleanup and shutdown don't race it.
func (*Tracker) Rebind ¶
Rebind switches to another workspace when the conversation enters or leaves a worktree. gc runs once per process, so a worktree's shadow repo is normally not collected; it is removed with the worktree.
func (*Tracker) Redo ¶
Redo returns ok=false when there is nothing to redo. Redo snapshots live only in memory, so they are too recent for gc to prune.