refactor: extract kb_framework package, build graph in memory
Scripts become thin CLIs over kb_framework (graph, query, query_tools, vault, instructions) so the hosted read-only connector shares one implementation with the stdio server. The MCP server builds the graph from Markdown on demand and invalidates it on writes; refresh_graph rebuilds in memory and reports validation problems. Pre-commit hook validates only; index/graph.json is no longer read, written or staged (generate-graph.py --write remains for operators). Golden fixtures pin graph and tool payloads to the previous output. Agent and skill docs updated to match. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+4
-10
@@ -1,15 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generate and validate the selected vault graph before accepting a commit.
|
||||
# Validate the selected vault graph before accepting a commit.
|
||||
# The graph is derived in memory; nothing is written and nothing must be staged.
|
||||
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..."
|
||||
"${PYTHON:-python3}" "$framework_root/scripts/generate-graph.py" --vault-root "$vault_root" --write --validate
|
||||
|
||||
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] Stage the generated index/graph.json before committing."
|
||||
exit 1
|
||||
fi
|
||||
echo "[pre-commit] Validating graph..."
|
||||
"${PYTHON:-python3}" "$framework_root/scripts/generate-graph.py" --vault-root "$vault_root" --validate
|
||||
|
||||
Reference in New Issue
Block a user