import { captureEvent } from "../../common/analytics/lib.js";
import { identify } from "../../common/middleware/user-identification.js";
import setBlocking from "../../common/output.js";
import { ZuploProjectValidator } from "../../common/validators/file-system-validator.js";
import { YargsChecker } from "../../common/validators/lib.js";
import { update } from "../../source/update/handler.js";
export default {
    desc: "Updates your project structure to the latest conventions",
    command: "upgrade",
    builder: (yargs) => {
        return yargs
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .middleware([setBlocking, identify])
            .check(async (argv) => {
            return await new YargsChecker(new ZuploProjectValidator()).check(argv);
        });
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo source upgrade" });
        await update(argv);
    },
};
//# sourceMappingURL=upgrade.js.map