From ae71122a2434e67b87c96bcda725da53e10e245c Mon Sep 17 00:00:00 2001 From: Serge Gatezh <2880401+gatezh@users.noreply.github.com> Date: Tue, 22 Sep 2026 21:41:01 -0600 Subject: [PATCH] fix(claude-code): refresh plugins on every init-plugins run ~/.claude is a named volume that survives rebuilds, so after the first run `claude plugin install` finds every plugin already present and no-ops. Plugin versions froze at whatever was latest when the volume was created, and "Rebuild Container" never updated them. After the install loop, refresh all marketplace indexes (`claude plugin marketplace update`, no name = all) and then run `claude plugin update ` per plugin. The index refresh must come first: `plugin update` resolves against the cached catalog. Both steps are non-fatal under `set -e`, matching the existing per-item success/warning output. Applied to the repo-root .devcontainer/init-plugins.sh too, which had the same install-only loop. README: describe the update step, and fix the adjacent bundled-plugins table (five marketplaces, add the missing cloudflare row). Fixes #158 --- .devcontainer/init-plugins.sh | 15 ++++++++++++++- claude-code/.devcontainer/init-plugins.sh | 18 +++++++++++++++++- claude-code/README.md | 5 +++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.devcontainer/init-plugins.sh b/.devcontainer/init-plugins.sh index 2aad0d9..003f3aa 100755 --- a/.devcontainer/init-plugins.sh +++ b/.devcontainer/init-plugins.sh @@ -1,6 +1,6 @@ #!/bin/bash # Initialize Claude Code plugins for the devcontainers repo -# This script is idempotent - safe to run multiple times +# This script is idempotent - safe to run multiple times; each run also updates plugins set -euo pipefail @@ -44,6 +44,19 @@ for plugin in "${PLUGINS[@]}"; do } done +# ~/.claude is a persistent volume, so `install` no-ops after the first run. +# Refresh marketplace indexes first — `plugin update` resolves against the cache. +echo "Updating Claude Code plugins..." +claude plugin marketplace update || { + echo "Note: marketplace refresh failed; updates use cached indexes" +} +for plugin in "${PLUGINS[@]}"; do + echo " Updating: $plugin" + claude plugin update "$plugin" 2>/dev/null || { + echo " Note: $plugin update failed or unavailable" + } +done + # Initialize rtk global hook for Claude Code (auto-rewrite mode). # --hook-only: installs only the PreToolUse rewrite hook, no workspace artifacts. # RTK_TELEMETRY_DISABLED=1 is the supported opt-out, not a workaround: since diff --git a/claude-code/.devcontainer/init-plugins.sh b/claude-code/.devcontainer/init-plugins.sh index 6f64ac7..a6f655b 100644 --- a/claude-code/.devcontainer/init-plugins.sh +++ b/claude-code/.devcontainer/init-plugins.sh @@ -1,6 +1,6 @@ #!/bin/bash # Claude Code plugin initialization — runs once at container creation. -# Idempotent — safe to run multiple times. +# Idempotent — safe to run multiple times; each run also updates plugins to latest. # # Wire into postCreateCommand in your devcontainer.json: # "postCreateCommand": "bash .devcontainer/init-plugins.sh" @@ -66,6 +66,22 @@ for plugin in "${PLUGINS[@]}"; do fi done +# ~/.claude is a persistent volume, so `install` no-ops after the first run. +# Refresh marketplace indexes first — `plugin update` resolves against the cache. +if claude plugin marketplace update 2>&1; then + echo "✔ Marketplaces refreshed" +else + echo "⚠ Failed to refresh marketplaces" >&2 +fi + +for plugin in "${PLUGINS[@]}"; do + if claude plugin update "$plugin" 2>&1; then + echo "✔ Up to date: $plugin" + else + echo "⚠ Failed to update: $plugin" >&2 + fi +done + # ── Playwright MCP: route every cached .mcp.json to system chromium ───────── # Universal across arches (no Chrome stable binary in either default or sandbox). # The patch binary is baked into the image (see Dockerfile #87) and also runs diff --git a/claude-code/README.md b/claude-code/README.md index fc00253..2c17b7a 100644 --- a/claude-code/README.md +++ b/claude-code/README.md @@ -80,7 +80,7 @@ Only pin tools that affect project stability — dev infrastructure (rtk, ralphe ### Optional: `.devcontainer/init-plugins.sh` -Claude Code plugin initialization. `init-plugins.sh` registers marketplaces, installs plugins, and invokes the image-baked `/usr/local/bin/patch-playwright-mcp` to rewrite every cached Playwright MCP `.mcp.json` to launch the system chromium. Idempotent. See [`.devcontainer/init-plugins.sh`](.devcontainer/init-plugins.sh) for the template. +Claude Code plugin initialization. `init-plugins.sh` registers marketplaces, installs plugins, updates them to the latest marketplace versions (`install` alone no-ops once the persistent `~/.claude` volume holds a plugin), and invokes the image-baked `/usr/local/bin/patch-playwright-mcp` to rewrite every cached Playwright MCP `.mcp.json` to launch the system chromium. Idempotent. See [`.devcontainer/init-plugins.sh`](.devcontainer/init-plugins.sh) for the template. Wire into `devcontainer.json`: @@ -95,7 +95,7 @@ Mark as executable: `chmod +x init-plugins.sh` #### Bundled plugins -`init-plugins.sh` registers four marketplaces and installs the following plugins: +`init-plugins.sh` registers five marketplaces and installs the following plugins: | Marketplace | Plugin | Purpose | |---|---|---| @@ -109,6 +109,7 @@ Mark as executable: `chmod +x init-plugins.sh` | `anthropics/claude-plugins-official` | `claude-md-management` | Audits and updates CLAUDE.md | | `anthropics/claude-plugins-official` | `claude-code-setup` | Settings, permissions, automation helpers | | `anthropics/claude-plugins-official` | `posthog` | PostHog product-analytics & LLM-traces skills | +| `cloudflare/skills` | `cloudflare` | Cloudflare skills and MCP server | | `umputun/ralphex` | `ralphex` | Autonomous plan execution | | `GoogleChrome/modern-web-guidance` | `modern-web-guidance` | Accessible, performant, secure modern web patterns ([docs](https://developer.chrome.com/docs/modern-web-guidance)) | | `AgriciDaniel/claude-seo` | `claude-seo` | SEO analysis toolkit — technical SEO, schema, E-E-A-T, GEO/AEO, Google APIs ([repo](https://github.com/AgriciDaniel/claude-seo)) |