Skip to content
Source
Sign inSign up
TanStack/intent

refactor: reuse hook invocation parser in standalone runners #268

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intofix-workspace-discovery-refresh fromrefs/pull/268/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

Stacked on #267. Addresses the bounded parser-sharing result of #239.

Generate the standalone runner parser from the tested, self-contained parseIntentInvocation function. Remove the duplicated escaped regex and parser body from the installer template. No new runtime asset, dependency, or framework.

Investigation Outcome

  • Invocation parsing has one source. Edit-tool sets and deny text already come from the policy module.
  • Event adaptation and observation-file handling remain in the standalone runner. The pure policy API takes in-memory observations; the installed runner owns stdin, persistence, and process output.
  • Keep each agent output format and existing user/project installation behavior. Do not widen this into command authority work from #229.
  • Preserve fail-open catalog behavior: a failed session catalog still permits subsequent edits. Observing a command does not prove it succeeded or that its guidance was applied. No new success/failure state is introduced.

The generation contract is that the parser stays self-contained after bundling. A packed-CLI test installs and copies the emitted scripts, then checks denial before a command observation and allowance afterward. The three-agent runtime matrix covers supported command runners and non-command exclusions.

Verification

44 hook-policy, installed-runner, and packed-release tests passed. Build, typecheck, focused ESLint, Knip, Prettier, and git diff --check passed. Guide and dependency files are unchanged.

✅ Checklist

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

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Warning

      Review limit reached

      Next included review available in 51 minutes.

      Check out review usage here.

      View limit details

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

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

      Learn how review limits work.

      Review configuration:

      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Advanced

      Run ID: a14b9916-c2bc-4b11-b01d-46f9e343df87

      📥 Commits

      Reviewing files that changed from the base of the PR and between 68ad8e3625ccd9bd003738ff04a17bf5c2be3a70 and a17880bdfb184ddb33a7c8656c4f4c93e9b01e8f.

      📒 Files selected for processing (5)
      • .changeset/reuse-hook-parser.md
      • packages/intent/src/hooks/install.ts
      • packages/intent/src/hooks/policy.ts
      • packages/intent/tests/hooks-install.test.ts
      • packages/intent/tests/integration/packed-release.test.ts

      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.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 20d7ea3a8c448513fadddf4cf7ac7b96cb5449e6

      CommandStatusDurationResult
      nx run-many --targets=build✅ Succeeded<1sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-09-11 20:50:14 UTC

    3. Open in StackBlitz

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

      commit: 20d7ea3

    4. codspeed[bot](GitHub profile, opens in a new tab)commented

      Merging this PR will not alter performance

      ✅ 9 untouched benchmarks


      Comparing refactor-hook-parser-source (a17880b) with fix-workspace-discovery-refresh (68ad8e3) Open in CodSpeed

Sign in to join this conversation.