/** * * Vendor-neutral PreToolUse hook entry. Reads the standard hook JSON * payload from stdin and either exits 0 (allow) or exits 2 with stderr * containing PEAKS_CODE_PROHIBITED_DIRECT_EDIT (deny). * * This command is the runtime adapter the shell-script sibling * (`src/services/hooks/pre-tool-code-gate.sh`) EXECS. The path-family * decision lives in ONE implementation — `decideGateAction` — and the * sibling's own no-CLI fallback is a narrower copy of it. * * Settings.json entry shape (vendor-neutral, registered by * `peaks hooks install`): an `Edit|Write|MultiEdit` matcher whose command is * `peaks code-gate`, carrying the adapter's own project-root env var and * `--json`. * * The vendor-specific install code (`src/cli/commands/hooks-commands.ts` * + `src/services/ide/adapters/*`) is the only place that knows how * to render this into any IDE's settings.json shape. This file is * vendor-neutral — no vendor references in the source code itself. */ import type { Command } from 'commander'; import { type ProgramIO } from '../cli-helpers.js'; /** * The marker the gate leaves on stderr when it could not decide. * * The gate fails OPEN on a payload it cannot read, and that is deliberate: a * blocked edit on every call would be worse than an allowed one. But a silent * allow is invisible, and the failure it hides is the expensive kind — an * acceptance that feeds the payload through a pipe (which some shells do not * forward to the process at all) then "passes" every case while proving * nothing. So the case says so, on the channel the harness already reads. */ export declare const UNDECIDABLE_MARKER = "PEAKS_CODE_GATE_UNDECIDABLE"; /** * How to feed the payload so that it arrives. A pipeline is not a delivery * mechanism on every shell — a PowerShell pipeline to a native executable * does not forward stdin at all — and then the gate reads no payload, allows * everything, and the check passes vacuously. */ export declare const PAYLOAD_DELIVERY_RECIPE: string; export declare function registerCodeGateCommand(program: Command, io: ProgramIO): void;