Support external vault roots across tooling

This commit is contained in:
2026-09-20 17:05:21 +02:00
parent 1cb6369282
commit 293b582e97
16 changed files with 573 additions and 204 deletions
+7 -3
View File
@@ -1,11 +1,15 @@
#!/usr/bin/env bash
# Generate and validate the selected vault graph before accepting a commit.
set -euo pipefail
framework_root="$(cd -- "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")/.." && pwd)"
vault_root="${1:-${KNOWLEDGE_BASE_ROOT:-$framework_root}}"
echo "[pre-commit] Generating and validating graph..."
make graph
"${PYTHON:-python3}" "$framework_root/scripts/generate-graph.py" --vault-root "$vault_root" --write --validate
if ! git diff --quiet -- index/graph.json; then
if ! git -C "$vault_root" ls-files --error-unmatch index/graph.json >/dev/null 2>&1 || \
! git -C "$vault_root" diff --quiet -- index/graph.json; then
echo "[pre-commit] index/graph.json was modified by generation."
echo "[pre-commit] Run 'make graph' and stage index/graph.json before committing."
echo "[pre-commit] Stage the generated index/graph.json before committing."
exit 1
fi