import { captureEvent } from "../../common/analytics/lib.js";
import { showHelpOnNoSubcommand } from "../../common/handler.js";
import { identify } from "../../common/middleware/user-identification.js";
import { migrateDevPortal } from "../../source/migrate/dev-portal/handler.js";
const commands = {
    describe: "Migration commands",
    command: "migrate",
    ...showHelpOnNoSubcommand((yargs) => yargs.command({
        describe: "Migrates legacy dev portal configuration to the new dev portal format",
        command: "dev-portal",
        builder: (yargs) => yargs
            .usage("$0 source migrate dev-portal [options]")
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo project and dev portal config",
            default: ".",
            normalize: true,
        })
            .option("force", {
            type: "boolean",
            describe: "Force overwrite of existing files",
            default: false,
        })
            .example([
            [
                "$0 source migrate dev-portal",
                "Migrate legacy dev portal configuration to new format",
            ],
            [
                "$0 source migrate dev-portal --dir ./my-project",
                "Specify the project directory path",
            ],
            [
                "$0 source migrate dev-portal --force",
                "Force overwrite existing dev portal files during migration",
            ],
        ])
            .middleware([identify]),
        handler: async (argv) => {
            await captureEvent({
                argv,
                event: "zuplo source migrate dev-portal",
            });
            await migrateDevPortal(argv);
        },
    })),
};
export default commands;
//# sourceMappingURL=migrate.js.map