Skip to content

Add package source kind to scanner results#171

Merged
LadyBluenotes merged 2 commits into
mainfrom
prep/m2-foundation
Jun 20, 2026
Merged

Add package source kind to scanner results#171
LadyBluenotes merged 2 commits into
mainfrom
prep/m2-foundation

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Jun 20, 2026

Copy link
Copy Markdown
Member

Adds package source-kind metadata to scanner results, tightens scan stats to match the runtime contract, and adds focused markdown destination rewrite coverage while preserving the current name-based allowlist behaviour.

Summary by CodeRabbit

  • New Features

    • Added source-kind metadata to identify discovered packages as workspace or npm packages
    • Enhanced markdown destination link rewriting to properly handle complex link scenarios
  • Bug Fixes

    • Aligned scan statistics handling with runtime contract expectations for improved reliability

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 009ac6e0-0ba7-4a78-9a5c-3f28482b0662

📥 Commits

Reviewing files that changed from the base of the PR and between de15caf and acd5be5.

📒 Files selected for processing (10)
  • .changeset/cuddly-games-cheer.md
  • packages/intent/src/core.ts
  • packages/intent/src/discovery/register.ts
  • packages/intent/src/scanner.ts
  • packages/intent/src/types.ts
  • packages/intent/tests/install-writer.test.ts
  • packages/intent/tests/markdown.test.ts
  • packages/intent/tests/resolver.test.ts
  • packages/intent/tests/scanner.test.ts
  • packages/intent/tests/source-policy.test.ts

📝 Walkthrough

Walkthrough

Adds kind: 'npm' | 'workspace' to the IntentPackage type and makes ScanResult.stats required. Wires a workspace-identity-based getPackageKind resolver through the scanner and registrar. Removes the fsCache.getStats() fallback in core debug output. Adds markdown rewrite tests and updates all test fixtures to match the new shapes.

Changes

Package kind classification and scan stats contract

Layer / File(s) Summary
Type contract: IntentPackage.kind and ScanResult.stats required
packages/intent/src/types.ts
Adds kind: 'npm' | 'workspace' discriminator to IntentPackage and changes ScanResult.stats from optional to required.
Workspace-kind resolver in scanner and registrar
packages/intent/src/discovery/register.ts, packages/intent/src/scanner.ts
Adds getPackageKind callback to CreatePackageRegistrarOptions, implements workspace-identity-based kind resolution helpers using findWorkspacePackages and fsCache.getFsIdentity, and wires the callback into both scanForIntents and scanIntentPackageAtRoot.
Core debug output uses stats directly
packages/intent/src/core.ts
Removes the ?? fsCache.getStats() fallback in listIntentSkills and resolveIntentSkillInCwd debug output, assigning scan stats directly.
Test fixtures and assertions updated
packages/intent/tests/install-writer.test.ts, packages/intent/tests/resolver.test.ts, packages/intent/tests/source-policy.test.ts, packages/intent/tests/scanner.test.ts, packages/intent/tests/markdown.test.ts
Updates fixture helpers to include kind: 'npm' on packages and stats on scan results; adds kind assertions for npm/workspace packages in scanner tests; removes non-null assertions on stats; adds new markdown rewrite test suite.
Changeset metadata
.changeset/cuddly-games-cheer.md
Adds patch-level changeset entry for @tanstack/intent describing the new behaviors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • schiller-manuel
  • KevinVandy

Poem

🐇 Hop hop, the packages now know their kind,
npm or workspace — no need to rewind!
Stats once optional now must always be there,
And markdown rewrites get tested with care.
The fallback is gone, direct paths prevail,
A tidy little patch tucked under my tail! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing the required template structure with 'Changes' and 'Checklist' sections, though it provides a summary statement. Use the provided template structure and complete all sections including the Changes section with details and the Checklist with proper checkboxes.
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the primary change: adding package source kind metadata to scanner results.
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 prep/m2-foundation

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 and usage tips.

@nx-cloud

nx-cloud Bot commented Jun 20, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit acd5be5


☁️ Nx Cloud last updated this comment at 2026-06-20 04:31:04 UTC

@nx-cloud

nx-cloud Bot commented Jun 20, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit acd5be5

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

☁️ Nx Cloud last updated this comment at 2026-06-20 04:31:05 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: acd5be5

@LadyBluenotes LadyBluenotes merged commit 392016b into main Jun 20, 2026
9 checks passed
@LadyBluenotes LadyBluenotes deleted the prep/m2-foundation branch June 20, 2026 04:37
@github-actions github-actions Bot mentioned this pull request Jun 20, 2026
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