/** * Task document exporter — T947 Step 3. * * Emits a rich Markdown document for a CLEO task using the llmtxt * `formatMarkdown` primitive from `llmtxt/export`. The output includes: * * 1. YAML frontmatter (id, title, status, kind, scope, priority, size, …) * via llmtxt's canonical `DocumentExportState` + `formatMarkdown`. * 2. Description and acceptance criteria body. * 3. Attached blob manifest (via {@link blobList}) with SHA-256 backlinks. * 4. Memory observations referencing this task (opt-in), sourced from * the BRAIN accessor. * * The `formatMarkdown` call is a pass-through to llmtxt — CLEO does NOT * re-implement frontmatter serialisation or LF-normalisation. When * `llmtxt/export` is unavailable (e.g. stripped bundle), a minimal built-in * Markdown builder is used as a graceful fallback. * * @epic T947 * @see ./docs-generator.ts (llms.txt attachment generator — different concern) * @see ../store/blob-ops.ts (blob manifest reader) * @see ../sessions/agent-session-adapter.ts (session recording) */ /** * Options for {@link exportDocument}. */ export interface ExportDocumentOptions { /** * CLEO task identifier to export (e.g. `"T947"`). */ readonly taskId: string; /** * When `true`, the blob attachment manifest (name + SHA-256 + size) * is appended as a Markdown section with content-address backlinks. * * @defaultValue true */ readonly includeAttachments?: boolean; /** * When `true`, BRAIN observations that reference this task are appended * as a Markdown section. Requires the BRAIN accessor to be available. * * @defaultValue false */ readonly includeMemoryRefs?: boolean; /** * Absolute project root. Defaults to `getProjectRoot()`. */ readonly projectRoot?: string; } /** * Result returned by {@link exportDocument}. */ export interface ExportDocumentResult { /** Full Markdown document with YAML frontmatter. */ readonly markdown: string; /** * Number of rendered pages (1 per logical document section: * frontmatter + body = 1; each attachment adds 0 pages since they are * inline; memory refs section adds 1 when present). */ readonly pages: number; } /** * Generate a rich Markdown export of a CLEO task. * * Uses `llmtxt/export.formatMarkdown` for canonical frontmatter * serialisation. Falls back to a built-in Markdown builder when * the llmtxt package is unavailable. * * @param options - Export options (see {@link ExportDocumentOptions}). * @returns `{ markdown, pages }` — Markdown string and page count. * * @throws {Error} when `taskId` does not resolve to a known task. * * @example * ```ts * import { exportDocument } from '@cleocode/core/docs/export-document'; * * const { markdown, pages } = await exportDocument({ * taskId: 'T947', * includeAttachments: true, * includeMemoryRefs: true, * }); * console.log(markdown); * ``` * * @epic T947 */ export declare function exportDocument(options: ExportDocumentOptions): Promise; //# sourceMappingURL=export-document.d.ts.map