/** * `docs.read` core-SDK implementation — render a single CLEO doc (body + full * provenance frontmatter) directly from `cleo.db`, the SOLE doc authority * (saga T11778). * * This is the live read API the Obsidian plugin (T11827) and `cleo docs view` * call. It is NOT a static export: every call reads the current DB state. The * body is surfaced as UTF-8 text when decodable, else base64 (T11825 AC2), so * binary blobs (images/PDFs) render without a second round-trip. * * Frontmatter is read straight from the `attachments` provenance columns * (`slug`, `doc_version`, `owner_version`, `supersedes`, `superseded_by`, * `topics`, `related_tasks`) — the same columns `docs_wikilinks` derives from — * so the response is self-describing for an external consumer. * * @task T11825 (Epic T11781 / Saga T11778) * @adr ADR-078 — Docs SSoT as provenance graph * @see DocReadResponse — packages/contracts/src/docs/read.ts * @see createDocsReadModel — body fetch + base64 plumbing reuse */ import type { DocReadResponse } from '@cleocode/contracts'; /** * Options for {@link readDoc}. * * @task T11825 */ export interface ReadDocOptions { /** Project root for DB resolution. Defaults to {@link getProjectRoot}(). */ readonly projectRoot?: string; } /** * Error raised when {@link readDoc}'s slug cannot be resolved to a doc. * * @task T11825 */ export declare class DocNotFoundError extends Error { constructor(slug: string); } /** * Read a single doc by slug, returning its body + full provenance frontmatter. * * Resolves the supersedes / superseded-by FK targets to their slugs (the * external-consumer-friendly addressing) and decodes the body to UTF-8 when * possible, falling back to base64 for binary content. * * @example * ```ts * const doc = await readDoc('adr-078-docs-provenance'); * console.log(doc.frontmatter.docVersion, doc.frontmatter.topics); * if (doc.body.encoding === 'utf-8') console.log(doc.body.text); * ``` * * @param slug - The exact doc slug (case-sensitive). * @param opts - Optional project-root override. * @returns The typed {@link DocReadResponse}. * @throws {DocNotFoundError} when no attachment carries the slug. * @task T11825 */ export declare function readDoc(slug: string, opts?: ReadDocOptions): Promise; //# sourceMappingURL=read-doc.d.ts.map