import type { ProjectRegistry } from "./project-registry.js";
/**
 * One-time migration from centralized state (`<server-cwd>/.bobbit/state/`)
 * to per-project state (`<project-root>/.bobbit/state/`).
 *
 * Distributes goals, sessions, tasks, teams, gates, and staff to the
 * correct project's state directory based on `projectId` tags.
 *
 * MIGRATION-ONLY default-project behavior
 * ----------------------------------------
 * Legacy records predate multi-project and therefore carry no `projectId`.
 * To avoid dropping them on the floor, this migration anchors such records
 * to a single "migration target" project: `projectRegistry.getByPath(serverCwd)`
 * if one is registered, else `projects[0]`. The variable below is named
 * `defaultProject` for historical reasons — it is NOT a runtime default
 * project. Bobbit has no runtime default project concept any more:
 *
 *   - `ProjectRegistry` does not expose `ensureDefaultProject()`.
 *   - `ProjectContextManager` does not expose `getDefault()` /
 *     `getDefaultOrNull()` / `getDefaultProjectId()` /
 *     `getDefaultProjectIdOrNull()`.
 *   - `POST /api/goals`, `POST /api/sessions`, and `POST /api/staff` require
 *     an explicit `projectId` or a `cwd` that matches a registered
 *     project's `rootPath`; otherwise they return 400.
 *
 * The `projects[0]` anchor below runs at most once per install (guarded by
 * the `.migrated-to-per-project` marker file). If you are tempted to reuse
 * this fallback anywhere outside this function, don't — resolve a project
 * explicitly via `resolveProjectForRequest` instead. See
 * [docs/internals.md — Multi-project architecture / State migration] for
 * the full rationale.
 *
 * Renamed (not deleted) central files get a `.pre-migration` suffix.
 * A marker file prevents re-running.
 *
 * Uses synchronous fs operations — runs once at startup.
 */
export declare function migrateToPerProjectState(centralStateDir: string, projectRegistry: ProjectRegistry, serverCwd: string): void;
/**
 * Recovery pass: if `.pre-migration` backup files exist in the state dir,
 * merge any entries missing from the current state files back in.
 *
 * This fixes data loss caused by the original migration code which
 * unconditionally renamed central files even when central dir == default
 * project dir — effectively deleting the sessions it just wrote.
 *
 * Runs once (writes a `.pre-migration-recovered` marker). Safe to re-run.
 */
export declare function recoverPreMigrationData(stateDir: string): void;
//# sourceMappingURL=state-migration.d.ts.map