Skip to content
Source
Sign inSign up
TanStack/intent

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

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

Showing 5 changed files with 72 additions and 4 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/nested-variant-skill-path.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/intent': patch
+---
+​
+Point a skill from a nested dependency copy at that copy. When a workspace package installed its own version of a package, such as `packages/a/node_modules/foo`, and the root had a different copy at `node_modules/foo`, `list` showed the nested skill but `load` reported its path as `node_modules/foo/...`. Loading then failed with `Resolved skill file was not found`, or read the root copy's file instead. Intent now uses `node_modules/<name>/...` only when that entry is the same copy, and otherwise reports a project-relative path such as `packages/a/node_modules/foo/skills/core/SKILL.md`. pnpm and bun direct dependencies keep their stable `node_modules/<name>/...` paths.
10 additions and 4 deletionspackages/intent/src/skills/paths.tsModified
View file
@@ -1,4 +1,4 @@
-import { existsSync } from 'node:fs'
+import { realpathSync } from 'node:fs'
import { join, relative } from 'node:path'
import { toPosixPath } from '../shared/utils.js'
import { formatIntentCommand } from '../shared/command-runner.js'
@@ -50,9 +50,15 @@
projectRoot: string
skills: Array<SkillEntry>
}): void {
- const hasStableSymlink =
- packageName !== '' &&
- existsSync(join(projectRoot, 'node_modules', packageName))
+ let hasStableSymlink: boolean
+ try {
+ hasStableSymlink =
+ packageName !== '' &&