opencode-ralph-loop-cli 0.1.0

Scaffolder CLI for OpenCode Ralph Loop plugin — one command setup
Documentation
use serde_json::json;

use crate::output::{FileEntry, Report, Summary};

pub fn print_entry(entry: &FileEntry) {
    match serde_json::to_string(entry) {
        Ok(line) => println!("{}", line),
        Err(e) => eprintln!("ERROR: failed to serialize NDJSON entry: {e}"),
    }
}

pub fn print_summary(summary: &Summary, plugin_version: &str) {
    let obj = json!({
        "type": "summary",
        "created": summary.created,
        "updated": summary.updated,
        "skipped": summary.skipped,
        "modified": summary.modified,
        "missing": summary.missing,
        "removed": summary.removed,
        "cli_version": env!("CARGO_PKG_VERSION"),
        "plugin_version": plugin_version,
    });
    println!("{}", obj);
}

pub fn print_report(report: &Report) {
    for entry in &report.files {
        print_entry(entry);
    }
    print_summary(&report.summary, &report.plugin_version);
}