Skip to main content

qualia_cli/cli/
mod.rs

1mod app;
2mod evaluate;
3mod inference_policy;
4mod llm;
5mod misc;
6mod qpu;
7mod science;
8mod solid;
9mod solve;
10mod webizen;
11
12pub use app::AppAction;
13pub use evaluate::EvaluateModality;
14pub use inference_policy::InferencePolicyAction;
15pub use llm::LlmAction;
16pub use misc::*;
17pub use qpu::QpuAction;
18pub use science::{
19    BioAction, ChemAction, ClinicalAction, EconomicsAction, GeoAction, GeometricAction,
20    ScienceAction, ThermoAction,
21};
22pub use solid::SolidAction;
23pub use solve::{
24    LinalgAction, OdeAction, OptimizeAction, QuantumSolveAction, SolveAction, SymbolicSolveAction,
25};
26pub use webizen::WebizenAction;
27
28use clap::{Parser, Subcommand, ValueEnum};
29use std::path::PathBuf;
30
31use crate::{daemon, mcp, mesh, service, shader};
32
33/// Qualia-DB Command Line Interface
34///
35/// Edge-native, zero-allocation semantic graph and neuro-symbolic engine.
36#[derive(Parser, Debug)]
37#[command(name = "qualia-cli", version = "0.0.12", author = "Qualia-DB")]
38#[command(about = "Manage, query, and evaluate Qualia-DB vaults and models", long_about = None)]
39pub struct Cli {
40    #[arg(short, long, action = clap::ArgAction::Count, global = true)]
41    pub verbose: u8,
42
43    #[arg(long, global = true)]
44    pub enable_qpu: bool,
45
46    #[command(subcommand)]
47    pub command: Commands,
48}
49
50/// How `import` reports work-in-progress (CLI humans vs UI parsers).
51#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, ValueEnum)]
52pub enum ImportProgressFormat {
53    #[default]
54    Text,
55    Json,
56    None,
57}
58
59#[derive(Subcommand, Debug)]
60pub enum Commands {
61    /// Explicit native Sentinel policy and actor setup for an operator-selected profile.
62    InferencePolicy {
63        #[arg(long)]
64        profile: PathBuf,
65        #[command(subcommand)]
66        action: InferencePolicyAction,
67    },
68    /// Manage, install, inspect, and uninstall QApp application packages (.qpkg)
69    App {
70        #[command(subcommand)]
71        action: AppAction,
72    },
73    Extension {
74        #[command(subcommand)]
75        action: ExtensionAction,
76    },
77    Evaluate {
78        #[command(subcommand)]
79        modality: EvaluateModality,
80    },
81    Governance {
82        #[command(subcommand)]
83        action: GovernanceAction,
84    },
85    Compile {
86        #[command(subcommand)]
87        action: CompileAction,
88    },
89    /// Compile and seal an ontological entity bundle (.hmc) in Reverse-LOD order with CBOR-LD manifest
90    EntityCompile(EntityCompileArgs),
91    /// Legacy alias for EntityCompile
92    TwinCompile(TwinCompileArgs),
93    /// Verify and validate an ontological entity (.10d or .hmc bundle)
94    EntityVerify(EntityVerifyArgs),
95    /// Legacy alias for EntityVerify
96    TwinVerify(TwinVerifyArgs),
97    Llm {
98        #[command(subcommand)]
99        action: LlmAction,
100    },
101    Shader {
102        #[command(subcommand)]
103        action: shader::ShaderAction,
104    },
105    MeshProbe {
106        #[command(subcommand)]
107        action: mesh::MeshAction,
108    },
109    Capabilities {
110        #[arg(long, help = "List all registered capabilities")]
111        list: bool,
112    },
113    Shacl {
114        #[command(subcommand)]
115        action: ShaclAction,
116    },
117    Vault {
118        #[arg(long, help = "Initialize the memory-mapped storage vault")]
119        init: bool,
120    },
121    Migrate {
122        #[command(subcommand)]
123        action: MigrateAction,
124    },
125    Mem {
126        #[arg(long, help = "Triggers the Block Inspector to read hex layouts")]
127        inspect: bool,
128    },
129    Inspect {
130        file_path: PathBuf,
131    },
132    Q42 {
133        #[command(subcommand)]
134        action: Q42Action,
135    },
136    /// Transparent hyper-media container (`.hmc` / QBDL) inspect and verify.
137    Hmc {
138        #[command(subcommand)]
139        action: HmcAction,
140    },
141    Dump {
142        out_path: PathBuf,
143    },
144    Daemon {
145        #[command(subcommand)]
146        action: Option<daemon::DaemonAction>,
147        #[command(flatten)]
148        opts: daemon::DaemonOpts,
149    },
150    Mcp {
151        #[command(subcommand)]
152        action: mcp::McpAction,
153    },
154    Service {
155        #[command(subcommand)]
156        action: service::ServiceAction,
157    },
158    Webizen {
159        #[command(subcommand)]
160        action: WebizenAction,
161    },
162    ExportSolid {
163        #[arg(long)]
164        input: PathBuf,
165        #[arg(long)]
166        output: PathBuf,
167    },
168    Solid {
169        #[command(subcommand)]
170        action: SolidAction,
171    },
172    #[command(name = "benchmark-action")]
173    Benchmark {
174        #[command(subcommand)]
175        action: BenchmarkAction,
176    },
177    #[command(name = "benchmark", alias = "bench")]
178    Bench {
179        #[arg(long, default_value = "full")]
180        suite: String,
181    },
182    VerifyIntegrity {
183        #[arg(long)]
184        input: PathBuf,
185        #[arg(long)]
186        dataset: PathBuf,
187    },
188    /// Prove exact encoded RDF/Q42 set equivalence using bounded external sorting.
189    VerifyGraph {
190        #[arg(long)]
191        input: PathBuf,
192        #[arg(long)]
193        dataset: PathBuf,
194        /// Maximum RAM for each fixed-width sort buffer.
195        #[arg(long, default_value_t = 32)]
196        memory_mib: u64,
197        /// Maximum live temporary-run space. The check fails closed at this limit.
198        #[arg(long, default_value_t = 24)]
199        temp_gib: u64,
200        /// `import` (default) = Rio + q_hash matching `qualia-cli import`.
201        /// `legacy-semantic` = whitespace/`hash_token` path (old ingest semantic).
202        #[arg(long, default_value = "import")]
203        encoder: String,
204        /// Comma-separated predicate IRIs to omit (identical filter for twin ingest).
205        #[arg(long)]
206        omit_predicates: Option<String>,
207        /// Preset omit list: `comment-gloss`.
208        #[arg(long)]
209        omit_preset: Option<String>,
210        /// Fail if blank nodes are present (require GroundGraphProven / future RDFC).
211        /// Default: encoded-set match is enough for exit 0; blanks emit a warning.
212        #[arg(long, alias = "strict-rdfc")]
213        require_isomorphism: bool,
214    },
215    Import {
216        /// RDF source path (omit with `--url` + `--job-dir`).
217        input: Option<PathBuf>,
218        /// Destination `.q42` path.
219        output: Option<PathBuf>,
220        #[arg(long)]
221        strip_literals: bool,
222        /// Publish an embedded-manifest root plus child Q42 segments capped at this size.
223        #[arg(long)]
224        segment_mib: Option<u64>,
225        /// Progress stream: human text (default), JSON lines for UIs, or silent.
226        #[arg(long, value_enum, default_value_t = ImportProgressFormat::Text)]
227        progress: ImportProgressFormat,
228        /// Stream RDF from this URL (gzip/zstd decoded in-flight). No second copy of the source.
229        #[arg(long)]
230        url: Option<String>,
231        /// Durable job directory (checkpoint + runs). Survives a crash; use `ingest-job continue`.
232        #[arg(long)]
233        job_dir: Option<PathBuf>,
234        /// Resume `--job-dir` instead of starting over.
235        #[arg(long)]
236        resume: bool,
237        /// Comma-separated predicate IRIs to drop before hashing.
238        #[arg(long)]
239        omit_predicates: Option<String>,
240        /// Preset omit list: `comment-gloss`.
241        #[arg(long)]
242        omit_preset: Option<String>,
243    },
244    /// Review, compare, continue, or append ingest jobs (including incomplete ones).
245    IngestJob {
246        #[command(subcommand)]
247        action: IngestJobAction,
248    },
249    Ingest {
250        #[command(subcommand)]
251        format: IngestFormat,
252    },
253    Query {
254        #[command(subcommand)]
255        dialect: QueryDialect,
256    },
257    Compress {
258        #[arg(long)]
259        input: PathBuf,
260        #[arg(long)]
261        output: PathBuf,
262    },
263    Resources {
264        subcommand: String,
265        arg: Option<String>,
266    },
267    Profile {
268        #[command(subcommand)]
269        action: ProfileAction,
270    },
271    Qpu {
272        #[command(subcommand)]
273        action: QpuAction,
274    },
275    Solve {
276        #[command(subcommand)]
277        action: SolveAction,
278    },
279    Science {
280        #[command(subcommand)]
281        action: ScienceAction,
282    },
283}