/** * The approval guard: a Claude Code `PreToolUse` hook that blocks an agent from * running the commands only a person may run, or writing the autopilot * approval record (agent-cannot-approve-itself/AC-8..AC-13). * * The opposite contract to the phase guard (`guard.ts`), on purpose, and the * same one as the reviewer guard (`compile/reviewer-guard.ts`): this is a * boundary, so every way it can fail is a block. The script exits 2 on anything * it cannot read, and the hook command turns any other exit — a missing script, * a missing `node`, a crash — into 2 as well. * * It is a standalone script rather than an `aidlc hook` subcommand because it * runs before every agent shell and file-write call: starting the CLI each time * is slow, and a broken build would block every call (design D1). The logic is * written once, here, as `guardVerdict`, and embedded in the script with * `Function.prototype.toString` — so it must stay self-contained. * * It is a denylist, and a shell denylist can be talked around (`sh -c`, a * variable, a script file). The CLI's terminal check (`human-only.ts`) is the * line; this is the early, logged layer (design D2). * * Design: design.md C3 * * @module */ import { type HumanOnlyCommand } from './human-only.js'; export declare const APPROVAL_GUARD_PATH = ".claude/hooks/aidlc-approval-guard.mjs"; export declare const APPROVAL_GUARD_MATCHER = "Bash|Edit|Write|MultiEdit|NotebookEdit"; export type Verdict = { block: false; } | { block: true; rule: string; reason: string; subject: string; }; /** * The settings.json command. Exit 0 allows and 2 blocks with the script's own * reason; any other status means the guard did not run, which blocks too, with a * line saying so (AC-12). `$CLAUDE_PROJECT_DIR` because a hook runs in the * session's working directory, which need not be the root. */ export declare function approvalGuardCommand(): string; /** * Block or pass one `PreToolUse` payload. Self-contained: no imports and no * outer references, because the rendered script carries its source text. */ export declare function guardVerdict(input: unknown, rules: readonly HumanOnlyCommand[]): Verdict; /** The script `aidlc hook install` writes to `APPROVAL_GUARD_PATH`. */ export declare function renderApprovalGuard(): string; //# sourceMappingURL=approval-guard.d.ts.map