/** * Build a typed {@link DocProvenanceResponse} envelope by traversing the * docs provenance graph (T10166 contract) from a single root. * * The root is addressed by either: * - a canonical doc slug (matches `attachments.slug`), or * - a CLEO task ID (matches `attachment_refs.owner_id` with `owner_type='task'`, * or any doc whose `related_tasks` JSON list contains the ID). * * Traversal walks the supersession chain in both directions (forward via * `attachments.supersedes`, reverse via `attachments.superseded_by`) plus the * cross-entity link from each visited doc to every owning task (via the * `attachment_refs` junction). `depth` bounds the BFS — `depth=0` returns only * the root, `depth=N` returns the root plus all neighbors reachable in `N` hops. * * The result conforms to {@link DocProvenanceResponse} from * `@cleocode/contracts/docs/provenance` (T10166) and is the wire envelope for * `cleo docs graph --root`. * * @see DocProvenanceResponse — packages/contracts/src/docs/provenance.ts * @see ADR-078 §4 — Docs SSoT as provenance graph * * @task T10164 (Epic T10157 / Saga T9855) */ import type { DocProvenanceResponse } from '@cleocode/contracts'; /** * Options accepted by {@link buildDocProvenanceGraph}. * * @task T10164 */ export interface BuildDocProvenanceGraphOptions { /** * Root identifier — either a doc slug (matches `attachments.slug`) or a * CLEO task ID (matches `attachment_refs.owner_id` or `related_tasks` JSON). */ readonly root: string; /** * Maximum BFS hops from the root. `0` returns the root alone; the default * (`2`) returns the root plus its direct + 1-hop neighbors. * * @default 2 */ readonly depth?: number; /** * Project root for DB resolution. Defaults to {@link getProjectRoot}(). */ readonly projectRoot?: string; /** * When `true`, hydrate the BFS result with the persisted `docs_wikilinks` * backlink edges (T11826) incident to the visited doc nodes — adding * `shares-topic` doc↔doc edges (which the on-the-fly BFS does not compute) * plus any persisted supersedes / related-task backlinks not already present. * The persisted edge table is the Obsidian-grade graph; this folds it into * the same envelope without a second query path. * * @default false * @task T11826 */ readonly hydrateWikilinks?: boolean; } /** * Error raised when {@link buildDocProvenanceGraph}'s root identifier cannot * be resolved to either a doc slug or any doc associated with a task ID. * * @task T10164 */ export declare class DocProvenanceRootNotFoundError extends Error { constructor(root: string); } /** * Build a {@link DocProvenanceResponse} by BFS-traversing the docs provenance * graph from a root (slug or task ID). * * @example * ```ts * const graph = await buildDocProvenanceGraph({ root: 'adr-078-docs-provenance', depth: 2 }); * for (const node of graph.nodes) { * if (node.kind === 'doc') console.log(node.slug, node.lifecycleStatus); * } * ``` * * @task T10164 */ export declare function buildDocProvenanceGraph(options: BuildDocProvenanceGraphOptions): Promise; /** * Render a {@link DocProvenanceResponse} as a Graphviz DOT graph. * * Each node renders with its kind-prefixed label; each edge renders with the * semantic relation as the edge label. Output is deterministic in node + edge * order so two equivalent graphs always render to byte-identical DOT. * * @example * ```ts * const graph = await buildDocProvenanceGraph({ root: 'adr-078' }); * const dot = renderProvenanceGraphAsDot(graph); * await writeFile('graph.dot', dot, 'utf8'); * // dot -Tsvg graph.dot -o graph.svg * ``` * * @task T10164 */ export declare function renderProvenanceGraphAsDot(graph: DocProvenanceResponse): string; //# sourceMappingURL=build-provenance-graph.d.ts.map