use crate::cli::DoctorArgs;
use crate::errors::{Error, Result};
use crate::io::oneharness::{self, ProbeOutcome};
pub fn run(args: DoctorArgs) -> Result<i32> {
let bin = args.oneharness_bin.clone().or_else(|| {
std::env::var("LLMLINT_ONEHARNESS_BIN")
.ok()
.filter(|s| !s.is_empty())
});
let client = oneharness::Client::new(bin.as_deref());
let version = client.check_min_version()?;
println!("oneharness: {version} ({})", client.bin.display());
if !args.probe {
return Ok(0);
}
let harness = args.harness.as_deref();
println!(
"probing tool execution via {} (this makes a real model call)…",
harness.unwrap_or("the default harness")
);
match client.probe(harness, args.model.as_deref(), args.timeout)? {
ProbeOutcome::Executed => {
println!("tool execution: ok — the harness ran a tool inline");
Ok(0)
}
ProbeOutcome::Deferred(detail) => Err(Error::ToolDeferred {
harness: harness.unwrap_or("oneharness default").to_string(),
detail,
}),
}
}