@kubb/cli 5.0.0-alpha.7 → 5.0.0-alpha.9
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-CjXjyuPe.js → agent-5mmp7QzF.js} +4 -4
- package/dist/{agent-CjXjyuPe.js.map → agent-5mmp7QzF.js.map} +1 -1
- package/dist/{agent-Cc-0-A8t.cjs → agent-BKphjOIF.cjs} +4 -4
- package/dist/{agent-Cc-0-A8t.cjs.map → agent-BKphjOIF.cjs.map} +1 -1
- package/dist/{agent-C6o_6GSJ.cjs → agent-BapvKB4r.cjs} +3 -3
- package/dist/{agent-C6o_6GSJ.cjs.map → agent-BapvKB4r.cjs.map} +1 -1
- package/dist/{agent-L50VNhXv.js → agent-CBrpIMMU.js} +3 -3
- package/dist/{agent-L50VNhXv.js.map → agent-CBrpIMMU.js.map} +1 -1
- package/dist/{constants-BTUap0zs.cjs → constants-D0XHAHeZ.cjs} +78 -8
- package/dist/constants-D0XHAHeZ.cjs.map +1 -0
- package/dist/{constants-CM3dJzjK.js → constants-DJM9zCXm.js} +73 -9
- package/dist/constants-DJM9zCXm.js.map +1 -0
- package/dist/{generate-BYqhZfbq.js → generate-BHNyeQXl.js} +4 -4
- package/dist/generate-BHNyeQXl.js.map +1 -0
- package/dist/{generate-yOyKmo19.cjs → generate-Cq5RDTBL.cjs} +4 -4
- package/dist/{generate-BYqhZfbq.js.map → generate-Cq5RDTBL.cjs.map} +1 -1
- package/dist/{generate-BP0WpC20.cjs → generate-DU5zzc54.cjs} +2 -2
- package/dist/{generate-BP0WpC20.cjs.map → generate-DU5zzc54.cjs.map} +1 -1
- package/dist/{generate-BX6LmxKo.js → generate-Rly1EXBN.js} +2 -2
- package/dist/{generate-BX6LmxKo.js.map → generate-Rly1EXBN.js.map} +1 -1
- package/dist/index.cjs +19 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/{init-hmolV6B4.cjs → init-BK6inBTR.cjs} +2 -2
- package/dist/{init-hmolV6B4.cjs.map → init-BK6inBTR.cjs.map} +1 -1
- package/dist/{init-C-InrmSY.js → init-BQ6zfsnw.js} +2 -2
- package/dist/{init-C-InrmSY.js.map → init-BQ6zfsnw.js.map} +1 -1
- package/dist/{init-DkwG4Gbs.cjs → init-CN1JFyGX.cjs} +3 -3
- package/dist/{init-DkwG4Gbs.cjs.map → init-CN1JFyGX.cjs.map} +1 -1
- package/dist/{init-BqkRvRTM.js → init-iN7e1XwI.js} +3 -3
- package/dist/{init-BqkRvRTM.js.map → init-iN7e1XwI.js.map} +1 -1
- package/dist/{mcp-D2SHEg_d.js → mcp-BiGUvbWP.js} +2 -2
- package/dist/{mcp-D2SHEg_d.js.map → mcp-BiGUvbWP.js.map} +1 -1
- package/dist/{mcp-ChHFPRzD.cjs → mcp-CONmm_xT.cjs} +2 -2
- package/dist/{mcp-ChHFPRzD.cjs.map → mcp-CONmm_xT.cjs.map} +1 -1
- package/dist/{mcp-BnEafD5r.cjs → mcp-T7Q4nWbT.cjs} +3 -3
- package/dist/{mcp-BnEafD5r.cjs.map → mcp-T7Q4nWbT.cjs.map} +1 -1
- package/dist/{mcp-Cqn_PHUg.js → mcp-eP1S40LZ.js} +3 -3
- package/dist/{mcp-Cqn_PHUg.js.map → mcp-eP1S40LZ.js.map} +1 -1
- package/dist/{package-DZb6I8FQ.cjs → package-BJ6ionm6.cjs} +2 -2
- package/dist/package-BJ6ionm6.cjs.map +1 -0
- package/dist/package-BKZ0H3Zf.js +6 -0
- package/dist/package-BKZ0H3Zf.js.map +1 -0
- package/dist/{telemetry-DxiR7clS.js → telemetry-BF3SMlH6.js} +2 -2
- package/dist/{telemetry-DxiR7clS.js.map → telemetry-BF3SMlH6.js.map} +1 -1
- package/dist/{telemetry-Cn9X1I5B.cjs → telemetry-DZ7IrLAU.cjs} +2 -2
- package/dist/{telemetry-Cn9X1I5B.cjs.map → telemetry-DZ7IrLAU.cjs.map} +1 -1
- package/dist/{validate-l8vLmwKA.js → validate-BImbbx1t.js} +2 -2
- package/dist/{validate-l8vLmwKA.js.map → validate-BImbbx1t.js.map} +1 -1
- package/dist/{validate-Bgqwmhir.js → validate-DAZdX_0i.js} +3 -3
- package/dist/{validate-Bgqwmhir.js.map → validate-DAZdX_0i.js.map} +1 -1
- package/dist/{validate-9FoHgtvi.cjs → validate-DucFMytl.cjs} +3 -3
- package/dist/{validate-9FoHgtvi.cjs.map → validate-DucFMytl.cjs.map} +1 -1
- package/dist/{validate-Bbrn3Q-A.cjs → validate-ujLCYSWU.cjs} +2 -2
- package/dist/{validate-Bbrn3Q-A.cjs.map → validate-ujLCYSWU.cjs.map} +1 -1
- package/package.json +5 -5
- package/src/constants.ts +57 -10
- package/src/index.ts +5 -4
- package/src/loggers/clackLogger.ts +1 -2
- package/src/types.ts +11 -0
- package/src/utils/flags.ts +10 -0
- package/dist/constants-BTUap0zs.cjs.map +0 -1
- package/dist/constants-CM3dJzjK.js.map +0 -1
- package/dist/generate-yOyKmo19.cjs.map +0 -1
- package/dist/package-DLd3fZNd.js +0 -6
- package/dist/package-DLd3fZNd.js.map +0 -1
- package/dist/package-DZb6I8FQ.cjs.map +0 -1
- package/src/utils/getIntro.ts +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as defineCommand } from "./define--M_JMcDC.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
4
|
-
import {
|
|
3
|
+
import { t as version } from "./package-BKZ0H3Zf.js";
|
|
4
|
+
import { o as agentDefaults } from "./constants-DJM9zCXm.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-CBrpIMMU.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-5mmp7QzF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-5mmp7QzF.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: { type: 'string', description: 'Path to the Kubb config', short: 'c' },\n port: { type: 'string', description: `Port for the server (default: ${agentDefaults.port})`, short: 'p' },\n host: { type: 'string', description: 'Host for the server', default: agentDefaults.host },\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': { type: 'boolean', description: 'Grant all permissions (implies --allow-write).', default: false },\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;IAAE,MAAM;IAAU,aAAa;IAA2B,OAAO;IAAK;GAC9E,MAAM;IAAE,MAAM;IAAU,aAAa,iCAAiC,cAAc,KAAK;IAAI,OAAO;IAAK;GACzG,MAAM;IAAE,MAAM;IAAU,aAAa;IAAuB,SAAS,cAAc;IAAM;GACzF,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IAAE,MAAM;IAAW,aAAa;IAAkD,SAAS;IAAO;GAChH;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,CAAC,CCxB2B;CAC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-D6Kfm7-Z.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
4
|
-
const require_constants = require("./constants-
|
|
3
|
+
const require_package = require("./package-BJ6ionm6.cjs");
|
|
4
|
+
const require_constants = require("./constants-D0XHAHeZ.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-BapvKB4r.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-BKphjOIF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-BKphjOIF.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: { type: 'string', description: 'Path to the Kubb config', short: 'c' },\n port: { type: 'string', description: `Port for the server (default: ${agentDefaults.port})`, short: 'p' },\n host: { type: 'string', description: 'Host for the server', default: agentDefaults.host },\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': { type: 'boolean', description: 'Grant all permissions (implies --allow-write).', default: false },\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;GAAE,MAAM;GAAU,aAAa;GAA2B,OAAO;GAAK;EAC9E,MAAM;GAAE,MAAM;GAAU,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GAAI,OAAO;GAAK;EACzG,MAAM;GAAE,MAAM;GAAU,aAAa;GAAuB,SAASA,kBAAAA,cAAc;GAAM;EACzF,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GAAE,MAAM;GAAW,aAAa;GAAkD,SAAS;GAAO;EAChH;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;;;AC3BF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;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-DZ7IrLAU.cjs");
|
|
3
3
|
const require_shell = require("./shell-7HPrTCJ5.cjs");
|
|
4
|
-
const require_constants = require("./constants-
|
|
4
|
+
const require_constants = require("./constants-D0XHAHeZ.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);
|
|
@@ -89,4 +89,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
|
|
|
89
89
|
//#endregion
|
|
90
90
|
exports.runAgentStart = runAgentStart;
|
|
91
91
|
|
|
92
|
-
//# sourceMappingURL=agent-
|
|
92
|
+
//# sourceMappingURL=agent-BapvKB4r.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-BapvKB4r.cjs","names":["net","process","path","agentDefaults","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\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 const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n // CLI params take priority over process.env; process.env fills in what the CLI didn't specify;\n // agentDefaults are the last resort. Build env as: defaults ← process.env ← CLI.\n const PORT = port !== undefined ? port : (process.env.PORT ?? agentDefaults.port)\n const HOST = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const KUBB_AGENT_CONFIG = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl\n\n const env = {\n ...process.env,\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(styleText('dim', `Host: ${HOST}`))\n clack.log.info(styleText('dim', `Port: ${PORT}`))\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(Number(PORT), HOST))) {\n clack.log.error(styleText('red', `Port ${PORT} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n console.log(env)\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'failed' }))\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAS,gBAAgB,MAAc,MAAgC;AACrE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAASA,SAAAA,QAAI,cAAc;AACjC,SAAO,KAAK,eAAe,QAAQ,MAAM,CAAC;AAC1C,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AACF,SAAO,OAAO,MAAM,KAAK;GACzB;;AAGJ,eAAsB,cAAc,EAAE,MAAM,MAAM,YAAY,YAAY,UAAU,WAA6C;CAC/H,MAAM,UAAUC,aAAQ,QAAQ;AAEhC,KAAI;AAEF,MAAI;AACF,gBAAQ,aAAa;UACf;EAMR,MAAM,gBAAA,GAAA,SAAA,eAAA,EAAA,CAD0B,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAWC,UAAAA,QAAK,QAAQ,aAAa;EAC3C,MAAM,aAAaA,UAAAA,QAAK,KAAK,UAAUC,kBAAAA,cAAc,gBAAgB;EAIrE,MAAM,OAAO,SAAS,KAAA,IAAY,OAAQF,aAAQ,IAAI,QAAQE,kBAAAA,cAAc;EAC5E,MAAM,OAAO,SAASA,kBAAAA,cAAc,OAAO,OAAQF,aAAQ,IAAI,QAAQE,kBAAAA,cAAc;EACrF,MAAM,kBAAkBF,aAAQ,IAAI,mBAAmBA,aAAQ,KAAK;EACpE,MAAM,oBAAoBC,UAAAA,QAAK,QAAQD,aAAQ,KAAK,EAAE,cAAcA,aAAQ,IAAI,qBAAqBE,kBAAAA,cAAc,WAAW;EAC9H,MAAM,yBAAyB,YAAY,aAAa,SAAUF,aAAQ,IAAI,0BAA0B;EACxG,MAAM,uBAAuB,WAAW,SAAUA,aAAQ,IAAI,wBAAwB;EACtF,MAAM,mBAAmBA,aAAQ,IAAI;EACrC,MAAM,2BAA2BA,aAAQ,IAAI,4BAA4BE,kBAAAA,cAAc;EACvF,MAAM,kBAAkBF,aAAQ,IAAI,mBAAmBE,kBAAAA,cAAc;EAErE,MAAM,MAAM;GACV,GAAGF,aAAQ;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAED,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,QAAQ,2BAA2B,CAAC;AAC7D,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,WAAW,oBAAoB,CAAC;AAChE,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,SAAS,OAAO,CAAC;AACjD,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,SAAS,OAAO,CAAC;AACjD,MAAI,CAAC,0BAA0B,CAAC,qBAC9B,gBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,UAAU,0EAA0E,CAAC;AAGhH,MAAI,CAAE,MAAM,gBAAgB,OAAO,KAAK,EAAE,KAAK,EAAG;AAChD,kBAAM,IAAI,OAAA,GAAA,UAAA,WAAgB,OAAO,QAAQ,KAAK,uFAAuF,CAAC;AACtI,gBAAQ,KAAK,EAAE;;AAGjB,UAAQ,IAAI,IAAI;AAGhB,QAAMG,cAAAA,WAAW,QAAQ,CAAC,WAAW,EAAE;GACrC;GACA,KAAKH,aAAQ,KAAK;GACnB,CAAC;AAEF,QAAMI,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACzG,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC/G,iBAAM,IAAI,OAAA,GAAA,UAAA,WAAgB,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,eAAQ,KAAK,EAAE"}
|
|
@@ -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-BF3SMlH6.js";
|
|
3
3
|
import { t as spawnAsync } from "./shell-DqqWsHCD.js";
|
|
4
|
-
import {
|
|
4
|
+
import { o as agentDefaults } from "./constants-DJM9zCXm.js";
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import * as process$1 from "node:process";
|
|
@@ -85,4 +85,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
|
|
|
85
85
|
//#endregion
|
|
86
86
|
export { runAgentStart };
|
|
87
87
|
|
|
88
|
-
//# sourceMappingURL=agent-
|
|
88
|
+
//# sourceMappingURL=agent-CBrpIMMU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-CBrpIMMU.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\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 const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n // CLI params take priority over process.env; process.env fills in what the CLI didn't specify;\n // agentDefaults are the last resort. Build env as: defaults ← process.env ← CLI.\n const PORT = port !== undefined ? port : (process.env.PORT ?? agentDefaults.port)\n const HOST = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const KUBB_AGENT_CONFIG = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl\n\n const env = {\n ...process.env,\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(styleText('dim', `Host: ${HOST}`))\n clack.log.info(styleText('dim', `Port: ${PORT}`))\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(Number(PORT), HOST))) {\n clack.log.error(styleText('red', `Port ${PORT} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n console.log(env)\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'failed' }))\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAS,gBAAgB,MAAc,MAAgC;AACrE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAS,IAAI,cAAc;AACjC,SAAO,KAAK,eAAe,QAAQ,MAAM,CAAC;AAC1C,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AACF,SAAO,OAAO,MAAM,KAAK;GACzB;;AAGJ,eAAsB,cAAc,EAAE,MAAM,MAAM,YAAY,YAAY,UAAU,WAA6C;CAC/H,MAAM,UAAUA,UAAQ,QAAQ;AAEhC,KAAI;AAEF,MAAI;AACF,aAAQ,aAAa;UACf;EAMR,MAAM,eAAe,cADD,OAAO,KAAK,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAW,KAAK,QAAQ,aAAa;EAC3C,MAAM,aAAa,KAAK,KAAK,UAAU,cAAc,gBAAgB;EAIrE,MAAM,OAAO,SAAS,KAAA,IAAY,OAAQA,UAAQ,IAAI,QAAQ,cAAc;EAC5E,MAAM,OAAO,SAAS,cAAc,OAAO,OAAQA,UAAQ,IAAI,QAAQ,cAAc;EACrF,MAAM,kBAAkBA,UAAQ,IAAI,mBAAmBA,UAAQ,KAAK;EACpE,MAAM,oBAAoB,KAAK,QAAQA,UAAQ,KAAK,EAAE,cAAcA,UAAQ,IAAI,qBAAqB,cAAc,WAAW;EAC9H,MAAM,yBAAyB,YAAY,aAAa,SAAUA,UAAQ,IAAI,0BAA0B;EACxG,MAAM,uBAAuB,WAAW,SAAUA,UAAQ,IAAI,wBAAwB;EACtF,MAAM,mBAAmBA,UAAQ,IAAI;EACrC,MAAM,2BAA2BA,UAAQ,IAAI,4BAA4B,cAAc;EACvF,MAAM,kBAAkBA,UAAQ,IAAI,mBAAmB,cAAc;EAErE,MAAM,MAAM;GACV,GAAGA,UAAQ;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAED,QAAM,IAAI,KAAK,UAAU,QAAQ,2BAA2B,CAAC;AAC7D,QAAM,IAAI,KAAK,UAAU,OAAO,WAAW,oBAAoB,CAAC;AAChE,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,OAAO,CAAC;AACjD,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,OAAO,CAAC;AACjD,MAAI,CAAC,0BAA0B,CAAC,qBAC9B,OAAM,IAAI,KAAK,UAAU,UAAU,0EAA0E,CAAC;AAGhH,MAAI,CAAE,MAAM,gBAAgB,OAAO,KAAK,EAAE,KAAK,EAAG;AAChD,SAAM,IAAI,MAAM,UAAU,OAAO,QAAQ,KAAK,uFAAuF,CAAC;AACtI,aAAQ,KAAK,EAAE;;AAGjB,UAAQ,IAAI,IAAI;AAGhB,QAAM,WAAW,QAAQ,CAAC,WAAW,EAAE;GACrC;GACA,KAAKA,UAAQ,KAAK;GACnB,CAAC;AAEF,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACzG,OAAO;AACd,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC/G,QAAM,IAAI,MAAM,UAAU,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,YAAQ,KAAK,EAAE"}
|
|
@@ -1,13 +1,73 @@
|
|
|
1
1
|
//#region src/constants.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* NPM registry endpoint used to check for @kubb/cli updates.
|
|
4
|
+
*/
|
|
3
5
|
const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* OpenTelemetry ingestion endpoint for anonymous usage telemetry.
|
|
8
|
+
*/
|
|
5
9
|
const OTLP_ENDPOINT = "https://otlp.kubb.dev";
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Horizontal rule rendered above/below the plain-logger generation summary.
|
|
12
|
+
*/
|
|
7
13
|
const SUMMARY_SEPARATOR = "─".repeat(27);
|
|
8
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Glob pattern for paths the file watcher ignores.
|
|
16
|
+
*/
|
|
9
17
|
const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
|
|
10
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Flags that short-circuit execution (help/version) — no telemetry notice is shown.
|
|
20
|
+
*/
|
|
21
|
+
const QUITE_FLAGS = new Set([
|
|
22
|
+
"--help",
|
|
23
|
+
"-h",
|
|
24
|
+
"--version",
|
|
25
|
+
"-v"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Flags accepted by the `generate` command.
|
|
29
|
+
*/
|
|
30
|
+
const GENERATE_FLAGS = new Set([
|
|
31
|
+
"--config",
|
|
32
|
+
"-c",
|
|
33
|
+
"--log-level",
|
|
34
|
+
"-l",
|
|
35
|
+
"--watch",
|
|
36
|
+
"-w",
|
|
37
|
+
"--debug",
|
|
38
|
+
"-d",
|
|
39
|
+
"--verbose",
|
|
40
|
+
"-v",
|
|
41
|
+
"--silent",
|
|
42
|
+
"-s"
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Flags accepted by the `validate` command.
|
|
46
|
+
*/
|
|
47
|
+
const VALIDATE_FLAGS = new Set(["--input", "-i"]);
|
|
48
|
+
/**
|
|
49
|
+
* Flags accepted by the `init` command.
|
|
50
|
+
*/
|
|
51
|
+
const INIT_FLAGS = new Set(["--yes", "-y"]);
|
|
52
|
+
/**
|
|
53
|
+
* Flags accepted by the `agent start` command.
|
|
54
|
+
*/
|
|
55
|
+
const AGENT_START_FLAGS = new Set([
|
|
56
|
+
"--config",
|
|
57
|
+
"-c",
|
|
58
|
+
"--port",
|
|
59
|
+
"-p",
|
|
60
|
+
"--host",
|
|
61
|
+
"--allow-write",
|
|
62
|
+
"--allow-all"
|
|
63
|
+
]);
|
|
64
|
+
new Set([
|
|
65
|
+
...QUITE_FLAGS,
|
|
66
|
+
...GENERATE_FLAGS,
|
|
67
|
+
...VALIDATE_FLAGS,
|
|
68
|
+
...INIT_FLAGS,
|
|
69
|
+
...AGENT_START_FLAGS
|
|
70
|
+
]);
|
|
11
71
|
const agentDefaults = {
|
|
12
72
|
port: "3000",
|
|
13
73
|
host: "localhost",
|
|
@@ -16,7 +76,9 @@ const agentDefaults = {
|
|
|
16
76
|
studioUrl: "https://studio.kubb.dev",
|
|
17
77
|
serverEntryPath: ".output/server/index.mjs"
|
|
18
78
|
};
|
|
19
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Default values used during interactive `init` scaffolding.
|
|
81
|
+
*/
|
|
20
82
|
const initDefaults = {
|
|
21
83
|
inputPath: "./openapi.yaml",
|
|
22
84
|
outputPath: "./src/gen",
|
|
@@ -60,7 +122,9 @@ const pluginDefaultConfigs = {
|
|
|
60
122
|
output: { path: 'msw' },
|
|
61
123
|
})`
|
|
62
124
|
};
|
|
63
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Color palette used by randomCliColor() for deterministic plugin name coloring.
|
|
127
|
+
*/
|
|
64
128
|
//#endregion
|
|
65
129
|
Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
|
|
66
130
|
enumerable: true,
|
|
@@ -74,6 +138,12 @@ Object.defineProperty(exports, "OTLP_ENDPOINT", {
|
|
|
74
138
|
return OTLP_ENDPOINT;
|
|
75
139
|
}
|
|
76
140
|
});
|
|
141
|
+
Object.defineProperty(exports, "QUITE_FLAGS", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function() {
|
|
144
|
+
return QUITE_FLAGS;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
77
147
|
Object.defineProperty(exports, "SUMMARY_SEPARATOR", {
|
|
78
148
|
enumerable: true,
|
|
79
149
|
get: function() {
|
|
@@ -105,4 +175,4 @@ Object.defineProperty(exports, "pluginDefaultConfigs", {
|
|
|
105
175
|
}
|
|
106
176
|
});
|
|
107
177
|
|
|
108
|
-
//# sourceMappingURL=constants-
|
|
178
|
+
//# sourceMappingURL=constants-D0XHAHeZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-D0XHAHeZ.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\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 QUITE_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\n/**\n * Flags accepted by the `generate` command.\n */\nexport const GENERATE_FLAGS = new Set(['--config', '-c', '--log-level', '-l', '--watch', '-w', '--debug', '-d', '--verbose', '-v', '--silent', '-s'] as const)\n\n/**\n * Flags accepted by the `validate` command.\n */\nexport const VALIDATE_FLAGS = new Set(['--input', '-i'] as const)\n\n/**\n * Flags accepted by the `init` command.\n */\nexport const INIT_FLAGS = new Set(['--yes', '-y'] as const)\n\n/**\n * Flags accepted by the `agent start` command.\n */\nexport const AGENT_START_FLAGS = new Set(['--config', '-c', '--port', '-p', '--host', '--allow-write', '--allow-all'] as const)\n\n/**\n * All known CLI flags across every command.\n */\nexport const ARGS = new Set([...QUITE_FLAGS, ...GENERATE_FLAGS, ...VALIDATE_FLAGS, ...INIT_FLAGS, ...AGENT_START_FLAGS] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\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-oas', '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-oas': 'pluginOas()',\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-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\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} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;AAGA,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;;;;AAKhF,MAAa,iBAAiB,IAAI,IAAI;CAAC;CAAY;CAAM;CAAe;CAAM;CAAW;CAAM;CAAW;CAAM;CAAa;CAAM;CAAY;CAAK,CAAU;;;;AAK9J,MAAa,iBAAiB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAU;;;;AAKjE,MAAa,aAAa,IAAI,IAAI,CAAC,SAAS,KAAK,CAAU;;;;AAK3D,MAAa,oBAAoB,IAAI,IAAI;CAAC;CAAY;CAAM;CAAU;CAAM;CAAU;CAAiB;CAAc,CAAU;AAK3G,IAAI,IAAI;CAAC,GAAG;CAAa,GAAG;CAAgB,GAAG;CAAgB,GAAG;CAAY,GAAG;CAAkB,CAAU;AAEjI,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,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}
|
|
@@ -1,13 +1,73 @@
|
|
|
1
1
|
//#region src/constants.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* NPM registry endpoint used to check for @kubb/cli updates.
|
|
4
|
+
*/
|
|
3
5
|
const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* OpenTelemetry ingestion endpoint for anonymous usage telemetry.
|
|
8
|
+
*/
|
|
5
9
|
const OTLP_ENDPOINT = "https://otlp.kubb.dev";
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Horizontal rule rendered above/below the plain-logger generation summary.
|
|
12
|
+
*/
|
|
7
13
|
const SUMMARY_SEPARATOR = "─".repeat(27);
|
|
8
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Glob pattern for paths the file watcher ignores.
|
|
16
|
+
*/
|
|
9
17
|
const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
|
|
10
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Flags that short-circuit execution (help/version) — no telemetry notice is shown.
|
|
20
|
+
*/
|
|
21
|
+
const QUITE_FLAGS = new Set([
|
|
22
|
+
"--help",
|
|
23
|
+
"-h",
|
|
24
|
+
"--version",
|
|
25
|
+
"-v"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Flags accepted by the `generate` command.
|
|
29
|
+
*/
|
|
30
|
+
const GENERATE_FLAGS = new Set([
|
|
31
|
+
"--config",
|
|
32
|
+
"-c",
|
|
33
|
+
"--log-level",
|
|
34
|
+
"-l",
|
|
35
|
+
"--watch",
|
|
36
|
+
"-w",
|
|
37
|
+
"--debug",
|
|
38
|
+
"-d",
|
|
39
|
+
"--verbose",
|
|
40
|
+
"-v",
|
|
41
|
+
"--silent",
|
|
42
|
+
"-s"
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Flags accepted by the `validate` command.
|
|
46
|
+
*/
|
|
47
|
+
const VALIDATE_FLAGS = new Set(["--input", "-i"]);
|
|
48
|
+
/**
|
|
49
|
+
* Flags accepted by the `init` command.
|
|
50
|
+
*/
|
|
51
|
+
const INIT_FLAGS = new Set(["--yes", "-y"]);
|
|
52
|
+
/**
|
|
53
|
+
* Flags accepted by the `agent start` command.
|
|
54
|
+
*/
|
|
55
|
+
const AGENT_START_FLAGS = new Set([
|
|
56
|
+
"--config",
|
|
57
|
+
"-c",
|
|
58
|
+
"--port",
|
|
59
|
+
"-p",
|
|
60
|
+
"--host",
|
|
61
|
+
"--allow-write",
|
|
62
|
+
"--allow-all"
|
|
63
|
+
]);
|
|
64
|
+
new Set([
|
|
65
|
+
...QUITE_FLAGS,
|
|
66
|
+
...GENERATE_FLAGS,
|
|
67
|
+
...VALIDATE_FLAGS,
|
|
68
|
+
...INIT_FLAGS,
|
|
69
|
+
...AGENT_START_FLAGS
|
|
70
|
+
]);
|
|
11
71
|
const agentDefaults = {
|
|
12
72
|
port: "3000",
|
|
13
73
|
host: "localhost",
|
|
@@ -16,7 +76,9 @@ const agentDefaults = {
|
|
|
16
76
|
studioUrl: "https://studio.kubb.dev",
|
|
17
77
|
serverEntryPath: ".output/server/index.mjs"
|
|
18
78
|
};
|
|
19
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Default values used during interactive `init` scaffolding.
|
|
81
|
+
*/
|
|
20
82
|
const initDefaults = {
|
|
21
83
|
inputPath: "./openapi.yaml",
|
|
22
84
|
outputPath: "./src/gen",
|
|
@@ -60,8 +122,10 @@ const pluginDefaultConfigs = {
|
|
|
60
122
|
output: { path: 'msw' },
|
|
61
123
|
})`
|
|
62
124
|
};
|
|
63
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Color palette used by randomCliColor() for deterministic plugin name coloring.
|
|
127
|
+
*/
|
|
64
128
|
//#endregion
|
|
65
|
-
export {
|
|
129
|
+
export { WATCHER_IGNORED_PATHS as a, pluginDefaultConfigs as c, SUMMARY_SEPARATOR as i, OTLP_ENDPOINT as n, agentDefaults as o, QUITE_FLAGS as r, initDefaults as s, KUBB_NPM_PACKAGE_URL as t };
|
|
66
130
|
|
|
67
|
-
//# sourceMappingURL=constants-
|
|
131
|
+
//# sourceMappingURL=constants-DJM9zCXm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-DJM9zCXm.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\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 QUITE_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\n/**\n * Flags accepted by the `generate` command.\n */\nexport const GENERATE_FLAGS = new Set(['--config', '-c', '--log-level', '-l', '--watch', '-w', '--debug', '-d', '--verbose', '-v', '--silent', '-s'] as const)\n\n/**\n * Flags accepted by the `validate` command.\n */\nexport const VALIDATE_FLAGS = new Set(['--input', '-i'] as const)\n\n/**\n * Flags accepted by the `init` command.\n */\nexport const INIT_FLAGS = new Set(['--yes', '-y'] as const)\n\n/**\n * Flags accepted by the `agent start` command.\n */\nexport const AGENT_START_FLAGS = new Set(['--config', '-c', '--port', '-p', '--host', '--allow-write', '--allow-all'] as const)\n\n/**\n * All known CLI flags across every command.\n */\nexport const ARGS = new Set([...QUITE_FLAGS, ...GENERATE_FLAGS, ...VALIDATE_FLAGS, ...INIT_FLAGS, ...AGENT_START_FLAGS] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\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-oas', '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-oas': 'pluginOas()',\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-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\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} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;AAGA,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;;;;AAKhF,MAAa,iBAAiB,IAAI,IAAI;CAAC;CAAY;CAAM;CAAe;CAAM;CAAW;CAAM;CAAW;CAAM;CAAa;CAAM;CAAY;CAAK,CAAU;;;;AAK9J,MAAa,iBAAiB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAU;;;;AAKjE,MAAa,aAAa,IAAI,IAAI,CAAC,SAAS,KAAK,CAAU;;;;AAK3D,MAAa,oBAAoB,IAAI,IAAI;CAAC;CAAY;CAAM;CAAU;CAAM;CAAU;CAAiB;CAAc,CAAU;AAK3G,IAAI,IAAI;CAAC,GAAG;CAAa,GAAG;CAAgB,GAAG;CAAgB,GAAG;CAAY,GAAG;CAAkB,CAAU;AAEjI,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,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as toCause, r as toError } from "./errors-6mF_WKxg.js";
|
|
3
|
-
import { a as canUseTTY, i as executeIfOnline, o as isGitHubActions, r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-
|
|
3
|
+
import { a as canUseTTY, i as executeIfOnline, o as isGitHubActions, r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-BF3SMlH6.js";
|
|
4
4
|
import { n as tokenize } from "./shell-DqqWsHCD.js";
|
|
5
|
-
import { t as version } from "./package-
|
|
6
|
-
import {
|
|
5
|
+
import { t as version } from "./package-BKZ0H3Zf.js";
|
|
6
|
+
import { a as WATCHER_IGNORED_PATHS, i as SUMMARY_SEPARATOR, t as KUBB_NPM_PACKAGE_URL } from "./constants-DJM9zCXm.js";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
8
|
import { EventEmitter } from "node:events";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -1456,4 +1456,4 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1456
1456
|
//#endregion
|
|
1457
1457
|
export { runGenerateCommand };
|
|
1458
1458
|
|
|
1459
|
-
//# sourceMappingURL=generate-
|
|
1459
|
+
//# sourceMappingURL=generate-BHNyeQXl.js.map
|