Skip to content

Improve Intent core loading for monorepos and agent adapters#124

Open
LadyBluenotes wants to merge 13 commits intomainfrom
core-load-feedback
Open

Improve Intent core loading for monorepos and agent adapters#124
LadyBluenotes wants to merge 13 commits intomainfrom
core-load-feedback

Conversation

@LadyBluenotes
Copy link
Copy Markdown
Member

@LadyBluenotes LadyBluenotes commented May 2, 2026

Summary

  • fix Yarn PnP discovery when stale or missing node_modules hides valid PnP packages
  • add shared @tanstack/intent/core APIs for list/load consumers
  • route CLI list and load through the shared core behavior
  • add hard package excludes from package.json config and CLI flags
  • add layered load resolution for workspace packages, root deps, pnpm isolated workspace deps, and full-scan fallback
  • accept unambiguous short skill names like @tanstack/router-core#auth-and-guards
  • add --debug output for list and load without changing stdout
  • split core implementation helpers into smaller focused modules

Summary by CodeRabbit

  • New Features

    • Added --debug and --exclude flags to intent list and intent load (debug prints to stderr; exclude filters packages).
    • intent load can print resolved skill paths (--path) and returns richer JSON with skills, packages, warnings, conflicts.
    • Skill resolution improved: package-prefixed short-name support and “did you mean” suggestions for missing skills.
    • Loaded skill markdown now rewrites relative link/image destinations to resolved locations.
  • Documentation

    • CLI docs for list and load updated to reflect new options, excludes behavior, JSON shape, and error messages.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

📝 Walkthrough

Walkthrough

This PR extracts intent listing/loading into a new core module, adds fast-path skill resolution, exclude-pattern handling, markdown destination rewriting, debug output, CLI flags (--debug, --exclude), and updates CLI commands, tests, docs, and a benchmark to use the new core APIs.

Changes

Intent Core & CLI Integration

Layer / File(s) Summary
Types & Exports
packages/intent/src/core/types.ts, packages/intent/package.json
Introduce core public types (IntentCoreOptions, IntentSkillSummary, IntentPackageSummary, IntentSkillList, ResolvedIntentSkill, LoadedIntentSkill, debug shapes, IntentCoreErrorCode) and add ./core export; build inputs updated to include src/core.ts.
Core Implementation
packages/intent/src/core.ts
Add IntentCoreError, listIntentSkills, resolveIntentSkill, loadIntentSkill, path-safety checks, debug metadata, and option normalization helpers.
Exclude Handling
packages/intent/src/core/excludes.ts
Collect and normalize intent.exclude from package.json up the tree, merge with CLI --exclude, implement glob (*) matching and package/warning filtering helpers.
Fast-Path Resolution
packages/intent/src/core/load-resolution.ts
Add filesystem-based fast-path resolveSkillUseFastPath with workspace and dependency candidate discovery, PnP detection, candidate deduplication, and scanned-package validation.
Scanner Integration
packages/intent/src/scanner.ts
Add scanIntentPackageAtRoot, reuse hint-based discovery, retry Yarn PnP when node_modules scan yields no packages, and introduce skill-read helpers.
Resolver Enhancements
packages/intent/src/resolver.ts
Add resolveSkillEntry supporting exact/package-prefixed matches and up-to-3 suggestions; extend ResolveSkillUseError to carry suggestions and update error formatting.
Markdown Rewriting
packages/intent/src/core/markdown.ts
Add destination rewriting for SKILL.md content: skip fences, handle bare/<...> destinations, avoid escaping package root, preserve suffixes, output POSIX-relative rewrites.
Package JSON Helper
packages/intent/src/core/package-json.ts
Add readPackageJson(dir) that safely reads/parses package.json or returns null on error.
CLI Support & Options
packages/intent/src/cli-support.ts, packages/intent/src/cli.ts
Replace scanOptionsFromGlobalFlags with coreOptionsFromGlobalFlags, add printDebugInfo; add --debug and --exclude <pattern> options to list and load commands.
Command Wiring & Output
packages/intent/src/commands/list.ts, packages/intent/src/commands/load.ts
runListCommand now uses listIntentSkills, builds per-package skill lists, simplifies table columns to PACKAGE/SOURCE/VERSION/SKILLS, emits debug to stderr; runLoadCommand uses resolveIntentSkill/loadIntentSkill, handles --path/--json/default outputs, and prints warnings/debug.
Tests & Benchmarks
packages/intent/tests/*.ts, benchmarks/intent/load.bench.ts
Add extensive core/unit tests for listing, resolution, load, excludes, yarn PnP fallback, markdown rewriting, resolver suggestions; update CLI tests for new JSON shape and debug behavior; add a Vitest benchmark for intent load.
Docs & Config
docs/cli/intent-list.md, docs/cli/intent-load.md, knip.json
Document new flags/options, JSON output shape, exclude behavior and precedence; add src/core.ts entry to knip config.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI (load command)
    participant Core as Intent Core
    participant Parser as parseSkillUse()
    participant Excludes as Exclude Checker
    participant FastPath as Fast-Path Resolver
    participant Scanner as Scanner (full-scan)
    participant Resolver as Resolver
    participant FileIO as File I/O / Markdown Rewriter
    participant User as User Output

    CLI->>Core: loadIntentSkill(use, options)
    Core->>Parser: parse use string
    Parser-->>Core: SkillUse { packageName, skillName }
    Core->>Excludes: getEffectiveExcludePatterns(...)
    Excludes-->>Core: patterns
    Core->>Excludes: isPackageExcluded(packageName, patterns)
    Excludes-->>Core: boolean
    alt package excluded
        Core->>CLI: throw IntentCoreError('package-excluded')
        CLI->>User: error message
    else
        Core->>FastPath: resolveSkillUseFastPath(parsedUse,...)
        alt fast-path result
            FastPath-->>Core: ResolveSkillResult
        else
            Core->>Scanner: scanForIntents(...)
            Scanner-->>Core: ScanResult
            Core->>Resolver: resolveSkillUse(parsedUse, ScanResult)
            Resolver-->>Core: ResolveSkillResult
        end
        Core->>FileIO: read file at resolved.path
        FileIO-->>Core: raw content
        Core->>FileIO: rewriteLoadedSkillMarkdownDestinations(...)
        FileIO-->>Core: rewritten content
        Core-->>CLI: LoadedIntentSkill { content, metadata, debug }
        CLI->>User: render content/path/json/debug
    end
Loading
sequenceDiagram
    participant CLI as CLI (list command)
    participant Core as Intent Core
    participant Scanner as Scanner
    participant Excludes as Exclude Collector
    participant Filter as Package/Warning Filter
    participant Formatter as Use Formatter
    participant User as CLI Output

    CLI->>Core: listIntentSkills(options)
    Core->>Scanner: scanForIntents(...)
    Scanner-->>Core: ScanResult { packages, warnings, conflicts }
    Core->>Excludes: getEffectiveExcludePatterns(...)
    Excludes-->>Core: patterns
    Core->>Filter: exclude packages/warnings/conflicts by patterns
    Filter-->>Core: filtered results
    Core->>Formatter: format skill uses and package summaries
    Formatter-->>Core: IntentSkillList
    alt debug=true
        Core->>Core: attach debug metadata
    end
    Core-->>CLI: IntentSkillList
    CLI->>User: render table/json/debug
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Possibly related PRs

Suggested reviewers

  • KyleAMathews

Poem

🐰 I hopped through code with nimble paws,

Rewrote links and learned the laws,
Fast-paths leapt, excludes held sway,
Debug lights blinked to guide the way,
Now SKILLs arrive — concise and gay.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.28% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main objective: improving Intent core loading capabilities for monorepos and agent adapters, which aligns with the substantial changes across the codebase.
Description check ✅ Passed The description follows the template structure with a comprehensive summary section covering the key changes (Yarn PnP fixes, core APIs, excludes, resolution layering, short skill names, debug output, and module refactoring), and includes the required 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch core-load-feedback

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 2, 2026

View your CI Pipeline Execution ↗ for commit 2146c51

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-02 07:47:45 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 2, 2026

Open in StackBlitz

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

commit: a9d7668

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 2, 2026

Merging this PR will not alter performance

✅ 3 untouched benchmarks
🆕 1 new benchmark

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 loads a direct dependency skill N/A 17.2 ms N/A

Comparing core-load-feedback (a9d7668) with main (28e8834)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (b5653be) during the generation of this report, so 28e8834 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/intent/src/core.ts`:
- Around line 166-187: The package-boundary check is currently lexical and can
be bypassed by a symlink; before calling isPathInsidePackageRoot and existsSync,
resolve symlinks for the target file and package root (e.g., use realpathSync on
resolved.path and resolved.packageRoot) and use those real paths (e.g.,
realResolvedPath, realPackageRoot) when checking with isPathInsidePackageRoot,
when calling existsSync, and when passing skillFilePath to
rewriteLoadedSkillMarkdownDestinations (instead of the original
resolved.path/resolved.packageRoot), so the containment check and file reads
operate on the canonical filesystem locations.
- Around line 111-118: The packages list currently omits a stable package
identifier, causing collisions; update the object built in IntentSkillList (the
mapping inside core.ts that creates packages with name/version/source) to
include the packageRoot (or unique id/root) field so each package retains a
stable identity, and then update packages/intent/src/commands/list.ts
getPackageSkills(...) to index/lookup packages by that packageRoot instead of
the name+version+source tuple so monorepo duplicated installs remain distinct.

In `@packages/intent/src/core/load-resolution.ts`:
- Around line 144-181: The fast-path loader in resolveSkillUseFastPath can
return stale node_modules results in Yarn PnP repos; modify
resolveSkillUseFastPath to detect Yarn PnP (presence of .pnp.cjs or .pnp.js at
process.cwd() or the workspace root) and immediately return null when PnP is
detected so the full PnP-aware scan runs instead; implement this check at the
top of resolveSkillUseFastPath before calling
getLoadFastPathCandidateDirs/scanIntentPackageAtRoot and ensure the early
bail-out preserves the existing behavior when options.globalOnly is true.

In `@packages/intent/src/scanner.ts`:
- Around line 573-584: The retry to probe Yarn PnP is using
packageCountBeforeNodeModules captured too early (before walkWorkspacePackages),
so workspace discoveries can suppress the PnP fallback; change the baseline to
capture the count immediately before the dependency-discovery steps (i.e., just
before calling scanTarget(nodeModules.local) and the dependency scans) or
otherwise compute a baseline specifically for dependency scans, then after
scanTarget(nodeModules.local), walkKnownPackages(), and walkProjectDeps() check
that dependency-specific count hasn't increased and only then call
getPnpApi()/scanPnpPackages(); reference packageCountBeforeNodeModules,
scanTarget(nodeModules.local), walkWorkspacePackages, walkKnownPackages,
walkProjectDeps, getPnpApi, and scanPnpPackages to locate and update the logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56ebcea7-25fb-43be-a39b-a3cc20d1067d

📥 Commits

Reviewing files that changed from the base of the PR and between b5653be and aa4d813.

📒 Files selected for processing (20)
  • benchmarks/intent/load.bench.ts
  • docs/cli/intent-list.md
  • docs/cli/intent-load.md
  • packages/intent/package.json
  • packages/intent/src/cli-support.ts
  • packages/intent/src/cli.ts
  • packages/intent/src/commands/list.ts
  • packages/intent/src/commands/load.ts
  • packages/intent/src/core.ts
  • packages/intent/src/core/excludes.ts
  • packages/intent/src/core/load-resolution.ts
  • packages/intent/src/core/markdown.ts
  • packages/intent/src/core/package-json.ts
  • packages/intent/src/core/types.ts
  • packages/intent/src/resolver.ts
  • packages/intent/src/scanner.ts
  • packages/intent/tests/cli.test.ts
  • packages/intent/tests/core.test.ts
  • packages/intent/tests/resolver.test.ts
  • packages/intent/tests/scanner.test.ts

Comment thread packages/intent/src/core.ts
Comment thread packages/intent/src/core.ts Outdated
Comment thread packages/intent/src/core/load-resolution.ts
Comment thread packages/intent/src/scanner.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
packages/intent/tests/cli.test.ts (1)

1005-1025: 💤 Low value

Test creates SKILL.md as a directory instead of a file.

Line 1014 uses mkdirSync to create SKILL.md as a directory. While this tests that --path doesn't read the file content (since reading a directory would fail), the test assertion expects the path output to include SKILL.md which is now a directory path. This works but is confusing and could mask real issues if the resolution logic changes.

Consider using a proper file that exists but verifying through other means (like mocking readFileSync) that content isn't read.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/cli.test.ts` around lines 1005 - 1025, The test 'prints
a skill path without reading skill content' currently creates SKILL.md as a
directory via mkdirSync; change this to create an actual file (use writeFileSync
or similar) at node_modules/@tanstack/query/skills/fetching/SKILL.md so the path
points to a real file, and keep the assertion on main(['load',
'@tanstack/query#fetching', '--path']) and logSpy intact; if you need to assert
that file content is not read, add a mock/spy on fs.readFileSync (or the
internal file-read helper used by main) to ensure it is not called while still
creating the SKILL.md file.
packages/intent/src/core/excludes.ts (1)

61-67: 💤 Low value

ReDoS risk from user-supplied glob patterns is low but worth noting.

The static analysis flags potential ReDoS. In practice, the risk is mitigated because:

  1. Patterns come from package.json config or CLI flags (trusted sources)
  2. The transformation escapes most metacharacters and only allows .* wildcards

However, patterns like ***** would generate .*.*.*.*.* which could cause backtracking on long package names. Consider adding a simple sanity check or documenting the expected pattern format.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/core/excludes.ts` around lines 61 - 67, The globToRegExp
function can produce catastrophic regexes from inputs like "*****"; modify
globToRegExp to sanity-check and normalize the pattern before building the
regex: reject or trim overly long patterns (e.g., max length 200), collapse
consecutive '*' into a single '*' (or reject runs longer than, say, 3), and
optionally throw a clear error for invalid patterns; implement these checks
inside globToRegExp (referencing function name globToRegExp and the local
variable source) so only normalized/safe patterns are converted to RegExp.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/intent/src/core/excludes.ts`:
- Around line 51-59: getEffectiveExcludePatterns currently calls
getConfigExcludePatterns(process.cwd(), context) which ignores an override
passed in options.cwd; update getEffectiveExcludePatterns to pass options.cwd
when present (e.g., use options?.cwd || process.cwd()) into
getConfigExcludePatterns so config-based excludes are read from the intended
working directory; ensure you reference the getEffectiveExcludePatterns function
and the getConfigExcludePatterns call when making the change and handle the case
where options or options.cwd is undefined.
- Around line 82-91: warningMentionsPackage currently only validates the
character after packageName which allows false positives like
"prefix@tanstack/query"; update the function (warningMentionsPackage) to also
check the character before the found match: iterate through all occurrences
using indexOf(packageName, fromIndex), for each occurrence verify the char
before is either undefined (start of string) or matches /[^a-zA-Z0-9_-]/ and the
char after is undefined or matches /[^a-zA-Z0-9_-]/; return true on the first
occurrence that satisfies both bounds, otherwise continue searching and return
false if none match.

In `@packages/intent/tests/scanner.test.ts`:
- Around line 907-916: The `@tanstack/react-start` test fixture created via
writeJson(join(reactStartDir, 'package.json'), ...) is missing the intent field;
update that writeJson call to include the same intent entry used in the other
PnP fixture (e.g., add an intent property with the pnp value/shape used
elsewhere such as intent: { type: 'pnp' }) so both Yarn PnP test fixtures are
consistent.

---

Nitpick comments:
In `@packages/intent/src/core/excludes.ts`:
- Around line 61-67: The globToRegExp function can produce catastrophic regexes
from inputs like "*****"; modify globToRegExp to sanity-check and normalize the
pattern before building the regex: reject or trim overly long patterns (e.g.,
max length 200), collapse consecutive '*' into a single '*' (or reject runs
longer than, say, 3), and optionally throw a clear error for invalid patterns;
implement these checks inside globToRegExp (referencing function name
globToRegExp and the local variable source) so only normalized/safe patterns are
converted to RegExp.

In `@packages/intent/tests/cli.test.ts`:
- Around line 1005-1025: The test 'prints a skill path without reading skill
content' currently creates SKILL.md as a directory via mkdirSync; change this to
create an actual file (use writeFileSync or similar) at
node_modules/@tanstack/query/skills/fetching/SKILL.md so the path points to a
real file, and keep the assertion on main(['load', '@tanstack/query#fetching',
'--path']) and logSpy intact; if you need to assert that file content is not
read, add a mock/spy on fs.readFileSync (or the internal file-read helper used
by main) to ensure it is not called while still creating the SKILL.md file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: baeea595-7b7f-404d-8ef6-721292e8ac8a

📥 Commits

Reviewing files that changed from the base of the PR and between aa4d813 and a9d7668.

📒 Files selected for processing (11)
  • knip.json
  • packages/intent/src/commands/list.ts
  • packages/intent/src/commands/load.ts
  • packages/intent/src/core.ts
  • packages/intent/src/core/excludes.ts
  • packages/intent/src/core/load-resolution.ts
  • packages/intent/src/core/types.ts
  • packages/intent/src/scanner.ts
  • packages/intent/tests/cli.test.ts
  • packages/intent/tests/core.test.ts
  • packages/intent/tests/scanner.test.ts
✅ Files skipped from review due to trivial changes (1)
  • knip.json
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/intent/src/core/types.ts
  • packages/intent/tests/core.test.ts
  • packages/intent/src/scanner.ts
  • packages/intent/src/commands/load.ts

Comment on lines +51 to +59
export function getEffectiveExcludePatterns(
options: IntentCoreOptions,
context?: ProjectContext,
): Array<string> {
return [
...getConfigExcludePatterns(process.cwd(), context),
...normalizeExcludePatterns(options.exclude),
]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Hardcoded process.cwd() ignores the options.cwd override.

getEffectiveExcludePatterns always reads config from process.cwd() instead of using options.cwd when provided. This means config-based excludes won't be discovered correctly if the caller specifies a different working directory.

Proposed fix
 export function getEffectiveExcludePatterns(
   options: IntentCoreOptions,
   context?: ProjectContext,
 ): Array<string> {
+  const cwd = options.cwd ?? process.cwd()
   return [
-    ...getConfigExcludePatterns(process.cwd(), context),
+    ...getConfigExcludePatterns(cwd, context),
     ...normalizeExcludePatterns(options.exclude),
   ]
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function getEffectiveExcludePatterns(
options: IntentCoreOptions,
context?: ProjectContext,
): Array<string> {
return [
...getConfigExcludePatterns(process.cwd(), context),
...normalizeExcludePatterns(options.exclude),
]
}
export function getEffectiveExcludePatterns(
options: IntentCoreOptions,
context?: ProjectContext,
): Array<string> {
const cwd = options.cwd ?? process.cwd()
return [
...getConfigExcludePatterns(cwd, context),
...normalizeExcludePatterns(options.exclude),
]
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/core/excludes.ts` around lines 51 - 59,
getEffectiveExcludePatterns currently calls
getConfigExcludePatterns(process.cwd(), context) which ignores an override
passed in options.cwd; update getEffectiveExcludePatterns to pass options.cwd
when present (e.g., use options?.cwd || process.cwd()) into
getConfigExcludePatterns so config-based excludes are read from the intended
working directory; ensure you reference the getEffectiveExcludePatterns function
and the getConfigExcludePatterns call when making the change and handle the case
where options or options.cwd is undefined.

Comment on lines +82 to +91
export function warningMentionsPackage(
warning: string,
packageName: string,
): boolean {
const idx = warning.indexOf(packageName)
if (idx === -1) return false

const after = warning[idx + packageName.length]
return after === undefined || /[^a-zA-Z0-9_-]/.test(after)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

warningMentionsPackage doesn't check the character before the match.

The function only validates the character after the package name but not before. A warning containing prefix@tanstack/query would incorrectly match when checking for @tanstack/query.

Proposed fix
 export function warningMentionsPackage(
   warning: string,
   packageName: string,
 ): boolean {
   const idx = warning.indexOf(packageName)
   if (idx === -1) return false

+  const before = warning[idx - 1]
+  if (before !== undefined && /[a-zA-Z0-9_-]/.test(before)) return false
+
   const after = warning[idx + packageName.length]
   return after === undefined || /[^a-zA-Z0-9_-]/.test(after)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/core/excludes.ts` around lines 82 - 91,
warningMentionsPackage currently only validates the character after packageName
which allows false positives like "prefix@tanstack/query"; update the function
(warningMentionsPackage) to also check the character before the found match:
iterate through all occurrences using indexOf(packageName, fromIndex), for each
occurrence verify the char before is either undefined (start of string) or
matches /[^a-zA-Z0-9_-]/ and the char after is undefined or matches
/[^a-zA-Z0-9_-]/; return true on the first occurrence that satisfies both
bounds, otherwise continue searching and return false if none match.

Comment on lines +907 to +916
writeJson(join(reactStartDir, 'package.json'), {
name: '@tanstack/react-start',
version: '1.167.52',
repository: {
type: 'git',
url: 'git+https://github.com/TanStack/router.git',
directory: 'packages/react-start',
},
homepage: 'https://tanstack.com/start',
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Same missing intent field as the first PnP test

The @tanstack/react-start fixture written at lines 907–916 omits the intent field for the same reason flagged above. Apply the same fix to keep both Yarn PnP test fixtures consistent.

🛠️ Proposed fix
  writeJson(join(reactStartDir, 'package.json'), {
    name: '@tanstack/react-start',
    version: '1.167.52',
+   intent: {
+     version: 1,
+     repo: 'TanStack/router',
+     docs: 'https://tanstack.com/start',
+   },
    repository: {
      type: 'git',
      url: 'git+https://github.com/TanStack/router.git',
      directory: 'packages/react-start',
    },
    homepage: 'https://tanstack.com/start',
  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
writeJson(join(reactStartDir, 'package.json'), {
name: '@tanstack/react-start',
version: '1.167.52',
repository: {
type: 'git',
url: 'git+https://github.com/TanStack/router.git',
directory: 'packages/react-start',
},
homepage: 'https://tanstack.com/start',
})
writeJson(join(reactStartDir, 'package.json'), {
name: '@tanstack/react-start',
version: '1.167.52',
intent: {
version: 1,
repo: 'TanStack/router',
docs: 'https://tanstack.com/start',
},
repository: {
type: 'git',
url: 'git+https://github.com/TanStack/router.git',
directory: 'packages/react-start',
},
homepage: 'https://tanstack.com/start',
})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/scanner.test.ts` around lines 907 - 916, The
`@tanstack/react-start` test fixture created via writeJson(join(reactStartDir,
'package.json'), ...) is missing the intent field; update that writeJson call to
include the same intent entry used in the other PnP fixture (e.g., add an intent
property with the pnp value/shape used elsewhere such as intent: { type: 'pnp'
}) so both Yarn PnP test fixtures are consistent.

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