fix(commands): resolve active plugin root in /instinct-status (#2037)#2059
fix(commands): resolve active plugin root in /instinct-status (#2037)#2059fxdv wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR updates Changesinstinct-status ECC_ROOT resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/zh-CN/commands/instinct-status.md`:
- Line 14: The sentence "相同的解析器运行本能 CLI——环境变量 → 标准安装 → 已知插件根 → 插件缓存 → 回退。" has
awkward phrasing; change "相同的解析器运行本能 CLI" to a more natural form such as
"以相同的解析器运行本能 CLI" or "用相同解析器运行本能 CLI" to improve readability while keeping the
rest of the line intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 51f7718a-8c1a-4e42-851c-6646d5780124
📒 Files selected for processing (6)
.opencode/commands/instinct-status.mdcommands/instinct-status.mddocs/ja-JP/commands/instinct-status.mddocs/tr/commands/instinct-status.mddocs/zh-CN/commands/instinct-status.mdtests/lib/command-plugin-root.test.js
…-m#2037) The `/instinct-status` slash command template expanded `${CLAUDE_PLUGIN_ROOT}` directly and documented a manual-install fallback to `~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py`. When users had both an active plugin install (under `~/.claude/plugins/cache/<slug>/<org>/<version>/`) and a legacy `~/.claude/skills/continuous-learning-v2/` directory left over from a previous manual install, an empty `CLAUDE_PLUGIN_ROOT` (which Claude Code does not always populate in slash-command shell contexts) silently made the command read the stale legacy install while the active plugin hooks and observer wrote to the new XDG path. The user saw "No instincts found" while the system was actively learning — exactly the divergence the bug reporter spent hours diagnosing. Replace the brittle two-block template with the same inline resolver pattern that `hooks/hooks.json` and `/sessions` / `/skill-health` already use: env var → standard install → known plugin roots → plugin cache walk → fallback. The resolver is the canonical `INLINE_RESOLVE` constant from `scripts/lib/resolve-ecc-root.js`, so no new code is introduced — just consistent adoption of the existing pattern. Apply the same fix to all five copies of the command: - commands/instinct-status.md (canonical) - .opencode/commands/instinct-status.md - docs/zh-CN/commands/instinct-status.md - docs/ja-JP/commands/instinct-status.md - docs/tr/commands/instinct-status.md Extend tests/lib/command-plugin-root.test.js with an assertion that the canonical instinct-status.md uses the inline resolver and no longer hard-codes the legacy `~/.claude/skills/...` fallback (regression guard). zh-CN copy: polish the Chinese phrasing per LanguageTool feedback (`使用与 ... 相同的解析器` → `以与 ... 相同的解析器`) so the verb is introduced by an explicit preposition instead of reading as an awkward verb-object construction.
25fdac5 to
6c99b78
Compare
|
Applied in |
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Summary
Fixes #2037.
The
/instinct-statusslash command template expanded${CLAUDE_PLUGIN_ROOT}directly and documented apython3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.pyfallback for manual installs. When users had both an active plugin install (under~/.claude/plugins/cache/<slug>/<org>/<version>/) AND a legacy~/.claude/skills/continuous-learning-v2/directory left over from a previous manual install, an emptyCLAUDE_PLUGIN_ROOT(which Claude Code does not always populate in slash-command shell contexts, per the issue repro) silently made the command read the stale legacy install while the active plugin hooks and observer wrote to the new XDG path.End result, as the reporter described: a fully functional, actively learning system that appeared completely broken to the user — "No instincts found" while observations were accumulating elsewhere.
Fix
Replace the brittle two-block template with the same inline-resolver pattern that
hooks/hooks.jsonand the other slash commands (/sessions,/skill-health) already use:The resolver chain is: env var → standard install → known plugin roots → plugin cache walk → fallback. It's the canonical
INLINE_RESOLVEconstant exported fromscripts/lib/resolve-ecc-root.js— no new code is introduced, just consistent adoption of the existing pattern across all slash commands.Files changed
commands/instinct-status.md— canonical.opencode/commands/instinct-status.mddocs/zh-CN/commands/instinct-status.mddocs/ja-JP/commands/instinct-status.mddocs/tr/commands/instinct-status.mdtests/lib/command-plugin-root.test.js— extends the existing pattern (which already coverssessions.mdandskill-health.md) with aninstinct-status.mdassertion, plus a regression guard that the legacy~/.claude/skills/...fallback string is no longer present.Test plan
node tests/lib/command-plugin-root.test.js— 4/4 pass (3 prior + 1 new)node tests/lib/resolve-ecc-root.test.js— 23/23 pass (resolver itself is unchanged; existing tests already cover the env-unset → plugin-cache-walk path that fixes this bug)node tests/hooks/hooks.test.js— 237/237 pass (sanity)unset CLAUDE_PLUGIN_ROOT; the resolver returns the correct active install path (falls through to~/.claudecleanly when no install is present, which matches the documented final-fallback behavior).Notes for reviewer
INLINE_RESOLVEinscripts/lib/resolve-ecc-root.js, so any future tightening of the resolver only needs to update that one constant + the inlined copies inhooks.json,sessions.md,skill-health.md, and nowinstinct-status.md(the existingtests/lib/command-plugin-root.test.jsalready pins this consistency).require()anything from the plugin tree — chicken-and-egg). The pre-minifiedINLINE_RESOLVEexport is the maintainer's solution to that constraint and is reused here as-is.Summary by cubic
Fixes stale path resolution in
/instinct-statusthat could read a legacy install whenCLAUDE_PLUGIN_ROOTwas unset, causing “No instincts found.” The command now uses the shared inline resolver to always target the active plugin install (#2037).scripts/lib/resolve-ecc-root.js..opencode, JA/TR/ZH) to use the resolver; polished zh-CN phrasing.~/.claude/skills/...fallback is not used.Written for commit 6c99b78. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Documentation
Tests