/**
 * Core upgrade logic - unified project maintenance.
 *
 * Handles:
 *   1. Storage engine migration (JSON → SQLite)
 *   2. Schema version upgrades
 *   3. Structural repairs (checksums, missing fields)
 *   4. Global ~/.cleo data migration
 *
 * CLI delegates here (shared-core pattern).
 *
 * @task T4699
 * @epic T4454
 */
/** A single upgrade action with status. */
export interface UpgradeAction {
    action: string;
    status: 'applied' | 'skipped' | 'preview' | 'error';
    details: string;
    reason?: string;
    fix?: string;
}
/** Full upgrade result. */
export interface UpgradeResult {
    success: boolean;
    upToDate: boolean;
    dryRun: boolean;
    actions: UpgradeAction[];
    applied: number;
    errors: string[];
    /** Summary of what was checked (added for --diagnose and bare upgrade). */
    summary?: UpgradeSummary;
    /** Storage migration sub-result (if migration was triggered). */
    storageMigration?: {
        migrated: boolean;
        tasksImported: number;
        archivedImported: number;
        sessionsImported: number;
        warnings: string[];
    };
}
/** Counts of what upgrade checked/applied/skipped. */
export interface UpgradeSummary {
    checked: number;
    applied: number;
    skipped: number;
    errors: number;
    warnings: string[];
}
/** A single diagnostic finding from --diagnose. */
export interface DiagnoseFinding {
    check: string;
    status: 'ok' | 'warning' | 'error';
    details: string;
    fix?: string;
}
/** Result from diagnoseUpgrade(). */
export interface DiagnoseResult {
    success: boolean;
    findings: DiagnoseFinding[];
    summary: {
        ok: number;
        warnings: number;
        errors: number;
    };
}
/**
 * Run a full upgrade pass on the project .cleo/ directory.
 *
 * Steps:
 *   1. Pre-flight storage check (JSON → SQLite)
 *   2. If migration needed and not dry-run, run auto-migration with backup
 *   3. Schema version checks on JSON files
 *   4. Structural repairs (checksums, missing fields)
 *
 * @param options.dryRun  Preview changes without applying
 * @param options.includeGlobal  Also check global ~/.cleo
 * @param options.autoMigrate  Auto-migrate storage if needed (default: true)
 * @param options.forceDetect  Force re-detection of project type (ignore staleness)
 * @param options.mapCodebase  Run full codebase analysis and store to brain.db
 * @param options.projectName  Update project name in project-info and nexus
 * @param options.cwd  Project directory override
 */
export declare function runUpgrade(options?: {
    dryRun?: boolean;
    includeGlobal?: boolean;
    autoMigrate?: boolean;
    forceDetect?: boolean;
    mapCodebase?: boolean;
    projectName?: string;
    cwd?: string;
}): Promise<UpgradeResult>;
/**
 * Deep diagnostic inspection of schema and migration state.
 *
 * Unlike bare `cleo upgrade` which skips checks that "look OK",
 * --diagnose validates:
 * - tasks.db: all required columns present via PRAGMA table_info
 * - tasks.db: migration journal entries match local migration files
 * - brain.db: migration journal entries match local migration files
 * - brain.db: expected tables exist
 * - Stale/orphaned journal entries detected and reported
 *
 * Read-only: does not modify any data.
 *
 * @task T131
 */
export declare function diagnoseUpgrade(options?: {
    cwd?: string;
}): Promise<DiagnoseResult>;
//# sourceMappingURL=upgrade.d.ts.map