majordomus_cli/lib.rs
1//! Majordomus control-plane CLI.
2//!
3//! The library half of the executable. Dependencies flow inward toward the domain model:
4//!
5//! ```text
6//! cli / commands -> mcp (surface, protocol, stdio) -> index / model
7//! discovery, metadata, repository, git -> model, error
8//! ```
9//!
10//! Nothing below `commands` knows about clap; nothing below `mcp` knows about JSON-RPC; and
11//! the model knows nothing about either.
12#![warn(missing_docs)]
13
14pub mod about;
15pub mod app;
16pub(crate) mod automation;
17pub mod bench;
18pub mod build_identity;
19pub mod capability;
20pub mod cli;
21pub mod cockpit;
22pub mod command_graph;
23pub mod commands;
24pub mod commit;
25pub(crate) mod continuity;
26pub mod convergence;
27pub(crate) mod delivery;
28pub mod deploy;
29pub(crate) mod design;
30pub mod devcontext;
31pub mod devtask;
32pub mod diagram;
33pub mod discovery;
34pub(crate) mod distribution;
35pub mod economics;
36pub(crate) mod editors;
37pub mod entity;
38pub mod environment;
39pub mod episodes;
40pub(crate) mod error;
41pub mod evidence;
42pub mod execution;
43pub mod gates;
44pub mod generate;
45pub mod generation;
46pub mod git;
47pub mod graph;
48pub mod guard;
49pub mod http;
50pub mod index;
51pub(crate) mod integration;
52pub mod intent;
53pub mod intent_binding;
54pub mod intent_plan;
55pub mod intent_realization;
56pub mod intent_review;
57pub mod lease;
58pub mod ledger;
59pub mod live;
60pub mod logging;
61pub mod mcp;
62pub mod mesh;
63pub mod metadata;
64pub mod model;
65pub mod models;
66pub(crate) mod monitor;
67pub(crate) mod offload;
68pub mod order;
69pub mod pack;
70pub mod peers;
71pub mod perf;
72pub mod plan;
73pub mod policy;
74pub mod product;
75pub mod proto;
76pub mod providers;
77pub mod quality;
78pub mod reasoning;
79pub mod redaction;
80pub mod release;
81pub mod repository;
82pub mod rules;
83pub mod scope;
84pub(crate) mod script;
85pub mod served;
86pub mod session;
87pub mod share;
88pub(crate) mod shared;
89pub mod site;
90pub mod skill;
91pub mod synthetic;
92pub mod ui;
93pub mod web;
94pub mod why;
95pub mod worktree;
96
97pub use error::Error;
98pub use index::Index;
99pub use model::{Diagnostic, Object, Provenance, Severity};
100pub use repository::Repository;
101
102/// The executable's version, from the crate manifest.
103pub const VERSION: &str = env!("CARGO_PKG_VERSION");
104
105/// The Rust target triple this executable was built for, from `build.rs`. The same string
106/// the distribution model names a target by, so that a build can say which artifact it is.
107pub const TARGET: &str = env!("MAJORDOMUS_TARGET");
108
109/// The cargo profile this executable was built with.
110pub const PROFILE: &str = env!("MAJORDOMUS_PROFILE");
111
112/// The commit this executable was built from, or `unknown` outside a work tree. Read at
113/// build time: nothing here shells out to git, and an installed binary needs no repository
114/// in order to say what it is.
115pub const COMMIT: &str = env!("MAJORDOMUS_COMMIT");
116
117/// Whether the tree [`COMMIT`] names carried uncommitted changes when this executable was
118/// built: `Some(true)` or `Some(false)` when the build knew, `None` when it did not — a
119/// commit handed in through `MAJORDOMUS_BUILD_COMMIT` without `MAJORDOMUS_BUILD_DIRTY`, or
120/// a build outside a work tree. It covers the crate's directory as the build script last saw
121/// it; [`build_identity::identify`] is the decision and holds its table.
122///
123/// Read with `option_env!`: a build-script output that predates the flag (a target directory
124/// shared across checkouts reuses one) must still compile, and what it did not record is
125/// unknown rather than a build failure.
126pub const DIRTY: Option<bool> = match option_env!("MAJORDOMUS_DIRTY") {
127 Some(v) => match v.as_bytes() {
128 b"true" => Some(true),
129 b"false" => Some(false),
130 _ => None,
131 },
132 None => None,
133};
134
135/// The generation this executable was built from: the digest `generation::crate_generation`
136/// takes over the crate sources, compiled in by `build.rs`, or `unknown` when the build
137/// could not read them.
138///
139/// [`VERSION`] says what this executable calls itself; this says what it *is*. Two builds
140/// of `majordomus-cli 0.4.0` from different revisions of the crate carry different models
141/// and derive a repository differently, and only this tells them apart — which is why
142/// `majordomus generate` compares it against the tree it is asked to derive rather than
143/// comparing versions.
144pub const GENERATION: &str = env!("MAJORDOMUS_GENERATION");