skilltest_core/exit.rs
1//! Documented process exit codes. Defined in the core so they are part of the
2//! library's contract; the CLI maps [`crate::Error`] onto them.
3//!
4//! These codes are a stable contract: scripts and CI branch on them, so do not
5//! renumber existing variants.
6
7/// Stable exit codes for the `skilltest` CLI.
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9#[repr(i32)]
10pub enum ExitCode {
11 /// Everything ran and every case/eval passed.
12 Success = 0,
13 /// The run completed but at least one test case failed its evals, or a
14 /// skill failed validation. The tool worked; the thing under test did not.
15 TestFailure = 1,
16 /// Bad usage or bad input: malformed config, malformed test-case YAML, a
17 /// missing file. The user must fix the input.
18 UsageError = 2,
19 /// The provider command failed: not found, crashed, or returned output that
20 /// did not satisfy the protocol. The environment must be fixed.
21 ProviderError = 3,
22}
23
24impl ExitCode {
25 /// The raw integer code.
26 #[must_use]
27 pub fn code(self) -> i32 {
28 self as i32
29 }
30}