Skip to content

Improve Intent core loading for monorepos and agent adapters#124

Merged
LadyBluenotes merged 21 commits intomainfrom
core-load-feedback
May 3, 2026
Merged

Improve Intent core loading for monorepos and agent adapters#124
LadyBluenotes merged 21 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 programmatic Intent core entrypoint; intent list/load accept --debug and repeatable --exclude; --path prints resolved SKILL.md; JSON output uses adapter-friendly shape; skill-name suggestions (“Did you mean …?”) improved; loaded SKILL.md rewrites relative link/image destinations.
  • Documentation

    • CLI docs for intent list/load updated to document options, excludes, JSON shape, outputs, and error messages.
  • Tests

    • Expanded unit tests and added a benchmark suite for intent load scenarios.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 67e33e47-c7db-4622-982e-d7e0bb191627

📥 Commits

Reviewing files that changed from the base of the PR and between c943255 and 5153bf4.

📒 Files selected for processing (10)
  • .changeset/five-lizards-peel.md
  • benchmarks/intent/load.bench.ts
  • docs/cli/intent-list.md
  • packages/intent/src/core.ts
  • packages/intent/src/core/excludes.ts
  • packages/intent/src/core/load-resolution.ts
  • packages/intent/src/scanner.ts
  • packages/intent/tests/core.test.ts
  • packages/intent/tests/resolver.test.ts
  • packages/intent/tests/scanner.test.ts

📝 Walkthrough

Walkthrough

Extracts an Intent core API, adds fast-path skill resolution and exclude-pattern handling, rewrites markdown link destinations, adds --debug/--exclude flags and debug printing, converts CLI to lazy per-command imports, exposes ./core entrypoint, and adds tests plus a Vitest benchmark for intent load.

Changes

Intent Core & CLI Integration

Layer / File(s) Summary
Types & Exports
packages/intent/src/core/types.ts, packages/intent/package.json
Add public core types and error codes; export new ./core subpath and include src/core.ts in build inputs.
Core Implementation
packages/intent/src/core.ts
Add IntentCoreError, listIntentSkills, resolveIntentSkill, loadIntentSkill, cwd/scope helpers, path-safety checks, and debug metadata handling.
Exclude Handling
packages/intent/src/core/excludes.ts
Collect excludes by walking up from cwd, normalize/merge with CLI --exclude, compile into ExcludeMatchers (glob * → anchored RegExp), and provide isPackageExcluded and warning-filter helpers.
Fast-Path Resolution
packages/intent/src/core/load-resolution.ts
Add resolveSkillUseFastPath with workspace candidate discovery, dependency-root resolution, Yarn PnP detection/skip, candidate deduplication, and filtered warnings.
Scanner Integration
packages/intent/src/scanner.ts
Centralize SKILL.md frontmatter parsing (readSkillEntry), add hint-based discovery and scanIntentPackageAtRoot, run workspace walk earlier, and retry Yarn PnP when node_modules yields no packages.
Resolver Enhancements
packages/intent/src/resolver.ts
Add resolveSkillEntry (exact/package-prefixed alias matching and suggestions); extend ResolveSkillUseError to carry suggestedSkills and update error formatting.
Markdown Rewriting
packages/intent/src/core/markdown.ts
Add rewriteLoadedSkillMarkdownDestinations to rewrite relative link/image destinations (skip fenced code blocks, preserve #/? suffixes, prevent escapes outside package root).
Package JSON Helper
packages/intent/src/core/package-json.ts
Add readPackageJson(dir) returning parsed package.json or null.
CLI Support & Options
packages/intent/src/cli-support.ts, packages/intent/src/cli.ts
Replace scanOptionsFromGlobalFlags with coreOptionsFromGlobalFlags, add printDebugInfo, register --debug and repeatable --exclude for list/load, and switch to per-command lazy imports.
Command Wiring & Output
packages/intent/src/commands/list.ts, packages/intent/src/commands/load.ts
runListCommand now calls listIntentSkills and groups result.skills by package to render simplified table columns; runLoadCommand uses resolveIntentSkill/loadIntentSkill, implements --path/--json/default output modes and prints warnings/debug to stderr.
Tests & Benchmarks
packages/intent/tests/*.ts, benchmarks/intent/load.bench.ts
Add extensive unit/integration tests for core/list/resolve/load/excludes/Yarn PnP/markdown rewrites and CLI JSON/debug behavior; add Vitest benchmark measuring intent load scenarios.
Docs & Config
docs/cli/intent-list.md, docs/cli/intent-load.md, knip.json
Document new flags/options, new JSON output shape, exclude precedence/behavior; add src/core.ts to knip entry list.
Minor API rename
packages/intent/src/discovery/register.ts
Rename discoverSkills callback second parameter from baseNamepackageName (type unchanged).

Sequence Diagram(s)

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

    CLI->>Core: loadIntentSkill(use, options)
    Core->>Parser: parse use
    Parser-->>Core: SkillUse {packageName, skillName}
    Core->>Excludes: getEffectiveExcludePatterns(...)
    Excludes-->>Core: matchers
    Core->>Excludes: isPackageExcluded(packageName, matchers)
    Excludes-->>Core: boolean
    alt package excluded
        Core->>CLI: throw IntentCoreError('package-excluded')
        CLI->>User: error message
    else
        Core->>FastPath: resolveSkillUseFastPath(parsedUse,...)
        alt fast-path
            FastPath-->>Core: ResolveSkillResult
        else
            Core->>Scanner: scanForIntents(...)
            Scanner-->>Core: ScanResult
            Core->>Core: resolveSkillUse via resolver
            Core-->>Core: ResolveSkillResult
        end
        Core->>FileIO: read 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)
    participant Core as Intent Core
    participant Scanner as Scanner
    participant Excludes as Exclude Collector
    participant Formatter as Formatter
    participant User as CLI Output

    CLI->>Core: listIntentSkills(options)
    Core->>Scanner: scanForIntents(...)
    Scanner-->>Core: ScanResult {packages,warnings,conflicts}
    Core->>Excludes: getEffectiveExcludePatterns(...)
    Excludes-->>Core: matchers
    Core->>Core: filter packages/warnings/conflicts
    Core->>Formatter: format skill uses & 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,

Fast-paths found skills without a pause,
Excludes drew fences, debug trails shone,
Links were rewritten to point back home,
SKILLs now load tidy, seeds freshly sown.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.16% 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 and concisely summarizes the main change: improving Intent core loading for monorepos and agent adapters.
Description check ✅ Passed The PR description is comprehensive with a clear summary section covering the main changes and motivations, but the checklist items are not marked as complete.
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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


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 5153bf4

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 3s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-03 02:37:14 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: 5153bf4

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 2, 2026

Merging this PR will not alter performance

✅ 3 untouched benchmarks
🆕 3 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 loads a direct dependency from a large workspace N/A 18.7 ms N/A
🆕 loads a direct dependency skill N/A 17.9 ms N/A
🆕 loads direct dependency content as json N/A 49.7 ms N/A

Comparing core-load-feedback (5153bf4) 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 Outdated
Comment thread packages/intent/src/core.ts Outdated
Comment thread packages/intent/src/core/load-resolution.ts Outdated
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 thread packages/intent/src/core/excludes.ts
Comment thread packages/intent/src/core/excludes.ts
Comment thread packages/intent/tests/scanner.test.ts
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: 5

🤖 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 42-49: The rethrow wraps resolver errors into IntentCoreError but
drops ResolveSkillUseError.suggestedSkills; modify IntentCoreError to accept and
store an optional suggestedSkills property and ensure wherever
ResolveSkillUseError is caught and rethrown (the code paths that create new
IntentCoreError) pass through err.suggestedSkills into the IntentCoreError
instance (e.g., add suggestedSkills?: SuggestedSkill[] to the IntentCoreError
constructor and assign this.suggestedSkills = suggestedSkills when constructing
from a caught ResolveSkillUseError). Ensure the exported IntentCoreError type
includes the new property so consumers can access structured skill suggestions.
- Around line 75-85: The helper withCwd currently mutates global process.cwd via
process.chdir, causing race conditions for public APIs like listIntentSkills,
resolveIntentSkill, and loadIntentSkill; instead remove use of process.chdir and
thread a cwd parameter through the scanning/resolution helpers: update withCwd
callers (listIntentSkills, resolveIntentSkill, loadIntentSkill) to accept and
pass an explicit cwd string into functions that resolve paths (e.g.,
scan/resolve helpers invoked inside those functions), add an optional cwd param
to those helper signatures and use path.resolve(baseCwd, relativePath) or join
with the provided cwd for all file lookups, and delete the process.chdir logic
so no global process state is mutated. Ensure all internal calls propagate the
cwd and default to process.cwd() only where a caller didn't supply one.

In `@packages/intent/src/core/excludes.ts`:
- Line 10: PACKAGE_NAME_BOUNDARY treats '.' as a separator which causes dotted
package names like "foo.bar" to be split; update the boundary regex constant
PACKAGE_NAME_BOUNDARY to include '.' as an allowed character (i.e., do not treat
'.' as a boundary) so warningMentionsPackage('foo.bar.baz', 'foo.bar') no longer
falsely matches; make the same change to the other identical regex occurrences
used for package tokenization (the ones referenced around the other match/block)
so all package-parsing logic consistently allows dots in package names.

In `@packages/intent/src/scanner.ts`:
- Around line 256-259: The code builds childDir by joining skillsDir with hint
parts from skillNameHints (hint, childDir, skillsDir, SKILL.md) without
validating the hint, allowing path traversal (e.g., "../"). Fix:
sanitize/validate each hint before building childDir by rejecting or normalizing
components that are empty, "." or ".." or that begin with a path separator, then
resolve the final path (using path.resolve) and assert it is contained within
skillsDir (e.g., resolvedPath.startsWith(path.resolve(skillsDir))) before
calling existsSync on the SKILL.md path; apply the same validation wherever hint
is split/joined in this file.

In `@packages/intent/tests/scanner.test.ts`:
- Line 9: Tests hardcode '/' suffixes for PnP fixture roots, which breaks
startsWith checks on Windows; update the fixtures used by the mocked
findPackageLocator in packages/intent/tests/scanner.test.ts to append the
platform separator instead of a hardcoded '/'. Replace occurrences where fixture
roots are concatenated with '/' (the roots used by the mocked
findPackageLocator) with code that uses path.sep (or path.join/Path methods) so
the locator comparisons use the OS-specific separator.
🪄 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: 4d4f7cee-5712-4752-9739-808540ada41b

📥 Commits

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

📒 Files selected for processing (10)
  • packages/intent/src/cli.ts
  • packages/intent/src/core.ts
  • packages/intent/src/core/excludes.ts
  • packages/intent/src/discovery/register.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
✅ Files skipped from review due to trivial changes (2)
  • packages/intent/src/discovery/register.ts
  • packages/intent/tests/core.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/intent/tests/resolver.test.ts
  • packages/intent/tests/cli.test.ts

Comment thread packages/intent/src/core.ts
Comment thread packages/intent/src/core.ts Outdated
Comment thread packages/intent/src/core/excludes.ts Outdated
Comment thread packages/intent/src/scanner.ts
Comment thread packages/intent/tests/scanner.test.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: 2

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

Inline comments:
In `@benchmarks/intent/load.bench.ts`:
- Around line 32-33: The benchmark is creating state.runner with
createCliRunner({ cwd: root }) which forces the runner to always use root, so
the "large-workspace" scenario never exercises workspaceRoot; update the
large-workspace case to use a runner constructed with cwd: workspaceRoot (e.g.
recreate state.runner via createCliRunner({ cwd: workspaceRoot }) before running
the large-workspace path) or make createCliRunner accept an override cwd when
invoked for that case so state.runner uses workspaceRoot for the large-workspace
benchmark.
- Around line 129-132: The console is silenced before calling createFixture()
which can throw, leaving output muted; wrap the createFixture() call so
consoleSilencer.restore() always runs on failure (use try/catch/finally or a try
around createFixture() and call consoleSilencer.restore() in the catch before
rethrowing), ensuring fixture is assigned only on success and that
consoleSilencer.silence()/consoleSilencer.restore() are paired around
createFixture() to avoid hiding errors.
🪄 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: 3902ef53-5c72-4369-b74e-88d87aa1ab8e

📥 Commits

Reviewing files that changed from the base of the PR and between fff866a and c943255.

📒 Files selected for processing (1)
  • benchmarks/intent/load.bench.ts

Comment thread benchmarks/intent/load.bench.ts
Comment thread benchmarks/intent/load.bench.ts
@LadyBluenotes LadyBluenotes merged commit 29d0c76 into main May 3, 2026
5 of 6 checks passed
@LadyBluenotes LadyBluenotes deleted the core-load-feedback branch May 3, 2026 02:37
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