/** * migrate-agent-outputs — ingest .cleo/agent-outputs/*.md into DocsAccessor. * * Migrates raw markdown agent-output files from the filesystem into the * DocsAccessor blob store (manifest.db via CleoBlobStore). Originals are * preserved at .cleo/agent-outputs/_archived/ as a rollback safety net * for one release. * * Migration model: * - Each .md file in .cleo/agent-outputs/ (excluding _archived/) is read * and stored via DocsAccessor.storeDoc(kind:'agent-output'). * - The original file is copied (NOT deleted) to .cleo/agent-outputs/_archived/ * preserving the full path structure. * - A manifest JSON at .cleo/agent-outputs/_archived/migration-manifest.json * records: source path, blob hash, migrated-at timestamp. * - Files that are already in .cleo/agent-outputs/_archived/ are skipped. * * Usage: * import { migrateAgentOutputs } from '@cleocode/core/internal'; * const result = await migrateAgentOutputs({ projectRoot: '/path/to/project' }); * * @task T9064 * @see packages/core/src/store/docs-accessor-impl.ts (DocsAccessorImpl) * @see packages/contracts/src/docs-accessor.ts (DocsAccessor interface) */ import type { DocsAccessor } from '@cleocode/contracts'; /** Result from a single file migration attempt. */ export interface MigratedFile { /** Original file path relative to agent-outputs directory. */ sourcePath: string; /** Blob hash assigned by DocsAccessor (content-addressed). */ blobHash: string; /** Whether this file was freshly migrated (vs already archived). */ wasMigrated: boolean; } /** A file that failed to migrate. */ export interface FailedFile { /** Source file path. */ sourcePath: string; /** Error message. */ error: string; } /** Result from migrateAgentOutputs(). */ export interface AgentOutputMigrationResult { /** Files successfully migrated in this run. */ migrated: MigratedFile[]; /** Files already archived from a previous run (skipped). */ skipped: string[]; /** Files that failed to migrate. */ failed: FailedFile[]; /** Total files scanned. */ totalScanned: number; /** Path to the migration manifest JSON. */ manifestPath: string; } /** Entry in the migration manifest. */ export interface MigrationManifestEntry { /** Source path relative to agent-outputs/. */ sourcePath: string; /** Content-addressed blob hash in manifest.db. */ blobHash: string; /** ISO-8601 timestamp of migration. */ migratedAt: string; } /** * Options for migrateAgentOutputs(). */ export interface MigrateAgentOutputsOptions { /** * Absolute path to the CLEO project root (containing .cleo/). */ projectRoot: string; /** * If true, do not actually write to DocsAccessor or copy files. * Print a dry-run report instead. Default: false. */ dryRun?: boolean; /** * Injected DocsAccessor (for testing). If not provided, one is created. */ accessor?: DocsAccessor; } /** * Migrate all .cleo/agent-outputs/*.md files into the DocsAccessor blob store. * * Originals are preserved at .cleo/agent-outputs/_archived/ as a rollback * safety net. A migration manifest is written at _archived/migration-manifest.json. * * @param options - Migration options. * @returns Summary of migration results. */ export declare function migrateAgentOutputs(options: MigrateAgentOutputsOptions): Promise; //# sourceMappingURL=migrate-agent-outputs.d.ts.map