chore: 更新 PL 相关知识图谱并修复 update-graph.sh 探测逻辑

使用本机 graphify CLI 强制重建 backend/web-admin 图谱;脚本改为优先走 PATH 中的 graphify。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-19 17:22:31 +08:00
1 parent aa5fbe7780
commit 6d9354a194
10 files changed
+481537 -950244

No files matched your search

+22 -6
View File
@@ -9,13 +9,29 @@
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PYTHON="/Users/zlwu/.pyenv/versions/3.12.13/bin/python"
# 检查 graphify 是否可用
if ! "$PYTHON" -m graphify --help >/dev/null 2>&1; then
echo "[graphify] 未安装,请运行: $PYTHON -m pip install graphify"
# 优先使用 PATH 中的 graphify;其次尝试本机常见 Python
run_graphify() {
if command -v graphify >/dev/null 2>&1; then
graphify "$@"
return
fi
local py
for py in \
"${GRAPHIFY_PYTHON:-}" \
"$ROOT_DIR/backend/venv/bin/python" \
"$(command -v python3 2>/dev/null || true)" \
"/Users/zlwu/.pyenv/versions/3.12.13/bin/python"
do
[ -n "$py" ] && [ -x "$py" ] || continue
if "$py" -m graphify --help >/dev/null 2>&1; then
"$py" -m graphify "$@"
return
fi
done
echo "[graphify] 未找到可用的 graphify。请安装 CLI(如: pipx install graphifyy)或设置 GRAPHIFY_PYTHON。"
exit 1
fi
}
# 更新单个项目的图谱
update_graph() {
@@ -30,7 +46,7 @@ update_graph() {
return 1
fi
"$PYTHON" -m graphify update "$ROOT_DIR/$name" --force
run_graphify update "$ROOT_DIR/$name" --force
echo "[graphify] ${label} 图谱更新完成 ✓"
}