fix: write the hook script parser as fixed text #326
Merged
LadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit into
main fromrefs/pull/326/head·merged by LadyBluenotes(GitHub profile, opens in a new tab) 🎯 Changes#
intent hooks installwrote the command parser into the hook script withparseIntentInvocation.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.tsexports it asINTENT_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 installrewrites an installed script once and reportsUpdated 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(runpnpm build:allfirst).
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
- 1
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.
View limit details
Limit details: You’ve used all 2 included reviews currently available.
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.mdpackages/intent/src/hooks/install.tspackages/intent/src/hooks/policy.tspackages/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.
Comment `@coderabbitai help` to get the list of available commands.View your CI Pipeline Execution ↗ for commit cfb57e76510fc485f05e84df19c31a3d0259484a
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:16UTCMerging this PR will not alter performance#
✅ 12untouched benchmarks
Comparingfix/hook-script-fixed-text(cfb57e7) withmain(594fd9d)
Sign in to join this conversation.
🦋 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
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