import type { SqlfuMigrationPrefix, SqlfuMigrationPreset, SqlfuProjectConfig } from '../types.js'; import type { SqlfuHost } from '../host.js'; import type { LoadedSqlfuProject } from '../config.js'; import { type Migration } from '../migrations/index.js'; export declare function migrationsPresetOf(context: SqlfuContext): SqlfuMigrationPreset; export declare function getCheckMismatches(context: SqlfuContext): Promise; export declare function getCheckAnalysis(context: SqlfuContext): Promise; export declare function writeDefinitionsSql(context: SqlfuContext, sql: string): Promise; export declare function getSchemaAuthorities(context: SqlfuContext): Promise<{ desiredSchemaSql: string; migrations: { id: string; fileName: string; content: string; applied: boolean; applied_at: string | null; integrity: "checksum mismatch" | "ok" | null; }[]; migrationHistory: { id: string; fileName: string | null; content: string; applied: boolean; applied_at: string; integrity: "checksum mismatch" | "ok"; }[]; liveSchemaSql: string; }>; export declare function getMigrationResultantSchema(context: SqlfuContext, input: { source: 'migrations' | 'history'; id: string; }): Promise; export type SqlfuCommandConfirmParams = { title: string; body: string; bodyType?: 'markdown' | 'sql' | 'typescript'; editable?: boolean; }; export type SqlfuCommandConfirm = (params: SqlfuCommandConfirmParams) => string | null | Promise; /** * A `SqlfuCommandConfirm` that accepts the proposed body without prompting. * Used by the CLI when `--yes` is passed or when stdin is non-TTY, and by * programmatic callers that want to skip interactive confirmation. */ export declare const autoAcceptConfirm: SqlfuCommandConfirm; export declare function runSqlfuCommand(context: SqlfuCommandContext, command: string, confirm: SqlfuCommandConfirm): Promise; export declare function readMigrationsFromContext(context: SqlfuContext): Promise; export declare function applyDraftSql(context: SqlfuContext, input: { name?: string; } | undefined, confirm: SqlfuCommandConfirm): Promise<{ path: string; } | null>; export declare function applySyncSql(context: SqlfuContext, confirm: SqlfuCommandConfirm): Promise; export declare function applyMigrateSql(context: SqlfuContext, confirm: SqlfuCommandConfirm): Promise; export declare function applyBaselineSql(context: SqlfuContext, input: { target: string; }, confirm: SqlfuCommandConfirm): Promise; export declare function applyGotoSql(context: SqlfuContext, input: { target: string; }, confirm: SqlfuCommandConfirm): Promise; export declare function getMigrationPrefix(input: { kind: SqlfuMigrationPrefix; now: Date; existing: string[]; }): string; export declare const materializeDefinitionsSchemaForContext: (context: SqlfuContext, definitionsSql: string) => Promise; export declare const materializeMigrationsSchemaForContext: (context: SqlfuContext, migrations: Migration[]) => Promise; export declare function analyzeDatabase(context: SqlfuContext): Promise<{ mismatches: CheckMismatch[]; recommendations: CheckRecommendation[]; }>; export declare function compareSchemasForContext(context: SqlfuContext, left: string, right: string): Promise<{ isDifferent: boolean; isSyncable: boolean; }>; export interface SqlfuContext { config: SqlfuProjectConfig; host: SqlfuHost; } export interface SqlfuCommandContext { projectRoot: string; configPath?: string; config?: SqlfuProjectConfig; loadProjectState?: () => Promise; host: SqlfuHost; } export interface SqlfuRouterContext extends SqlfuContext { } export interface SqlfuCommandRouterContext extends SqlfuCommandContext { confirm: SqlfuCommandConfirm; } export declare function requireContextConfig(context: SqlfuCommandContext): SqlfuContext; export declare function loadContextConfig(context: SqlfuCommandContext): Promise; export declare function loadContextProjectState(context: SqlfuCommandContext): Promise; export type CheckMismatch = { kind: 'repoDrift' | 'pendingMigrations' | 'historyDrift' | 'schemaDrift' | 'syncDrift'; title: 'Repo Drift' | 'Pending Migrations' | 'History Drift' | 'Schema Drift' | 'Sync Drift'; summary: string; details: string[]; }; export type CheckRecommendation = { kind: 'draft' | 'migrate' | 'baseline' | 'goto' | 'sync' | 'restoreMissingMigration' | 'restoreOriginalMigration'; command?: [string, ...string[]]; label: string; rationale?: string; }; export type CheckAnalysis = { mismatches: CheckMismatch[]; recommendations: CheckRecommendation[]; }; export declare function formatCheckFailure(analysis: CheckAnalysis): string;