/** * Hook Executor * * Executes hook commands and parses their output. * Handles variable substitution, timeouts, and process management. */ import type { Logger } from '../observability/logger.js'; import type { HookDefinition, HookInput, HookVariables, HookExecutionResult } from './types.js'; /** * Executes hook commands in child processes. * Handles variable substitution, timeouts, and output parsing. */ export declare class HookExecutor { private readonly logger; private readonly defaultTimeout; constructor(logger: Logger, defaultTimeout?: number); /** * Execute a hook command and parse its output. * * @param hook - Hook definition to execute * @param input - Input data to pass to the hook * @returns Hook execution result */ execute(hook: HookDefinition, input: HookInput): Promise; /** * Substitute variables in a command string. * Variables use the ${VAR_NAME} syntax. * * @param command - Command string with variable placeholders * @param variables - Variable values to substitute * @returns Command with variables substituted */ substituteVariables(command: string, variables: Partial): string; /** * Build environment variables for hook process. * Merges current environment with hook-specific env and variables. * * @param hook - Hook definition * @param input - Hook input data * @param variables - Computed variable values * @returns Environment variables for the process */ buildEnv(hook: HookDefinition, input: HookInput, variables: Partial): Record; /** * Build variable values from hook input. * * @param input - Hook input data * @returns Variable values for substitution */ private buildVariables; /** * Run a shell command with timeout and input handling. * * @param command - Shell command to execute * @param options - Execution options * @returns Hook output parsed from stdout */ private runCommand; /** * Parse hook output from stdout. * Attempts to parse as JSON, falls back to raw output. * * @param stdout - Raw stdout from the hook * @param stderr - Raw stderr from the hook * @param exitCode - Process exit code * @returns Parsed hook output */ private parseOutput; /** * Escape a string for safe use in shell commands. * * @param value - String to escape * @returns Shell-safe string */ private escapeForShell; } //# sourceMappingURL=hook-executor.d.ts.map