CLI: propagate alias rename errors, doctor config resilience

aliases: rename now propagates every meta.json I/O and parse error
instead of silently ignoring failures. Previously, a corrupt or
unreadable meta.json after directory rename would leave the alias
in an inconsistent state with no user-visible error.

doctor: Config::load failure now falls back to Config::default()
with a warning instead of aborting the entire health check. Doctor
should still run diagnostics even when config is missing or corrupt
— that's exactly when you need it most.
This commit is contained in:
teernisse
2026-02-12 16:14:01 -05:00
parent 75d9344b44
commit 0b9a8a36c5
3 changed files with 29 additions and 16 deletions

View File

@@ -32,8 +32,8 @@ pub struct Args {
#[arg(long)]
pub prune_stale: bool,
/// Days before an alias is considered stale (default: 90)
#[arg(long, default_value_t = 90)]
/// Days before an alias is considered stale (default: 30, matching config)
#[arg(long, default_value_t = 30)]
pub prune_threshold: u32,
/// Evict least-recently-used aliases until total size is under this limit (MB)
@@ -290,13 +290,13 @@ fn execute_prune(args: &Args, robot: bool, start: Instant) -> Result<(), Swagger
"cache",
start.elapsed(),
);
} else if stale.is_empty() {
} else if pruned.is_empty() {
println!(
"No stale aliases (threshold: {} days).",
args.prune_threshold
);
} else {
println!("Pruned {} stale alias(es).", stale.len());
println!("Pruned {} stale alias(es).", pruned.len());
}
Ok(())
}