/** * What a git hook actually used (T13921), so a hooked `git push` or `git * commit` is charged by its measured peak, not assumed to be a scoped build * (a pre-push typecheck was charged 12 GiB and four routine pushes held a * one-file fix for 35 minutes). * * Safety rules (review of #2386): * * - The key covers the repository root, the hook name, the file git calls AND * the hook manager's real script or config (husky's `.husky/`, * lefthook's config, pre-commit's config). A manager whose real script * cannot be found is never measured, so a shared shim never pools the * peaks of different repositories. * - A run counts only when its tree was sampled at least * {@link HOOK_MIN_SAMPLES} times (it ran long enough for the hook to have * done work: an "Everything up-to-date" push or a skipped hook is not a * measurement), and the charge is lowered only after * {@link HOOK_MIN_RUNS} counted runs. The recorded peak is the maximum of * every counted run, so one light run never lowers it. * - Writes take a lock and keep the maximum, so concurrent runs never lose * a peak. * * Every failure reads as "not measured", which keeps the class plan. * * @task T13921 */ /** The measured peak is charged with this margin. */ export declare const HOOK_PEAK_MARGIN = 1.25; /** Tree samples a run needs before it counts as a measurement of its hook. */ export declare const HOOK_MIN_SAMPLES = 2; /** Counted runs before the charge may fall below the class plan. */ export declare const HOOK_MIN_RUNS = 3; /** * Environment variables that switch a hook manager off or narrow what it runs * (T13972): their values are part of the key, so `HUSKY=0 git push` is never * measured as the same hook as a full one. */ export declare const HOOK_ENV_KEYS: readonly ["HUSKY", "HUSKY_SKIP_HOOKS", "LEFTHOOK", "LEFTHOOK_EXCLUDE", "LEFTHOOK_ONLY", "SKIP", "PRE_COMMIT_ALLOW_NO_CONFIG"]; /** * Where git looks for a hook in the repository at `cwd`: `git rev-parse * --git-path hooks/` honours `core.hooksPath`, and the command's own * global options (`-C `, `-c core.hooksPath=…`) pick the repository and * hooks directory it will use (T13458). Throws when git cannot say. * * @param cwd - Where the git command runs. * @param hook - Hook name (`pre-push`). * @param globals - The command's git global options. * @returns The absolute hook path (the file may not exist). */ export declare function gitHookPath(cwd: string, hook: string, globals?: readonly string[]): string; /** * The key for a hook as installed in the repository at `cwd`: `:` * over the repository root, the hook name, the file git calls * ({@link gitHookPath}), the hook manager's real script or config, and the * {@link HOOK_ENV_KEYS} the run sees. `null` when any of them cannot be read, * or the file names a manager whose real script is missing: such a hook is * never measured. * * @param cwd - Where the git command runs. * @param hook - Hook name (`pre-push`). * @param globals - The command's git global options. * @param env - The environment the run inherits. @defaultValue process.env */ export declare function hookFootprintKey(cwd: string, hook: string, globals?: readonly string[], env?: NodeJS.ProcessEnv): string | null; /** A `node` script's measurement key and what it loads (T14050). */ export interface ScriptFootprint { /** `