#!/usr/bin/env bash # Install the Sea Haven security-review pre-commit hook into a target repo. # Usage: install-hooks.sh /path/to/repo set -euo pipefail REPO="${1:?usage: install-hooks.sh /path/to/repo}" SRC="$(cd "$(dirname "$0")" && pwd)/hooks/pre-commit" [ -d "$REPO/.git" ] || { echo "not a git repo: $REPO" >&2; exit 1; } HOOK="$REPO/.git/hooks/pre-commit" if [ -f "$HOOK" ]; then echo "warning: existing pre-commit hook at $HOOK will be overwritten" >&2; fi cp "$SRC" "$HOOK"; chmod +x "$HOOK" echo "installed security-review pre-commit hook -> $HOOK" echo "note: hook runs deterministic scanners only; full review is /sh-security-review (on demand)."