Skip to content
Source
Sign inSign up
TanStack/intent

fix: write the hook script parser as fixed text #326

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

🎯 Changes

  • intent hooks install wrote the command parser into the hook script with parseIntentInvocation.toString(), so the installed file held whatever text the build produced for that function. A bundler upgrade or a minified build would rewrite the script that users install.
  • The parser is now fixed text in the script template, like the other functions there. The matching pattern stays in one place: policy.ts exports it as INTENT_INVOCATION_PATTERN, and the template prints that same constant. The pattern does not change.
  • Hook behavior does not change. A new test runs the parser from the generated script and the source parser on the same commands and fails if the two copies drift.
  • The generated script is byte-identical from the source, from the current build, and from a minified build.
  • The next intent hooks install rewrites an installed script once and reports Updated Intent hooks. A script that is not reinstalled keeps working.
  • The built package grows by 578 bytes, because the parser now exists in the bundle and as fixed text.
  • Adds a patch changeset.

✅ 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: cfb57e76510fc485f05e84df19c31a3d0259484a

      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. Warning

      Review limit reached

      You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

      Next included review available in 26 minutes.

      Check out review usage here.

      View limit details

      Limit details: You’ve used all 2 included reviews currently available.

      Learn how review limits work.

      Review configuration:

      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 836c80c8-414a-4b50-b16d-5e6ad5bbd172
      📥 Commits

      Reviewing files that changed from the base of the PR and between 594fd9d4f00a476238e000a0dd8062fd91755a93 and cfb57e76510fc485f05e84df19c31a3d0259484a.

      📒 Files selected for processing (4)
      • .changeset/hook-script-fixed-text.md
      • packages/intent/src/hooks/install.ts
      • packages/intent/src/hooks/policy.ts
      • packages/intent/tests/hooks-install.test.ts
      • Autopilot · 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 cfb57e76510fc485f05e84df19c31a3d0259484a

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded42sView ↗
      nx run-many --targets=build✅ Succeeded2sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-04 22:45:16 UTC

    4. Open in StackBlitz

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

      commit: cfb57e7

    5. Merging this PR will not alter performance

      ✅ 12 untouched benchmarks


      Comparing fix/hook-script-fixed-text (cfb57e7) with main (594fd9d) Open in CodSpeed

Sign in to join this conversation.