mecha10-cli 0.6.3

Mecha10 CLI tool
Documentation
//! Schema command handlers

use crate::commands::schema::SchemaExportArgs;
use crate::services::SchemaExportService;
use anyhow::Result;

/// Handle the schema export command
///
/// Writes every schema this CLI knows about (project config, every built-in
/// node type, model catalog) as raw JSON Schema files plus a generated
/// Markdown field reference, under `args.out`. Re-implements no schema-derivation
/// logic of its own — delegates entirely to [`SchemaExportService::export`], the
/// same schemas `mecha10 config validate` validates against (see
/// `docs/validate-configs.md`).
pub async fn handle_schema_export(args: &SchemaExportArgs) -> Result<()> {
    println!();
    println!("📄 Schema Export");
    println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
    println!();

    let written = SchemaExportService::export(&args.out)?;

    println!("Wrote {} file(s) to {}:", written.len(), args.out.display());
    for path in &written {
        println!("  - {}", path.display());
    }
    println!();

    Ok(())
}