fix(hooks): check venv cache path before marketplace path
Startup hooks in data-platform and pr-review were checking for venvs at the marketplace path (~/.claude/plugins/marketplaces/.../mcp-servers/) which gets wiped on updates. The actual venvs live in the cache directory (~/.cache/claude-mcp-venvs/) which survives updates. This caused false "MCP venv missing" errors even when venvs existed, wasting hours of debugging time. Fixed hooks now check cache path first, matching the pattern used by run.sh scripts. Also updated docs/CANONICAL-PATHS.md with the correct venv path pattern to prevent future occurrences. Lesson learned: lessons/patterns/startup-hooks-must-check-venv-cache-path-first Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,13 +5,18 @@
|
||||
|
||||
PREFIX="[data-platform]"
|
||||
|
||||
# Check if MCP venv exists
|
||||
# Check if MCP venv exists - check cache first, then local
|
||||
CACHE_VENV="$HOME/.cache/claude-mcp-venvs/leo-claude-mktplace/data-platform/.venv/bin/python"
|
||||
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "$(realpath "$0")")")}"
|
||||
# MCP servers are at marketplace root, not inside plugin
|
||||
MARKETPLACE_ROOT="$(dirname "$(dirname "$PLUGIN_ROOT")")"
|
||||
VENV_PATH="$MARKETPLACE_ROOT/mcp-servers/data-platform/.venv/bin/python"
|
||||
LOCAL_VENV="$MARKETPLACE_ROOT/mcp-servers/data-platform/.venv/bin/python"
|
||||
|
||||
if [[ ! -f "$VENV_PATH" ]]; then
|
||||
# Check cache first (preferred), then local
|
||||
if [[ -f "$CACHE_VENV" ]]; then
|
||||
VENV_PATH="$CACHE_VENV"
|
||||
elif [[ -f "$LOCAL_VENV" ]]; then
|
||||
VENV_PATH="$LOCAL_VENV"
|
||||
else
|
||||
echo "$PREFIX MCP venv missing - run /initial-setup or setup.sh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user