Module exit_codes

Module exit_codes 

Source
Expand description

Semantic exit codes for CI/CD integration

This module defines standardized exit codes that allow CI/CD pipelines to programmatically handle different error conditions. Exit codes follow Unix conventions (0 = success, non-zero = error) with specific meanings.

§Exit Code Ranges

RangeCategory
0Success
1-9General errors
10-19Security issues
20-29Configuration errors
30-39I/O and resource errors
40-49Validation errors

§CI/CD Usage

# In a CI pipeline
infiniloom embed /path/to/repo --security-check
exit_code=$?

case $exit_code in
    0) echo "Success" ;;
    10) echo "Secrets detected - blocking PR" ;;
    11) echo "PII detected - review required" ;;
    12) echo "License violation - legal review needed" ;;
    *) echo "Error: $exit_code" ;;
esac

§GitHub Actions Integration

- name: Security Scan
  id: scan
  run: infiniloom embed . --security-check
  continue-on-error: true

- name: Block on Secrets
  if: steps.scan.outcome == 'failure' && steps.scan.exit-code == 10
  run: |
    echo "::error::Secrets detected in codebase"
    exit 1

- name: Warn on PII
  if: steps.scan.exit-code == 11
  run: echo "::warning::PII detected - review recommended"

Structs§

ExitResult
Result type that can be converted to an exit code

Enums§

ExitCode
Semantic exit codes for CLI commands
ExitCodeCategory
Categories of exit codes

Traits§

ToExitCode
Helper trait to convert errors to exit codes