cargo-governor 2.0.3

Machine-First, LLM-Ready, CI/CD-Native release automation tool for Rust crates
Documentation
//! Check command.

use governor_application::release::{CheckInput, check};

use crate::cli::{CheckOpts, OutputFormat};
use crate::error::{CommandExitCode, Result};
use crate::presenter::print_json;
use crate::runtime::cargo_adapter;

pub async fn execute(
    workspace_path: &str,
    opts: CheckOpts,
    _format: OutputFormat,
) -> Result<CommandExitCode> {
    let started_at = std::time::Instant::now();
    let cargo = cargo_adapter();
    let output = check(
        &cargo,
        CheckInput {
            workspace_path: workspace_path.to_string(),
            checks: opts.checks,
            fail_fast: opts.fail_fast,
        },
    )
    .await?;
    let success = output.success;
    print_json(
        "release.check",
        Some(workspace_path.to_string()),
        success,
        output,
        started_at,
        Vec::new(),
    )?;
    Ok(if success {
        CommandExitCode::Success
    } else {
        CommandExitCode::CheckFailed
    })
}