# Exit Codes ## Reference | Code | Constant | Meaning | Recommended Action | |------|----------|---------|-------------------| | 0 | `CodeSuccess` | Analysis completed, no issues above threshold | Pipeline passes | | 1 | `CodeSeverityFailed` | Vulnerabilities found above `--fail-on-severity` threshold | Review findings, fix or adjust threshold | | 2 | `CodeAnalysisError` | Analysis failed on the Purplemet platform | Check target URL accessibility, retry | | 3 | `CodeTimeout` | Polling timeout exceeded (`--wait-timeout`) | Increase timeout or check analysis status manually | | 4 | `CodeNetwork` / `CodeApi` | Network or HTTP API error | Check network, API token validity, rate limits | | 5 | `CodeUsage` | Invalid arguments or configuration | Check command syntax and required parameters | | 6 | `CodeContract` | Unexpected API response format | Report to Purplemet support, check CLI version | ## CI/CD Usage ### Blocking on severity (recommended) ```bash purplemet-cli analyze https://app.com --json --fail-on-severity high # Exit 0: pass (no high/critical issues) # Exit 1: fail (high or critical issues found) ``` ### Non-blocking (warning only) ```bash purplemet-cli analyze https://app.com --json || true # Always continues, check output for results ``` ### Custom handling ```bash purplemet-cli analyze https://app.com --json EXIT_CODE=$? case $EXIT_CODE in 0) echo "Analysis passed" ;; 1) echo "WARNING: vulnerabilities found" ;; 2) echo "Analysis error — retrying..." ;; 3) echo "Timeout — check manually" ;; *) echo "Error (code $EXIT_CODE)" ;; esac ```