#!/usr/bin/env node /** * Codex hook adapter — `code-audit codex-hook`. * * Reads Codex's PostToolUse stdin JSON and runs a diff-scoped audit. * * Phase 0 verification (2026-07-19): * - Source: learn.chatgpt.com/docs/hooks * - PostToolUse is BLOCKING: exit 2 replaces the tool result with feedback * - Matcher in hooks.json: "apply_patch" (Codex's file-editing tool) * - stdin shape: { session_id, tool_name, tool_use_id, tool_input, tool_response } * - tool_input.file_path contains the edited file * * Exit codes: * 0 — no critical violations found * 2 — critical violations found (blocking feedback loop) * 1 — internal error (adapter crash, not violation-related) */ import type { HookAuditOutput } from './core.js'; export interface CodexPostToolUse { session_id?: string; transcript_path?: string; cwd?: string; hook_event_name?: string; tool_name?: string; tool_use_id?: string; tool_input?: { file_path?: string; path?: string; [key: string]: unknown; }; tool_response?: unknown; } export interface CodexHookResult { exitCode: number; stdout: string; stderr: string; } /** * Build the Codex feedback payload from audit output. */ export declare function formatCodexFeedback(output: HookAuditOutput): { feedback: Record | null; isBlocking: boolean; }; /** * Process a Codex PostToolUse event and return the hook result. * Extracted from main() for testability — tests inject a mock audit function. */ export declare function processCodexEvent(rawStdin: string, auditFn?: (filePaths: string[], projectRoot: string) => Promise, resolveRoot?: (event: CodexPostToolUse) => string): Promise; /** * CLI entry point — reads stdin, processes, writes result, exits. */ export declare function main(): Promise; //# sourceMappingURL=codex.d.ts.map