/** * migrate-dirs.ts * * One-shot, idempotent migration for daemon installs upgrading from <=0.2.2. * * Background: daemon <=0.2.2 used `%APPDATA%\AstraMemory` (config) and * `%LOCALAPPDATA%\AstraMemory` (data) on Windows. The plugin has always used * `%APPDATA%\Astramem`. This divergence caused a bearer mismatch (401 on every * ingest) because each product's `init` wizard writes its own `secrets.env` * to its own directory. * * Fix: daemon now uses `Astramem` as the canonical dir name (matching the * plugin). This module renames the legacy dirs to canonical on first boot * after the upgrade. It is safe to call on every boot. * * Windows-only. On macOS/Linux the legacy and canonical paths are identical * (no migration needed) and this function returns immediately. */ export interface MigrationResult { configMigrated: boolean; dataMigrated: boolean; warnings: string[]; } /** * Migrate legacy Windows config/data dirs to canonical names if needed. * * Rules for each dir pair (legacy → canonical): * - canonical exists → no-op (already migrated or user did fresh init) * - only legacy exists → rename legacy to canonical (log migration) * - both exist → no-op, emit warning (user must reconcile manually) * - neither exists → no-op (fresh install, nothing to migrate) * * IMPORTANT: never overwrites canonical if it already contains data. This * preserves any bearer the user wrote via `astramem-local init` after upgrading. */ export declare function migrateLegacyDirsIfPresent(): MigrationResult;