chore: add Claude Project Knowledge sync tooling

- 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>
This commit is contained in:
2026-04-24 12:38:26 +02:00
parent 83821b1bd5
commit 79189a64e5
8 changed files with 480 additions and 0 deletions

54
.githooks/post-commit Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
# Auto-sync Claude Project Knowledge when a commit touched any configured doc.
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
if [ -z "${REPO_ROOT}" ]; then
exit 0
fi
cd "${REPO_ROOT}"
CONF_FILE=".claude-sync.conf"
SYNC_SCRIPT="scripts/sync-claude-docs.sh"
if [ ! -f "${CONF_FILE}" ] || [ ! -f "${SYNC_SCRIPT}" ]; then
exit 0
fi
# Files changed in the commit we just made.
changed="$(git diff-tree --no-commit-id --name-only -r HEAD 2>/dev/null || true)"
if [ -z "${changed}" ]; then
exit 0
fi
# Configured paths (strip # comments and blanks).
configured="$(awk '
{
sub(/#.*/, "")
gsub(/^[[:space:]]+|[[:space:]]+$/, "")
if (length($0) > 0) print
}
' "${CONF_FILE}")"
match=0
while IFS= read -r cfile; do
[ -z "${cfile}" ] && continue
while IFS= read -r conf_path; do
[ -z "${conf_path}" ] && continue
if [ "${cfile}" = "${conf_path}" ]; then
match=1
break 2
fi
done <<EOF
${configured}
EOF
done <<EOF
${changed}
EOF
if [ "${match}" -eq 1 ]; then
bash "${SYNC_SCRIPT}" sync
fi
exit 0