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)

Showing 5 changed files with 14 additions and 17 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/reuse-hook-parser.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/intent': patch
+---
+​
+Generate standalone hook command parsing from the tested policy parser. Preserve agent-specific output, install ownership, and fail-open catalog behavior.
6 additions and 13 deletionspackages/intent/src/hooks/install.tsModified
View file
@@ -5,7 +5,11 @@
import { fail } from '../shared/cli-error.js'
import { formatIntentCommand } from '../shared/command-runner.js'
import { ALL_HOOK_AGENTS, HOOK_AGENT_ADAPTERS } from './adapters.js'
-import { EDIT_TOOLS_BY_AGENT, GATE_DENY_REASON } from './policy.js'
+import {
+ EDIT_TOOLS_BY_AGENT,
+ GATE_DENY_REASON,
+ parseIntentInvocation,
+} from './policy.js'
import type { HookAgent, HookInstallScope } from './types.js'
​
type HookInstallStatus = 'created' | 'skipped' | 'unchanged' | 'updated'
@@ -85,7 +89,7 @@
const LOAD_COMMAND = ${JSON.stringify(loadCommand)}
const EDIT_TOOLS = new Set(${JSON.stringify(editTools)})
const GATE_DENY_REASON = ${JSON.stringify(GATE_DENY_REASON)}
-const INTENT_COMMAND_PATTERN = /(?:^|&&|\\|\\||;|\\|)\\s*((?:bunx\\s+@tanstack\\/intent(?:@latest)?)|(?:pnpm\\s+exec\\s+intent)|(?:pnpm\\s+dlx\\s+@tanstack\\/intent(?:@latest)?)|(?:npx\\s+@tanstack\\/intent(?:@latest)?)|(?:yarn\\s+dlx\\s+@tanstack\\/intent(?:@latest)?)|(?:intent))\\s+(list|load)(?:\\s+([^\\s|;&]+))?/i
+const parseIntentInvocation = ${parseIntentInvocation.toString()}
​
try {