cordance-cli 0.1.1

Cordance CLI — installs the `cordance` binary. The umbrella package `cordance` re-exports this entry; either install command works.
Documentation
//! `cordance advise` — deterministic doctrine checks.

use anyhow::Result;
use cordance_core::advise::Severity;
use cordance_core::pack::CordancePack;

pub fn run(pack: &CordancePack, json: bool) -> Result<()> {
    let report = cordance_advise::run_all(pack)?;
    if json {
        let out = serde_json::to_string_pretty(&report)?;
        println!("{out}");
    } else if report.findings.is_empty() {
        println!("cordance advise: no findings");
    } else {
        for f in &report.findings {
            let level = match f.severity {
                Severity::Error => "ERROR",
                Severity::Warning => "WARN ",
                Severity::Info => "INFO ",
            };
            println!("[{level}] {}{}", f.id, f.summary);
            println!("       Doctrine: {}", f.doctrine_anchor);
            println!("       Remediation: {}", f.remediation);
        }
    }
    Ok(())
}