Skip to content

fix(ce-update): derive cache dir from CLAUDE_PLUGIN_ROOT parent#645

Merged
tmchow merged 1 commit intomainfrom
worktree-proud-booping-minsky
Apr 22, 2026
Merged

fix(ce-update): derive cache dir from CLAUDE_PLUGIN_ROOT parent#645
tmchow merged 1 commit intomainfrom
worktree-proud-booping-minsky

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 22, 2026

Summary

Fixes #556. /ce-update was emitting __CE_UPDATE_CACHE_FAILED__ and falsely reporting "No marketplace cache found" on healthy Claude Code installs.

CLAUDE_PLUGIN_ROOT points 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 from dirname "${CLAUDE_PLUGIN_ROOT}". Guarded by a case shape-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 dangerous rm -rf target.
  • 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
  • Reproduced original failure against ~/.claude/plugins/cache/every-marketplace/compound-engineering/2.68.1 install
  • Verified fix across 5 scenarios: standard install, alternate marketplace name, unset env, dev checkout, dangerous input path — all correct
  • Regression test confirmed to fail when the antipattern is reintroduced

🤖 Generated with Claude Code

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>
@tmchow tmchow merged commit 6155b9d into main Apr 22, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 22, 2026
This was referenced Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instructions for updating plugin?

1 participant