Exit Codes
The Vibgrate CLI uses standard exit codes to communicate results:
| Code | Meaning | When It Happens |
|---|---|---|
0 | Success | Scan completed, all gates passed |
1 | Runtime error | Invalid flags, missing files, unexpected crash |
2 | Threshold exceeded | --fail-on severity gate or drift budget/worsening gate triggered |
Using Exit Codes in CI
vibgrate scan . --fail-on error
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "Scan passed"
elif [ $exit_code -eq 2 ]; then
echo "Drift threshold exceeded"
# Take action: notify, create issue, etc.
else
echo "Scan failed with error"
fiWhen Does Exit Code 2 Trigger?
Exit code 2 is returned when any of these conditions are met:
--fail-on errorand error-level findings exist--fail-on warnand warning-level (or error-level) findings exist--drift-budget <score>and the drift score exceeds the budget--drift-worsening <percent>and drift has worsened beyond the threshold vs baseline