#!/bin/sh
# PRD Plugin local enforcement gate (host-neutral; works for any git user
# regardless of Codex / Claude Code / opencode).
#
# Activate once per clone:
#   git config core.hooksPath .githooks
#
# Blocks the commit when the repo state violates an enforced rule (duplicate
# IDs, version-marker drift, implemented requests without graduated_to, stranded
# outbox packages, or state-consistency errors). Warnings do not block.
gate=".prd_plugin/scripts/prd_gate.py"
if [ -f "$gate" ]; then
  if ! python "$gate" check --format markdown; then
    echo "prd-gate: commit blocked by enforcement findings above." >&2
    echo "Fix them, or bypass intentionally with: git commit --no-verify" >&2
    exit 1
  fi
fi
exit 0
