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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Exit codes for the CLI
//!
//! Standard exit codes used by RepoLens CLI for CI/CD integration.
//!
//! # Exit Code Reference
//!
//! | Code | Constant | Meaning | Example |
//! |------|----------|---------|---------|
//! | 0 | `SUCCESS` | Success | Audit completed, no critical issues |
//! | 1 | `CRITICAL_ISSUES` | Critical issues | Secrets exposed, critical vulnerabilities |
//! | 2 | `WARNINGS` | Warnings | Missing files, non-critical findings |
//! | 3 | `ERROR` | Runtime error | File not found, network error |
//! | 4 | `INVALID_ARGS` | Invalid arguments | Unknown category, invalid preset |
//!
//! # Usage
//!
//! ```rust,ignore
//! use repolens::cli::exit_codes;
//!
//! // Return success
//! std::process::exit(exit_codes::SUCCESS);
//!
//! // Return critical issues
//! std::process::exit(exit_codes::CRITICAL_ISSUES);
//! ```
/// Success - no issues found or operation completed successfully.
///
/// Used when:
/// - Audit completed with no findings
/// - All actions applied successfully
/// - Command completed normally
pub const SUCCESS: i32 = 0;
/// Critical issues detected (secrets exposed, critical vulnerabilities).
///
/// Used when:
/// - Secrets are detected in the repository
/// - Critical security vulnerabilities are found
/// - All applied actions failed
/// - Regressions detected (compare command with --fail-on-regression)
pub const CRITICAL_ISSUES: i32 = 1;
/// Warning issues detected (missing files, non-critical findings).
///
/// Used when:
/// - Missing recommended files (README, LICENSE, etc.)
/// - Non-critical security findings
/// - Some actions failed (partial success)
pub const WARNINGS: i32 = 2;
/// Runtime error (file not found, network error, etc.).
///
/// Used when:
/// - Configuration file not found or invalid
/// - File system errors
/// - Network errors
/// - Prerequisites check failed
/// - All actions failed during apply
pub const ERROR: i32 = 3;
/// Invalid arguments (unknown category, invalid preset, etc.).
///
/// Used when:
/// - Unknown preset name provided
/// - Invalid category specified
/// - Invalid command-line arguments
pub const INVALID_ARGS: i32 = 4;