#!/usr/bin/env bash set -euo pipefail # One-time installer for the Claude Project Knowledge sync hooks. # Points git at the versioned .githooks/ directory and ensures hooks are executable. REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)" if [ -z "${REPO_ROOT}" ]; then printf '%s\n' "❌ Not inside a git repository." >&2 exit 1 fi cd "${REPO_ROOT}" if [ ! -d ".githooks" ]; then printf '%s\n' "❌ .githooks/ directory missing at repo root." >&2 exit 1 fi git config core.hooksPath .githooks chmod +x .githooks/post-commit .githooks/pre-push cat <<'EOF' ✅ Claude sync hooks installed. • post-commit: auto-syncs on dev-doc changes • pre-push: warns if .claude-sync/ is stale Run once to verify: bash scripts/sync-claude-docs.sh sync EOF