1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Shared implementation of the `codingest` CLI.
//!
//! `codingest` builds/checks a `.kgl` code graph from a checkout or one or more
//! git revisions and installs Codingest's code-review Agent Skill. The
//! `CodeTreeCommand` variants are the binary's top-level commands.
//!
//! Pure-Rust over the sibling `codingest` builder + `kglite::api::io` (no
//! libpython link in the standalone binary). The `pip install codingest` wheel
//! links this same library through `_run_cli`, so command parsing and behavior
//! cannot drift between the cargo binary and the console script.
use OsString;
use Result;
use Parser;
pub use StaleGraph;
/// Process exit code for an error returned by [`run`] — the CI contract.
///
/// `0` success and `2` usage errors are clap's, emitted before [`run`] is
/// reached. `3` is reserved for a `--require-fresh` refusal so a pipeline can
/// tell "the graph is stale" apart from "the query failed"; every other
/// operational failure (missing artifact, bad Cypher, timeout, I/O) is `1`.
///
/// The `pip install codingest` wheel's `_run_cli` maps every error to
/// `PyRuntimeError`, so a stale refusal exits `1` through the console script.
/// Run the CLI over an explicit argument vector, including the program name.
///
/// The standalone binary and the `pip install codingest` wheel shim both call
/// this entry point, so command parsing and behavior cannot drift.