- Filter YAML comment lines (grep -v '^\s*#') from both extraction pipelines to prevent phantom canonical IDs - Trim trailing whitespace from extracted fact_ids so grep -qxF exact match works reliably - Pre-commit dispatcher now prints explicit warning when a check script is missing instead of silently skipping - Document --no-verify bypass for emergencies in DEVOPS.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
786 B
Bash
Executable File
30 lines
786 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit hook dispatcher. Runs modular checks from tooling/.
|
|
# Installed via: git config core.hooksPath .config/hooks
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
ERRORS=0
|
|
|
|
run_check() {
|
|
local script="$1"
|
|
local label="$2"
|
|
if [ -x "$REPO_ROOT/$script" ]; then
|
|
if ! "$REPO_ROOT/$script"; then
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
else
|
|
echo "pre-commit: WARNING — $label skipped ($script not found or not executable)"
|
|
echo " Run 'make setup' or check that $script exists and is executable."
|
|
fi
|
|
}
|
|
|
|
# --- Checks ---
|
|
run_check "tooling/check-fact-ids" "fact_id validation"
|
|
|
|
if [ "$ERRORS" -gt 0 ]; then
|
|
echo ""
|
|
echo "pre-commit: $ERRORS check(s) failed. Commit aborted."
|
|
exit 1
|
|
fi
|