Expand description
Standardized exit codes for dcg commands.
These codes are stable and documented for agent/robot mode consumption. See ADR-002 for the design rationale.
§Exit Code Contract
| Code | Constant | Meaning |
|---|---|---|
| 0 | EXIT_SUCCESS | Success / Allow |
| 1 | EXIT_DENIED | Command denied/blocked |
| 2 | EXIT_WARNING | Warning (with –fail-on warn) |
| 3 | EXIT_CONFIG_ERROR | Configuration error |
| 4 | EXIT_PARSE_ERROR | Parse/input error |
| 5 | EXIT_IO_ERROR | IO error |
§Usage
ⓘ
use dcg::exit_codes::{EXIT_SUCCESS, EXIT_DENIED};
fn main() {
let result = evaluate_command("rm -rf /");
std::process::exit(if result.is_denied() {
EXIT_DENIED
} else {
EXIT_SUCCESS
});
}Constants§
- EXIT_
CONFIG_ ERROR - Configuration error (invalid config file, missing required config).
- EXIT_
DENIED - Command was denied/blocked by a security rule.
- EXIT_
IO_ ERROR - IO error (file not found, permission denied, network error).
- EXIT_
PARSE_ ERROR - Parse/input error (invalid JSON, malformed command).
- EXIT_
SUCCESS - Command completed successfully (allowed, passed, healthy).
- EXIT_
WARNING - Command triggered a warning (with –fail-on warn).
Traits§
- ToExit
Code - Trait for converting evaluation results to exit codes.
Functions§
- exit_
with - Exit the process with the given exit code.
- to_
exit_ code - Convert an exit code constant to
std::process::ExitCode.