Skip to content
Source
Sign inSign up
TanStack/intent

perf: share package context, path checks, and frontmatter across maintainer batches #337

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/337/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

  • intent maintainer setup discovered existing skills in findExistingSkills and then passed them to planAddSkills, which repeated projectPath lstatSync walks, uncached resolveProjectContext ancestor walks, package.json reads, and SKILL.md frontmatter reads across the batch.
  • resolveProjectContext now caches findOwningPackageRoot results per IntentFsCache and uses a single statSync(path, { throwIfNoEntry: false }) probe in toSearchDir.
  • projectPath, skillPath, recordPath, readRecord, and skillEntries accept a per-batch Set<string> of verified non-symlink paths so shared directory prefixes are checked once per operation.
  • findExistingSkills, planSetupRecords, and planAddSkills share one IntentFsCache, verified path set, and parsed SKILL.md frontmatter across maintainer setup (planMaintainerSync also shares fsCache and verified paths across its skill loop), and findExistingSkills counts duplicate names in a Map instead of an $O(N^2)$ skills.some(...) scan.
  • Command output, validation rules, and exit codes do not change.
Benchmark (benchmarks/intent/maintainer.bench.ts, Vitest 4.1.11 on Windows Node)main (ab9877c) mean (rme)PR (2156afb) mean (rme)Change
maintainer setup with 20 existing skills493.33 ms (±4.50%)240.12 ms (±1.89%)-51.3% (2.05x)
maintainer setup with 200 existing skills1,509.42 ms (±5.68%)397.76 ms (±4.87%)-73.6% (3.79x)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr (run pnpm build:all first).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
    1. 🦋 Changeset detected

      Latest commit: 2156afbca7f99a6fcab1a7765d2db076b07b1784

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/intentPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. Review in Change Stack →

      Note

      Currently processing new changes in this PR. This may take a few minutes, please wait...

      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 8e822157-7451-49be-8a2e-1300f779a878
      📥 Commits

      Reviewing files that changed from the base of the PR and between ab9877c50888913e45afea92a0a87169de9c7d84 and 2156afbca7f99a6fcab1a7765d2db076b07b1784.

      📒 Files selected for processing: 8
      • .changeset/maintainer-setup-batch.md
      • packages/intent/src/commands/maintainer.ts
      • packages/intent/src/core/project-context.ts
      • packages/intent/src/maintainer/add.ts
      • packages/intent/src/maintainer/existing.ts
      • packages/intent/src/maintainer/project.ts
      • packages/intent/src/maintainer/sync.ts
      • packages/intent/tests/repeated-work.test.ts
      +-----------------------------------------+
      | Code review, I will. Find bugs, I must. |
      +-----------------------------------------+
        \
         \   (\__/)
             (•ㅅ•)
             /   づ
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      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.
    3. View your CI Pipeline Execution ↗ for commit 2156afbca7f99a6fcab1a7765d2db076b07b1784

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded1m 2sView ↗
      nx run-many --targets=build✅ Succeeded1sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-19 00:37:33 UTC

    4. Open in StackBlitz

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

      commit: 2156afb

    5. Merging this PR will not alter performance

      :warning: 7 benchmarks spent significant time in system calls

      System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

      Measurement and system calls

      ✅ 12 untouched benchmarks


      Comparing perf/maintainer-setup-batch (2156afb) with main (ab9877c) Open in CodSpeed

Sign in to join this conversation.