From 2d5a10c0a29ee2d8355bacfbdbf0ccf57b558cc5 Mon Sep 17 00:00:00 2001 From: Safi Date: Wed, 3 Jun 2026 14:30:33 +0100 Subject: [PATCH] also probe graphify-out/.graphify_python in hook interpreter detection The issue reporter correctly noted that the hooks never consulted graphify-out/.graphify_python -- the runtime interpreter source the skill and README already rely on. Added as a second probe (after the pinned sys.executable, before the launcher shebang and python3/python fallbacks). This covers Windows/Git Bash where the uv-tool launcher is a binary with no parseable shebang, and where the pinned exe may go stale after a reinstall. Co-Authored-By: Claude Opus 4.8 --- graphify/hooks.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/graphify/hooks.py b/graphify/hooks.py index aeaa8d14..efedb2df 100644 --- a/graphify/hooks.py +++ b/graphify/hooks.py @@ -25,7 +25,21 @@ _PINNED="__PINNED_PYTHON__" if [ -n "$_PINNED" ] && [ -x "$_PINNED" ] && "$_PINNED" -c "import graphify" 2>/dev/null; then GRAPHIFY_PYTHON="$_PINNED" fi -# Dynamic fallback: resolve via the graphify launcher on PATH (shebang probe). +# Second probe: read graphify-out/.graphify_python (written by the skill and +# CLI; survives uv-tool reinstalls and is the same source the README documents). +if [ -z "$GRAPHIFY_PYTHON" ]; then + _GFY_PYTHON_FILE="graphify-out/.graphify_python" + if [ -f "$_GFY_PYTHON_FILE" ]; then + _FROM_FILE=$(cat "$_GFY_PYTHON_FILE" 2>/dev/null | tr -d '[:space:]') + case "$_FROM_FILE" in + *[!a-zA-Z0-9/_.@:\\-]*) _FROM_FILE="" ;; # allowlist (covers Windows paths) + esac + if [ -n "$_FROM_FILE" ] && [ -x "$_FROM_FILE" ] && "$_FROM_FILE" -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="$_FROM_FILE" + fi + fi +fi +# Third probe: resolve via the graphify launcher on PATH (shebang probe). if [ -z "$GRAPHIFY_PYTHON" ]; then GRAPHIFY_BIN=$(command -v graphify 2>/dev/null) if [ -n "$GRAPHIFY_BIN" ]; then