@kubb/cli 5.0.0-alpha.1 → 5.0.0-alpha.11
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-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/{agent-79E3-u7O.cjs → agent-CWjx99b7.cjs} +4 -4
- package/dist/{agent-79E3-u7O.cjs.map → agent-CWjx99b7.cjs.map} +1 -1
- package/dist/{agent-Cp04hn9e.js → agent-Cj8-zyUG.js} +4 -4
- package/dist/{agent-Cp04hn9e.js.map → agent-Cj8-zyUG.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--bVppR6p.cjs → generate-BGSP-yWr.cjs} +2 -2
- package/dist/{generate--bVppR6p.cjs.map → generate-BGSP-yWr.cjs.map} +1 -1
- package/dist/{generate-0eqtALtg.js → generate-CEdqAJKY.js} +24 -33
- package/dist/generate-CEdqAJKY.js.map +1 -0
- package/dist/{generate-CY3dN5fP.cjs → generate-CHXYcc6u.cjs} +23 -32
- package/dist/generate-CHXYcc6u.cjs.map +1 -0
- package/dist/{generate-B7E6fotL.js → generate-pRDRKUm-.js} +2 -2
- package/dist/{generate-B7E6fotL.js.map → generate-pRDRKUm-.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-DxULcUVZ.js → init-DTf3Icbd.js} +3 -3
- package/dist/{init-DxULcUVZ.js.map → init-DTf3Icbd.js.map} +1 -1
- package/dist/{init-D9PIcHv5.cjs → init-Difgj4DR.cjs} +3 -3
- package/dist/{init-D9PIcHv5.cjs.map → init-Difgj4DR.cjs.map} +1 -1
- package/dist/{mcp-CmdDQe1I.cjs → mcp-B0nE_DlL.cjs} +3 -3
- package/dist/{mcp-CmdDQe1I.cjs.map → mcp-B0nE_DlL.cjs.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-C0nP6f7U.js → mcp-DgcnQRu7.js} +3 -3
- package/dist/{mcp-C0nP6f7U.js.map → mcp-DgcnQRu7.js.map} +1 -1
- package/dist/{package-Dj3K_LEj.cjs → package-BMz8d3aM.cjs} +2 -2
- package/dist/package-BMz8d3aM.cjs.map +1 -0
- package/dist/package-BPoYTLqk.js +6 -0
- package/dist/package-BPoYTLqk.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-tj-fCEwB.js → validate-DTllDsSn.js} +3 -3
- package/dist/{validate-tj-fCEwB.js.map → validate-DTllDsSn.js.map} +1 -1
- package/dist/{validate-BugLA3jw.cjs → validate-P6Zttj3f.cjs} +3 -3
- package/dist/{validate-BugLA3jw.cjs.map → validate-P6Zttj3f.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/runners/generate.ts +14 -22
- 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-0eqtALtg.js.map +0 -1
- package/dist/generate-CY3dN5fP.cjs.map +0 -1
- package/dist/package-Dj3K_LEj.cjs.map +0 -1
- package/dist/package-fz4uup_a.js +0 -6
- package/dist/package-fz4uup_a.js.map +0 -1
- package/src/utils/getIntro.ts +0 -1
|
@@ -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,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-BMz8d3aM.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-CWjx99b7.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-CWjx99b7.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
|
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-BPoYTLqk.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-Cj8-zyUG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-Cj8-zyUG.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,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"}
|
|
@@ -50,7 +50,7 @@ const command = require("./define-D6Kfm7-Z.cjs").defineCommand({
|
|
|
50
50
|
},
|
|
51
51
|
async run({ values, positionals }) {
|
|
52
52
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
53
|
-
const { runGenerateCommand } = await Promise.resolve().then(() => require("./generate-
|
|
53
|
+
const { runGenerateCommand } = await Promise.resolve().then(() => require("./generate-CHXYcc6u.cjs"));
|
|
54
54
|
await runGenerateCommand({
|
|
55
55
|
input: positionals[0],
|
|
56
56
|
configPath: values.config,
|
|
@@ -62,4 +62,4 @@ const command = require("./define-D6Kfm7-Z.cjs").defineCommand({
|
|
|
62
62
|
//#endregion
|
|
63
63
|
exports.command = command;
|
|
64
64
|
|
|
65
|
-
//# sourceMappingURL=generate
|
|
65
|
+
//# sourceMappingURL=generate-BGSP-yWr.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate
|
|
1
|
+
{"version":3,"file":"generate-BGSP-yWr.cjs","names":["defineCommand"],"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: { type: 'string', description: 'Path to the Kubb config', short: 'c' },\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: { type: 'boolean', description: 'Watch mode based on the input file', short: 'w', default: false },\n debug: { type: 'boolean', description: 'Override logLevel to debug', short: 'd', default: false },\n verbose: { type: 'boolean', description: 'Override logLevel to verbose', short: 'v', default: false },\n silent: { type: 'boolean', description: 'Override logLevel to silent', short: 's', default: false },\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({ input: positionals[0], configPath: values.config, logLevel, watch: values.watch })\n },\n})\n"],"mappings":";;AAEA,MAAa,2CAAUA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,WAAW,CAAC,UAAU;CACtB,SAAS;EACP,QAAQ;GAAE,MAAM;GAAU,aAAa;GAA2B,OAAO;GAAK;EAC9E,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GAAE,MAAM;GAAW,aAAa;GAAsC,OAAO;GAAK,SAAS;GAAO;EACzG,OAAO;GAAE,MAAM;GAAW,aAAa;GAA8B,OAAO;GAAK,SAAS;GAAO;EACjG,SAAS;GAAE,MAAM;GAAW,aAAa;GAAgC,OAAO;GAAK,SAAS;GAAO;EACrG,QAAQ;GAAE,MAAM;GAAW,aAAa;GAA+B,OAAO;GAAK,SAAS;GAAO;EACpG;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,uBAAuB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAErC,QAAM,mBAAmB;GAAE,OAAO,YAAY;GAAI,YAAY,OAAO;GAAQ;GAAU,OAAO,OAAO;GAAO,CAAC;;CAEhH,CAAC"}
|
|
@@ -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-BPoYTLqk.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";
|
|
@@ -12,7 +12,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
12
12
|
import path, { dirname, relative, resolve } from "node:path";
|
|
13
13
|
import process$1 from "node:process";
|
|
14
14
|
import * as clack from "@clack/prompts";
|
|
15
|
-
import {
|
|
15
|
+
import { defineLogger, detectFormatter, detectLinter, formatters, getConfigs, isInputPath, linters, logLevel, safeBuild, setup } from "@kubb/core";
|
|
16
16
|
import { NonZeroExitError, x } from "tinyexec";
|
|
17
17
|
import { Writable } from "node:stream";
|
|
18
18
|
import { cosmiconfig } from "cosmiconfig";
|
|
@@ -1316,7 +1316,7 @@ async function generate({ input, config: userConfig, events, logLevel: logLevel$
|
|
|
1316
1316
|
};
|
|
1317
1317
|
await events.emit("generation:start", config);
|
|
1318
1318
|
await events.emit("info", config.name ? `Setup generation ${styleText("bold", config.name)}` : "Setup generation", inputPath);
|
|
1319
|
-
const { sources, fabric,
|
|
1319
|
+
const { sources, fabric, driver } = await setup({
|
|
1320
1320
|
config,
|
|
1321
1321
|
events
|
|
1322
1322
|
});
|
|
@@ -1325,7 +1325,7 @@ async function generate({ input, config: userConfig, events, logLevel: logLevel$
|
|
|
1325
1325
|
config,
|
|
1326
1326
|
events
|
|
1327
1327
|
}, {
|
|
1328
|
-
|
|
1328
|
+
driver,
|
|
1329
1329
|
fabric,
|
|
1330
1330
|
events,
|
|
1331
1331
|
sources
|
|
@@ -1345,7 +1345,7 @@ async function generate({ input, config: userConfig, events, logLevel: logLevel$
|
|
|
1345
1345
|
await sendTelemetry(buildTelemetryEvent({
|
|
1346
1346
|
command: "generate",
|
|
1347
1347
|
kubbVersion: version,
|
|
1348
|
-
plugins:
|
|
1348
|
+
plugins: driver.plugins.map((p) => ({
|
|
1349
1349
|
name: p.name,
|
|
1350
1350
|
options: p.options
|
|
1351
1351
|
})),
|
|
@@ -1404,7 +1404,7 @@ async function generate({ input, config: userConfig, events, logLevel: logLevel$
|
|
|
1404
1404
|
await sendTelemetry(buildTelemetryEvent({
|
|
1405
1405
|
command: "generate",
|
|
1406
1406
|
kubbVersion: version,
|
|
1407
|
-
plugins:
|
|
1407
|
+
plugins: driver.plugins.map((p) => ({
|
|
1408
1408
|
name: p.name,
|
|
1409
1409
|
options: p.options
|
|
1410
1410
|
})),
|
|
@@ -1416,7 +1416,6 @@ async function generate({ input, config: userConfig, events, logLevel: logLevel$
|
|
|
1416
1416
|
async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, watch }) {
|
|
1417
1417
|
const logLevel$3 = logLevel[logLevelKey] ?? logLevel.info;
|
|
1418
1418
|
const events = new AsyncEventEmitter();
|
|
1419
|
-
const promiseManager = new PromiseManager();
|
|
1420
1419
|
await setupLogger(events, { logLevel: logLevel$3 });
|
|
1421
1420
|
await executeIfOnline(async () => {
|
|
1422
1421
|
try {
|
|
@@ -1432,30 +1431,22 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1432
1431
|
await events.emit("success", "Config loaded successfully", path.relative(process$1.cwd(), result.filepath));
|
|
1433
1432
|
await events.emit("config:end", configs);
|
|
1434
1433
|
await events.emit("lifecycle:start", version);
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
await generate({
|
|
1451
|
-
input,
|
|
1452
|
-
config,
|
|
1453
|
-
logLevel: logLevel$3,
|
|
1454
|
-
events
|
|
1455
|
-
});
|
|
1456
|
-
};
|
|
1434
|
+
for (const config of configs) if (isInputPath(config) && watch) await startWatcher([input || config.input.path], async (paths) => {
|
|
1435
|
+
events.removeAll();
|
|
1436
|
+
await generate({
|
|
1437
|
+
input,
|
|
1438
|
+
config,
|
|
1439
|
+
logLevel: logLevel$3,
|
|
1440
|
+
events
|
|
1441
|
+
});
|
|
1442
|
+
clack.log.step(styleText("yellow", `Watching for changes in ${paths.join(" and ")}`));
|
|
1443
|
+
});
|
|
1444
|
+
else await generate({
|
|
1445
|
+
input,
|
|
1446
|
+
config,
|
|
1447
|
+
logLevel: logLevel$3,
|
|
1448
|
+
events
|
|
1457
1449
|
});
|
|
1458
|
-
await promiseManager.run("seq", promises);
|
|
1459
1450
|
await events.emit("lifecycle:end");
|
|
1460
1451
|
} catch (error) {
|
|
1461
1452
|
await events.emit("error", toError(error));
|
|
@@ -1465,4 +1456,4 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1465
1456
|
//#endregion
|
|
1466
1457
|
export { runGenerateCommand };
|
|
1467
1458
|
|
|
1468
|
-
//# sourceMappingURL=generate-
|
|
1459
|
+
//# sourceMappingURL=generate-CEdqAJKY.js.map
|