import type { ExternalAnalyzerGraphEdge, ExternalAnalyzerParsedItem, ExternalAnalyzerResults } from "./types.js"; /** * Repo-relative form of an analyzer-reported path, case PRESERVED. * * Seven of the twelve candidates hand their tool the ABSOLUTE repository root as a * positional target, so those tools echo absolute paths back. Persisting one makes * the lead machine-specific, un-joinable against every repo-relative consumer, and * unreadable by the provenance reader (`join(root, "/abs/path")` names nothing). * Containment is decided with the shared {@link normalizeRepoPath} (case- and * separator-folded, so win32 drive-letter and case drift still match); the returned * value is sliced out of the ORIGINAL string so on-disk case survives. * * A path outside the repository root is left as-is: it is not repo-relative, and * silently rewriting it would invent an identity the tool never reported. */ export declare function toRepoRelativeAnalyzerPath(repoRoot: string | undefined, rawPath: string): string; /** A degradation observed while normalizing, reported to the caller rather than swallowed. */ export interface NormalizeExternalDiagnostics { /** Items dropped for a missing `path` or `summary`. */ dropped_items: number; /** * Items that HAD a path + line_start but whose source could not be read, so their * provenance was dropped. Distinct from an item that simply has no anchor. */ source_read_failures: number; } export interface NormalizeExternalOptions { /** * Source reader for content-anchored lead provenance (item C): given a * repo-relative path, return the file's contents, or undefined when * unreadable. When supplied, every item with a `path` + `line_start` whose * span hashes non-empty gains an {@link AnalyzerLeadProvenance}; absent or * failing, items simply carry no provenance (optional everywhere). */ readSource?: (path: string) => string | undefined; /** * Absolute repository root. When supplied, every item path is normalized to its * repo-relative form BEFORE it is persisted and before `readSource` is called, so * an absolute-path emitter cannot leak a machine-specific path into the artifact * or silently lose provenance. */ repoRoot?: string; /** * Receives the normalization degradations. The caller (the acquisition engine) * carries them onto the tool's status record, which is the only post-run evidence * that items were lost. */ onDiagnostics?: (diagnostics: NormalizeExternalDiagnostics) => void; } export declare function normalizeGenericExternalResults(tool: string, items: ExternalAnalyzerParsedItem[], options?: NormalizeExternalOptions): ExternalAnalyzerResults; /** * Normalize a raw list of edge candidates (from an external dataflow analyzer: * ast-grep / broader-semgrep dataflow / CodeQL) into the language-neutral * {@link ExternalAnalyzerGraphEdge} contract. * * Degrade-to-empty + deterministic by construction: * - any candidate missing a non-empty string `from`/`to`, or a self-edge * (`from === to`), is dropped — never throws on a malformed payload; * - duplicate (from,to,kind) triples collapse to one; * - output is sorted by from-then-to-then-kind so identical input yields * byte-identical output run to run. * * The returned shape is the wire contract carried on * `ExternalAnalyzerResults.graph_edges`; the graph extractor resolves the * endpoints against the repo path lookup and merges them into the edge set. */ export declare function normalizeGenericExternalEdges(candidates: Array<{ from?: unknown; to?: unknown; kind?: unknown; confidence?: unknown; reason?: unknown; }>): ExternalAnalyzerGraphEdge[]; //# sourceMappingURL=normalizeExternal.d.ts.map