/** * Heavy-command hook delivery for `cleo init`, `cleo upgrade`, `cleo doctor` * and the session briefing (T13124). * * The hook (`cleo hook heavy-command`, T12983) routes agent-run tests, builds * and typechecks through `cleo run`, the machine-wide ResourceGovernor. It only * helps where it is installed. init/upgrade used to install it through * `AdapterManager`, whose discovery finds no adapter in any project, and a * try/catch swallowed every failure, so on 2026-10-03 it was installed nowhere. * Delivery is now its own step, with one outcome per provider in the report, * and `cleo doctor` plus the briefing say when a provider in use lacks it. * * The per-provider installers live in `@cleocode/adapters` (provider delivery). * That package builds on this one, so it is loaded at run time through its * light `@cleocode/adapters/heavy-command-hook` entry point and validated * against the {@link HeavyHookDeliveryApi} contract. * * @module resources/heavy-command-hook-delivery * @task T13124 * @epic T13121 */ import type { HeavyCommandHookMode, HeavyHookCliProbe, HeavyHookDeliveryApi, HeavyHookDeliveryOptions, HeavyHookDeliveryOutcome, HeavyHookInspection } from '@cleocode/contracts'; /** The adapters entry point that carries the delivery functions. */ export declare const HEAVY_HOOK_DELIVERY_MODULE = "@cleocode/adapters/heavy-command-hook"; /** The command that installs or refreshes only this hook. */ export declare const HEAVY_HOOK_FIX = "cleo doctor heavy-command-hook --fix"; /** * Load the delivery functions from `@cleocode/adapters`. The specifier is held * in a variable so TypeScript does not resolve it at build time (adapters * references core, so a static import would be a build cycle). * * @returns the delivery API. * @throws when the module is missing or does not export the API. */ export declare function loadHeavyHookDelivery(): Promise; /** * The hook mode init/upgrade install from: `resources.heavyCommandHook` * (default `rewrite`). The `CLEO_HEAVY_COMMAND_HOOK` environment variable * switches the hook at run time only and does not change what is installed. * * @param projectRoot - the project whose config to read. */ export declare function installedHeavyHookMode(projectRoot: string): Promise; /** What {@link deliverHeavyCommandHooks} did. */ export interface HeavyHookDeliveryReport { /** The mode installed from. */ readonly mode: HeavyCommandHookMode; /** One outcome per provider. */ readonly outcomes: readonly HeavyHookDeliveryOutcome[]; } /** * Install, refresh or remove the hook for every provider in use in the project. * * @param projectRoot - the project root. * @param options - environment and provider list (tests); `api` replaces the * run-time loaded adapters module. * @returns the mode and each provider's outcome. * @throws only when the adapters module cannot be loaded. */ export declare function deliverHeavyCommandHooks(projectRoot: string, options?: HeavyHookDeliveryOptions & { readonly api?: HeavyHookDeliveryApi; }): Promise; /** What {@link inspectHeavyCommandHooks} found. */ export interface HeavyHookInspectionReport { /** The configured mode. */ readonly mode: HeavyCommandHookMode; /** One inspection per provider. */ readonly inspections: readonly HeavyHookInspection[]; } /** * Read-only: the hook's state for every provider in the project. * * @param projectRoot - the project root. * @param options - environment and provider list (tests); `api` replaces the * run-time loaded adapters module. * @returns the mode and each provider's state. * @throws only when the adapters module cannot be loaded. */ export declare function inspectHeavyCommandHooks(projectRoot: string, options?: HeavyHookDeliveryOptions & { readonly api?: HeavyHookDeliveryApi; }): Promise; /** * Whether the `cleo` on PATH, as the hook resolves it from the project, can * answer the hook (an installed hook in front of an older CLEO governs * nothing). Starts that `cleo` once. * * @param projectRoot - the project root. * @param options - environment (tests); `api` replaces the run-time loaded * adapters module. * @throws only when the adapters module cannot be loaded. */ export declare function probeHeavyHookCliFor(projectRoot: string, options?: HeavyHookDeliveryOptions & { readonly api?: HeavyHookDeliveryApi; }): Promise; /** * Whether any provider has CLEO's hook in place (installed or outdated), so * the `cleo` it calls matters. * * @param inspections - the providers' states. */ export declare function heavyHookPresent(inspections: readonly HeavyHookInspection[]): boolean; /** One line of an init/upgrade report about the hook. */ export interface HeavyHookReportLine { /** `applied`: something was written; `skipped`: the hook is not (fully) in place. */ readonly status: 'applied' | 'skipped'; /** What happened, naming the provider and file. */ readonly details: string; /** Why the hook is not in place (`skipped` only). */ readonly reason?: string; /** The exact remedy (`skipped` only). */ readonly fix?: string; } /** * The report lines for a delivery: every write, and every provider in use * whose hook could not be put in place (blocked, unsupported or failed). * Unchanged hooks and providers not in use add nothing. * * @param outcomes - the delivery outcomes. * @returns the lines, in provider order. */ export declare function heavyHookReportLines(outcomes: readonly HeavyHookDeliveryOutcome[]): readonly HeavyHookReportLine[]; /** * Whether an inspection is a problem the user should fix: the hook is * missing, outdated, blocked or unreadable for a provider in use (or present * while the mode is off). * * @param inspection - one provider's state. */ export declare function isHeavyHookProblem(inspection: HeavyHookInspection): boolean; /** * The one-line briefing warning when a provider in use has no working hook, * or `null` when every provider in use is covered (or the check itself * fails; doctor reports that). Kimi's permanent `unsupported` state and a * team's `needs-consent` are left to `cleo doctor`, so the briefing does not * repeat them every session. It makes no git spawns (`gitChecks: false`). * * @param projectRoot - the project root. * @param options - environment and provider list (tests); `api` replaces the * run-time loaded adapters module. */ export declare function heavyHookBriefingWarning(projectRoot: string, options?: HeavyHookDeliveryOptions & { readonly api?: HeavyHookDeliveryApi; }): Promise; //# sourceMappingURL=heavy-command-hook-delivery.d.ts.map