securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
use anyhow::{bail, Result};
use std::path::Path;

pub fn execute(path: &Path, files: &[String], cached: bool) -> Result<()> {
    let repo = crate::ops::open_repo(path)?;
    let mut index = repo.index()?;

    for file in files {
        // Validate the file is tracked (exists in the index)
        if index.get_path(Path::new(file), 0).is_none() {
            bail!("pathspec '{}' did not match any files known to git", file);
        }

        index.remove_path(Path::new(file))?;

        if !cached {
            let full = path.join(file);
            if full.exists() {
                if full.is_dir() {
                    std::fs::remove_dir_all(&full)?;
                } else {
                    std::fs::remove_file(&full)?;
                }
            }
        }
        println!("rm '{}'", file);
    }

    index.write()?;
    Ok(())
}