use aristo_core::canon::cache::CanonMatchesFile;
use crate::commands::canon::runner::{print_stamp_summary, run_canon_step, RunnerArgs};
use crate::commands::index::workspace_or_error;
use crate::CliResult;
pub(crate) fn run() -> CliResult<()> {
let ws = workspace_or_error()?;
let config = ws.load_config();
let index = crate::commands::show::load_index(&ws)?;
let outcome = run_canon_step(RunnerArgs {
ws: &ws,
config: &config.canon,
index: &index,
skip_flag: false,
refresh_flag: true,
threshold: config.canon.threshold_stamp,
found_by: "aristo canon refresh",
})?;
let cache_path = ws.canon_matches_path();
let cache = CanonMatchesFile::read(&cache_path).unwrap_or_default();
print_stamp_summary(&outcome, &cache, &ws);
Ok(())
}