use roboticus_llm::oauth::check_and_repair_oauth_storage;
use super::icons;
use crate::cli::{CRT_DRAW_MS, theme};
pub(super) fn run_oauth_storage_maintenance() {
let (OK, _, WARN, DETAIL, _) = icons();
let oauth_health = check_and_repair_oauth_storage(true);
if oauth_health.needs_attention() {
if oauth_health.repaired {
println!(" {OK} OAuth token storage repaired/migrated");
} else if !oauth_health.keystore_available {
println!(" {WARN} OAuth migration check skipped (keystore unavailable)");
println!(
" {DETAIL} Run `roboticus mechanic --repair` after fixing keystore access."
);
} else {
println!(" {WARN} OAuth token storage requires manual attention");
println!(" {DETAIL} Run `roboticus mechanic --repair` to attempt recovery.");
}
} else {
println!(" {OK} OAuth token storage is healthy");
}
}