Files
zkxw/scripts/post-commit-graph.sh
2026-05-20 09:28:36 +08:00

16 lines
629 B
Bash
Executable File

#!/bin/bash
# Post-commit hook: 增量更新知识图谱(仅当 backend/app/ 或 web-admin/src/ 有变化时)
# 安装: cp scripts/post-commit-graph.sh .git/hooks/post-commit
CHANGED=$(git diff-tree --no-commit-id --name-only -r HEAD)
if echo "$CHANGED" | grep -q "^backend/app/"; then
echo "[graphify] 检测到后端代码变更,更新图谱..."
"$(dirname "$0")/../../scripts/update-graph.sh" backend 2>/dev/null &
fi
if echo "$CHANGED" | grep -q "^web-admin/src/"; then
echo "[graphify] 检测到前端代码变更,更新图谱..."
"$(dirname "$0")/../../scripts/update-graph.sh" frontend 2>/dev/null &
fi