//! `cargo conformance` โ€” check or bless the soft3 stack's conformance snapshot.
//!
//! ```text
//! cargo conformance --check                 compare the current build with the committed snapshots
//! cargo conformance --bless [--tier <t>]    regenerate snapshots + proof fixtures, print the diff
//! cargo conformance show <substring>        print current fingerprints whose key contains <substring>
//! cargo conformance manifest                print the protocol stability root of the current build
//!
//! --stack <dir>        directory holding the sibling checkouts (default: beside soft3)
//! --conformance <dir>  soft3/conformance directory (default: this crate's parent)
//! ```

use std::path::PathBuf;
use std::process::ExitCode;

use cyber_conformance::Tier;
use cyber_conformance::harness;
use cyber_conformance::surfaces::{Context, Fixtures};

enum Mode {
    Check,
    Bless,
    Show(String),
    Manifest,
}

fn usage() -> ExitCode {
    eprintln!(
        "usage: cargo conformance (--check | --bless [--tier <alpha|beta|gamma|delta>] | show <key> | manifest) \
         [--stack <dir>] [--conformance <dir>]"
    );
    ExitCode::from(2)
}

fn main() -> ExitCode {
    let mut args: Vec<String> = std::env::args().skip(1).collect();
    // invoked as `cargo conformance โ€ฆ`, cargo passes the subcommand name first
    if args.first().map(String::as_str) == Some("conformance") {
        args.remove(0);
    }
    let mut mode = None;
    let mut tier = Tier::Gamma;
    let mut ctx = Context::from_manifest_dir(Fixtures::Committed);
    let mut it = args.into_iter();
    while let Some(a) = it.next() {
        match a.as_str() {
            "--check" | "check" => mode = Some(Mode::Check),
            "--bless" | "bless" => mode = Some(Mode::Bless),
            "show" => match it.next() {
                Some(k) => mode = Some(Mode::Show(k)),
                None => return usage(),
            },
            "manifest" => mode = Some(Mode::Manifest),
            "--tier" => match it.next().as_deref().and_then(Tier::parse) {
                Some(t) => tier = t,
                None => return usage(),
            },
            "--stack" => match it.next() {
                Some(d) => ctx.stack = PathBuf::from(d),
                None => return usage(),
            },
            "--conformance" => match it.next() {
                Some(d) => ctx.conformance = PathBuf::from(d),
                None => return usage(),
            },
            "-h" | "--help" => {
                usage();
                return ExitCode::SUCCESS;
            }
            _ => return usage(),
        }
    }
    let report = match mode {
        None => return usage(),
        Some(Mode::Check) => harness::check(&ctx),
        Some(Mode::Bless) => harness::bless(&ctx, tier),
        Some(Mode::Show(key)) => {
            let out = harness::generate(&ctx);
            let snap = out.snapshot;
            for e in snap.encoding_entries().into_iter().chain(snap.mechanism_entries()) {
                if e.key.contains(&key) {
                    println!("{}  tier={}  {}", e.key, e.tier.name(), e.fingerprint.to_snap_string());
                }
            }
            return ExitCode::SUCCESS;
        }
        Some(Mode::Manifest) => {
            let out = harness::generate(&ctx);
            println!("{}", out.snapshot.manifest().root().to_snap_string());
            return if out.failures.is_empty() { ExitCode::SUCCESS } else { ExitCode::FAILURE };
        }
    };
    for line in &report.lines {
        println!("{line}");
    }
    if report.green { ExitCode::SUCCESS } else { ExitCode::FAILURE }
}

Homonyms

cyber/src/main.rs
soft3/tru/cli/main.rs
warriors/trisha/cli/main.rs
soft3/glia/import/main.rs
cyb/apps/src/main.rs
cyb/optica/src/main.rs
warriors/joy/cli/main.rs
neural/trident/src/main.rs
cyb/cli/src/main.rs
neural/rune/cli/main.rs
soft3/nox/cli/main.rs
cyb/shell/src/main.rs
cyberia/cyberia-my/src/main.rs
soft3/radio/iroh-relay/src/main.rs
soft3/radio/particle/src/main.rs
neural/eidos/cli/src/main.rs
soft3/glia/run/cli/main.rs
soft3/cybergraph/cli/src/main.rs
soft3/neuron/cli/src/main.rs
soft3/hemera/cli/src/main.rs
warriors/erga/cli/src/main.rs
soft3/strata/cli/src/main.rs
neural/rs/pure-rust-check/src/main.rs
soft3/radio/iroh-dns-server/src/main.rs
neural/rs/macho-linker/src/main.rs
soft3/zheng/cli/src/main.rs
soft3/foculus/src/bin/main.rs
neural/rs/cli/src/main.rs
soft3/radio/radio-cli/src/main.rs
neural/rs/rsc/src/main.rs
soft3/lens/cli/src/main.rs
soft3/bbg/cli/src/main.rs
neural/rs/link/src/main.rs
soft3/strata/nebu/cli/src/main.rs
soft3/mudra/audit/quantus-mldsa-crosscheck/src/main.rs
warriors/erga/rs/mine-bench/src/main.rs
warriors/erga/rs/blake-bench/src/main.rs
soft3/strata/trop/cli/src/main.rs
soft3/strata/genies/cli/src/main.rs
cyb/honeycrisp/acpu/src/probe/main.rs
soft3/strata/jali/cli/src/main.rs
cyb/wysm/crates/cli/src/main.rs
warriors/erga/rs/rtable-bench/src/main.rs
warriors/trisha/tools/neptune-policy-oracle/src/main.rs
cyb/honeycrisp/rane/src/probe/main.rs
soft3/lytics/rs/agent/src/main.rs
neural/inf/rs/cli/src/main.rs
soft3/strata/kuro/cli/src/main.rs
neural/trident/silicon/src/bin/main.rs
soft3/lytics/rs/ingest/src/main.rs
cyb/honeycrisp/unimem/experiments/iosurface_probe/src/main.rs
cyb/honeycrisp/unimem/experiments/hyp_probe/src/main.rs
soft3/radio/audit/2026-10-12-bao-proof-research/primary-probe/src/main.rs
soft3/mudra/audit/signature-optimality/xnt-predicate-check/src/main.rs
soft3/radio/audit/2026-10-12-bao-bounded-proof/nostd-parent/src/main.rs
soft3/radio/audit/2026-10-12-bao-bounded-proof/nostd/src/main.rs
soft3/radio/audit/2026-10-12-bao-bounded-proof/fixture-probe/src/main.rs
soft3/radio/audit/2026-10-12-bao-proof-research/probe/src/main.rs
cyb/honeycrisp/unimem/experiments/dext_contiguous_alloc/client/src/main.rs
cyb/honeycrisp/unimem/experiments/dext_iosurface_pa/client/src/main.rs

Graph