snapshot

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDiff

type FileDiff struct {
	File      string `json:"file"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Status    string `json:"status"` // added, deleted, modified
}

FileDiff represents a diff for a single file between two snapshots.

type Patch

type Patch struct {
	Hash      string    `json:"hash"`
	Message   string    `json:"message"`
	Files     []string  `json:"files"`
	Timestamp time.Time `json:"timestamp"`
}

Patch represents a recorded snapshot with its changed files.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker maintains a shadow git repository that records every file change the agent makes. Supports point-in-time restore and selective revert.

func New

func New(projectDir string) *Tracker

New creates a Tracker for the given project directory.

func (*Tracker) Cleanup

func (t *Tracker) Cleanup(maxAge time.Duration) error

Cleanup runs garbage collection on the shadow repo.

func (*Tracker) Diff

func (t *Tracker) Diff(from, to string) ([]FileDiff, error)

Diff returns the list of changed files between two snapshot hashes.

func (*Tracker) History

func (t *Tracker) History(limit int) ([]Patch, error)

History returns the last N snapshots.

func (*Tracker) Init

func (t *Tracker) Init() error

Init initializes the shadow git repository if it doesn't exist.

func (*Tracker) Restore

func (t *Tracker) Restore(hash string) error

Restore resets the project directory to the state at the given snapshot.

func (*Tracker) Track

func (t *Tracker) Track(message string) (string, error)

Track takes a snapshot of the current project state. Returns the commit hash.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL