use crate::core::session::{self, Session};
use anyhow::Result;
pub fn run(file: &str) -> Result<String> {
let session = Session::open()?;
let resolved = session::resolve_path(file);
let canonical = resolved
.canonicalize()
.map(|c| c.to_string_lossy().into_owned())
.unwrap_or_else(|_| resolved.to_string_lossy().into_owned());
let affected = session.delete_read_all_sessions(&canonical)?;
Ok(match affected {
0 => format!("No baseline tracked for {canonical} — nothing to clear.\n"),
1 => format!("Cleared baseline for {canonical}\nNext read will return the full file.\n"),
n => format!(
"Cleared baseline for {canonical} in {n} sessions\nNext read in any session will return the full file.\n"
),
})
}