Skip to main content

omne_cli/
cli.rs

1//! Top-level clap parser and subcommand enum.
2//!
3//! Adding a new subcommand is a mechanical three-edit change: a new
4//! `src/commands/<name>.rs` module with an `Args` struct and `run()`
5//! function, a `pub mod <name>;` line in `src/commands/mod.rs`, and a
6//! new variant on `Command` below. The exhaustive match in `main.rs`
7//! forces the compiler to refuse to build until the dispatcher is
8//! wired up, which is the structural encoding of R11.
9
10use clap::{Parser, Subcommand};
11
12use crate::commands;
13
14#[derive(Debug, Parser)]
15#[command(
16    name = "omne",
17    version,
18    about = "Manage omne volumes: init, upgrade, validate",
19    long_about = "omne is a CLI for managing omne volumes. It fetches kernel \
20and distro release tarballs from GitHub Releases, scaffolds a `.omne/` \
21directory, and validates volume integrity. \
22\n\nPhase 1 status: this build is a scaffold. The init, upgrade, and \
23validate subcommands are stub handlers that exit 0 without doing real \
24work; the operational behavior described below lands in subsequent units.\
25\n\nAuthentication: set GITHUB_TOKEN or GH_TOKEN to raise the GitHub API \
26rate limit from 60/hour to 5000/hour. When both are set, GITHUB_TOKEN wins.\
27\n\nExit codes:\n  0  success\n  1  logical error (bad specifier, volume \
28not found, validation failure)\n  2  argument parse error",
29    subcommand_required = true,
30    arg_required_else_help = false
31)]
32pub struct Cli {
33    #[command(subcommand)]
34    pub command: Command,
35}
36
37#[derive(Debug, Subcommand)]
38pub enum Command {
39    /// Initialize a new omne volume in the current directory.
40    Init(commands::init::Args),
41
42    /// Upgrade the kernel or distro to the latest release.
43    Upgrade(commands::upgrade::Args),
44
45    /// Check volume integrity and run the distro gate runner.
46    Validate(commands::validate::Args),
47
48    /// Execute a pipe end-to-end: allocate a run_id, dispatch each DAG
49    /// node, and stream events to `.omne/var/runs/<run_id>/events.jsonl`.
50    Run(commands::run::Args),
51
52    /// Show run state. Without a run_id, lists all runs. With a run_id,
53    /// shows per-node DAG state with ✓ / ▶ / ✗ glyphs.
54    Status(commands::status::Args),
55}