Skip to content

CI & Enforcement

SpecLeft enforcement is opt-in. When enabled, it validates your specs and fails CI only if required intent is missing.

Use enforcement when you want coverage and priority rules to be a hard gate.

SpecLeft supports two enforcement tiers:

  • Core policy: enforce priority requirements only
  • Enforce policy: enforce priority plus coverage thresholds

Both are executed with the same command:

Terminal window
specleft enforce
Terminal window
# Use the default policy location
specleft enforce
# Use a specific policy file
specleft enforce .specleft/policies/policy-core.yml
# JSON output for CI
specleft enforce --format json

Exit codes:

  • 0: policy satisfied
  • 1: policy violated
  • 2: license issue

Add this job to .github/workflows/specleft.yml:

name: SpecLeft Compliance
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install SpecLeft
run: pip install specleft
- name: Enforce spec policy
run: specleft enforce --format json