/** * Shared hook adapter core — reads stdin, runs a diff-scoped audit, writes stdout. * * Each tool's hook adapter (cursor.ts, codex.ts) is a thin payload mapper that: * 1. Reads the tool-specific stdin JSON * 2. Extracts edited file paths * 3. Calls runHookAudit() with those paths * 4. Maps audit results back to the tool's stdout contract * * Phase 0 live-docs verification (2026-07-20): * - Cursor postToolUse (Write matcher): BLOCKING (exit 2, additional_context) * Verified: cursor.com/docs/hooks + cursor.com/docs/reference/third-party-hooks * - Cursor afterFileEdit: EXISTS but observation-only — NOT used for blocking * - Codex PostToolUse: blocking (exit 2 replaces tool result with feedback) * Verified: learn.chatgpt.com/docs/extend/hooks * - Claude Code PostToolUse: blocking (exit 2 blocks the edit) * Cursor reads .claude/settings.json natively via third-party hooks compat */ import type { Severity } from '../types.js'; export interface HookAuditInput { filePaths: string[]; projectRoot: string; failOn: Severity; } export interface HookViolation { analyzer: string; rule: string; severity: Severity; message: string; file: string; line?: number; column?: number; endLine?: number; endColumn?: number; enclosingSymbol?: string; suggestion?: string; details?: string; } export interface HookAuditOutput { violations: HookViolation[]; summary: { total: number; critical: number; warning: number; suggestion: number; }; filesAnalyzed: number; } /** * Read all of stdin as a string. Returns empty string on EOF/error. */ export declare function readStdin(): Promise; /** * Run a diff-scoped audit on the given file paths. * This is the shared core — all hook adapters call this. */ export declare function runHookAudit(input: HookAuditInput): Promise; /** * Check if violations at or above failOn severity exist. */ export declare function hasViolationsAtOrAbove(violations: HookViolation[], failOn: Severity): boolean; //# sourceMappingURL=core.d.ts.map