Skip to content

CI/CD

contextlint runs in any CI environment that has Node.js. The @contextlint/cli package has light dependencies and finishes in sub-seconds, so running it on every PR doesn’t noticeably affect CI time. You can wire it in either to guarantee document integrity before merge, or to catch issues fast in a local pre-commit hook.

TimingMain toolsPurpose
Local hookpre-commit / Husky / lint-stagedLast safety net before commit
On pushGitHub Actions / GitLab CI / CircleCIGuarantee document integrity before PR review

While editor integration (Editors (LSP)) and AI integration (AI Agents) cover the “while you’re writing” feedback, CI/CD covers the “before merge” final check. Combining all three layers keeps document integrity from breaking in your repository.

When running contextlint in CI, commit contextlint.config.json to the repository. The runner picks it up automatically once the repo is checked out, so npx contextlint doesn’t need any extra arguments.

For the spec of the config file, see Configuration.

contextlint exits non-zero if there’s at least one violation, so the CI job fails as-is. To produce review comments or annotations, get machine-readable output via --format json.

Terminal window
npx contextlint --format json

For the structure and fields of the JSON output, see Integrations → CLI → JSON output.