import type { FailOn } from './headlessReview.js'; export type HookType = 'pre-commit' | 'pre-push'; export type HookAction = 'install' | 'uninstall' | 'help'; export interface HookArgs { action: HookAction; hookType: HookType; failOn: FailOn; help: boolean; } export declare const HOOK_HELP = "Usage: codeep hook [options]\n\nInstall a git hook that runs `codeep review` on your changes, blocking the\ncommit/push when issues at/above the threshold are found. Honors a project's\n.codeep/review.yml (or .json).\n\nActions:\n install Install the hook (pre-commit by default)\n uninstall Remove the Codeep-managed hook\n\nOptions:\n --pre-push Manage the pre-push hook instead of pre-commit\n --fail-on Severity that blocks: error | warning | info | none (default: error)\n -h, --help Show this help\n\nThe pre-commit hook reviews the working-tree content of staged files, so stage\nyour changes fully before committing for the most accurate result.\nCodeep never overwrites a pre-existing hook it didn't create."; /** Parse argv after `hook`. Pure. */ export declare function parseHookArgs(argv: string[]): HookArgs; /** The hook script body. Pure. pre-commit scopes to staged files; pre-push reviews changes. */ export declare function buildHookScript(hookType: HookType, failOn: FailOn): string; /** True when a hook file was created by Codeep (safe to overwrite/remove). */ export declare function isCodeepHook(content: string): boolean; /** * Where this repository keeps its hooks — as a three-way answer, because two * of the three used to come back as the same `null`. * * `none` means git answered and there is no hook directory to speak of (not a * repository, no git on PATH). `unknown` means git was REFUSED: hardenedGitEnv * would not build an environment for this repository, so nobody can say where * its hooks live or whether a path is one. * * Folding `unknown` into `none` is a fail-OPEN, and it is a live hole rather * than a theoretical one: the write gate in utils/toolExecution.ts reads a * null hook directory as "this repository has no hook directory" and stops * gating, so the one repository whose config Codeep refuses to scan is * exactly the one whose `.githooks/pre-commit` an agent could write * unprompted. A caller that has to decide something must branch on `kind`. */ export type HooksDirResult = { kind: 'hooks'; dir: string; } | { kind: 'none'; } | { kind: 'unknown'; reason: string; }; export declare function resolveHooksDirResult(cwd: string): HooksDirResult; /** * Resolve the git hooks directory (honors worktrees + core.hooksPath). Null if * not a repo — and THROWS `GitHardeningError` when git was refused, so a * refusal can never be mistaken for "no hooks here". Callers that must not * throw (the write gate) use resolveHooksDirResult() above instead. */ export declare function resolveHooksDir(cwd: string): string | null; export interface HookDeps { resolveHooksDir: (cwd: string) => string | null; readHook: (path: string) => string | null; writeHook: (path: string, content: string) => void; removeHook: (path: string) => void; write: (text: string) => void; } export declare function runHookCommand(argv: string[], deps?: HookDeps): number;