import { type CodegraphExcludeViolation, type ReadCodegraphExcludeConfig, type ReadTrackedFiles } from './codegraph-exclude-reconciler.js'; /** * Exit code `peaks codegraph status` uses when the index is * demonstrably incomplete. Distinct from the upstream pass-through * exit code and from `CODEGRAPH_INIT_CONFLICT_EXIT_CODE` (73) so a CI * job can tell "codegraph said no" apart from "peaks-loop found a * tracked source file the index silently dropped". */ export declare const CODEGRAPH_INTEGRITY_EXIT_CODE = 74; export type CodegraphExcludeRuleImpact = { /** The `exclude` rule that must be dropped. */ readonly rule: string; /** Distinct tracked source files this single rule blocks. */ readonly blockedCount: number; }; export type CodegraphExcludeIntegrityReport = { /** Absolute path of the reconciled config file — see `codegraph-project-config.ts`. */ readonly configPath: string; /** True when at least one tracked source file is blocked. */ readonly gap: boolean; /** Tracked files that pass the config's `include` filter at all. */ readonly trackedSourceCount: number; /** Distinct tracked source files blocked by at least one rule. */ readonly excludedTrackedCount: number; /** One entry per (file, rule) pair — see S1's reconciler. */ readonly violations: readonly CodegraphExcludeViolation[]; /** Rules that must be dropped; empty exactly when `gap` is false. */ readonly rulesToRemove: readonly string[]; /** Per-rule blocked-file counts, in `rulesToRemove` order. */ readonly ruleImpacts: readonly CodegraphExcludeRuleImpact[]; }; /** * True when the project's codegraph config file exists, i.e. when an * exclude list is actually in play here. Both consumers use this to * stay SILENT on a project that never configured one: there is no * exclusion to report, and a missing config is not a finding. * * WHICH file that is comes from `codegraph-project-config.ts`, because it * is a property of the installed upstream rather than of this module: it is * `/codegraph.json` under 1.6.x and * `/.codegraph/config.json` under 0.7.x. Asking about the old * path only would answer `false` on every 1.6.x project, which reads as * "nothing is excluded" when the truth is "the exclusion list was never * looked at". * * Note the difference from `isCodegraphInitialized` in * `codegraph-service.ts`, which probes `codegraph.db` (upstream's own * definition of "initialized"). The config is what carries `exclude`, so * its presence is the narrower question this module asks. */ export declare function isCodegraphExcludeConfigPresent(projectRoot: string): boolean; /** * Read the project's git-tracked files + `.codegraph/config.json` and * fold the reconciliation into a report. * * Throws (never silently degrades) when the project is not a git work * tree, when the config is missing, or when it is malformed — callers * that must stay alive (doctor, `status`) catch and surface the reason. * * `inputs` is the optional shared-read seam (perf audit F1): a caller * that runs BOTH codegraph axes in one process reads * `readCodegraphProjectInputs(projectRoot)` once and passes it here and * to `inspectCodegraphIndexIntegrity`, so the `git ls-files` spawn, the * config read and the `include` glob compilation happen once instead of * twice. Omitted (the default) the readers run exactly as they always * did, so this is additive for every existing caller. * * Both fields are read-marked (code review R4-1): a caller may hand over a * value that came out of the readers, never one it built itself. An * explicit `[]` used to be accepted and silently meant "nothing is * tracked", turning a real gap into a clean report; it is now a compile * error, and a run-time throw for a caller the type system cannot see. * `undefined` still means "read it yourself" — unchanged. */ export declare function inspectCodegraphExcludeIntegrity(projectRoot: string, inputs?: { readonly trackedFiles?: ReadTrackedFiles | undefined; readonly config?: ReadCodegraphExcludeConfig | undefined; }): CodegraphExcludeIntegrityReport; /** * Human-readable detail lines for a gapped report: the headline count, * then the offending rules, then a sample of the blocked files so an * operator can point at a concrete path without re-running anything. * * Returns an empty array for a clean report — the caller decides * whether "clean" is worth printing at all. */ export declare function renderCodegraphExcludeIntegrityLines(report: CodegraphExcludeIntegrityReport): readonly string[];