import type { SharedFacts, BucketFreshness, ReadonlyFS } from "../types.js";
import type { IndexFreshness } from "./index-freshness.js";
/** Aggregated per-surface view over one learning-loop directory (footguns or lessons). */
export interface BucketSection {
    path: string;
    exists: boolean;
    totalEntries: number;
    totalStaleRefs: number;
    totalInvalidLineRefs: number;
    bands: {
        fresh: number;
        aging: number;
        stale: number;
        unknown: number;
    };
    buckets: BucketFreshness[];
    formatDiagnostic: string | null;
}
/** Full `goat-flow stats` report payload. */
export interface StatsReport {
    footguns: BucketSection;
    lessons: BucketSection;
    decisions?: DecisionsSection;
    /** Generated-index freshness per bucket (`index-fresh` check); absent when not collected. */
    indexes?: IndexFreshness[];
}
/**
 * ADR file snapshot used by stats checks.
 *
 * `content` is nullable because unreadable files still need filename/routing validation.
 */
interface DecisionFileSummary {
    path: string;
    filename: string;
    content: string | null;
}
/**
 * Advisory stats issue that should be shown but must not fail `stats --check`.
 *
 * Warnings are intentionally separate from findings so noisy metadata nudges do not block CI.
 */
interface StatsWarning {
    file: string;
    rule: "decision-metadata" | "empty-learning-loop" | "index-missing";
    message: string;
}
/**
 * Decision-record stats section.
 *
 * ADR warnings live here rather than in `StatsCheckReport` so renderers can display the same
 * decision metadata in normal stats output and in `--check` output.
 */
export interface DecisionsSection {
    path: string;
    exists: boolean;
    files: DecisionFileSummary[];
    warnings: StatsWarning[];
}
/** One actionable problem surfaced by `goat-flow stats --check`. */
interface StatsFinding {
    file: string;
    rule: "missing-last-reviewed" | "invalid-last-reviewed" | "stale-last-reviewed" | "stale-ref" | "invalid-line-ref" | "format" | "bucket-size" | "decision-filename" | "decision-structure" | "index-stale";
    message: string;
}
/** Pass/fail verdict produced by `goat-flow stats --check`. */
export interface StatsCheckReport {
    status: "pass" | "fail";
    findings: StatsFinding[];
    warnings: StatsWarning[];
}
/**
 * Build the full stats report from the learning-loop slice of shared facts.
 *
 * @param shared Footgun, lesson, optional decision, and optional index-freshness facts from the shared extraction pipeline.
 * @returns Report shape consumed by all text, JSON, Markdown, and check renderers.
 */
export declare function buildStatsReport(shared: {
    footguns: SharedFacts["footguns"];
    lessons: SharedFacts["lessons"];
    decisions?: DecisionsSection;
    indexes?: IndexFreshness[];
}): StatsReport;
export declare function buildDecisionsSection(fs: ReadonlyFS, rawPath: string): DecisionsSection;
/**
 * Run the `--check` verdict against an already-built stats report.
 *
 * @param report Stats report built from the same facts used by normal rendering.
 * @returns Pass/fail verdict with blocking findings separated from advisory warnings.
 */
export declare function checkStats(report: StatsReport): StatsCheckReport;
export {};
//# sourceMappingURL=stats.d.ts.map