fix(post-update): clear Claude plugin cache on update
The Claude plugin cache at ~/.claude/plugins/cache/leo-claude-mktplace/ holds versioned copies of .mcp.json files. When we update .mcp.json to use run.sh instead of direct python paths, the cache retains old versions, causing MCP servers to fail. Now post-update.sh clears this cache, forcing Claude to read fresh configs from the installed marketplace on next session start. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,19 @@ PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$(dirname "$(dirname "$(realpath "$0")")")}"
|
|||||||
# Marketplace root is 2 levels up from plugin root (plugins/projman -> .)
|
# Marketplace root is 2 levels up from plugin root (plugins/projman -> .)
|
||||||
MARKETPLACE_ROOT="$(dirname "$(dirname "$PLUGIN_ROOT")")"
|
MARKETPLACE_ROOT="$(dirname "$(dirname "$PLUGIN_ROOT")")"
|
||||||
VENV_REPAIR_SCRIPT="$MARKETPLACE_ROOT/scripts/venv-repair.sh"
|
VENV_REPAIR_SCRIPT="$MARKETPLACE_ROOT/scripts/venv-repair.sh"
|
||||||
|
PLUGIN_CACHE="$HOME/.claude/plugins/cache/leo-claude-mktplace"
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Clear stale plugin cache (MUST run before MCP servers load)
|
||||||
|
# ============================================================================
|
||||||
|
# The cache at ~/.claude/plugins/cache/ holds versioned .mcp.json files.
|
||||||
|
# After marketplace updates, cached configs may point to old paths.
|
||||||
|
# Clearing forces Claude to read fresh configs from installed marketplace.
|
||||||
|
|
||||||
|
if [[ -d "$PLUGIN_CACHE" ]]; then
|
||||||
|
rm -rf "$PLUGIN_CACHE"
|
||||||
|
# Don't output anything - this should be silent and automatic
|
||||||
|
fi
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Auto-repair MCP venvs (runs before other checks)
|
# Auto-repair MCP venvs (runs before other checks)
|
||||||
|
|||||||
@@ -5,13 +5,16 @@
|
|||||||
# Usage: ./scripts/post-update.sh
|
# Usage: ./scripts/post-update.sh
|
||||||
#
|
#
|
||||||
# This script:
|
# This script:
|
||||||
# 1. Restores MCP venv symlinks (instant if cache exists)
|
# 1. Clears Claude plugin cache (forces fresh .mcp.json reads)
|
||||||
# 2. Creates venvs in external cache if missing (first run only)
|
# 2. Restores MCP venv symlinks (instant if cache exists)
|
||||||
# 3. Shows recent changelog updates
|
# 3. Creates venvs in external cache if missing (first run only)
|
||||||
|
# 4. Shows recent changelog updates
|
||||||
#
|
#
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
CLAUDE_PLUGIN_CACHE="$HOME/.claude/plugins/cache/leo-claude-mktplace"
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||||
|
|
||||||
@@ -47,6 +50,14 @@ main() {
|
|||||||
echo "=============================================="
|
echo "=============================================="
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Clear Claude plugin cache to force fresh .mcp.json reads
|
||||||
|
# This cache holds versioned copies that become stale after updates
|
||||||
|
if [[ -d "$CLAUDE_PLUGIN_CACHE" ]]; then
|
||||||
|
log_info "Clearing Claude plugin cache..."
|
||||||
|
rm -rf "$CLAUDE_PLUGIN_CACHE"
|
||||||
|
log_success "Plugin cache cleared"
|
||||||
|
fi
|
||||||
|
|
||||||
# Run venv-repair.sh to restore symlinks to external cache
|
# Run venv-repair.sh to restore symlinks to external cache
|
||||||
# This is instant if cache exists, or does full setup on first run
|
# This is instant if cache exists, or does full setup on first run
|
||||||
if [[ -x "$SCRIPT_DIR/venv-repair.sh" ]]; then
|
if [[ -x "$SCRIPT_DIR/venv-repair.sh" ]]; then
|
||||||
@@ -68,6 +79,7 @@ main() {
|
|||||||
echo ""
|
echo ""
|
||||||
log_success "Post-update complete!"
|
log_success "Post-update complete!"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "IMPORTANT: Restart Claude Code for changes to take effect."
|
||||||
echo "MCP servers will work immediately on next session start."
|
echo "MCP servers will work immediately on next session start."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user