← back to Ventura Claw Leads

scripts/install-hooks.sh

23 lines

#!/usr/bin/env bash
# install-hooks.sh — symlink tracked hook scripts into .git/hooks/.
# Run once per clone. Idempotent.

set -euo pipefail

REPO_DIR="$(git rev-parse --show-toplevel)"
HOOKS_DIR="$REPO_DIR/.git/hooks"
SCRIPTS_DIR="$REPO_DIR/scripts"

mkdir -p "$HOOKS_DIR"
chmod +x "$SCRIPTS_DIR"/*.sh 2>/dev/null || true

# post-commit → fires codex-3way debate in background
cat > "$HOOKS_DIR/post-commit" <<'HOOK'
#!/usr/bin/env bash
exec "$(git rev-parse --show-toplevel)/scripts/post-commit-hook.sh"
HOOK
chmod +x "$HOOKS_DIR/post-commit"

echo "[install-hooks] post-commit installed → scripts/post-commit-hook.sh"
echo "[install-hooks] done"