fix(ce-update): derive cache dir from CLAUDE_PLUGIN_ROOT parent#645
Merged
fix(ce-update): derive cache dir from CLAUDE_PLUGIN_ROOT parent#645
Conversation
CLAUDE_PLUGIN_ROOT points at the currently-loaded plugin version directory
(~/.claude/plugins/cache/<marketplace>/compound-engineering/<version>), not
the plugins cache root. Appending /cache/<marketplace>/compound-engineering/
onto it produced a path that never exists, so the cache probe always failed
and emitted __CE_UPDATE_CACHE_FAILED__ on healthy installs.
Derive the cache dir via dirname "${CLAUDE_PLUGIN_ROOT}" instead. Guard with
a case shape-check that only emits the path when it matches
*/cache/*/compound-engineering, so malformed env values collapse to the
sentinel rather than producing a dangerous rm -rf target. Works for any
marketplace name, which removes the earlier hardcoded-segment footgun.
Add tests/skills/ce-update.test.ts as a regression guard so the
${CLAUDE_PLUGIN_ROOT}/cache/... antipattern cannot reappear.
Fixes #556.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #556.
/ce-updatewas emitting__CE_UPDATE_CACHE_FAILED__and falsely reporting "No marketplace cache found" on healthy Claude Code installs.CLAUDE_PLUGIN_ROOTpoints at the currently-loaded plugin version directory (~/.claude/plugins/cache/<marketplace>/compound-engineering/<version>), not the plugins cache root. Line 34 was appending/cache/<marketplace>/compound-engineering/onto it, producing a path that never exists. #566 corrected one wrong marketplace segment with another wrong one — the underlying path-structure mistake remained.What changed
plugins/compound-engineering/skills/ce-update/SKILL.md: derive the cache dir fromdirname "${CLAUDE_PLUGIN_ROOT}". Guarded by acaseshape-check that requires the parent to match*/cache/*/compound-engineering. Malformed env values, dev checkouts, and non-Claude harnesses collapse to the sentinel instead of producing a dangerousrm -rftarget.tests/skills/ce-update.test.ts(new): regression guard that fails if the${CLAUDE_PLUGIN_ROOT}/cache/...antipattern is reintroduced. Verified to fail on the old pattern and pass on the new one.Works regardless of marketplace-folder name (
every-marketplace,compound-engineering-plugin, future marketplaces).Test plan
bun test— 864/0 pass (was 863; +1 new regression test)bun run release:validate— clean~/.claude/plugins/cache/every-marketplace/compound-engineering/2.68.1install🤖 Generated with Claude Code