Interpreter probe fails on pipx installs: shebang with an argument is parsed as a file path
Both the generated post-commit hook and the skill's own interpreter probes read the shebang of the graphify launcher and use it as a path. pipx writes #!/path/to/venv/bin/python -E — with an argument — so the string is not a path, and every probe falls through to a python3 that does not have graphify installed.
Result on my machine: every commit printed
[graphify hook] could not locate a Python with graphify installed.
for weeks, so the graph silently stopped updating. Since it is one line of noise after each commit, it went unnoticed for a long time.
Reproduce
$ which graphify
/Users/me/.local/bin/graphify
$ head -1 "$(which graphify)" | tr -d #!
/Users/me/.local/pipx/venvs/graphifyy/bin/python -E # <- note the argument
Now the probe from SKILL.md step 1:
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d "#!")
case "$_SHEBANG" in
*[!a-zA-Z0-9/_.@-]*) ;; # <- space matches, probe is skipped entirely
*) "$_SHEBANG" -c "import graphify" && PYTHON="$_SHEBANG" ;;
esac
The character guard rejects the string because of the space, so the verification never runs and the probe never fires.
The ## Interpreter guard for subcommands block has the same parse without the import graphify verification, so it writes the unverified python3 fallback into graphify-out/.graphify_python. Every later step reads that pinned path and fails as if the install were broken.
Suggested fix
Strip the interpreter argument before using the shebang as a path, and verify the candidate before pinning it:
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d "#!" | cut -d" " -f1)
"$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG"
With cut -d" " -f1 the path resolves and the import check passes on a stock pipx install. The same two changes apply to the generated post-commit hook, which carries the identical probe.
I patched this locally in SKILL.md and confirmed the hook now reports launching background rebuild. Happy to open a PR if useful.
Environment: macOS 15 (Darwin 25.5.0), graphify 0.9.12, installed via pipx.
Second pipx shim format that defeats the same probe, plus a follow-on break after the probe succeeds.
Env: graphifyy 0.9.39, pipx 1.16.6, macOS 15 (Darwin 25.6.0), Claude Code host, pipx install graphifyy.
Variant 2: the sh trampoline (no argument at all)
This pipx does not write #!/path/to/venv/bin/python -E. It writes a POSIX trampoline:
$ head -1 "$(which graphify)"
#!/bin/sh
$ sed -n 2p "$(which graphify)"
'''exec' "/Users/me/Library/Application Support/pipx/venvs/graphifyy/bin/python" "$0" "$@"
So the real interpreter is on line 2, and line 1 is /bin/sh — which passes the *[!a-zA-Z0-9/_.@-]* charset guard rather than being skipped by it. The probe then runs:
/bin/sh -c "import graphify" # -> "import: command not found", exit 127
PYTHON stays empty, the probe falls through to python3, and that python3 has no graphify. Same end state as the -E variant, different cause — a fix that only strips shebang arguments will not catch this one.
Follow-on: the resolved path contains spaces
Once the correct interpreter is found, every subsequent skill code block does:
$(cat graphify-out/.graphify_python) -c "..."
unquoted. On macOS the pipx venv lives under ~/Library/Application Support/..., so this word-splits:
/Users/me/Library/Application: No such file or directory
I had to hand-quote "$(cat graphify-out/.graphify_python)" in every block for the whole run. The ## Interpreter guard for subcommands block has the same unquoted form.
Suggested fix that closes both variants and the quoting issue
A graphify --python-path (or graphify debug python) subcommand that just prints sys.executable from inside the installed package. That is authoritative regardless of shim format, and the skill's ~30-line detection block collapses to one line. Quoting still needs fixing in the snippets, since any path may contain a space.