#!/usr/bin/env bash
# Block AI-agent authorship attribution in commit messages.
# The human drives the code, not the agents (Claude/Codex/Gemini/Copilot/...).
# Active when core.hooksPath=.githooks (set by scripts/worktree.sh and documented
# in docs/10-quality/WORKSPACE_ISOLATION.md). Bypass once with `git commit --no-verify`.
set -euo pipefail

root="$(git rev-parse --show-toplevel)"
checker="$root/scripts/check_no_agent_attribution.py"

# Fail open only if the checker is missing (older checkouts); otherwise enforce.
if [ -f "$checker" ]; then
  exec python3 "$checker" --message-file "$1"
fi
