#!/bin/sh
# Refuse commits on main from anyone but the owner. Agents (Gemini, etc.)
# work on gemini/<topic> branches and land via PR + PROMPTS.md §2.8 audit.
# Decision of 2026-09-12; see agents.md "Working agreement" and CONTRIBUTING.md.
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
[ "$branch" = "main" ] || exit 0
owner=$(git config --get uscript.owner)
me=$(git config --get user.email)
if [ -n "$owner" ] && [ "$me" = "$owner" ]; then exit 0; fi
echo "pre-commit: '$me' may not commit on main. Branch first:" >&2
echo "  git switch -c gemini/<topic>   (then push and open a PR)" >&2
echo "The owner sets: git config uscript.owner <email>" >&2
exit 1
