Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
ID string `json:"id"`
FilePath string `json:"file_path"`
OldContent string `json:"old_content"`
NewContent string `json:"new_content"`
Timestamp time.Time `json:"timestamp"`
ToolCall string `json:"tool_call"`
}
Checkpoint represents a saved file state before a tool edit.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages file checkpoints for undo support.
func NewManager ¶
NewManager creates a new checkpoint manager with the given max limit.
func (*Manager) Last ¶
func (m *Manager) Last() *Checkpoint
Last returns the most recent checkpoint, or nil if empty.
func (*Manager) List ¶
func (m *Manager) List() []Checkpoint
List returns all checkpoints (most recent last).
func (*Manager) Revert ¶
func (m *Manager) Revert(id string) (*Checkpoint, error)
Revert rolls back to a specific checkpoint by ID, writing OldContent back to the file. It also removes all checkpoints newer than the target.
func (*Manager) Save ¶
func (m *Manager) Save(filePath, oldContent, newContent, toolCall string) Checkpoint
Save records a checkpoint before a file edit.
func (*Manager) Undo ¶
func (m *Manager) Undo() (*Checkpoint, error)
Undo rolls back the most recent checkpoint by writing OldContent back to the file.
Click to show internal directories.
Click to hide internal directories.