/** * Git-hook side of ADR 0008's lifecycle contract: the coordination content of * a consumer's git hooks is machine-owned, exactly like the AGENTS.md block. * `init` installs/refreshes it, `deinit` removes it, `init --check` flags * drift. * * What lives in the hook file is deliberately tiny: a hash-versioned managed * region (# harnery:begin/end markers) that locates `agent-coord` and invokes * `git-hook `. Every piece of actual behavior — staged collection, * submodule canonicalization, gitlink discrimination, verdict, claim pruning — * lives in harnery and upgrades with the package. The region only changes when * the invocation contract does, and then `init` re-splices it and `--check` * catches a stale copy. History's lesson (the first host carried ~200 lines of * coordination bash that decayed for months): logic in a host hook file is * logic outside the upgrade path. * * A hook file harnery created whole is deletable by `deinit` (nothing but the * shebang remains after the region is removed); a host-authored hook keeps all * host content and only loses the managed region. */ import type { GitHookEvent } from "../../core/agents/git-hook.js"; import { type ManagedStatus } from "./splice.js"; export declare const GIT_HOOK_EVENTS: readonly ["pre-commit", "post-commit", "post-checkout"]; export type { GitHookEvent }; /** * The managed region body for one hook event. POSIX sh, `harnery_`-prefixed * variables (the region runs inside arbitrary host hook scripts), and a bin * lookup that covers both consumer layouts: git-submodule * (`/harnery/bin/`) and npm (`/node_modules/harnery/bin/`). * * pre-commit propagates a blocking exit code; post-commit / post-checkout are * best-effort and never fail the git operation. */ export declare function renderGitHookBody(event: GitHookEvent): string; /** * The effective hooks dir for the repo at `projectRoot`: honors * `core.hooksPath` (relative values resolve against the repo root) and * worktree layouts, because that's what `git rev-parse --git-path hooks` * reports. Null when `projectRoot` isn't a git repo. */ export declare function resolveHooksDir(projectRoot: string): string | null; export interface GitHooksResult { actions: string[]; warnings: string[]; } /** Install or refresh the managed region in each of the three hook files. */ export declare function applyGitHooks(projectRoot: string, opts: { dryRun?: boolean; }): GitHooksResult; /** * Has this project adopted harnery-managed git hooks at all? True when any of * the three hook files carries a managed region. Adoption is the gate between * "never installed" (a consumer that upgraded but hasn't opted in — not drift, * `--check` stays green, `doctor` nudges) and "decayed" (a region existed and * is now stale or partially deleted — drift, `--check` goes red). */ export declare function gitHooksInstalled(projectRoot: string): boolean; /** * Drift report for `init --check`: per-hook managed-region freshness. A * project that never adopted git hooks reports fresh — an upgrade must not * turn a consumer's CI red for a feature they haven't installed. */ export declare function checkGitHooks(projectRoot: string): { status: ManagedStatus; issues: string[]; }; /** * Remove the managed region from each hook. A file that was harnery-created * whole (nothing but a shebang left) is deleted; host-authored hooks keep * every host line. */ export declare function removeGitHooks(projectRoot: string, opts: { dryRun?: boolean; }): GitHooksResult; //# sourceMappingURL=git-hooks.d.ts.map