Skip to main content

Module file_history

Module file_history 

Source
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§

FileHistory
File version history tracker
FileSnapshot
A single file version snapshot
VersionSummary
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