Skip to main content

qualia_cli/cli/
misc.rs

1use clap::Subcommand;
2use std::path::PathBuf;
3
4#[derive(Subcommand, Debug)]
5pub enum ExtensionAction {
6    Register { manifest_path: PathBuf },
7    List,
8    Dispatch { id: String, input: String },
9}
10
11#[derive(Subcommand, Debug)]
12pub enum ShaclAction {
13    List,
14    Validate { dataset: PathBuf, shapes: PathBuf },
15}
16
17#[derive(Subcommand, Debug)]
18pub enum GovernanceAction {
19    WalAppend {
20        #[arg(long)]
21        quin: String,
22        #[arg(long)]
23        sign: String,
24    },
25    Ratify {
26        agreement_did: String,
27    },
28}
29
30#[derive(Subcommand, Debug)]
31pub enum CompileAction {
32    N3ToDeontic { file: PathBuf },
33}
34
35#[derive(Subcommand, Debug)]
36pub enum ProfileAction {
37    Compile {
38        input: PathBuf,
39        #[arg(long)]
40        out: Option<PathBuf>,
41    },
42    List,
43    Inspect {
44        file: PathBuf,
45    },
46}
47
48#[derive(Subcommand, Debug)]
49pub enum Q42Action {
50    /// Header, sections, lexicon cardinality, PIDX/FIDX/root.
51    Inspect { path: PathBuf },
52    /// Layered verification. A volume-set root walks every data child and
53    /// lexicon shard. `full` cannot PASS if a required check was skipped.
54    Verify {
55        path: PathBuf,
56        #[arg(long, default_value = "full")]
57        level: String,
58    },
59    /// SHA-1 magnet (`urn:btih:`) with optional daemon web-seed.
60    ///
61    /// Denied for Sanctuary, medical, bilateral, mixed, and unmarked personal
62    /// volumes. Catalog ontologies require `--commons`.
63    Magnet {
64        path: PathBuf,
65        #[arg(long)]
66        name: Option<String>,
67        #[arg(long, default_value_t = 4242)]
68        port: u16,
69        #[arg(long)]
70        webseed: Option<String>,
71        /// Also emit magnets for every child of a volume root.
72        #[arg(long)]
73        set: bool,
74        /// Assert this is a Permissive Commons catalog (not a person's file).
75        /// Still rejected if any Quin is restricted, classified, medical, legal,
76        /// fiduciary, or bilateral.
77        #[arg(long)]
78        commons: bool,
79    },
80    /// Compact a logical volume set (or a single-file volume) into a new generation.
81    ///
82    /// SuperBlocks stream through the existing rollover / streaming writer.
83    /// Output is a new root (or single `.q42`) under `--out`, never an in-place rewrite.
84    Compact {
85        root: PathBuf,
86        /// Directory for the compacted generation. Defaults to `<root-parent>/compacted`.
87        #[arg(long)]
88        out: Option<PathBuf>,
89    },
90    /// Register this `.q42` with the in-process WebTorrent seeder (daemon).
91    ///
92    /// Same publication gate as `magnet`. Personal/medical volumes stay local.
93    Seed {
94        path: PathBuf,
95        #[arg(long)]
96        name: Option<String>,
97        #[arg(long)]
98        id: Option<String>,
99        /// Assert this is a Permissive Commons catalog (not a person's file).
100        #[arg(long)]
101        commons: bool,
102    },
103}
104
105#[derive(Subcommand, Debug)]
106pub enum MigrateAction {
107    Meta {
108        path: PathBuf,
109        #[arg(long)]
110        dry_run: bool,
111    },
112}
113
114#[derive(Subcommand, Debug)]
115pub enum BenchmarkAction {
116    SparqlStar { path: PathBuf },
117    RssScan { path: PathBuf, percent: u8 },
118    LazyInference { path: PathBuf },
119    Incremental { path: PathBuf },
120    P2pSwarm { path: PathBuf },
121}
122
123#[derive(Subcommand, Debug)]
124pub enum QueryDialect {
125    Sparql {
126        vault: PathBuf,
127        query_string: Option<String>,
128        #[arg(short, long)]
129        file: Option<PathBuf>,
130    },
131    SparqlStar {
132        vault: PathBuf,
133        query_string: Option<String>,
134        #[arg(short, long)]
135        file: Option<PathBuf>,
136    },
137}
138
139#[derive(Subcommand, Debug)]
140pub enum IngestFormat {
141    Semantic {
142        file: PathBuf,
143    },
144    Csv {
145        file: PathBuf,
146        #[arg(long)]
147        map: PathBuf,
148    },
149    Json {
150        file: PathBuf,
151        #[arg(long)]
152        map: PathBuf,
153    },
154}