Skip to content

Exit Codes

PromptLint uses exit codes to communicate results to CI/CD pipelines.

Code Reference

CodeMeaning
0Clean — no findings at or above --fail-level
1WARN-level findings detected
2CRITICAL-level findings detected

--fail-level Mapping

--fail-levelExit 0 whenExit 1 whenExit 2 when
critical (default)No CRITICAL findingsCRITICAL findings present
warnNo WARN or CRITICAL findingsWARN findings presentCRITICAL findings present
infoNo findings at allAny finding presentCRITICAL findings present
noneAlwaysNeverNever

Examples

bash
# Default: fail only on CRITICAL
promptlint --file prompt.txt
echo $?  # 0 (clean), 1 (warn only), or 2 (critical)

# Strict: fail on any warning
promptlint --file prompt.txt --fail-level warn
echo $?  # 0 (clean), 1 (warn+), or 2 (critical)

# Informational: fail on any finding
promptlint --file prompt.txt --fail-level info
echo $?  # 0 (clean) or 1 (any finding)

# Never fail (report only)
promptlint --file prompt.txt --fail-level none
echo $?  # always 0

In Shell Scripts

bash
#!/bin/bash
set -e

promptlint --file prompt.txt --fail-level warn
# Script stops here if exit code != 0
echo "Prompt passed all checks"

In Makefiles

makefile
lint-prompts:
	promptlint --file "prompts/**/*.txt" --fail-level warn

.PHONY: lint-prompts

In GitHub Actions

yaml
- name: Lint prompts
  run: promptlint --file "prompts/**/*.txt" --fail-level warn
  # Step fails if exit code != 0

Or use the dedicated action which maps exit codes to annotations:

yaml
- uses: AryaanSheth/promptlint@v1
  with:
    path: prompts/
    fail-level: warn

Released under the Apache 2.0 License.