Skip to content

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

Merged
LadyBluenotes merged 1 commit into
mainfrom
fix/hook-script-fixed-text
Oct 4, 2026
Merged

LadyBluenotes merged 1 commit into
mainfrom
fix/hook-script-fixed-text

Conversation

@LadyBluenotes

Copy link
Copy Markdown
Member

🎯 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).

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfb57e7

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

This PR includes changesets to release 1 package
Name Type
@tanstack/intent Patch

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

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

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 594fd9d and cfb57e7.

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

@nx-cloud

nx-cloud Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cfb57e7

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 42s View ↗
nx run-many --targets=build ✅ Succeeded 2s View ↗

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: cfb57e7

@codspeed

codspeed Bot commented Oct 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 12 untouched benchmarks


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

Open in CodSpeed

@LadyBluenotes
LadyBluenotes merged commit cd5a024 into main Oct 4, 2026
10 checks passed
@LadyBluenotes
LadyBluenotes deleted the fix/hook-script-fixed-text branch October 4, 2026 22:49
@github-actions github-actions Bot mentioned this pull request Oct 4, 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