#!/usr/bin/env bash # Design-corpus enforcement: no binding page, no functional change. # # If a commit touches crates/ (or legacy src/), it must also touch a Type: law # or Type: spec page under wiki/. Root DESIGN.md is navigation and does not # satisfy the rule. set -euo pipefail bash tools/corpus_gate.sh changed=$(git diff --cached --name-only --diff-filter=ACMR HEAD) [ -n "$changed" ] || exit 0 echo "$changed" | grep -qE '^(crates/|src/)' || exit 0 touches_binding=0 while IFS= read -r path; do case "$path" in wiki/*.md|wiki/*/*.md|wiki/*/*/*.md|wiki/*/*/*/*.md|wiki/*/*/*/*/*.md) if [ -f "$path" ] && grep -qE '^Type: (law|spec)$' "$path"; then touches_binding=1 break fi ;; esac done <<< "$changed" if [ "$touches_binding" -eq 0 ]; then echo "" echo "DESIGN CORPUS VIOLATION" echo " This commit touches crates/ (or src/) but does not amend a changed" echo " Type: law or Type: spec page under wiki/." echo "" echo " Amend the binding page that owns the behavior in the same commit." echo " Root DESIGN.md is a doorway and does not count." echo "" exit 1 fi exit 0