@kubb/cli 5.0.0-beta.5 → 5.0.0-beta.7

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.
Files changed (150) hide show
  1. package/README.md +177 -26
  2. package/dist/agent-DN7o8nlE.js +68 -0
  3. package/dist/agent-DN7o8nlE.js.map +1 -0
  4. package/dist/agent-Fm9_8BBH.cjs +70 -0
  5. package/dist/agent-Fm9_8BBH.cjs.map +1 -0
  6. package/dist/{chunk--u3MIqq1.js → chunk-BvFE5Tac.js} +1 -0
  7. package/dist/constants-B2JTeRBb.js +42 -0
  8. package/dist/constants-B2JTeRBb.js.map +1 -0
  9. package/dist/constants-BINTA5VZ.cjs +77 -0
  10. package/dist/constants-BINTA5VZ.cjs.map +1 -0
  11. package/dist/constants-BYGmiFs0.cjs +139 -0
  12. package/dist/constants-BYGmiFs0.cjs.map +1 -0
  13. package/dist/constants-DSJ-Xrbv.js +116 -0
  14. package/dist/constants-DSJ-Xrbv.js.map +1 -0
  15. package/dist/define-Bdn8j5VM.cjs.map +1 -1
  16. package/dist/{define-Ctii4bel.js → define-m_fp-Aqm.js} +2 -2
  17. package/dist/{define-Ctii4bel.js.map → define-m_fp-Aqm.js.map} +1 -1
  18. package/dist/{errors-CjPmyZHy.js → errors-CINO1EIv.js} +2 -2
  19. package/dist/{errors-CjPmyZHy.js.map → errors-CINO1EIv.js.map} +1 -1
  20. package/dist/errors-CLCjoSg0.cjs.map +1 -1
  21. package/dist/{generate-BqeFFQGD.js → generate-BY-juRdH.js} +12 -6
  22. package/dist/generate-BY-juRdH.js.map +1 -0
  23. package/dist/{generate-7td_hs73.cjs → generate-Bod9YCbF.cjs} +10 -4
  24. package/dist/generate-Bod9YCbF.cjs.map +1 -0
  25. package/dist/index.cjs +20 -11
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +22 -13
  29. package/dist/index.js.map +1 -1
  30. package/dist/init-BIkZU6mB.cjs +53 -0
  31. package/dist/init-BIkZU6mB.cjs.map +1 -0
  32. package/dist/init-Cs3Fp6nN.js +53 -0
  33. package/dist/init-Cs3Fp6nN.js.map +1 -0
  34. package/dist/mcp-BSNulBcC.js +39 -0
  35. package/dist/mcp-BSNulBcC.js.map +1 -0
  36. package/dist/mcp-DcSrFhhP.cjs +39 -0
  37. package/dist/mcp-DcSrFhhP.cjs.map +1 -0
  38. package/dist/package-D5wmvFl4.js +6 -0
  39. package/dist/package-D5wmvFl4.js.map +1 -0
  40. package/dist/{package-BmYRU2hz.cjs → package-DrUndPET.cjs} +2 -2
  41. package/dist/package-DrUndPET.cjs.map +1 -0
  42. package/dist/{generate-DVmGtwWe.js → run-BAJubgdA.js} +298 -315
  43. package/dist/run-BAJubgdA.js.map +1 -0
  44. package/dist/{agent-IP0eLV3C.js → run-BzpYYOQs.js} +46 -43
  45. package/dist/run-BzpYYOQs.js.map +1 -0
  46. package/dist/run-CCZ24VKk.js +51 -0
  47. package/dist/run-CCZ24VKk.js.map +1 -0
  48. package/dist/{init-Cag3082g.js → run-CF97BWVa.js} +102 -147
  49. package/dist/run-CF97BWVa.js.map +1 -0
  50. package/dist/run-CQbj3ley.cjs +52 -0
  51. package/dist/run-CQbj3ley.cjs.map +1 -0
  52. package/dist/{generate-CUd1dUY5.cjs → run-CqKd6JNc.cjs} +295 -312
  53. package/dist/run-CqKd6JNc.cjs.map +1 -0
  54. package/dist/run-D0hmRpHy.js +49 -0
  55. package/dist/run-D0hmRpHy.js.map +1 -0
  56. package/dist/{agent-CS45W0kL.cjs → run-DwdAwnLG.cjs} +44 -41
  57. package/dist/run-DwdAwnLG.cjs.map +1 -0
  58. package/dist/{mcp-BfORW-mY.cjs → run-Lr0Ctnu0.cjs} +24 -21
  59. package/dist/run-Lr0Ctnu0.cjs.map +1 -0
  60. package/dist/{init-C5sZulT6.cjs → run-YsoCk5we.cjs} +100 -145
  61. package/dist/run-YsoCk5we.cjs.map +1 -0
  62. package/dist/shell-475fQKaX.cjs.map +1 -1
  63. package/dist/{shell-DLzN4fRo.js → shell-CN6DNqeC.js} +2 -2
  64. package/dist/{shell-DLzN4fRo.js.map → shell-CN6DNqeC.js.map} +1 -1
  65. package/dist/{telemetry-BU25EoI-.cjs → telemetry-B2iWkY5e.cjs} +5 -7
  66. package/dist/telemetry-B2iWkY5e.cjs.map +1 -0
  67. package/dist/{telemetry-CaNU4-Bf.js → telemetry-BkektVz6.js} +6 -8
  68. package/dist/telemetry-BkektVz6.js.map +1 -0
  69. package/dist/validate-Bfpf_UIh.cjs +26 -0
  70. package/dist/validate-Bfpf_UIh.cjs.map +1 -0
  71. package/dist/validate-lbUkWQ5o.js +26 -0
  72. package/dist/validate-lbUkWQ5o.js.map +1 -0
  73. package/package.json +12 -12
  74. package/src/commands/agent/start.ts +10 -7
  75. package/src/commands/agent.ts +3 -1
  76. package/src/commands/generate.ts +5 -3
  77. package/src/commands/init.ts +34 -3
  78. package/src/commands/mcp.ts +28 -4
  79. package/src/commands/validate.ts +6 -4
  80. package/src/constants.ts +1 -57
  81. package/src/index.ts +5 -3
  82. package/src/loggers/clackLogger.ts +45 -43
  83. package/src/loggers/fileSystemLogger.ts +11 -1
  84. package/src/loggers/githubActionsLogger.ts +13 -25
  85. package/src/loggers/plainLogger.ts +12 -23
  86. package/src/loggers/types.ts +6 -0
  87. package/src/loggers/utils.ts +155 -9
  88. package/src/runners/agent/run.ts +113 -0
  89. package/src/runners/agent/utils.ts +98 -0
  90. package/src/runners/generate/run.ts +276 -0
  91. package/src/runners/generate/utils.ts +209 -0
  92. package/src/runners/init/run.ts +211 -0
  93. package/src/{utils/packageManager.ts → runners/init/utils.ts} +10 -0
  94. package/src/runners/mcp/run.ts +55 -0
  95. package/src/runners/validate/run.ts +63 -0
  96. package/src/{utils/telemetry.ts → telemetry.ts} +12 -5
  97. package/dist/agent-BcUEl9yB.js +0 -56
  98. package/dist/agent-BcUEl9yB.js.map +0 -1
  99. package/dist/agent-CS45W0kL.cjs.map +0 -1
  100. package/dist/agent-CsMvXeqI.cjs +0 -58
  101. package/dist/agent-CsMvXeqI.cjs.map +0 -1
  102. package/dist/agent-IP0eLV3C.js.map +0 -1
  103. package/dist/constants-B4iBDvCe.cjs +0 -148
  104. package/dist/constants-B4iBDvCe.cjs.map +0 -1
  105. package/dist/constants-DmPrkaz8.js +0 -95
  106. package/dist/constants-DmPrkaz8.js.map +0 -1
  107. package/dist/generate-7td_hs73.cjs.map +0 -1
  108. package/dist/generate-BqeFFQGD.js.map +0 -1
  109. package/dist/generate-CUd1dUY5.cjs.map +0 -1
  110. package/dist/generate-DVmGtwWe.js.map +0 -1
  111. package/dist/init-C5sZulT6.cjs.map +0 -1
  112. package/dist/init-Cag3082g.js.map +0 -1
  113. package/dist/init-CfAn19gC.js +0 -25
  114. package/dist/init-CfAn19gC.js.map +0 -1
  115. package/dist/init-CfsYoyGe.cjs +0 -25
  116. package/dist/init-CfsYoyGe.cjs.map +0 -1
  117. package/dist/mcp-BfORW-mY.cjs.map +0 -1
  118. package/dist/mcp-BtOV6acy.js +0 -16
  119. package/dist/mcp-BtOV6acy.js.map +0 -1
  120. package/dist/mcp-CIbuLGMx.cjs +0 -16
  121. package/dist/mcp-CIbuLGMx.cjs.map +0 -1
  122. package/dist/mcp-DtQ5o0On.js +0 -46
  123. package/dist/mcp-DtQ5o0On.js.map +0 -1
  124. package/dist/package-BmYRU2hz.cjs.map +0 -1
  125. package/dist/package-DBU5ii-k.js +0 -6
  126. package/dist/package-DBU5ii-k.js.map +0 -1
  127. package/dist/telemetry-BU25EoI-.cjs.map +0 -1
  128. package/dist/telemetry-CaNU4-Bf.js.map +0 -1
  129. package/dist/validate-CQqM9siF.js +0 -25
  130. package/dist/validate-CQqM9siF.js.map +0 -1
  131. package/dist/validate-DBXLaLIn.cjs +0 -34
  132. package/dist/validate-DBXLaLIn.cjs.map +0 -1
  133. package/dist/validate-DI23zgmL.js +0 -33
  134. package/dist/validate-DI23zgmL.js.map +0 -1
  135. package/dist/validate-DwX4LzYq.cjs +0 -25
  136. package/dist/validate-DwX4LzYq.cjs.map +0 -1
  137. package/src/runners/agent.ts +0 -155
  138. package/src/runners/generate.ts +0 -333
  139. package/src/runners/init.ts +0 -296
  140. package/src/runners/mcp.ts +0 -51
  141. package/src/runners/validate.ts +0 -39
  142. package/src/types.ts +0 -11
  143. package/src/utils/Writables.ts +0 -17
  144. package/src/utils/executeHooks.ts +0 -45
  145. package/src/utils/flags.ts +0 -9
  146. package/src/utils/getConfig.ts +0 -10
  147. package/src/utils/getCosmiConfig.ts +0 -75
  148. package/src/utils/getSummary.ts +0 -68
  149. package/src/utils/runHook.ts +0 -91
  150. package/src/utils/watcher.ts +0 -19
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-CS45W0kL.cjs","names":["process","agentDefaults","path","net","spawnAsync","sendTelemetry","buildTelemetryEvent"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/agent package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/agent'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/agent'))\n console.error('')\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,SAAS,6BAA6B,EAAE,MAAM,MAAM,YAAY,YAAY,YAA+E;CACzJ,MAAM,eAAe,QAAQA,aAAQ,IAAI,QAAQC,kBAAAA,cAAc;CAC/D,MAAM,eAAe,SAASA,kBAAAA,cAAc,OA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Q,CAAC,WAAW,EAAE;GACrC,KAAK,YAAY;GACjB,KAAKJ,aAAQ,KAAK;GACnB,CAAC;AAEF,QAAMK,kBAAAA,cACJC,kBAAAA,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;UACM,OAAO;AACd,QAAMD,kBAAAA,cACJC,kBAAAA,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,iBAAM,IAAI,OAAA,GAAA,UAAA,WAAgB,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,eAAQ,KAAK,EAAE"}
@@ -1,58 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-Bdn8j5VM.cjs");
3
- const require_package = require("./package-BmYRU2hz.cjs");
4
- const require_constants = require("./constants-B4iBDvCe.cjs");
5
- //#region src/commands/agent/start.ts
6
- const command$1 = require_define.defineCommand({
7
- name: "start",
8
- description: "Start the Agent server",
9
- options: {
10
- config: {
11
- type: "string",
12
- description: "Path to the Kubb config",
13
- short: "c"
14
- },
15
- port: {
16
- type: "string",
17
- description: `Port for the server (default: ${require_constants.agentDefaults.port})`,
18
- short: "p"
19
- },
20
- host: {
21
- type: "string",
22
- description: "Host for the server",
23
- default: require_constants.agentDefaults.host
24
- },
25
- "allow-write": {
26
- type: "boolean",
27
- description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
28
- default: false
29
- },
30
- "allow-all": {
31
- type: "boolean",
32
- description: "Grant all permissions (implies --allow-write).",
33
- default: false
34
- }
35
- },
36
- async run({ values }) {
37
- const { runAgentStart } = await Promise.resolve().then(() => require("./agent-CS45W0kL.cjs"));
38
- await runAgentStart({
39
- port: values.port !== void 0 ? values.port : void 0,
40
- host: values.host,
41
- configPath: values.config,
42
- allowWrite: values["allow-write"],
43
- allowAll: values["allow-all"],
44
- version: require_package.version
45
- });
46
- }
47
- });
48
- //#endregion
49
- //#region src/commands/agent.ts
50
- const command = require_define.defineCommand({
51
- name: "agent",
52
- description: "Manage the Kubb Agent server",
53
- subCommands: [command$1]
54
- });
55
- //#endregion
56
- exports.command = command;
57
-
58
- //# sourceMappingURL=agent-CsMvXeqI.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-CsMvXeqI.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GACjE,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-IP0eLV3C.js","names":["process"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/agent package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/agent'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/agent'))\n console.error('')\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAS,6BAA6B,EAAE,MAAM,MAAM,YAAY,YAAY,YAA+E;CACzJ,MAAM,eAAe,QAAQA,UAAQ,IA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AAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,QAAM,IAAI,MAAM,UAAU,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,YAAQ,KAAK,EAAE"}
@@ -1,148 +0,0 @@
1
- //#region src/constants.ts
2
- /**
3
- * Default filename for the Kubb configuration file.
4
- *
5
- * Used by the `init` command when scaffolding new projects and by the `agent` default config.
6
- */
7
- const KUBB_CONFIG_FILENAME = "kubb.config.ts";
8
- /**
9
- * NPM registry endpoint used to check for @kubb/cli updates.
10
- */
11
- const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
12
- /**
13
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
14
- */
15
- const OTLP_ENDPOINT = "https://otlp.kubb.dev";
16
- /**
17
- * Horizontal rule rendered above/below the plain-logger generation summary.
18
- */
19
- const SUMMARY_SEPARATOR = "─".repeat(27);
20
- /**
21
- * Glob pattern for paths the file watcher ignores.
22
- */
23
- const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
24
- /**
25
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
26
- */
27
- const QUIET_FLAGS = new Set([
28
- "--help",
29
- "-h",
30
- "--version",
31
- "-v"
32
- ]);
33
- const agentDefaults = {
34
- port: "3000",
35
- host: "localhost",
36
- configFile: KUBB_CONFIG_FILENAME,
37
- retryTimeout: "30000",
38
- studioUrl: "https://kubb.studio",
39
- /**
40
- * Relative path from the @kubb/agent package root to the server entry.
41
- */
42
- serverEntryPath: ".output/server/index.mjs"
43
- };
44
- /**
45
- * Default values used during interactive `init` scaffolding.
46
- */
47
- const initDefaults = {
48
- inputPath: "./openapi.yaml",
49
- outputPath: "./src/gen",
50
- plugins: ["plugin-ts"]
51
- };
52
- /**
53
- * Maps each plugin value to the default config snippet inserted by `init`.
54
- * The `satisfies` constraint ensures all values remain plain strings while
55
- * `as const` keeps the object deeply immutable.
56
- */
57
- const pluginDefaultConfigs = {
58
- "plugin-ts": `pluginTs({
59
- output: { path: 'models' },
60
- })`,
61
- "plugin-client": `pluginClient({
62
- output: { path: 'clients' },
63
- })`,
64
- "plugin-react-query": `pluginReactQuery({
65
- output: { path: 'hooks' },
66
- })`,
67
- "plugin-vue-query": `pluginVueQuery({
68
- output: { path: 'hooks' },
69
- })`,
70
- "plugin-zod": `pluginZod({
71
- output: { path: 'zod' },
72
- })`,
73
- "plugin-faker": `pluginFaker({
74
- output: { path: 'mocks' },
75
- })`,
76
- "plugin-msw": `pluginMsw({
77
- output: { path: 'msw' },
78
- })`,
79
- "plugin-cypress": `pluginCypress({
80
- output: { path: 'cypress' },
81
- })`,
82
- "plugin-mcp": `pluginMcp({
83
- output: { path: 'mcp' },
84
- })`,
85
- "plugin-redoc": `pluginRedoc({
86
- output: { path: 'redoc' },
87
- })`
88
- };
89
- /**
90
- * Color palette used by randomCliColor() for deterministic plugin name coloring.
91
- */
92
- //#endregion
93
- Object.defineProperty(exports, "KUBB_CONFIG_FILENAME", {
94
- enumerable: true,
95
- get: function() {
96
- return KUBB_CONFIG_FILENAME;
97
- }
98
- });
99
- Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
100
- enumerable: true,
101
- get: function() {
102
- return KUBB_NPM_PACKAGE_URL;
103
- }
104
- });
105
- Object.defineProperty(exports, "OTLP_ENDPOINT", {
106
- enumerable: true,
107
- get: function() {
108
- return OTLP_ENDPOINT;
109
- }
110
- });
111
- Object.defineProperty(exports, "QUIET_FLAGS", {
112
- enumerable: true,
113
- get: function() {
114
- return QUIET_FLAGS;
115
- }
116
- });
117
- Object.defineProperty(exports, "SUMMARY_SEPARATOR", {
118
- enumerable: true,
119
- get: function() {
120
- return SUMMARY_SEPARATOR;
121
- }
122
- });
123
- Object.defineProperty(exports, "WATCHER_IGNORED_PATHS", {
124
- enumerable: true,
125
- get: function() {
126
- return WATCHER_IGNORED_PATHS;
127
- }
128
- });
129
- Object.defineProperty(exports, "agentDefaults", {
130
- enumerable: true,
131
- get: function() {
132
- return agentDefaults;
133
- }
134
- });
135
- Object.defineProperty(exports, "initDefaults", {
136
- enumerable: true,
137
- get: function() {
138
- return initDefaults;
139
- }
140
- });
141
- Object.defineProperty(exports, "pluginDefaultConfigs", {
142
- enumerable: true,
143
- get: function() {
144
- return pluginDefaultConfigs;
145
- }
146
- });
147
-
148
- //# sourceMappingURL=constants-B4iBDvCe.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-B4iBDvCe.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Default filename for the Kubb configuration file.\n *\n * Used by the `init` command when scaffolding new projects and by the `agent` default config.\n */\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://kubb.studio',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/**\n * Default values used during interactive `init` scaffolding.\n */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB;;;;AAKD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;;;;;;AAOD,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
@@ -1,95 +0,0 @@
1
- //#region src/constants.ts
2
- /**
3
- * Default filename for the Kubb configuration file.
4
- *
5
- * Used by the `init` command when scaffolding new projects and by the `agent` default config.
6
- */
7
- const KUBB_CONFIG_FILENAME = "kubb.config.ts";
8
- /**
9
- * NPM registry endpoint used to check for @kubb/cli updates.
10
- */
11
- const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
12
- /**
13
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
14
- */
15
- const OTLP_ENDPOINT = "https://otlp.kubb.dev";
16
- /**
17
- * Horizontal rule rendered above/below the plain-logger generation summary.
18
- */
19
- const SUMMARY_SEPARATOR = "─".repeat(27);
20
- /**
21
- * Glob pattern for paths the file watcher ignores.
22
- */
23
- const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
24
- /**
25
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
26
- */
27
- const QUIET_FLAGS = new Set([
28
- "--help",
29
- "-h",
30
- "--version",
31
- "-v"
32
- ]);
33
- const agentDefaults = {
34
- port: "3000",
35
- host: "localhost",
36
- configFile: KUBB_CONFIG_FILENAME,
37
- retryTimeout: "30000",
38
- studioUrl: "https://kubb.studio",
39
- /**
40
- * Relative path from the @kubb/agent package root to the server entry.
41
- */
42
- serverEntryPath: ".output/server/index.mjs"
43
- };
44
- /**
45
- * Default values used during interactive `init` scaffolding.
46
- */
47
- const initDefaults = {
48
- inputPath: "./openapi.yaml",
49
- outputPath: "./src/gen",
50
- plugins: ["plugin-ts"]
51
- };
52
- /**
53
- * Maps each plugin value to the default config snippet inserted by `init`.
54
- * The `satisfies` constraint ensures all values remain plain strings while
55
- * `as const` keeps the object deeply immutable.
56
- */
57
- const pluginDefaultConfigs = {
58
- "plugin-ts": `pluginTs({
59
- output: { path: 'models' },
60
- })`,
61
- "plugin-client": `pluginClient({
62
- output: { path: 'clients' },
63
- })`,
64
- "plugin-react-query": `pluginReactQuery({
65
- output: { path: 'hooks' },
66
- })`,
67
- "plugin-vue-query": `pluginVueQuery({
68
- output: { path: 'hooks' },
69
- })`,
70
- "plugin-zod": `pluginZod({
71
- output: { path: 'zod' },
72
- })`,
73
- "plugin-faker": `pluginFaker({
74
- output: { path: 'mocks' },
75
- })`,
76
- "plugin-msw": `pluginMsw({
77
- output: { path: 'msw' },
78
- })`,
79
- "plugin-cypress": `pluginCypress({
80
- output: { path: 'cypress' },
81
- })`,
82
- "plugin-mcp": `pluginMcp({
83
- output: { path: 'mcp' },
84
- })`,
85
- "plugin-redoc": `pluginRedoc({
86
- output: { path: 'redoc' },
87
- })`
88
- };
89
- /**
90
- * Color palette used by randomCliColor() for deterministic plugin name coloring.
91
- */
92
- //#endregion
93
- export { SUMMARY_SEPARATOR as a, initDefaults as c, QUIET_FLAGS as i, pluginDefaultConfigs as l, KUBB_NPM_PACKAGE_URL as n, WATCHER_IGNORED_PATHS as o, OTLP_ENDPOINT as r, agentDefaults as s, KUBB_CONFIG_FILENAME as t };
94
-
95
- //# sourceMappingURL=constants-DmPrkaz8.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-DmPrkaz8.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Default filename for the Kubb configuration file.\n *\n * Used by the `init` command when scaffolding new projects and by the `agent` default config.\n */\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://kubb.studio',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/**\n * Default values used during interactive `init` scaffolding.\n */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB;;;;AAKD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;;;;;;AAOD,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-7td_hs73.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: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { runGenerateCommand } = await import('../runners/generate.ts')\n\n await runGenerateCommand({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;AAEA,MAAa,0CAAUA,CAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,WAAW,CAAC,UAAU;CACtB,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,uBAAuB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAErC,QAAM,mBAAmB;GACvB,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-BqeFFQGD.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n arguments: ['[input]'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { runGenerateCommand } = await import('../runners/generate.ts')\n\n await runGenerateCommand({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;;AAEA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,WAAW,CAAC,UAAU;CACtB,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,uBAAuB,MAAM,OAAO;AAE5C,QAAM,mBAAmB;GACvB,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}