Expand description
File version history tracking
Automatically captures file snapshots before modifications (write, edit, patch). Provides version listing, diff generation, and restore capabilities.
§Design
- Per-session file history stored in memory
- Snapshots captured before each file-modifying tool execution
- Unified diff generation between any two versions
- Restore to any previous version
§Usage
ⓘ
use a3s_code::file_history::FileHistory;
let history = FileHistory::new(100); // max 100 snapshots
history.save_snapshot("/path/to/file.rs", "original content");
history.save_snapshot("/path/to/file.rs", "modified content");
let versions = history.list_versions("/path/to/file.rs");
let diff = history.diff("/path/to/file.rs", 0, 1);Structs§
- File
History - File version history tracker
- File
Snapshot - A single file version snapshot
- Version
Summary - Summary of a file version (without content, for listing)
Functions§
- extract_
file_ path - Extract the file path from tool arguments for file-modifying tools
- is_
file_ modifying_ tool - Check if a tool name is a file-modifying tool that should trigger snapshots