@@ -52,6 +52,10 @@ struct Args {
5252 #[ arg( long) ]
5353 json : bool ,
5454
55+ /// Interactive review mode for directory diffs
56+ #[ arg( long) ]
57+ review : bool ,
58+
5559 /// Ignore regions in format x,y,width,height (can be used multiple times)
5660 #[ arg( short, long, value_delimiter = ' ' ) ]
5761 ignore : Vec < Region > ,
@@ -174,6 +178,50 @@ fn run_dir_diff(args: &Args) -> Result<()> {
174178 items. len( ) ,
175179 diff_count
176180 ) ;
181+
182+ if args. review && diff_count > 0 {
183+ use dialoguer:: Select ;
184+ println ! ( "\n {}" , "Entering Review Mode..." . bold( ) . yellow( ) ) ;
185+
186+ for item in items {
187+ if let dir:: DirDiffStatus :: Match ( res) = & item. status {
188+ if res. diff_pixels > 0 {
189+ println ! ( "\n {}" , "-" . repeat( 40 ) ) ;
190+ println ! ( "Reviewing: {}" , item. relative_path. display( ) . to_string( ) . bold( ) . cyan( ) ) ;
191+ println ! ( "Pixel Similarity: {:.2}%" , res. score * 100.0 ) ;
192+
193+ // Regenerate diff for preview
194+ let full_res = compare:: compare_images (
195+ & args. path_a . join ( & item. relative_path ) ,
196+ & args. path_b . join ( & item. relative_path ) ,
197+ args. threshold ,
198+ true ,
199+ & args. ignore ,
200+ args. mask . as_deref ( ) ,
201+ ) ?;
202+
203+ if let Some ( diff_img) = full_res. diff_image {
204+ println ! ( "{}" , "Terminal Preview (Heatmap):" . dimmed( ) ) ;
205+ terminal:: print_preview ( & image:: DynamicImage :: ImageRgba8 ( diff_img) ) ;
206+ }
207+
208+ let selections = & [ "Keep Original" , "Accept New (Overwrite Original)" , "Skip" ] ;
209+ let selection = Select :: new ( )
210+ . with_prompt ( "Action" )
211+ . default ( 0 )
212+ . items ( & selections[ ..] )
213+ . interact ( ) ?;
214+
215+ if selection == 1 {
216+ let src = args. path_b . join ( & item. relative_path ) ;
217+ let dst = args. path_a . join ( & item. relative_path ) ;
218+ std:: fs:: copy ( & src, & dst) ?;
219+ println ! ( "{}" , "✓ Baseline updated." . green( ) ) ;
220+ }
221+ }
222+ }
223+ }
224+ }
177225 }
178226
179227 if args. fail_on_diff && diff_count > 0 {
0 commit comments