openclaw-scan 0.1.1

Security scanner for agentic AI framework installations (OpenClaw, Claude Code, and compatible)
Documentation
//! Output dispatching — terminal (human-readable) or JSON.

pub mod json;
pub mod terminal;

use crate::report::Report;

/// Output configuration derived from CLI flags.
#[derive(Debug, Clone)]
pub struct OutputConfig {
    /// Emit machine-readable JSON instead of the rich terminal view.
    pub json: bool,
    /// Suppress the banner and progress; show findings only.
    pub quiet: bool,
    /// Include per-finding remediation and evidence in terminal output.
    pub verbose: bool,
    /// Disable ANSI colour codes (auto-disabled when stdout is not a tty).
    pub color: bool,
}

impl Default for OutputConfig {
    fn default() -> Self {
        OutputConfig {
            json: false,
            quiet: false,
            verbose: false,
            color: true,
        }
    }
}

/// Render `report` to stdout according to `cfg`.
pub fn render(report: &Report, cfg: &OutputConfig) -> anyhow::Result<()> {
    if cfg.json {
        json::print(report)
    } else {
        terminal::print(report, cfg)
    }
}