Fix bugs and improve robustness across the codebase
- Fix staged files being silently cleared when commit uses inline files - Refactor step navigation to use direct go_to_step instead of fragile delta math - Change step numbers from i32 to u32 (reject negative values at parse time) - Add tour rm command to mark files for removal during carry-forward - Add tour reset command to clear session and remove tracked files - Consolidate duplicate recursive copy functions into shared copy_tree in utils - Validate step directories are sequential (detect corruption) - Detect binary files in diffs instead of showing garbage - Use /// doc comments on enum variants so clap generates proper help text - Remove custom Help subcommand in favor of clap's built-in --help - Add CorruptedTour error variant for integrity checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
src/reset.rs
Normal file
18
src/reset.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::error::TourError;
|
||||
use crate::step;
|
||||
use crate::utils::require_tour;
|
||||
use crate::SESSION_PATH;
|
||||
use std::fs;
|
||||
|
||||
pub fn reset() -> Result<(), TourError> {
|
||||
require_tour()?;
|
||||
|
||||
let cwd = std::env::current_dir()?;
|
||||
let tracked = step::get_tracked_files()?;
|
||||
step::remove_tracked_files(&cwd, &tracked)?;
|
||||
|
||||
let _ = fs::remove_file(SESSION_PATH);
|
||||
|
||||
println!("Tour session reset. Tracked files removed from working directory.");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user