import { captureEvent } from "../common/analytics/lib.js";
import { authenticate } from "../common/middleware/authentication.js";
import { configure } from "../common/middleware/user-configuration.js";
import { identify } from "../common/middleware/user-identification.js";
import setBlocking from "../common/output.js";
import { validDeployDirectoryValidator } from "../common/validators/file-system-validator.js";
import { YargsChecker } from "../common/validators/lib.js";
import { deploy } from "../deploy/handler.js";
export default {
    desc: "Deploys current Git branch of the current directory",
    command: "deploy",
    builder: (yargs) => {
        return yargs
            .option("api-key", {
            type: "string",
            describe: "The API Key from Zuplo",
            envVar: "API_KEY",
        })
            .option("project", {
            type: "string",
            hidden: true,
            describe: "The project name",
        })
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .option("verify-remote", {
            deprecated: true,
            type: "boolean",
            describe: "Verify that this Git repository matches the one configured on Zuplo. Use --no-verify-remote to disable.",
            default: false,
        })
            .option("environment", {
            type: "string",
            describe: "The value to use for environment name, instead of the current branch name",
        })
            .option("self-hosted-endpoint", {
            type: "string",
            describe: "The endpoint of your self-hosted service to deploy to",
        })
            .option("override-repo-url", {
            type: "string",
            describe: "Override the repo url reference",
            default: undefined,
            hidden: true,
        })
            .boolean("verify-remote")
            .middleware([setBlocking, authenticate, configure, identify])
            .check(async (argv) => {
            return await new YargsChecker(validDeployDirectoryValidator).check(argv);
        });
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo deploy" });
        await deploy(argv);
    },
};
//# sourceMappingURL=deploy.js.map