Skip to main content

apr_cli/
lib.rs

1//! apr-cli library
2//!
3//! This library is the foundation for the apr CLI binary.
4//! Exports CLI structures for testing and reuse.
5
6use clap::{Parser, Subcommand};
7use std::path::{Path, PathBuf};
8
9mod commands;
10pub mod error;
11mod output;
12pub mod pipe;
13
14pub use error::CliError;
15
16// Public re-exports for integration tests
17pub mod qa_types {
18    pub use crate::commands::qa::{GateResult, QaReport, SystemInfo};
19}
20
21// Public re-exports for downstream crates (whisper-apr proxies these)
22pub mod model_pull {
23    pub use crate::commands::pull::{list, run};
24}
25
26#[cfg(feature = "inference")]
27pub mod federation;
28
29// Commands are crate-private, used internally by execute_command
30use commands::{
31    bench, canary, canary::CanaryCommands, cbtop, chat, compare_hf, convert, debug, diff, distill,
32    eval, explain, export, finetune, flow, hex, import, inspect, lint, merge, oracle, probar,
33    profile, prune, ptx_explain, publish, pull, qa, quantize, rosetta, rosetta::RosettaCommands,
34    run, serve, showcase, tensors, trace, tree, tui, tune, validate,
35};
36
37/// apr - APR Model Operations Tool
38///
39/// Inspect, debug, and manage .apr model files.
40/// Toyota Way: Genchi Genbutsu - Go and see the actual data.
41#[derive(Parser, Debug)]
42#[command(name = "apr")]
43#[command(author, version = concat!(env!("CARGO_PKG_VERSION"), " (", env!("APR_GIT_SHA"), ")"), about, long_about = None)]
44#[command(propagate_version = true)]
45pub struct Cli {
46    #[command(subcommand)]
47    pub command: Box<Commands>,
48
49    /// Output as JSON
50    #[arg(long, global = true)]
51    pub json: bool,
52
53    /// Verbose output
54    #[arg(short, long, global = true)]
55    pub verbose: bool,
56
57    /// Quiet mode (errors only)
58    #[arg(short, long, global = true)]
59    pub quiet: bool,
60
61    /// Disable network access (Sovereign AI compliance, Section 9)
62    #[arg(long, global = true)]
63    pub offline: bool,
64
65    /// Skip tensor contract validation (PMAT-237: use with diagnostic tooling)
66    #[arg(long, global = true)]
67    pub skip_contract: bool,
68}
69
70include!("commands_enum.rs");
71include!("model_ops_commands.rs");
72include!("extended_commands.rs");
73include!("tool_commands.rs");
74include!("validate.rs");
75include!("dispatch_run.rs");
76include!("dispatch.rs");
77include!("dispatch_analysis.rs");
78include!("lib_07.rs");