#!/usr/bin/env bash # Point git at the repo's tracked hooks directory. # # TRACES: | DR-207 # # bun run hooks:install # or: ./scripts/install-hooks.sh # # `core.hooksPath` is used rather than copying files into .git/hooks so the # hooks stay version-controlled: an update to scripts/hooks/pre-commit reaches # everyone on their next pull instead of needing a re-install. # # The setting is local to this clone (git config, not committed). To undo: # git config --unset core.hooksPath set -euo pipefail REPO_ROOT="$(git rev-parse --show-toplevel)" cd "$REPO_ROOT" HOOKS_DIR="scripts/hooks" if [ ! -d "$HOOKS_DIR" ]; then echo "❌ $HOOKS_DIR does not exist — are you in the JellyTau repo?" >&2 exit 1 fi # Git refuses to run a hook that is not executable, and the bit is easy to lose # on a fresh checkout on some filesystems. chmod +x "$HOOKS_DIR"/* 2>/dev/null || true git config core.hooksPath "$HOOKS_DIR" echo "✅ core.hooksPath = $(git config core.hooksPath)" echo "" echo "Installed hooks:" for hook in "$HOOKS_DIR"/*; do [ -f "$hook" ] || continue echo " - $(basename "$hook")" done echo "" echo "pre-commit runs: bun run check, bun run test, check-frontend-boundary.sh," echo "and cargo fmt --check when src-tauri/ is staged." echo "Bypass a single commit with: git commit --no-verify"