netsuke-build 0.1.0-beta2

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 help;
mod merge;
mod parser;
mod parsing;
mod release_help;

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

pub use config::{AccessibilityPolicy, CliConfig, ColourPolicy, EmojiPolicy, ProgressPolicy};
pub use diag::{
    resolve_json_and_layers_outcome_with_env, resolve_merged_json, resolve_merged_json_with_env,
};
/// Cached file layers, discovery errors, and deferred diagnostics from one
/// configuration discovery pass.
pub use discovery::DiscoveredLayers;
/// Side-effect-free diagnostic-mode resolution paired with cached discovery.
pub use discovery::DiscoveryOutcome;
/// Environment access seam for configuration discovery and merging.
pub use discovery::EnvProvider as ConfigEnvProvider;
/// Process-backed configuration environment adapter for production callers.
pub use discovery::StdEnvProvider as ConfigStdEnvProvider;
pub use help::{HelpArgs, HelpTopic};
pub use merge::{merge_with_cached_file_layers, 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,
};
pub use release_help::ReleaseHelpCli;

/// 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(),
    })
}