import { EnsureAuditIgnoreLocalExclusionsMigration } from "./ensure-audit-ignore-local-exclusions.js";
import { EnsureJestRnMockAccessibilityManagerMigration } from "./ensure-jest-rn-mock-accessibility-manager.js";
import { EnsureLearningsGitattributesMigration } from "./ensure-learnings-gitattributes.js";
import { EnsureLearningsMergeDriverMigration } from "./ensure-learnings-merge-driver.js";
import { EnsureLisaPostinstallMigration } from "./ensure-lisa-postinstall.js";
import { EnsureOxlintBaseConfigsMigration } from "./ensure-oxlint-base-configs.js";
import { EnsurePlaywrightDedicatedCallerMigration } from "./ensure-playwright-dedicated-caller.js";
import { EnsureQualityCallerScopesMigration } from "./ensure-quality-caller-scopes.js";
import { EnsureSeededGatesMigration } from "./ensure-seeded-gates.js";
import { EnsureSonarExcludesLisaHarnessMigration } from "./ensure-sonar-excludes-lisa-harness.js";
import { EnsureTsconfigLocalFilesFallbackMigration } from "./ensure-tsconfig-local-files-fallback.js";
import { EnsureWikiSourceDeclaredMigration } from "./ensure-wiki-source-declared.js";
import { EnsureTsconfigLocalIncludesMigration } from "./ensure-tsconfig-local-includes.js";
import { ReconcileClaudeStackPluginsMigration } from "./reconcile-claude-stack-plugins.js";
import { UntrackCodexMarketplaceMigration } from "./untrack-codex-marketplace.js";
export { EnsureAuditIgnoreLocalExclusionsMigration } from "./ensure-audit-ignore-local-exclusions.js";
export { EnsureJestRnMockAccessibilityManagerMigration } from "./ensure-jest-rn-mock-accessibility-manager.js";
export { EnsureLearningsGitattributesMigration } from "./ensure-learnings-gitattributes.js";
export { EnsureLearningsMergeDriverMigration } from "./ensure-learnings-merge-driver.js";
export { EnsureLisaPostinstallMigration } from "./ensure-lisa-postinstall.js";
export { EnsureOxlintBaseConfigsMigration } from "./ensure-oxlint-base-configs.js";
export { EnsurePlaywrightDedicatedCallerMigration } from "./ensure-playwright-dedicated-caller.js";
export { EnsureQualityCallerScopesMigration } from "./ensure-quality-caller-scopes.js";
export { EnsureSeededGatesMigration } from "./ensure-seeded-gates.js";
export { EnsureSonarExcludesLisaHarnessMigration } from "./ensure-sonar-excludes-lisa-harness.js";
export { EnsureTsconfigLocalFilesFallbackMigration } from "./ensure-tsconfig-local-files-fallback.js";
export { EnsureWikiSourceDeclaredMigration } from "./ensure-wiki-source-declared.js";
export { EnsureTsconfigLocalIncludesMigration } from "./ensure-tsconfig-local-includes.js";
export { ReconcileClaudeStackPluginsMigration } from "./reconcile-claude-stack-plugins.js";
export { UntrackCodexMarketplaceMigration } from "./untrack-codex-marketplace.js";
/**
 * Registry that runs applicable migrations against a destination project
 */
export class MigrationRegistry {
    migrations;
    /**
     * Initialize registry with provided or default migrations
     * @param migrations - Optional array of migrations (uses defaults if omitted)
     */
    constructor(migrations) {
        this.migrations = migrations ?? [
            new EnsureTsconfigLocalIncludesMigration(),
            new EnsureTsconfigLocalFilesFallbackMigration(),
            new EnsureAuditIgnoreLocalExclusionsMigration(),
            new EnsureJestRnMockAccessibilityManagerMigration(),
            new EnsureLearningsGitattributesMigration(),
            new EnsureLearningsMergeDriverMigration(),
            new EnsureLisaPostinstallMigration(),
            new EnsureOxlintBaseConfigsMigration(),
            new EnsurePlaywrightDedicatedCallerMigration(),
            new EnsureQualityCallerScopesMigration(),
            new EnsureSeededGatesMigration(),
            new EnsureSonarExcludesLisaHarnessMigration(),
            new EnsureWikiSourceDeclaredMigration(),
            new ReconcileClaudeStackPluginsMigration(),
            new UntrackCodexMarketplaceMigration(),
        ];
    }
    /**
     * Get all registered migrations
     * @returns All migrations in registration order
     */
    getAll() {
        return this.migrations;
    }
    /**
     * Invoke the optional `beforeStrategies` hook on every registered migration.
     * Used to snapshot project state that strategies will subsequently overwrite.
     * @param ctx - Migration context
     */
    async runBeforeStrategies(ctx) {
        for (const migration of this.migrations) {
            if (migration.beforeStrategies) {
                await migration.beforeStrategies(ctx);
            }
        }
    }
    /**
     * Run every migration whose `applies` returns true
     * @param ctx - Migration context
     * @returns Aggregated results from every registered migration
     */
    async runAll(ctx) {
        const results = [];
        for (const migration of this.migrations) {
            const shouldRun = await migration.applies(ctx);
            if (!shouldRun) {
                results.push({ name: migration.name, action: "skipped" });
                continue;
            }
            const result = await migration.apply(ctx);
            results.push(result);
        }
        return results;
    }
}
/**
 * Create the default migration registry
 * @returns New MigrationRegistry with all default migrations registered
 */
export function createMigrationRegistry() {
    return new MigrationRegistry();
}
//# sourceMappingURL=index.js.map