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 { dev } from "../dev/handler.js";
export default {
    desc: "Runs the Zuplo API locally",
    command: "dev",
    builder: (yargs) => {
        return yargs
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .option("start-editor", {
            type: "boolean",
            describe: "Start the editor with the local server",
            default: true,
        })
            .option("port", {
            type: "number",
            describe: "The port to run the local server on",
            default: 9000,
        })
            .option("editor-port", {
            type: "number",
            describe: "The port to run the route designer on",
            default: 9100,
        })
            .option("debug-port", {
            type: "number",
            describe: "The port to run the Chrome inspector on",
        })
            .option("unsafely-ignore-certificate-errors", {
            type: "boolean",
            describe: "Unsafely ignore certificate errors",
            default: false,
        })
            .middleware([setBlocking, identify])
            .check(async (argv) => {
            return await new YargsChecker(new ZuploProjectValidator()).check(argv);
        });
    },
    handler: async (argv) => {
        await captureEvent({
            argv,
            properties: {
                "debug-port": argv["debugPort"],
                "unsafely-ignore-certificate-errors": argv["unsafelyIgnoreCertificateErrors"],
            },
            event: "zuplo dev",
        });
        await dev(argv);
    },
};
//# sourceMappingURL=dev.js.map