CI gating with deterministic diffs
Add ContractSpec CI checks that validate specs, detect drift, and gate breaking changes before merge.
What you'll build
- CI workflow running ContractSpec validation and drift checks.
- Machine-readable output for PR annotations.
- Deterministic contract diffs in review.
1) Add the CI workflow
Copy the template from the CLI package.
ci-copy
cp node_modules/@contractspec/app.cli-contractspec/templates/github-action.yml .github/workflows/contractspec.ymlExpected output: new workflow file in .github/workflows.
2) Run CI locally
ci-local
contractspec ci --format json --check-driftExpected output: JSON summary including pass/fail counts and drift status (if configured).
3) Add a diff check
Use the diff command to inspect breaking changes in PRs.
ci-diff
contractspec diff src/contracts/spec-v1.ts src/contracts/spec-v2.ts --breakingExpected output: deterministic diff with breaking change hints.
Example package
The CRM pipeline example is already wired in the quickstart smoke test. Use it as a CI-ready template.
crm-ci
cd packages/examples/crm-pipeline
bun run build
bun run validateNeed managed CI policy gates?
Studio adds policy approvals, drift dashboards, and audit trails after CI checks pass.
Join Studio waitlist