fix: point nested dependency variant skills at their own copy #335
main fromrefs/pull/335/head·opened 🎯 Changes#
What changed#
rewriteSkillLoadPathsnow uses the root’snode_modulespath only if it points to the package copy where the skill was found; otherwise, it uses that copy’s path relative to the project root.- The tests check that skills load from the correct package copy when different versions are installed, and that paths still work when a symlink points to the same copy.
Why#
In a monorepo, there might be a case where we have the same dependency installed in the root directory, and in the child directories. The dependency could have a different version, which means, we have something like this:
root/
├── package.json # depends on foo@1.0.0
├── node_modules/
│ └── foo/ # v1.0.0
└── packages/bar/
├── package.json # depends on foo@2.0.0
└── node_modules/
└── foo/ # v2.0.0
└── skills/core/SKILL.md
Let's say, the foo v1 doesn't have a core skill, while the foo v2 has it (like the example above).
Right now, if we run intent list --json from the root directory, it will display the foo's core skill path from the bar project, which is an intended behavior (based on https://github.com/TanStack/intent/pull/79), but when we run intent load foo#core, it will give us an error: Resolved skill file was not found: node_modules/foo/skills/core/SKILL.md because the path was resolved to the root's node_modules instead of the bar's node_modules.
Anything reviewers should look at closely#
Please check if the real path comparison is the right approach
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm run test:pr(runpnpm build:allfirst).
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
The commit and the visual illustration generated with Claude Code
Summary by CodeRabbit#
- Bug Fixes
- Skill discovery now uses the correct nested package copy when multiple versions of a dependency are present, so listing, resolving, and loading a skill selects the matching package and its content.
- Skill paths remain stable for direct dependencies and symlinked packages, while paths for separate nested copies are resolved relative to the project.
- 1
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
Review Status Commit Review trigger 📝 Code Review ✅ Completed 2026-10-18T22:03:57.993510Z 46f3f53PR opened ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7afd7115-d37f-408f-b07b-2e8b3aa3c3df
📥 Commits
-
Reviewing files that changed from the base of the PR and between ab9877c50888913e45afea92a0a87169de9c7d84 and 46f3f53af63e4540e85f11cf804ff8f97d88108e.
📒 Files selected for processing: 5
-
.changeset/nested-variant-skill-path.mdpackages/intent/src/skills/paths.tspackages/intent/tests/core.test.tspackages/intent/tests/scanner.test.tspackages/intent/tests/skill-paths.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
-
📝 Walkthrough
-
The path rewrite now compares resolved package paths before using a top-level
node_modulespath. Tests cover nested package selection, loading, and symlinked package paths.Changes: Nested skill-path resolution
Layer / File(s) Summary Select paths by resolved package identity
packages/intent/src/skills/paths.ts,packages/intent/tests/skill-paths.test.ts,.changeset/nested-variant-skill-path.mdrewriteSkillLoadPathsuses a top-levelnode_modulespath only when its resolved path matchespackageRoot. Tests cover different package copies and a symlink to the same copy. The changeset documents the path behavior.Validate nested package selection
packages/intent/tests/scanner.test.ts,packages/intent/tests/core.test.tsTests verify that scanning, listing, resolving, and loading select the nested foov2 copy when it contains the skill. They also cover the nested skill path and a root symlink to the scanned copy.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
ladybluenotes
Merge Risk: ⚪ Minimal · up to
46f3f-
The change appears mergeable after normal checks; no concrete issue with nested skill loading remains identified.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Description check The description includes the required Changes, Checklist, and Release Impact sections. It explains the motivation, implementation, testing, and changeset status. Title check The title clearly and concisely describes the primary fix: correcting skill paths for nested dependency variants.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 `@coderabbitai help` to get the list of available commands.-
Thanks for the PR. The description is too long to review efficiently and reads as just an LLM output. Could you rewrite it in your own words? A few lines is plenty:
- What changed
- Why
- Anything reviewers should look at closely
Honest concern: when the write-up is fully generated, I can't tell how well you understand the change. If I wanted AI output, I could generate it myself. What I need from a contributor is the reasoning and judgment behind it. Happy to review once it's trimmed.
Thank you for the prompt response @LadyBluenotes. I have updated it. I'm keeping the visual illustration so it's easier to understand the issue.
Thanks for trimming the description and for surfacing the
rewriteSkillLoadPathsbug. Looking through the diff itself, the PR still carries a lot of unedited LLM output: 205 lines of test code across three files for a 6-line change (including arootCopyHasSkillhelper branch incore.test.tsthat is never used and threescanner.test.tstests that duplicateskill-paths.test.tsandcore.test.ts), plus a changeset claim ("or read the root copy's file instead") thattoResolvedIntentSkill's package-root check already prevents.I'm going to close this rather than do a cleanup pass on generated code. You're welcome to open a fresh PR with just the
paths.tsfix, the two unit tests inskill-paths.test.ts, and one lean integration test incore.test.tsonce you've verified each piece by hand.
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 46f3f53af63e4540e85f11cf804ff8f97d88108e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR