Skip to content
Source
Sign inSign up
TanStack/intent

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

Openitsfaqih(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/346/headopened

🎯 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 https://github.com/TanStack/intent/pull/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.
    1. 🦋 Changeset detected

      Latest commit: c6260855dd14c98b539b5e661b90ddb1725ea311

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

      This PR includes changesets to release 1 package
      NameType
      @tanstack/intentPatch

      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

    2. chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented

      Codex Review Summary

      This comment shows the latest Codex review activity on this pull request.

      ReviewStatusCommitReview trigger
      📝 Code Review✅ Completed 2026-10-19T17:10:43.067528Zc626085PR 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.

    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 248c6f02605b12f9a31be069fabd945361f701bf and c6260855dd14c98b539b5e661b90ddb1725ea311.

      📒 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 nameStatusExplanationResolution
      Docstring CoverageWarningDocstring 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 nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: correcting skill paths for nested dependency variants.
      Description checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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 in to join this conversation.