Every code-multivitals entry point — CLI, GitHub Action, or programmatic API — is a plain process/function that returns a plain exit code or object, so it composes with whatever CI or git-hook setup you already have.
| File | What it is |
|---|---|
.github-workflows-templates/quality-gate.yml |
PR gate: runs the packaged GitHub Action, uploads SARIF to Code Scanning, prints scores from the action's typed outputs |
.github-workflows-templates/baseline-and-trend.yml |
Two jobs: baseline diff on PRs (only new regressions fail), snapshot+trend on pushes to main (tracks health over time, ranks churn x degradation hotspots) |
pre-commit-hook.sh |
Local git hook — analyses only staged files, blocks the commit on errors |
These live outside .github/workflows/ on purpose (as templates, not active
workflows) — copy the one(s) you want into your own .github/workflows/.
Turning this on for a codebase that already has years of untouched complexity will surface a lot of pre-existing debt at once. The recommended order:
- Run once locally with
--save-baseline baseline.json, commit it. - Wire the baseline diff job into PRs — only new issues block a merge.
- Wire the snapshot + trend job into pushes to
main— this is how you watch the pre-existing debt actually go down (or catch it quietly going up) over time, without ever hard-failing a build over it. - Periodically (e.g. once a quarter, or after a cleanup sprint),
regenerate
baseline.jsonso it keeps rising to meet your improving codebase instead of staying frozen at day one.
cp examples/ci-integration/pre-commit-hook.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commitOr via husky if you'd rather manage hooks through npm:
npx husky add .husky/pre-commit "npx code-multivitals \$(git diff --cached --name-only --diff-filter=ACM -- '*.ts' '*.js') --max-errors 0"Verified against a real staged commit: a file containing the god-function
smell blocks the commit with the exact console report shown above; a clean
file commits normally. Bypass any single commit with git commit --no-verify
when you genuinely need to.