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
//! Exit-code contract.
//!
//! - `0` — success.
//! - `1` — runtime failure (`Result::Err` from [`crate::PluginConfig::run`]).
//! - `2` — usage error. clap emits this automatically on parse-time
//! failures; command code returns the same code for argument-shape
//! errors caught after parse.
//!
//! Library code must not call `std::process::exit`; `main.rs` returns
//! [`std::process::ExitCode`] and embedding hosts propagate via `Result`.
use ExitCode;
/// Exit code 0 — operation completed successfully.
// referenced by cross-cutting test harness
pub const SUCCESS: u8 = 0;
/// Exit code 1 — runtime failure (validation, I/O, immutability collision,
/// parse error, internal invariant break, etc.).
// referenced by cross-cutting test harness
pub const RUNTIME_FAILURE: u8 = 1;
/// Exit code 2 — usage error (unknown flag, missing required arg, invalid
/// `--output` value, etc.). clap emits this on parse-time failures.
// referenced by cross-cutting test harness
pub const USAGE_ERROR: u8 = 2;
/// Maps a `Result` to the success/runtime-failure exit codes.
///
/// Does not consume / inspect the `Err` payload; callers needing to
/// render the error to stderr handle that separately before exiting.
// referenced by cross-cutting test harness
pub