import { type InstructionBaseline, type ParsedBaseline } from "./core/instruction-baseline.js"; import type { InstructionWeight } from "./core/instruction-weight.js"; import type { RuleSeverity } from "./core/types.js"; /** The file on disk, read once: absent, parsed, or refused. */ export type BaselineOnDisk = { readonly kind: "absent"; } | ParsedBaseline; export declare function readInstructionBaseline(root: string): BaselineOnDisk; /** One bundle's measurement: where it is, and its weight (`null` = nothing to weigh). */ export type MeasuredBundle = readonly [ at: string, weight: InstructionWeight | null ]; /** Write the baseline for every measured bundle; returns what was written. */ export declare function writeInstructionBaseline(root: string, onDisk: BaselineOnDisk, measured: readonly MeasuredBundle[]): InstructionBaseline; /** * One line of lint output. `finding` counts toward the exit code; `ok` is the * baseline holding; `note` is the opt-in nudge on a repo with no baseline. */ export interface RatchetLine { readonly at: string; readonly status: "finding" | "ok" | "note"; readonly text: string; } /** * Pure: the lines a run prints, given what was measured and what is on disk. * `max` is the opt-in absolute ceiling; a bundle over it adds a finding of its * own, whatever the baseline says (including when there is none, or it is * unreadable). * * A bundle with no entry is a nudge while the repo has NO baseline file (it has * not opted in, and a fresh repo must not fail on day one) — but a FINDING once * the file exists: a bundle that appeared after the baseline was recorded is * weight nobody signed off on. */ export declare function ratchetLines(onDisk: BaselineOnDisk, measured: readonly MeasuredBundle[], max?: number): readonly RatchetLine[]; /** * The bundles `--update-baseline` must not record: each one over the ceiling, * as the refusal text. Empty when there is no ceiling or nothing exceeds it. */ export declare function updateRefusals(measured: readonly MeasuredBundle[], max: number | undefined): readonly string[]; /** The options {@link checkInstructionWeightRatchet} takes. */ interface RatchetOptions { readonly root: string; readonly severity: RuleSeverity; /** The opt-in absolute ceiling (`["error", { max }]`); `undefined` = ratchet only. */ readonly max?: number; readonly update: boolean; readonly silent: boolean; /** Called only when the rule is on or an update was asked for. */ readonly measure: () => readonly MeasuredBundle[]; readonly annotate: (level: "error" | "warning", message: string) => void; } /** Run the ratchet for `lint`: print, annotate, count. */ export declare function checkInstructionWeightRatchet(opts: RatchetOptions): { issues: number; errors: number; }; /** * The line `compile` prints after writing instruction files: the weight NOW, * against the baseline, at the moment the author changed it. Report-only — * `lint` stays the single gate. `null` when there is nothing to weigh. */ export declare function compileWeightLine(root: string, weight: InstructionWeight | null): string | null; export {}; //# sourceMappingURL=instruction-weight-ratchet.d.ts.map