@@ -28,14 +28,14 @@ use crate::os::Os;
2828
2929/// Manages a shadow git repository for tracking and restoring workspace changes
3030#[ derive( Debug , Clone , Serialize , Deserialize ) ]
31- pub struct CaptureManager {
31+ pub struct CheckpointManager {
3232 /// Path to the shadow (bare) git repository
3333 pub shadow_repo_path : PathBuf ,
3434
35- /// All captures in chronological order
36- pub captures : Vec < Capture > ,
35+ /// All checkpoints in chronological order
36+ pub checkpoints : Vec < Checkpoint > ,
3737
38- /// Fast lookup: tag -> index in captures vector
38+ /// Fast lookup: tag -> index in checkpoints vector
3939 pub tag_index : HashMap < String , usize > ,
4040
4141 /// Track the current turn number
@@ -63,7 +63,7 @@ pub struct FileStats {
6363}
6464
6565#[ derive( Debug , Clone , Serialize , Deserialize ) ]
66- pub struct Capture {
66+ pub struct Checkpoint {
6767 pub tag : String ,
6868 pub timestamp : DateTime < Local > ,
6969 pub description : String ,
@@ -72,21 +72,21 @@ pub struct Capture {
7272 pub tool_name : Option < String > ,
7373}
7474
75- impl CaptureManager {
76- /// Initialize capture manager automatically (when in a git repo)
75+ impl CheckpointManager {
76+ /// Initialize checkpoint manager automatically (when in a git repo)
7777 pub async fn auto_init ( os : & Os , shadow_path : impl AsRef < Path > ) -> Result < Self > {
7878 if !is_git_installed ( ) {
79- bail ! ( "Git is not installed. Captures require git to function." ) ;
79+ bail ! ( "Git is not installed. Checkpoints require git to function." ) ;
8080 }
8181 if !is_in_git_repo ( ) {
82- bail ! ( "Not in a git repository. Use '/capture init' to manually enable captures ." ) ;
82+ bail ! ( "Not in a git repository. Use '/checkpoint init' to manually enable checkpoints ." ) ;
8383 }
8484
8585 let manager = Self :: manual_init ( os, shadow_path) . await ?;
8686 Ok ( manager)
8787 }
8888
89- /// Initialize capture manager manually
89+ /// Initialize checkpoint manager manually
9090 pub async fn manual_init ( os : & Os , path : impl AsRef < Path > ) -> Result < Self > {
9191 let path = path. as_ref ( ) ;
9292 os. fs . create_dir_all ( path) . await ?;
@@ -97,10 +97,10 @@ impl CaptureManager {
9797 // Configure git
9898 configure_git ( & path. to_string_lossy ( ) ) ?;
9999
100- // Create initial capture
100+ // Create initial checkpoint
101101 stage_commit_tag ( & path. to_string_lossy ( ) , "Initial state" , "0" ) ?;
102102
103- let initial_capture = Capture {
103+ let initial_checkpoint = Checkpoint {
104104 tag : "0" . to_string ( ) ,
105105 timestamp : Local :: now ( ) ,
106106 description : "Initial state" . to_string ( ) ,
@@ -114,7 +114,7 @@ impl CaptureManager {
114114
115115 Ok ( Self {
116116 shadow_repo_path : path. to_path_buf ( ) ,
117- captures : vec ! [ initial_capture ] ,
117+ checkpoints : vec ! [ initial_checkpoint ] ,
118118 tag_index,
119119 current_turn : 0 ,
120120 tools_in_turn : 0 ,
@@ -124,8 +124,8 @@ impl CaptureManager {
124124 } )
125125 }
126126
127- /// Create a new capture point
128- pub fn create_capture (
127+ /// Create a new checkpoint point
128+ pub fn create_checkpoint (
129129 & mut self ,
130130 tag : & str ,
131131 description : & str ,
@@ -136,8 +136,8 @@ impl CaptureManager {
136136 // Stage, commit and tag
137137 stage_commit_tag ( & self . shadow_repo_path . to_string_lossy ( ) , description, tag) ?;
138138
139- // Record capture metadata
140- let capture = Capture {
139+ // Record checkpoint metadata
140+ let checkpoint = Checkpoint {
141141 tag : tag. to_string ( ) ,
142142 timestamp : Local :: now ( ) ,
143143 description : description. to_string ( ) ,
@@ -146,20 +146,20 @@ impl CaptureManager {
146146 tool_name,
147147 } ;
148148
149- self . captures . push ( capture ) ;
150- self . tag_index . insert ( tag. to_string ( ) , self . captures . len ( ) - 1 ) ;
149+ self . checkpoints . push ( checkpoint ) ;
150+ self . tag_index . insert ( tag. to_string ( ) , self . checkpoints . len ( ) - 1 ) ;
151151
152- // Cache file stats for this capture
152+ // Cache file stats for this checkpoint
153153 if let Ok ( stats) = self . compute_file_stats ( tag) {
154154 self . file_stats_cache . insert ( tag. to_string ( ) , stats) ;
155155 }
156156
157157 Ok ( ( ) )
158158 }
159159
160- /// Restore workspace to a specific capture
160+ /// Restore workspace to a specific checkpoint
161161 pub fn restore ( & self , conversation : & mut ConversationState , tag : & str , hard : bool ) -> Result < ( ) > {
162- let capture = self . get_capture ( tag) ?;
162+ let checkpoint = self . get_checkpoint ( tag) ?;
163163
164164 // Restore files
165165 let args = if hard {
@@ -174,7 +174,7 @@ impl CaptureManager {
174174 }
175175
176176 // Restore conversation history
177- while conversation. history ( ) . len ( ) > capture . history_index {
177+ while conversation. history ( ) . len ( ) > checkpoint . history_index {
178178 conversation
179179 . pop_from_history ( )
180180 . ok_or ( eyre ! ( "Failed to restore conversation history" ) ) ?;
@@ -183,7 +183,7 @@ impl CaptureManager {
183183 Ok ( ( ) )
184184 }
185185
186- /// Get file change statistics for a capture
186+ /// Get file change statistics for a checkpoint
187187 pub fn compute_file_stats ( & self , tag : & str ) -> Result < FileStats > {
188188 if tag == "0" {
189189 return Ok ( FileStats :: default ( ) ) ;
@@ -193,7 +193,7 @@ impl CaptureManager {
193193 self . compute_stats_between ( & prev_tag, tag)
194194 }
195195
196- /// Compute file statistics between two captures
196+ /// Compute file statistics between two checkpoints
197197 pub fn compute_stats_between ( & self , from : & str , to : & str ) -> Result < FileStats > {
198198 let output = run_git ( & self . shadow_repo_path , false , & [ "diff" , "--name-status" , from, to] ) ?;
199199
@@ -213,7 +213,7 @@ impl CaptureManager {
213213 Ok ( stats)
214214 }
215215
216- /// Generate detailed diff between captures
216+ /// Generate detailed diff between checkpoints
217217 pub fn diff ( & self , from : & str , to : & str ) -> Result < String > {
218218 let mut result = String :: new ( ) ;
219219
@@ -263,15 +263,15 @@ impl CaptureManager {
263263 Ok ( ( ) )
264264 }
265265
266- fn get_capture ( & self , tag : & str ) -> Result < & Capture > {
266+ fn get_checkpoint ( & self , tag : & str ) -> Result < & Checkpoint > {
267267 self . tag_index
268268 . get ( tag)
269- . and_then ( |& idx| self . captures . get ( idx) )
270- . ok_or_else ( || eyre ! ( "Capture '{}' not found" , tag) )
269+ . and_then ( |& idx| self . checkpoints . get ( idx) )
270+ . ok_or_else ( || eyre ! ( "Checkpoint '{}' not found" , tag) )
271271 }
272272}
273273
274- impl Drop for CaptureManager {
274+ impl Drop for CheckpointManager {
275275 fn drop ( & mut self ) {
276276 let path = self . shadow_repo_path . clone ( ) ;
277277 // Try to spawn cleanup task
@@ -304,7 +304,7 @@ pub fn truncate_message(s: &str, max_len: usize) -> String {
304304 }
305305}
306306
307- pub const CAPTURE_MESSAGE_MAX_LENGTH : usize = 60 ;
307+ pub const CHECKPOINT_MESSAGE_MAX_LENGTH : usize = 60 ;
308308
309309fn is_git_installed ( ) -> bool {
310310 Command :: new ( "git" )
0 commit comments