/** * migrate-cmd.ts — one-way clone between two CortexStore backends. * * Implements `fozikio migrate --from --to [options]`. Backed by * the spec at docs/superpowers/specs/2026-05-16-store-migration-design.md. * * The CortexStore interface intentionally exposes only the access patterns * that engines need at runtime — there is no "list all signals" or * "list all generic collections" method, because no engine code wants those. * Migration is the one caller that does, so we reach into the concrete store * classes (SQLite, JSON, Firestore) for iteration. That is a deliberate trade * to keep the public interface lean. */ import type { CortexStore } from '../core/store.js'; import type { Memory } from '../core/types.js'; export interface MigrateOptions { from: string; to: string; /** Only migrate this namespace (currently informational — the URL controls namespace). */ namespace?: string; /** Rewrite the source namespace to a different destination namespace string in entity data. */ renameNamespace?: { src: string; dst: string; }; /** Resume from .cortex-migrate-state.json instead of starting fresh. */ resume?: boolean; /** After migration, sample-diff source vs destination. */ verify?: boolean; /** Read source + validate compatibility, do not write anything. */ dryRun?: boolean; /** Allow migrating into a destination that already has data. */ allowMerge?: boolean; /** Items per checkpoint flush (default 100). */ batchSize?: number; /** Override the checkpoint file path (default ./.cortex-migrate-state.json). */ checkpointPath?: string; /** Stream progress messages somewhere other than stderr. */ logger?: (line: string) => void; } export type MigrationStage = 'memories' | 'observations' | 'edges' | 'ops' | 'signals' | 'beliefs' | 'generic'; export declare const MIGRATION_STAGES: readonly MigrationStage[]; interface Checkpoint { startedAt: string; srcUrl: string; dstUrl: string; /** Per stage: 'done' once finished, or the last id processed mid-stage, or null when untouched. */ memories: string | null; observations: string | null; edges: string | null; ops: string | null; signals: string | null; beliefs: string | null; generic: string | null; } export interface VerifyReport { ok: boolean; perKind: Record; } export declare function migrate(opts: MigrateOptions): Promise; export declare function assertCompatibility(src: CortexStore, dst: CortexStore, opts: { allowMerge: boolean; }): Promise; declare function rowToMemory(r: Record): Memory; export declare function loadCheckpoint(path: string): Checkpoint | null; export declare function saveCheckpoint(path: string, checkpoint: Checkpoint): void; export declare function verifyMigration(src: CortexStore, dst: CortexStore): Promise; export declare function runMigrate(args: string[]): Promise; interface ParsedMigrateArgs { from?: string; to?: string; namespace?: string; renameNamespace?: { src: string; dst: string; }; resume?: boolean; verify?: boolean; dryRun?: boolean; allowMerge?: boolean; batchSize?: number; } export declare function parseArgs(args: string[]): ParsedMigrateArgs; export declare const _internals: { rowToMemory: typeof rowToMemory; }; export {}; //# sourceMappingURL=migrate-cmd.d.ts.map