roboticus-cli 0.11.4

CLI commands and migration engine for the Roboticus agent runtime
Documentation
include!("mechanic_json_flow.rs");

async fn cmd_mechanic_json(
    base_url: &str,
    repair: bool,
    allow_jobs: &[String],
) -> Result<(), Box<dyn std::error::Error>> {
    let roboticus_dir = roboticus_core::home_dir().join(".roboticus");
    let mut findings: Vec<MechanicFinding> = vec![];
    let mut actions = RepairActionSummary::default();

    collect_mechanic_json_local_findings(&roboticus_dir, repair, &mut findings, &mut actions)?;
    collect_mechanic_json_gateway_findings(
        base_url,
        &roboticus_dir,
        repair,
        allow_jobs,
        &mut findings,
        &mut actions,
    )
    .await?;
    collect_mechanic_json_security_and_plugin_findings(
        &roboticus_dir,
        repair,
        &mut findings,
        &mut actions,
    )?;

    let report = MechanicJsonReport {
        ok: findings
            .iter()
            .all(|f| f.severity == "info" || f.auto_repaired),
        repair_mode: repair,
        findings,
        actions,
    };
    println!("{}", serde_json::to_string_pretty(&report)?);
    Ok(())
}