mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
v1.4.30 PR push failed CI on first attempt because the two new MeasurementType enums weren't reflected in `docs/api/openapi.yaml`. A separate `chore(openapi): regenerate the public spec` commit was needed before the checks turned green. This hook catches the drift at commit time locally so the contributor sees the regeneration prompt before pushing. New `.githooks/pre-commit`: - Skips when no relevant files (`src/lib/openapi/`, `src/lib/validations/`, `src/app/api/`, the generator script itself) are staged. - Runs `pnpm openapi:check` quietly; exits fast on match. - On drift, runs `pnpm openapi:generate`, re-stages the regenerated `docs/api/openapi.yaml`, and continues the commit. - Skips in CI so the existing `pnpm openapi:check` job in `.github/workflows/security.yml` stays the server-side authoritative gate. `scripts/install-hooks.sh` flips `git config core.hooksPath` to `.githooks/` — idempotent, one-shot per fresh clone. AGENTS.md adds the install command to the contributor workflow section.