Documentation
¶
Overview ¶
Package checkpoint snapshots the working tree into a hidden per-project git repo so users can rewind code to any prior turn. The shadow repo is separate from any real .git: its GIT_DIR lives under ~/.bee/checkpoints, its work-tree is the project root, and it excludes the project's own .git while honoring the project .gitignore. Conversation rewind is handled elsewhere (session.Fork).
Index ¶
- type RestoreResult
- type Snapshot
- type Store
- func (s *Store) DiffStat(from, to string) (string, error)
- func (s *Store) List() ([]Snapshot, error)
- func (s *Store) Prune(keep int) error
- func (s *Store) Restore(msgID string) (RestoreResult, error)
- func (s *Store) Snapshot(msgID, label string) (string, error)
- func (s *Store) SnapshotFor(msgID string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RestoreResult ¶
type RestoreResult struct {
TargetSHA string // state restored to
UndoSHA string // pre-restore state, kept so rewind is reversible
ShortStat string // git --shortstat between undo and target
}
RestoreResult reports the outcome of a rewind.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a shadow git repo bound to one project root.
func (*Store) DiffStat ¶
DiffStat returns a one-line --shortstat between two snapshot shas. An empty from compares against the empty tree (useful for the first snapshot).
func (*Store) Prune ¶
Prune keeps the newest keep snapshots, drops undo refs older than 24h, and gcs unreferenced objects. Best-effort; failures are returned but partial.
func (*Store) Restore ¶
func (s *Store) Restore(msgID string) (RestoreResult, error)
Restore rewinds the work-tree to msgID's snapshot. The current state is captured first (refs/bee/undo) so the rewind itself is reversible. Tracked files revert; files created since the snapshot are removed; gitignored paths are left untouched (clean has no -x).