#!/usr/bin/env bash # Nomarchy pre-commit hook. # # Enable per-clone with: # git config core.hooksPath .githooks # # Re-runs the script audit generator when any nomarchy-* script in the three # script directories is added, modified, or deleted in this commit, then # stages the refreshed docs/SCRIPTS.md so it lands together with the change. set -e repo_root="$(git rev-parse --show-toplevel)" cd "$repo_root" script_dirs_re='^(features/scripts/utils|core/system/scripts|themes/engine/scripts)/nomarchy-' if git diff --cached --name-only --diff-filter=ACMRD | grep -qE "$script_dirs_re"; then echo "pre-commit: regenerating docs/SCRIPTS.md (script change detected)…" ./bin/utils/nomarchy-docs-scripts --out docs/SCRIPTS.md git add docs/SCRIPTS.md fi