fix(ce-update): replace cache sweep with claude plugin update#656
fix(ce-update): replace cache sweep with claude plugin update#656
Conversation
The pre-resolution commands used ${CLAUDE_PLUGIN_ROOT:-} inside $(dirname ...),
which silently expanded to empty because Claude Code substitutes bare
${CLAUDE_PLUGIN_ROOT} tokens at skill-load time but does not recognize the
${VAR:-} form. Result: the cache-directory discriminator always fell through
to the error sentinel, telling users "no marketplace cache found" even when
the cache was present with multiple stale versions.
Switch to ${CLAUDE_SKILL_DIR}, which is a Claude Code documented skill-body
substitution and reliably resolves. Derive plugin cache dir, cached version
folders, and currently-loaded version from this single source. Anchor the
pattern on $HOME/.claude/plugins/cache/ so the skill cleanly distinguishes
marketplace installs from --plugin-dir / dev-checkout sessions.
Also: friendlier no-marketplace message explaining --plugin-dir mode and that
the marketplace install (if any) is untouched; drop self-referential prose
that was itself getting substituted when the skill rendered.
Claude Code ships `claude plugin update <name>@<marketplace>` which
handles version comparison, marketplace refresh, and install updates in
one command. Replace the skill's bespoke cache-sweep logic (rm -rf of
stale version folders, advisory `/plugin marketplace update`, restart)
with a single recommendation to run that command.
Drop the pre-resolution of plugin cache directory and cached version
folders — no longer needed. Only the currently-loaded version is still
derived from ${CLAUDE_SKILL_DIR}, used to compare against the latest
release.
The marketplace name is hardcoded as `every-marketplace` rather than
derived from the skill path. That is the fixed publish destination for
this plugin; deriving it added complexity without flexibility.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d501f62a49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address two correctness issues from code review on PR #656: P1: hardcoded marketplace name. The recommended update command used `compound-engineering@every-marketplace`, but the marketplace name is not fixed across users. The marketplace manifest declares the name as `compound-engineering-plugin`, which is what the README install flow (`/plugin marketplace add EveryInc/compound-engineering-plugin`) produces. Only the Every-internal install uses `every-marketplace`. Derive the marketplace name from the skill path instead so the recommended command targets the user's actual install. P2: cache-root prefix too narrow. The case pattern anchored on `${HOME}/.claude/plugins/cache/`, so any non-default cache root (such as a CLAUDE_CONFIG_DIR relocation, or container/CI layouts) was treated as "not a marketplace install" and skipped. Broaden the pattern prefix to `*/plugins/cache/` so any parent location matches while still rejecting dev checkouts (they lack the `plugins/cache/` segment). Both fixes share the same case pattern and derivation mechanics.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ae6f4d124
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
/ce-updatenow recommendsclaude plugin update compound-engineering@every-marketplaceinstead of sweeping the plugin cache directly. The bespoke cache handling (listing~/.claude/plugins/cache/<marketplace>/compound-engineering/, comparing version folder names,rm -rfing stale ones) is gone. Claude Code's own CLI subcommand already handles version comparison, marketplace refresh, and install updates in one call.The refactor surfaced via a bug fix.
/ce-updatehad been silently returning "no marketplace cache found" for everyone, even when stale versions were piled up in the cache, because the pre-resolution used${CLAUDE_PLUGIN_ROOT:-}inside$(dirname ...)and Claude Code's skill-body substitution does not recognize the${VAR:-}form (only bare${VAR}is in the documented substitution set). Fixing the detection by switching to${CLAUDE_SKILL_DIR}(commit 1) made it clear that the whole cache-walking approach was unnecessary: delete it and call the right command instead (commit 2).Net change: 3 pre-resolved values instead of 4, no path-derivation of plugin cache or marketplace name, no
rm -rfin the skill, and the recommended action is a single copy-paste command.Test plan
--plugin-dir), run/ce-update. Should report current vs. latest and either "up to date" or theclaude plugin updaterecommendation.claude --plugin-dir <repo>/plugins/compound-engineering, run/ce-update. Should report the skill directory path and explain no action for this session.