import type { Logger } from "../util/logger.js";
import { MIGRATION_CHECKLIST_FILE } from "./migration-checklist.js";
/**
 * Deterministic v2 -> v3 restructure on the local app filesystem.
 *
 * This runs on the user's machine inside the vite dev server process, so it
 * is allowed to mutate the working tree directly. It is intentionally pure
 * filesystem work -- no network, no git. The orchestrating HTTP route is
 * responsible for sandwiching this between the pre-migration backup commit
 * (which snapshots what is about to be moved) and the atomic template flip
 * (which asks the server to update application_v2.template_name and spin a
 * fresh SABS pod).
 *
 * High-level flow:
 *   1. Move every top-level entry (except guarded dirs) into
 *      `scratch/v2-backup/`. This is our only rollback surface on disk.
 *   2. Copy the bundled `app-fullstack` template into the app root.
 *   3. Remap user content from the backup onto the new layout:
 *        - pages/<Page>/index.tsx (and siblings besides apis/) -> client/pages
 *        - non-stock components -> client/components (fullstack stock wins)
 *        - lib/utils.ts and index.css only if they diverge from template
 *   4. For each v2 api.yaml, write a stub `server/apis/<name>/api.ts` and
 *      regenerate `server/apis/index.ts` so useTypedApi type inference
 *      lights up immediately.
 *   5. Write `scratch/migration-state.json` -- the signal file Clark uses
 *      to resume a migration and to render the API checklist.
 */
export interface MigrateToFullstackArgs {
    /** Absolute path to the user's app root (the vite dev server's `root`). */
    appRootDirPath: string;
    /**
     * Absolute path to the bundled `app-fullstack` template tree. In practice
     * this comes from `getFullstackTemplateDir()`; callers pass it explicitly
     * so tests can point at a fixture.
     */
    templateSourceDirPath: string;
    logger: Logger;
}
export interface MigrateToFullstackResult {
    scratchDirPath: string;
    backupDirPath: string;
    restructuredFiles: number;
    apiStubs: string[];
    stateFilePath: string;
    migrationChecklistFilePath: string;
}
export declare const SCRATCH_DIR_NAME = "scratch";
export declare const BACKUP_SUBDIR_NAME = "v2-backup";
export declare const MIGRATION_STATE_FILE = "migration-state.json";
export { MIGRATION_CHECKLIST_FILE };
export declare const MIGRATION_STATE_VERSION = 1;
export interface MigrationState {
    version: typeof MIGRATION_STATE_VERSION;
    startedAt: string;
    targetTemplateName: "app-fullstack";
    sourceTemplateName: string;
    backupDirPath: string;
    /**
     * Filled by migration routes once backup/flip commits are known so UI
     * actions (e.g. abort/rollback) can still recover IDs after restart.
     */
    backupCommitId?: string;
    migrationCommitId?: string;
    apiChecklist: Array<{
        /** Name from metadata.name in api.yaml (or derived from directory). */
        name: string;
        /** Relative path of the original api.yaml under the backup dir. */
        yamlPathInBackup: string;
        /** Relative path of the stub file written into the new layout. */
        stubPath: string;
        /** Free-form status field Clark flips as it ports logic. */
        status: "stub";
    }>;
}
export declare function migrateToFullstack(args: MigrateToFullstackArgs): Promise<MigrateToFullstackResult>;
//# sourceMappingURL=restructure.d.ts.map