#!/usr/bin/env bash # Pre-commit guard: run `make ci` (registry + stack + tests) and block the # commit on failure. Per milestone-1 §Definition of done, every commit must # pass `make ci`. This file is the local-repo equivalent of the # .github/workflows/ runner the DoD also accepts. # # Install once: # ln -sf ../../tools/git-hooks/pre-commit .git/hooks/pre-commit # (relative symlink so the hook follows toolchain updates without re-installing.) # # Bypass deliberately (e.g., emergency WIP push to a branch you will rewrite): # git commit --no-verify # CLAUDE.md forbids bypassing hooks for AI agents — humans only, with a reason. set -euo pipefail REPO_ROOT="$(git rev-parse --show-toplevel)" cd "$REPO_ROOT" echo "pre-commit: running make ci" if ! make ci; then echo echo "pre-commit: 'make ci' failed — commit blocked." >&2 echo "Fix the failing checks, re-stage, and commit again." >&2 exit 1 fi