/** * import-orchestrator — wire `scan → classify → slug → dedup → write → audit` * for `cleo docs import` (T9709 / T9639). * * Single entry point: {@link runDocsImport}. Composes the pure helpers from * sibling files in this directory and the {@link DocsAccessor} store * contract. Returns a counter-balanced result the CLI handler can * print verbatim or serialise into the LAFS envelope. * * Counter-integrity invariant (T9709 acceptance): * `scanCount === importCount + noopCount + errorCount` * * On mismatch the function throws {@link CounterMismatchError} so the * CLI maps it to exit code 2 with `E_COUNTER_MISMATCH`. * * @epic T9628 (Saga T9625) * @task T9709 (ST-MIG-1e) */ import type { DocKind, DocsAccessor } from '@cleocode/contracts'; import { type ImportCounters, type ImportManifestEntry } from './audit.js'; import { type DocImportType } from './scanner.js'; /** * Map the CLI-level {@link DocImportType} onto the underlying * {@link DocKind} used by {@link DocsAccessor.storeDoc}. * * `adr` maps 1:1; everything else is stored as `agent-output` with the * actual import type retained in `meta.importType` so future schema work * (e.g. T9627's slug + type columns) can read the canonical classification * without re-scanning the source files. */ export declare function importTypeToDocKind(type: DocImportType): DocKind; /** Result returned by {@link runDocsImport}. */ export interface RunDocsImportResult { /** Counters at run completion. */ readonly counters: ImportCounters; /** Per-file outcomes. */ readonly entries: ImportManifestEntry[]; /** Absolute path of the audit manifest written to disk (undefined on dry-run). */ readonly manifestPath?: string; /** True when the run was `--dry-run`. */ readonly dryRun: boolean; } /** Options for {@link runDocsImport}. */ export interface RunDocsImportOptions { /** Absolute directory to scan recursively. */ readonly root: string; /** Plug-in store (injected by the CLI handler). */ readonly accessor: DocsAccessor; /** True to skip all writes and print proposed actions only. */ readonly dryRun?: boolean; /** True to bypass SHA dedup. */ readonly force?: boolean; /** Override the manifest output path (default: `/docs-import-.json`). */ readonly manifestPath?: string; /** Override the audit manifest directory (default: ``). */ readonly auditDir?: string; /** Inject a clock for deterministic tests. */ readonly now?: () => Date; /** * Custom classifier override forwarded to {@link scanDirectory}. When the * scan root is one of the canonical source dirs (`.cleo/adrs`, `.cleo/rcasd`, * `docs/`, ...), the relPath of every scanned file lacks the source-dir * prefix and the default classifier falls back to `note`. Callers that * already know the source dir SHOULD pass a closure (typically from * {@link import('./scanner.js').makeClassifierForScanRoot}) so files * receive their correct {@link DocImportType}. * * @task T9791 */ readonly classify?: (relPath: string) => import('./scanner.js').DocImportType; } /** Thrown when the counter-integrity invariant fails (T9709 AC). */ export declare class CounterMismatchError extends Error { readonly counters: ImportCounters; readonly sum: number; constructor(counters: ImportCounters, sum: number); } /** * Run a full import pass on `root` using the provided {@link DocsAccessor}. * * @param options - Import options (root, accessor, flags). * @returns Per-file outcomes + counters + audit manifest path. */ export declare function runDocsImport(options: RunDocsImportOptions): Promise; //# sourceMappingURL=import-orchestrator.d.ts.map