@kubb/cli 5.0.0-alpha.71 → 5.0.0-alpha.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-DypvJBwO.js → agent-BIfY3VbL.js} +4 -4
- package/dist/{agent-DypvJBwO.js.map → agent-BIfY3VbL.js.map} +1 -1
- package/dist/{agent-Zo8CQwxZ.cjs → agent-B_pirbeB.cjs} +3 -3
- package/dist/{agent-Zo8CQwxZ.cjs.map → agent-B_pirbeB.cjs.map} +1 -1
- package/dist/{agent-D5OIwM0z.cjs → agent-DHrMsOeV.cjs} +4 -4
- package/dist/{agent-D5OIwM0z.cjs.map → agent-DHrMsOeV.cjs.map} +1 -1
- package/dist/{agent-CouS-H2S.js → agent-Ev5hU5hH.js} +3 -3
- package/dist/{agent-CouS-H2S.js.map → agent-Ev5hU5hH.js.map} +1 -1
- package/dist/{constants-BgLUQ1nx.cjs → constants-CnDXa1R6.cjs} +11 -12
- package/dist/constants-CnDXa1R6.cjs.map +1 -0
- package/dist/{constants-mIdg9ls2.js → constants-aL3CP_Wq.js} +11 -12
- package/dist/constants-aL3CP_Wq.js.map +1 -0
- package/dist/{generate-Cy11Ra5n.js → generate-BCH1e7AZ.js} +2 -2
- package/dist/{generate-Cy11Ra5n.js.map → generate-BCH1e7AZ.js.map} +1 -1
- package/dist/{generate-CLYhWYY1.cjs → generate-CygyrMfn.cjs} +4 -4
- package/dist/{generate-CLYhWYY1.cjs.map → generate-CygyrMfn.cjs.map} +1 -1
- package/dist/{generate-DfhKa1mG.js → generate-DNF0WK_l.js} +4 -4
- package/dist/{generate-DfhKa1mG.js.map → generate-DNF0WK_l.js.map} +1 -1
- package/dist/{generate-BW0J1wvg.cjs → generate-TY3XSJSF.cjs} +2 -2
- package/dist/{generate-BW0J1wvg.cjs.map → generate-TY3XSJSF.cjs.map} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +8 -8
- package/dist/{init-CmrUd26x.cjs → init-CZ5Xq2Hd.cjs} +16 -39
- package/dist/init-CZ5Xq2Hd.cjs.map +1 -0
- package/dist/{init-C_EgqqO4.cjs → init-CvFJJYFu.cjs} +3 -3
- package/dist/{init-C_EgqqO4.cjs.map → init-CvFJJYFu.cjs.map} +1 -1
- package/dist/{init-CaQZcAvy.js → init-DVWDPeBp.js} +3 -3
- package/dist/{init-CaQZcAvy.js.map → init-DVWDPeBp.js.map} +1 -1
- package/dist/{init-DEC1gCsk.js → init-eNRlotJK.js} +16 -39
- package/dist/init-eNRlotJK.js.map +1 -0
- package/dist/{mcp-vi8t2Rkb.cjs → mcp-CLcDV4Jm.cjs} +2 -2
- package/dist/{mcp-vi8t2Rkb.cjs.map → mcp-CLcDV4Jm.cjs.map} +1 -1
- package/dist/{mcp-nlFo36z0.js → mcp-D7EIR9fR.js} +2 -2
- package/dist/{mcp-nlFo36z0.js.map → mcp-D7EIR9fR.js.map} +1 -1
- package/dist/{mcp-CmXrXzDF.cjs → mcp-UlWP6n6X.cjs} +3 -3
- package/dist/{mcp-CmXrXzDF.cjs.map → mcp-UlWP6n6X.cjs.map} +1 -1
- package/dist/{mcp-7rBVhoQz.js → mcp-o2ut08eK.js} +3 -3
- package/dist/{mcp-7rBVhoQz.js.map → mcp-o2ut08eK.js.map} +1 -1
- package/dist/package-BkMeYdbU.js +6 -0
- package/dist/package-BkMeYdbU.js.map +1 -0
- package/dist/{package-DsKVMEXO.cjs → package-TiU83fhk.cjs} +2 -2
- package/dist/package-TiU83fhk.cjs.map +1 -0
- package/dist/{telemetry-kmnc5OAT.cjs → telemetry-DN95_2pF.cjs} +2 -2
- package/dist/{telemetry-kmnc5OAT.cjs.map → telemetry-DN95_2pF.cjs.map} +1 -1
- package/dist/{telemetry-CS5ZE0cN.js → telemetry-LgT_sdPe.js} +2 -2
- package/dist/{telemetry-CS5ZE0cN.js.map → telemetry-LgT_sdPe.js.map} +1 -1
- package/dist/{validate-RG85Fqjh.js → validate-CJpf1wjX.js} +3 -3
- package/dist/{validate-RG85Fqjh.js.map → validate-CJpf1wjX.js.map} +1 -1
- package/dist/{validate-BR_0eveE.js → validate-kLJoT_hi.js} +2 -2
- package/dist/{validate-BR_0eveE.js.map → validate-kLJoT_hi.js.map} +1 -1
- package/dist/{validate-BZKRjT0Y.cjs → validate-lAEML4Ic.cjs} +3 -3
- package/dist/{validate-BZKRjT0Y.cjs.map → validate-lAEML4Ic.cjs.map} +1 -1
- package/dist/{validate-Db7vfaU9.cjs → validate-yKKzqEZ5.cjs} +2 -2
- package/dist/{validate-Db7vfaU9.cjs.map → validate-yKKzqEZ5.cjs.map} +1 -1
- package/package.json +5 -5
- package/src/constants.ts +10 -11
- package/src/runners/init.ts +15 -42
- package/dist/constants-BgLUQ1nx.cjs.map +0 -1
- package/dist/constants-mIdg9ls2.js.map +0 -1
- package/dist/init-CmrUd26x.cjs.map +0 -1
- package/dist/init-DEC1gCsk.js.map +0 -1
- package/dist/package-BD90dOVc.js +0 -6
- package/dist/package-BD90dOVc.js.map +0 -1
- package/dist/package-DsKVMEXO.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as defineCommand } from "./define-Ctii4bel.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
4
|
-
import { s as agentDefaults } from "./constants-
|
|
3
|
+
import { t as version } from "./package-BkMeYdbU.js";
|
|
4
|
+
import { s as agentDefaults } from "./constants-aL3CP_Wq.js";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/commands/agent.ts
|
|
7
7
|
const command = defineCommand({
|
|
@@ -38,7 +38,7 @@ const command = defineCommand({
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
async run({ values }) {
|
|
41
|
-
const { runAgentStart } = await import("./agent-
|
|
41
|
+
const { runAgentStart } = await import("./agent-Ev5hU5hH.js");
|
|
42
42
|
await runAgentStart({
|
|
43
43
|
port: values.port !== void 0 ? values.port : void 0,
|
|
44
44
|
host: values.host,
|
|
@@ -53,4 +53,4 @@ const command = defineCommand({
|
|
|
53
53
|
//#endregion
|
|
54
54
|
export { command };
|
|
55
55
|
|
|
56
|
-
//# sourceMappingURL=agent-
|
|
56
|
+
//# sourceMappingURL=agent-BIfY3VbL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-BIfY3VbL.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CDFQ,cAAc;EACnC,MAAM;EACN,aAAa;EACb,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa,iCAAiC,cAAc,KAAK;IACjE,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;IACxB;GACD,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,SAAM,cAAc;IAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,OAAO;IACnB,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;IACD,CAAC;;EAEL,CCxCeC,CAAa;CAC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
2
|
-
const require_telemetry = require("./telemetry-
|
|
2
|
+
const require_telemetry = require("./telemetry-DN95_2pF.cjs");
|
|
3
3
|
const require_shell = require("./shell-475fQKaX.cjs");
|
|
4
|
-
const require_constants = require("./constants-
|
|
4
|
+
const require_constants = require("./constants-CnDXa1R6.cjs");
|
|
5
5
|
let node_util = require("node:util");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_chunk.__toESM(node_path, 1);
|
|
@@ -113,4 +113,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
|
|
|
113
113
|
//#endregion
|
|
114
114
|
exports.runAgentStart = runAgentStart;
|
|
115
115
|
|
|
116
|
-
//# sourceMappingURL=agent-
|
|
116
|
+
//# sourceMappingURL=agent-B_pirbeB.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-B_pirbeB.cjs","names":["process","agentDefaults","path","net","spawnAsync","sendTelemetry","buildTelemetryEvent"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(`Import of '@kubb/agent' is required to start the Agent server`)\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
4
|
-
const require_constants = require("./constants-
|
|
3
|
+
const require_package = require("./package-TiU83fhk.cjs");
|
|
4
|
+
const require_constants = require("./constants-CnDXa1R6.cjs");
|
|
5
5
|
//#region src/commands/agent/start.ts
|
|
6
6
|
const command$1 = require_define.defineCommand({
|
|
7
7
|
name: "start",
|
|
@@ -34,7 +34,7 @@ const command$1 = require_define.defineCommand({
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
async run({ values }) {
|
|
37
|
-
const { runAgentStart } = await Promise.resolve().then(() => require("./agent-
|
|
37
|
+
const { runAgentStart } = await Promise.resolve().then(() => require("./agent-B_pirbeB.cjs"));
|
|
38
38
|
await runAgentStart({
|
|
39
39
|
port: values.port !== void 0 ? values.port : void 0,
|
|
40
40
|
host: values.host,
|
|
@@ -55,4 +55,4 @@ const command = require_define.defineCommand({
|
|
|
55
55
|
//#endregion
|
|
56
56
|
exports.command = command;
|
|
57
57
|
|
|
58
|
-
//# sourceMappingURL=agent-
|
|
58
|
+
//# sourceMappingURL=agent-DHrMsOeV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-DHrMsOeV.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GACjE,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
|
-
import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-
|
|
2
|
+
import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-LgT_sdPe.js";
|
|
3
3
|
import { t as spawnAsync } from "./shell-DLzN4fRo.js";
|
|
4
|
-
import { s as agentDefaults } from "./constants-
|
|
4
|
+
import { s as agentDefaults } from "./constants-aL3CP_Wq.js";
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import * as process$1 from "node:process";
|
|
@@ -109,4 +109,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
|
|
|
109
109
|
//#endregion
|
|
110
110
|
export { runAgentStart };
|
|
111
111
|
|
|
112
|
-
//# sourceMappingURL=agent-
|
|
112
|
+
//# sourceMappingURL=agent-Ev5hU5hH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-Ev5hU5hH.js","names":["process"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(`Import of '@kubb/agent' is required to start the Agent server`)\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":"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"}
|
|
@@ -47,7 +47,7 @@ const agentDefaults = {
|
|
|
47
47
|
const initDefaults = {
|
|
48
48
|
inputPath: "./openapi.yaml",
|
|
49
49
|
outputPath: "./src/gen",
|
|
50
|
-
plugins: ["plugin-
|
|
50
|
+
plugins: ["plugin-ts"]
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Maps each plugin value to the default config snippet inserted by `init`.
|
|
@@ -55,7 +55,6 @@ const initDefaults = {
|
|
|
55
55
|
* `as const` keeps the object deeply immutable.
|
|
56
56
|
*/
|
|
57
57
|
const pluginDefaultConfigs = {
|
|
58
|
-
"plugin-oas": "pluginOas()",
|
|
59
58
|
"plugin-ts": `pluginTs({
|
|
60
59
|
output: { path: 'models' },
|
|
61
60
|
})`,
|
|
@@ -64,18 +63,9 @@ const pluginDefaultConfigs = {
|
|
|
64
63
|
})`,
|
|
65
64
|
"plugin-react-query": `pluginReactQuery({
|
|
66
65
|
output: { path: 'hooks' },
|
|
67
|
-
})`,
|
|
68
|
-
"plugin-solid-query": `pluginSolidQuery({
|
|
69
|
-
output: { path: 'hooks' },
|
|
70
|
-
})`,
|
|
71
|
-
"plugin-svelte-query": `pluginSvelteQuery({
|
|
72
|
-
output: { path: 'hooks' },
|
|
73
66
|
})`,
|
|
74
67
|
"plugin-vue-query": `pluginVueQuery({
|
|
75
68
|
output: { path: 'hooks' },
|
|
76
|
-
})`,
|
|
77
|
-
"plugin-swr": `pluginSwr({
|
|
78
|
-
output: { path: 'hooks' },
|
|
79
69
|
})`,
|
|
80
70
|
"plugin-zod": `pluginZod({
|
|
81
71
|
output: { path: 'zod' },
|
|
@@ -85,6 +75,15 @@ const pluginDefaultConfigs = {
|
|
|
85
75
|
})`,
|
|
86
76
|
"plugin-msw": `pluginMsw({
|
|
87
77
|
output: { path: 'msw' },
|
|
78
|
+
})`,
|
|
79
|
+
"plugin-cypress": `pluginCypress({
|
|
80
|
+
output: { path: 'cypress' },
|
|
81
|
+
})`,
|
|
82
|
+
"plugin-mcp": `pluginMcp({
|
|
83
|
+
output: { path: 'mcp' },
|
|
84
|
+
})`,
|
|
85
|
+
"plugin-redoc": `pluginRedoc({
|
|
86
|
+
output: { path: 'redoc' },
|
|
88
87
|
})`
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
@@ -146,4 +145,4 @@ Object.defineProperty(exports, "pluginDefaultConfigs", {
|
|
|
146
145
|
}
|
|
147
146
|
});
|
|
148
147
|
|
|
149
|
-
//# sourceMappingURL=constants-
|
|
148
|
+
//# sourceMappingURL=constants-CnDXa1R6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-CnDXa1R6.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Default filename for the Kubb configuration file.\n *\n * Used by the `init` command when scaffolding new projects and by the `agent` default config.\n */\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/**\n * Default values used during interactive `init` scaffolding.\n */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB;;;;AAKD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;;;;;;AAOD,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
|
|
@@ -47,7 +47,7 @@ const agentDefaults = {
|
|
|
47
47
|
const initDefaults = {
|
|
48
48
|
inputPath: "./openapi.yaml",
|
|
49
49
|
outputPath: "./src/gen",
|
|
50
|
-
plugins: ["plugin-
|
|
50
|
+
plugins: ["plugin-ts"]
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Maps each plugin value to the default config snippet inserted by `init`.
|
|
@@ -55,7 +55,6 @@ const initDefaults = {
|
|
|
55
55
|
* `as const` keeps the object deeply immutable.
|
|
56
56
|
*/
|
|
57
57
|
const pluginDefaultConfigs = {
|
|
58
|
-
"plugin-oas": "pluginOas()",
|
|
59
58
|
"plugin-ts": `pluginTs({
|
|
60
59
|
output: { path: 'models' },
|
|
61
60
|
})`,
|
|
@@ -64,18 +63,9 @@ const pluginDefaultConfigs = {
|
|
|
64
63
|
})`,
|
|
65
64
|
"plugin-react-query": `pluginReactQuery({
|
|
66
65
|
output: { path: 'hooks' },
|
|
67
|
-
})`,
|
|
68
|
-
"plugin-solid-query": `pluginSolidQuery({
|
|
69
|
-
output: { path: 'hooks' },
|
|
70
|
-
})`,
|
|
71
|
-
"plugin-svelte-query": `pluginSvelteQuery({
|
|
72
|
-
output: { path: 'hooks' },
|
|
73
66
|
})`,
|
|
74
67
|
"plugin-vue-query": `pluginVueQuery({
|
|
75
68
|
output: { path: 'hooks' },
|
|
76
|
-
})`,
|
|
77
|
-
"plugin-swr": `pluginSwr({
|
|
78
|
-
output: { path: 'hooks' },
|
|
79
69
|
})`,
|
|
80
70
|
"plugin-zod": `pluginZod({
|
|
81
71
|
output: { path: 'zod' },
|
|
@@ -85,6 +75,15 @@ const pluginDefaultConfigs = {
|
|
|
85
75
|
})`,
|
|
86
76
|
"plugin-msw": `pluginMsw({
|
|
87
77
|
output: { path: 'msw' },
|
|
78
|
+
})`,
|
|
79
|
+
"plugin-cypress": `pluginCypress({
|
|
80
|
+
output: { path: 'cypress' },
|
|
81
|
+
})`,
|
|
82
|
+
"plugin-mcp": `pluginMcp({
|
|
83
|
+
output: { path: 'mcp' },
|
|
84
|
+
})`,
|
|
85
|
+
"plugin-redoc": `pluginRedoc({
|
|
86
|
+
output: { path: 'redoc' },
|
|
88
87
|
})`
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
@@ -93,4 +92,4 @@ const pluginDefaultConfigs = {
|
|
|
93
92
|
//#endregion
|
|
94
93
|
export { SUMMARY_SEPARATOR as a, initDefaults as c, QUIET_FLAGS as i, pluginDefaultConfigs as l, KUBB_NPM_PACKAGE_URL as n, WATCHER_IGNORED_PATHS as o, OTLP_ENDPOINT as r, agentDefaults as s, KUBB_CONFIG_FILENAME as t };
|
|
95
94
|
|
|
96
|
-
//# sourceMappingURL=constants-
|
|
95
|
+
//# sourceMappingURL=constants-aL3CP_Wq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-aL3CP_Wq.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Default filename for the Kubb configuration file.\n *\n * Used by the `init` command when scaffolding new projects and by the `agent` default config.\n */\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/**\n * Default values used during interactive `init` scaffolding.\n */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB;;;;AAKD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;;;;;;AAOD,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
|
|
@@ -51,7 +51,7 @@ const command = defineCommand({
|
|
|
51
51
|
},
|
|
52
52
|
async run({ values, positionals }) {
|
|
53
53
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
54
|
-
const { runGenerateCommand } = await import("./generate-
|
|
54
|
+
const { runGenerateCommand } = await import("./generate-DNF0WK_l.js");
|
|
55
55
|
await runGenerateCommand({
|
|
56
56
|
input: positionals[0],
|
|
57
57
|
configPath: values.config,
|
|
@@ -63,4 +63,4 @@ const command = defineCommand({
|
|
|
63
63
|
//#endregion
|
|
64
64
|
export { command };
|
|
65
65
|
|
|
66
|
-
//# sourceMappingURL=generate-
|
|
66
|
+
//# sourceMappingURL=generate-BCH1e7AZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-
|
|
1
|
+
{"version":3,"file":"generate-BCH1e7AZ.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n arguments: ['[input]'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { runGenerateCommand } = await import('../runners/generate.ts')\n\n await runGenerateCommand({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;;AAEA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,WAAW,CAAC,UAAU;CACtB,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,uBAAuB,MAAM,OAAO;AAE5C,QAAM,mBAAmB;GACvB,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_errors = require("./errors-CLCjoSg0.cjs");
|
|
3
|
-
const require_telemetry = require("./telemetry-
|
|
3
|
+
const require_telemetry = require("./telemetry-DN95_2pF.cjs");
|
|
4
4
|
const require_shell = require("./shell-475fQKaX.cjs");
|
|
5
|
-
const require_package = require("./package-
|
|
6
|
-
const require_constants = require("./constants-
|
|
5
|
+
const require_package = require("./package-TiU83fhk.cjs");
|
|
6
|
+
const require_constants = require("./constants-CnDXa1R6.cjs");
|
|
7
7
|
let node_util = require("node:util");
|
|
8
8
|
let node_events = require("node:events");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1761,4 +1761,4 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1761
1761
|
//#endregion
|
|
1762
1762
|
exports.runGenerateCommand = runGenerateCommand;
|
|
1763
1763
|
|
|
1764
|
-
//# sourceMappingURL=generate-
|
|
1764
|
+
//# sourceMappingURL=generate-CygyrMfn.cjs.map
|