export declare function compareCalVer(a: string, b: string): number; export interface Migration { /** File path relative to DATA_DIR, e.g. "config/thread-templates.json". */ filePath: string; /** CalVer when this migration was introduced. Compared against the per-file * version tracked in versions.json to decide whether to run. */ version: string; /** Target file format. 'json' (default) parses/serializes JSON; 'text' passes * the raw file contents (string) through unchanged. Determines how the runner * reads, diffs, and writes the file. */ format?: 'json' | 'text'; /** Idempotent migration function. For 'json' migrations, receives the parsed JSON * of the target file and optionally the parsed JSON of the corresponding defaults * file. For 'text' migrations, receives the raw file string and optionally the raw * defaults string. Must return the migrated data (object for json, string for text) * — the runner compares before/after to decide whether to write. */ migrate(data: unknown, defaults?: unknown): unknown; } /** Replace any existing `` … `` region with * `block`, or append `block` (separated by a blank line) when absent. Idempotent: feeding * the output back in is a no-op. Matches any block version on the start marker so an old * block is upgraded in place rather than duplicated. */ export declare function upsertMarkerBlock(content: string, block: string): string; /** Apply an ordered list of literal `[from, to]` replacements, each only when `from` * is present in the content. Used by text migrations that neutralize opinionated or * project-specific phrasing in shipped default prompts (e.g. a hard TDD mandate, a * hardcoded `npm test`, a named lint tool) on existing installs whose prompt copies * predate the edit. Idempotent provided no `to` re-introduces another rule's `from`: * once replaced the `from` is gone, so re-runs are no-ops. A prompt the user has * customized away from the shipped wording simply won't match and is left untouched, * preserving their edits. */ export declare function applyReplacements(content: string, pairs: ReadonlyArray): string; export interface MigrationOptions { /** Override DATA_DIR (user config location). Defaults to the real CORTEX_HOME. */ dataDir?: string; /** Override DEFAULTS_DIR (default config location). Defaults to INSTALL_ROOT/defaults. */ defaultsDir?: string; /** Override versions.json location. Defaults to dataDir/data. */ storeDir?: string; } export declare function runMigrations(opts?: MigrationOptions): Promise; /** * Migrate config.yaml from CORTEX_HOME/config/ (wrong location before 2026.6.11) * to ~/.aistatus/config.yaml (correct location read by aistatus). * Idempotent: if target already exists and is valid YAML, source is deleted without copying. * If source is malformed YAML, it's deleted to avoid interfering with aistatus. */ export declare function migrateAistatusConfigLocation(dataDir: string): Promise;