mecha10-cli 0.6.3

Mecha10 CLI tool
Documentation
//! Schema command arguments
//!
//! Commands for exporting the JSON Schemas this repo derives/hand-writes for its
//! config kinds (project config, per-node-type configs, model catalog) as static
//! reference docs — see `docs/validate-configs.md` and `docs/schemas/README.md`.

use clap::{Args, Subcommand};
use std::path::PathBuf;

/// Default output directory for `mecha10 schema export`, relative to the current
/// working directory — this repo's own committed reference docs live here
/// (`docs/schemas/`), checked for drift in CI (see `scripts/ci/schema-docs-check.sh`).
pub const DEFAULT_SCHEMA_EXPORT_DIR: &str = "docs/schemas";

/// Schema subcommands
#[derive(Subcommand)]
pub enum SchemaCommand {
    /// Export every schema this CLI knows about — the project config
    /// (`mecha10.json`), every built-in node type's config, and the model
    /// catalog (`model_catalog.toml`) — as raw JSON Schema files plus a
    /// generated Markdown field reference. Nothing under the output directory
    /// is hand-written; re-run this after a node's `Config` struct (or its doc
    /// comments) change and commit the result.
    Export(#[command(flatten)] SchemaExportArgs),
}

/// Arguments for the schema export command
#[derive(Args)]
pub struct SchemaExportArgs {
    /// Output directory to write schema JSON + Markdown reference docs into
    /// (created if missing). Existing contents are overwritten in place, not
    /// removed first, so stale files from a since-removed schema won't be
    /// cleaned up automatically.
    #[arg(long, default_value = DEFAULT_SCHEMA_EXPORT_DIR)]
    pub out: PathBuf,
}