netsuke-build 0.1.0-beta1

A YAML-powered Ninja/Jinja hybrid build system.
//! Command-line parsing plus layered CLI configuration support.
//!
//! The parser-facing [`Cli`] type remains responsible for user-facing command
//! syntax, while [`CliConfig`] is the authoritative OrthoConfig-derived schema
//! used to merge defaults, configuration files, environment variables, and CLI
//! overrides into the runtime shape consumed by the runner.

use ortho_config::OrthoError;
use std::sync::Arc;

pub mod config;
mod constants;
mod diag;
mod discovery;
mod environment;
mod merge;
mod parser;
mod parsing;

#[cfg(test)]
pub(crate) mod test_support;

pub use config::{AccessibilityPolicy, CliConfig, ColourPolicy, EmojiPolicy, ProgressPolicy};
pub use diag::{resolve_merged_json, resolve_merged_json_with_env};
pub use discovery::{EnvProvider as ConfigEnvProvider, StdEnvProvider as ConfigStdEnvProvider};
pub use merge::{merge_with_config, merge_with_config_and_env};
pub use parser::{
    BuildArgs, Cli, Commands, GraphArgs, json_hint_from_args, locale_hint_from_args,
    parse_with_localizer_from,
};

/// Maximum number of jobs accepted by the CLI.
pub(super) const MAX_JOBS: usize = 64;

pub(super) fn validation_error(key: &str, message: &str) -> Arc<OrthoError> {
    Arc::new(OrthoError::Validation {
        key: key.to_owned(),
        message: message.to_owned(),
    })
}