/** * Hook Executor * * Core execution engine for running hooks at lifecycle points * Handles command execution, timeout enforcement, and exit code handling */ import type { HookMatcher, StopHook } from "@/types/hooks.js"; import type { HookExecutionContext } from "./types.js"; import type { Logger } from "@/logger.js"; /** * Hook executor class * Manages hook execution with proper error handling and timeout enforcement */ export declare class HookExecutor { private workspace; private logger; constructor(workspace: string, logger: Logger); /** * Execute hooks for a specific event with tool filtering * * @param eventName - The hook event name * @param matchers - Array of hook matchers (for PreToolUse/PostToolUse) * @param context - Execution context * @param blocking - Whether hook failures should block execution (PreToolUse only) */ executeHooksForEvent(eventName: "PreToolUse" | "PostToolUse", matchers: HookMatcher[] | undefined, context: HookExecutionContext, blocking?: boolean): Promise; /** * Execute Stop hooks (no filtering needed) * * @param stopHooks - Array of Stop hook configurations * @param context - Execution context */ executeStopHooks(stopHooks: StopHook[] | undefined, context: HookExecutionContext): Promise; /** * Execute a single hook command * * @param hook - The hook configuration * @param hookInput - Input data to pass via stdin * @param eventName - The event name (for logging) * @param blocking - Whether failures should throw errors */ private executeHook; /** * Run a shell command with JSON input via stdin * * @param command - The command to execute * @param input - JSON input to pass via stdin * @param timeoutMs - Timeout in milliseconds * @returns Execution result with stdout/stderr/exitCode */ private runCommand; }