Skip to content

fix: point nested dependency variant skills at their own copy - #346

Open
itsfaqih wants to merge 1 commit into
TanStack:mainfrom
itsfaqih:fix/nested-variant-skill-path
Open

itsfaqih wants to merge 1 commit into
TanStack:mainfrom
itsfaqih:fix/nested-variant-skill-path

Conversation

@itsfaqih

@itsfaqih itsfaqih commented Oct 19, 2026 •

Copy link
Copy Markdown

🎯 Changes

What changed

  • rewriteSkillLoadPaths now uses the root’s node_modules path 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 @tanstack/query@4.0.0
├── node_modules/
│   └── @tanstack/query/               # v4.0.0
└── packages/bar/
    ├── package.json                   # depends on @tanstack/query@5.0.0
    └── node_modules/
        └── @tanstack/query/           # v5.0.0
            └── skills/fetching/SKILL.md

Let's say, @tanstack/query v4 doesn't have a fetching skill, while @tanstack/query v5 has it (like the example above).

Right now, if we run intent list --json from the root directory, it will list the fetching skill from bar's copy of @tanstack/query (v5), which is an intended behavior (based on #79), but when we run intent load @tanstack/query#fetching, it will give us an error: Resolved skill file was not found: node_modules/@tanstack/query/skills/fetching/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 (run pnpm build:all first).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • intent load now selects a dependency’s nested copy when it differs from the project’s root copy, so skills load from the expected version.
    • Skill paths stay project-relative for distinct nested copies. Hoisted dependencies and pnpm or bun symlinks pointing to the same copy retain stable node_modules paths.

rewriteSkillLoadPaths rewrote every project-local skill path to
node_modules/<name>/... whenever that entry existed, even when it was a
different copy of the package. When a workspace package installed its own
version, list showed the nested skill but load looked for it in the root
copy and failed. Use the node_modules/<name> path only when it realpaths
to the same directory as the package root.
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c626085

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/intent Patch

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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-19T17:10:43.067528Z c626085 PR 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.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7f08fe6a-2075-427d-a43d-b33b5196e664
📥 Commits

Reviewing files that changed from the base of the PR and between 248c6f0 and c626085.

📒 Files selected for processing: 4
  • .changeset/nested-variant-skill-path.md
  • packages/intent/src/skills/paths.ts
  • packages/intent/tests/core.test.ts
  • packages/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

rewriteSkillLoadPaths now distinguishes a top-level package from a different installed copy by comparing resolved paths. Tests cover nested dependency selection and symlinked package paths. A patch changeset documents the update.

Changes: Skill path selection

Layer / File(s) Summary
Compare resolved package paths
packages/intent/src/skills/paths.ts
Top-level matching now requires the expected path or matching resolved paths. If real-path resolution fails, the skill path remains project-relative.
Verify nested and symlinked package paths
packages/intent/tests/core.test.ts, packages/intent/tests/skill-paths.test.ts, .changeset/nested-variant-skill-path.md
Tests verify that loading selects a workspace package’s nested dependency copy and that a pnpm store copy uses the stable top-level symlink path. The changeset describes the path handling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ladybluenotes

Merge Risk: ⚪ Minimal · up to c6260

No concrete merge-blocking issue is established. The change appears ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 1 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: correcting skill paths for nested dependency variants.
Description check Passed The description explains what changed, why it changed, review focus, testing, and release impact. It includes all required template sections and completed checklist items.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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 1 functions across 3 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant