Skip to content

fix: handle pnpm symlinks in node_modules scanner#41

Merged
LadyBluenotes merged 4 commits intomainfrom
fix/pnpm-symlink-scanner
Mar 5, 2026
Merged

fix: handle pnpm symlinks in node_modules scanner#41
LadyBluenotes merged 4 commits intomainfrom
fix/pnpm-symlink-scanner

Conversation

@KyleAMathews
Copy link
Collaborator

Summary

intent list returns no packages when using pnpm because Dirent.isDirectory() returns false for symlinks. This two-line fix also accepts isSymbolicLink() in both the top-level and scoped-package scan loops.

Approach

pnpm symlinks packages from its content-addressable store into node_modules/. Node's Dirent treats isDirectory() and isSymbolicLink() as mutually exclusive — a symlink to a directory is only a symlink, not a directory. The fix adds || entry.isSymbolicLink() to both directory checks in scanForIntents.

No changes to discoverSkills's walk() — once we resolve into the package directory, skills are real directories, not symlinks.

Key Invariants

  • Every entry in node_modules/ that is either a directory or a symlink (to a directory) is now scanned
  • Existing npm/yarn/bun behavior unchanged — isDirectory() still passes for real directories

Verification

pnpm vitest run tests/scanner.test.ts

Two new tests use real symlinks to simulate pnpm layout (scoped and unscoped packages).

Files changed

  • src/scanner.ts — Added || !entry.isSymbolicLink() to both directory-filter checks (lines 216, 231)
  • tests/scanner.test.ts — Added two tests: scoped and unscoped symlinked packages

Fixes #39

🤖 Generated with Claude Code

KyleAMathews and others added 2 commits March 5, 2026 16:51
Users rarely install global packages, so show the npx invocation everywhere.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dirent.isDirectory() returns false for symlinks, causing scanForIntents
to skip every package in pnpm-managed node_modules. Accept symlinks too
since they always point to directories in node_modules.

Fixes #39

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LadyBluenotes
LadyBluenotes previously approved these changes Mar 5, 2026
@LadyBluenotes LadyBluenotes dismissed their stale review March 5, 2026 23:56

The merge-base changed after approval.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@41

commit: c4018d8

@LadyBluenotes LadyBluenotes merged commit 6ed303d into main Mar 5, 2026
3 of 4 checks passed
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.

intent list finds no packages with pnpm (symlink issue)

2 participants