- scripts/sync-claude-docs.sh with sync/check/list/help subcommands - scripts/install-claude-sync-hooks.sh for one-time hook setup - .githooks/post-commit auto-syncs on dev-doc changes - .githooks/pre-push warns (non-blocking) on stale sync - .claude-sync.conf lists 11 synced documents - SYNC_MANIFEST.md provides drift-detection anchor for Claude Chat - package.json: npm run sync:docs | sync:check - .gitignore excludes .claude-sync/ output directory Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
778 B
Bash
Executable File
28 lines
778 B
Bash
Executable File
#!/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
|