dotbabel

ADR-0013 — Exit-code convention

Status: Accepted (2026-04-14)

Context

Each bin originally exited 0 on success and 1 on any other outcome. Operators running these in CI couldn’t distinguish “a validation rule failed” (an expected outcome; the pipeline should fail the PR check) from “the CLI was invoked with a bad flag” (a workflow-author bug; the pipeline should fail the workflow author’s attention, not the PR author’s).

Decision

A single named enum, exported as EXIT_CODES, consumed by every bin:

Name Value Meaning
OK 0 Success
VALIDATION 1 One or more validation rules failed (expected failure mode)
ENV 2 Misconfigured environment — missing file, bad git repo, unreadable facts
USAGE 64 Bad CLI invocation — unknown flag, missing required positional

64 is chosen deliberately: it matches BSD sysexits.h EX_USAGE. Pipeline authors can then write:

- run: npx dotbabel-validate-specs
- if: failure()
  run: |
    case $? in
      1)  echo "validation failed — review the PR"; exit 1 ;;
      2)  echo "environment issue — check workflow setup"; exit 2 ;;
      64) echo "bad CLI invocation — the workflow needs editing"; exit 64 ;;
    esac

Consequences

Alternatives considered

Revisit triggers