@kubb/cli 5.0.0-beta.1 → 5.0.0-beta.100

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 (148) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +171 -51
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-7z2tIqPm.js +282 -0
  5. package/dist/Telemetry-7z2tIqPm.js.map +1 -0
  6. package/dist/Telemetry-xcWb-UWT.cjs +331 -0
  7. package/dist/Telemetry-xcWb-UWT.cjs.map +1 -0
  8. package/dist/{errors-CjPmyZHy.js → errors-CMvLO2NE.js} +3 -15
  9. package/dist/{errors-CjPmyZHy.js.map → errors-CMvLO2NE.js.map} +1 -1
  10. package/dist/{errors-CLCjoSg0.cjs → errors-DNxBUo3k.cjs} +2 -20
  11. package/dist/{errors-CLCjoSg0.cjs.map → errors-DNxBUo3k.cjs.map} +1 -1
  12. package/dist/generate-dIcWEfOA.cjs +95 -0
  13. package/dist/generate-dIcWEfOA.cjs.map +1 -0
  14. package/dist/generate-nPLBd69v.js +95 -0
  15. package/dist/generate-nPLBd69v.js.map +1 -0
  16. package/dist/index.cjs +33 -252
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +6 -2
  19. package/dist/index.js +34 -253
  20. package/dist/index.js.map +1 -1
  21. package/dist/init-6h3K2syO.cjs +52 -0
  22. package/dist/init-6h3K2syO.cjs.map +1 -0
  23. package/dist/init-CNV6OC7m.js +53 -0
  24. package/dist/init-CNV6OC7m.js.map +1 -0
  25. package/dist/mcp-BzPiZA36.js +21 -0
  26. package/dist/mcp-BzPiZA36.js.map +1 -0
  27. package/dist/mcp-CmxnIZku.cjs +20 -0
  28. package/dist/mcp-CmxnIZku.cjs.map +1 -0
  29. package/dist/package-By3tigpl.js +6 -0
  30. package/dist/package-By3tigpl.js.map +1 -0
  31. package/dist/{package-Cdo6lNjF.cjs → package-CImfPtTH.cjs} +2 -2
  32. package/dist/package-CImfPtTH.cjs.map +1 -0
  33. package/dist/run-BJhB7Qer.js +306 -0
  34. package/dist/run-BJhB7Qer.js.map +1 -0
  35. package/dist/run-BdtVrLKu.cjs +46 -0
  36. package/dist/run-BdtVrLKu.cjs.map +1 -0
  37. package/dist/run-CaOjZRiQ.js +45 -0
  38. package/dist/run-CaOjZRiQ.js.map +1 -0
  39. package/dist/run-D-gAS1Vq.js +1264 -0
  40. package/dist/run-D-gAS1Vq.js.map +1 -0
  41. package/dist/run-DAHp52w3.js +33 -0
  42. package/dist/run-DAHp52w3.js.map +1 -0
  43. package/dist/run-DaVewTtW.cjs +310 -0
  44. package/dist/run-DaVewTtW.cjs.map +1 -0
  45. package/dist/run-HUVxfpGj.cjs +1267 -0
  46. package/dist/run-HUVxfpGj.cjs.map +1 -0
  47. package/dist/run-iidDikJH.cjs +34 -0
  48. package/dist/run-iidDikJH.cjs.map +1 -0
  49. package/dist/tools-CzgGQa64.cjs +175 -0
  50. package/dist/tools-CzgGQa64.cjs.map +1 -0
  51. package/dist/tools-DH1a7ZJH.js +152 -0
  52. package/dist/tools-DH1a7ZJH.js.map +1 -0
  53. package/dist/validate-BUw6PkPp.js +25 -0
  54. package/dist/validate-BUw6PkPp.js.map +1 -0
  55. package/dist/validate-DMfyLIta.cjs +24 -0
  56. package/dist/validate-DMfyLIta.cjs.map +1 -0
  57. package/package.json +24 -30
  58. package/dist/agent-B_pirbeB.cjs +0 -116
  59. package/dist/agent-B_pirbeB.cjs.map +0 -1
  60. package/dist/agent-CUmEyiqY.cjs +0 -58
  61. package/dist/agent-CUmEyiqY.cjs.map +0 -1
  62. package/dist/agent-Ev5hU5hH.js +0 -112
  63. package/dist/agent-Ev5hU5hH.js.map +0 -1
  64. package/dist/agent-v_2S-bnN.js +0 -56
  65. package/dist/agent-v_2S-bnN.js.map +0 -1
  66. package/dist/constants-CnDXa1R6.cjs +0 -148
  67. package/dist/constants-CnDXa1R6.cjs.map +0 -1
  68. package/dist/constants-aL3CP_Wq.js +0 -95
  69. package/dist/constants-aL3CP_Wq.js.map +0 -1
  70. package/dist/define-Bdn8j5VM.cjs +0 -54
  71. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  72. package/dist/define-Ctii4bel.js +0 -43
  73. package/dist/define-Ctii4bel.js.map +0 -1
  74. package/dist/generate-BaJRhbCS.js +0 -66
  75. package/dist/generate-BaJRhbCS.js.map +0 -1
  76. package/dist/generate-CuxArvEk.js +0 -1753
  77. package/dist/generate-CuxArvEk.js.map +0 -1
  78. package/dist/generate-TL8zY_IT.cjs +0 -65
  79. package/dist/generate-TL8zY_IT.cjs.map +0 -1
  80. package/dist/generate-UCP0qpDp.cjs +0 -1756
  81. package/dist/generate-UCP0qpDp.cjs.map +0 -1
  82. package/dist/init-CZ5Xq2Hd.cjs +0 -293
  83. package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
  84. package/dist/init-DRR_YWIq.cjs +0 -25
  85. package/dist/init-DRR_YWIq.cjs.map +0 -1
  86. package/dist/init-DSnRd1RJ.js +0 -25
  87. package/dist/init-DSnRd1RJ.js.map +0 -1
  88. package/dist/init-eNRlotJK.js +0 -289
  89. package/dist/init-eNRlotJK.js.map +0 -1
  90. package/dist/mcp-CLcDV4Jm.cjs +0 -41
  91. package/dist/mcp-CLcDV4Jm.cjs.map +0 -1
  92. package/dist/mcp-D7EIR9fR.js +0 -40
  93. package/dist/mcp-D7EIR9fR.js.map +0 -1
  94. package/dist/mcp-Dakxi9CL.js +0 -16
  95. package/dist/mcp-Dakxi9CL.js.map +0 -1
  96. package/dist/mcp-Dr_RY-hd.cjs +0 -16
  97. package/dist/mcp-Dr_RY-hd.cjs.map +0 -1
  98. package/dist/package-Cdo6lNjF.cjs.map +0 -1
  99. package/dist/package-DPooAj2l.js +0 -6
  100. package/dist/package-DPooAj2l.js.map +0 -1
  101. package/dist/shell-475fQKaX.cjs +0 -62
  102. package/dist/shell-475fQKaX.cjs.map +0 -1
  103. package/dist/shell-DLzN4fRo.js +0 -51
  104. package/dist/shell-DLzN4fRo.js.map +0 -1
  105. package/dist/telemetry-DN95_2pF.cjs +0 -282
  106. package/dist/telemetry-DN95_2pF.cjs.map +0 -1
  107. package/dist/telemetry-LgT_sdPe.js +0 -245
  108. package/dist/telemetry-LgT_sdPe.js.map +0 -1
  109. package/dist/validate-B1o-rY9o.js +0 -25
  110. package/dist/validate-B1o-rY9o.js.map +0 -1
  111. package/dist/validate-CXFY-mHL.cjs +0 -25
  112. package/dist/validate-CXFY-mHL.cjs.map +0 -1
  113. package/dist/validate-kLJoT_hi.js +0 -33
  114. package/dist/validate-kLJoT_hi.js.map +0 -1
  115. package/dist/validate-yKKzqEZ5.cjs +0 -34
  116. package/dist/validate-yKKzqEZ5.cjs.map +0 -1
  117. package/src/commands/agent/start.ts +0 -47
  118. package/src/commands/agent.ts +0 -8
  119. package/src/commands/generate.ts +0 -57
  120. package/src/commands/init.ts +0 -20
  121. package/src/commands/mcp.ts +0 -12
  122. package/src/commands/validate.ts +0 -20
  123. package/src/constants.ts +0 -104
  124. package/src/index.ts +0 -43
  125. package/src/loggers/clackLogger.ts +0 -458
  126. package/src/loggers/fileSystemLogger.ts +0 -138
  127. package/src/loggers/githubActionsLogger.ts +0 -379
  128. package/src/loggers/plainLogger.ts +0 -254
  129. package/src/loggers/types.ts +0 -1
  130. package/src/loggers/utils.ts +0 -106
  131. package/src/runners/agent.ts +0 -149
  132. package/src/runners/generate.ts +0 -333
  133. package/src/runners/init.ts +0 -296
  134. package/src/runners/mcp.ts +0 -45
  135. package/src/runners/validate.ts +0 -39
  136. package/src/types.ts +0 -11
  137. package/src/utils/Writables.ts +0 -17
  138. package/src/utils/executeHooks.ts +0 -45
  139. package/src/utils/flags.ts +0 -9
  140. package/src/utils/getConfig.ts +0 -10
  141. package/src/utils/getCosmiConfig.ts +0 -80
  142. package/src/utils/getSummary.ts +0 -68
  143. package/src/utils/packageManager.ts +0 -23
  144. package/src/utils/runHook.ts +0 -91
  145. package/src/utils/telemetry.ts +0 -273
  146. package/src/utils/watcher.ts +0 -19
  147. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
  148. /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
@@ -1,25 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-Bdn8j5VM.cjs");
3
- const require_package = require("./package-Cdo6lNjF.cjs");
4
- //#region src/commands/validate.ts
5
- const command = require_define.defineCommand({
6
- name: "validate",
7
- description: "Validate a Swagger/OpenAPI file",
8
- options: { input: {
9
- type: "string",
10
- description: "Path to Swagger/OpenAPI file",
11
- short: "i",
12
- required: true
13
- } },
14
- async run({ values }) {
15
- const { runValidate } = await Promise.resolve().then(() => require("./validate-yKKzqEZ5.cjs"));
16
- await runValidate({
17
- input: values.input,
18
- version: require_package.version
19
- });
20
- }
21
- });
22
- //#endregion
23
- exports.command = command;
24
-
25
- //# sourceMappingURL=validate-CXFY-mHL.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-CXFY-mHL.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n short: 'i',\n required: true,\n },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EACL,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;EACX,EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAE9B,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;GAAS,CAAC;;CAEtD,CAAC"}
@@ -1,33 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- import { t as getErrorMessage } from "./errors-CjPmyZHy.js";
3
- import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-LgT_sdPe.js";
4
- import process from "node:process";
5
- import { parseDocument, validateDocument } from "@kubb/adapter-oas";
6
- //#region src/runners/validate.ts
7
- async function runValidate({ input, version }) {
8
- const hrStart = process.hrtime();
9
- try {
10
- await validateDocument(await parseDocument(input), { throwOnError: true });
11
- await sendTelemetry(buildTelemetryEvent({
12
- command: "validate",
13
- kubbVersion: version,
14
- hrStart,
15
- status: "success"
16
- }));
17
- console.log("✅ Validation success");
18
- } catch (error) {
19
- await sendTelemetry(buildTelemetryEvent({
20
- command: "validate",
21
- kubbVersion: version,
22
- hrStart,
23
- status: "failed"
24
- }));
25
- console.error("❌ Validation failed");
26
- console.error(getErrorMessage(error));
27
- process.exit(1);
28
- }
29
- }
30
- //#endregion
31
- export { runValidate };
32
-
33
- //# sourceMappingURL=validate-kLJoT_hi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-kLJoT_hi.js","names":[],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport { parseDocument, validateDocument } from '@kubb/adapter-oas'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n const hrStart = process.hrtime()\n try {\n const document = await parseDocument(input)\n await validateDocument(document, { throwOnError: true })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'validate',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'validate',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;AAUA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,MAAM,UAAU,QAAQ,QAAQ;AAChC,KAAI;AAEF,QAAM,iBAAiB,MADA,cAAc,MAAM,EACV,EAAE,cAAc,MAAM,CAAC;AAExD,QAAM,cACJ,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAM,cACJ,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAM,gBAAgB,MAAM,CAAC;AACrC,UAAQ,KAAK,EAAE"}
@@ -1,34 +0,0 @@
1
- const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
- const require_errors = require("./errors-CLCjoSg0.cjs");
3
- const require_telemetry = require("./telemetry-DN95_2pF.cjs");
4
- let node_process = require("node:process");
5
- node_process = require_chunk.__toESM(node_process, 1);
6
- let _kubb_adapter_oas = require("@kubb/adapter-oas");
7
- //#region src/runners/validate.ts
8
- async function runValidate({ input, version }) {
9
- const hrStart = node_process.default.hrtime();
10
- try {
11
- await (0, _kubb_adapter_oas.validateDocument)(await (0, _kubb_adapter_oas.parseDocument)(input), { throwOnError: true });
12
- await require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
13
- command: "validate",
14
- kubbVersion: version,
15
- hrStart,
16
- status: "success"
17
- }));
18
- console.log("✅ Validation success");
19
- } catch (error) {
20
- await require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
21
- command: "validate",
22
- kubbVersion: version,
23
- hrStart,
24
- status: "failed"
25
- }));
26
- console.error("❌ Validation failed");
27
- console.error(require_errors.getErrorMessage(error));
28
- node_process.default.exit(1);
29
- }
30
- }
31
- //#endregion
32
- exports.runValidate = runValidate;
33
-
34
- //# sourceMappingURL=validate-yKKzqEZ5.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-yKKzqEZ5.cjs","names":["process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport { parseDocument, validateDocument } from '@kubb/adapter-oas'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n const hrStart = process.hrtime()\n try {\n const document = await parseDocument(input)\n await validateDocument(document, { throwOnError: true })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'validate',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'validate',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;AAUA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,MAAM,UAAUA,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AAEF,SAAA,GAAA,kBAAA,kBAAuB,OAAA,GAAA,kBAAA,eADc,MAAM,EACV,EAAE,cAAc,MAAM,CAAC;AAExD,QAAMC,kBAAAA,cACJC,kBAAAA,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAMD,kBAAAA,cACJC,kBAAAA,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC;AACrC,eAAA,QAAQ,KAAK,EAAE"}
@@ -1,47 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../../package.json'
3
- import { agentDefaults } from '../../constants.ts'
4
-
5
- export const command = defineCommand({
6
- name: 'start',
7
- description: 'Start the Agent server',
8
- options: {
9
- config: {
10
- type: 'string',
11
- description: 'Path to the Kubb config',
12
- short: 'c',
13
- },
14
- port: {
15
- type: 'string',
16
- description: `Port for the server (default: ${agentDefaults.port})`,
17
- short: 'p',
18
- },
19
- host: {
20
- type: 'string',
21
- description: 'Host for the server',
22
- default: agentDefaults.host,
23
- },
24
- 'allow-write': {
25
- type: 'boolean',
26
- description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',
27
- default: false,
28
- },
29
- 'allow-all': {
30
- type: 'boolean',
31
- description: 'Grant all permissions (implies --allow-write).',
32
- default: false,
33
- },
34
- },
35
- async run({ values }) {
36
- const { runAgentStart } = await import('../../runners/agent.ts')
37
-
38
- await runAgentStart({
39
- port: values.port !== undefined ? values.port : undefined,
40
- host: values.host,
41
- configPath: values.config,
42
- allowWrite: values['allow-write'],
43
- allowAll: values['allow-all'],
44
- version,
45
- })
46
- },
47
- })
@@ -1,8 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { command as startCommand } from './agent/start.ts'
3
-
4
- export const command = defineCommand({
5
- name: 'agent',
6
- description: 'Manage the Kubb Agent server',
7
- subCommands: [startCommand],
8
- })
@@ -1,57 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
-
3
- export const command = defineCommand({
4
- name: 'generate',
5
- description: "[input] Generate files based on a 'kubb.config.ts' file",
6
- arguments: ['[input]'],
7
- options: {
8
- config: {
9
- type: 'string',
10
- description: 'Path to the Kubb config',
11
- short: 'c',
12
- },
13
- logLevel: {
14
- type: 'string',
15
- description: 'Info, silent, verbose or debug',
16
- short: 'l',
17
- default: 'info',
18
- hint: 'silent|info|verbose|debug',
19
- enum: ['silent', 'info', 'verbose', 'debug'],
20
- },
21
- watch: {
22
- type: 'boolean',
23
- description: 'Watch mode based on the input file',
24
- short: 'w',
25
- default: false,
26
- },
27
- debug: {
28
- type: 'boolean',
29
- description: 'Override logLevel to debug',
30
- short: 'd',
31
- default: false,
32
- },
33
- verbose: {
34
- type: 'boolean',
35
- description: 'Override logLevel to verbose',
36
- short: 'v',
37
- default: false,
38
- },
39
- silent: {
40
- type: 'boolean',
41
- description: 'Override logLevel to silent',
42
- short: 's',
43
- default: false,
44
- },
45
- },
46
- async run({ values, positionals }) {
47
- const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel
48
- const { runGenerateCommand } = await import('../runners/generate.ts')
49
-
50
- await runGenerateCommand({
51
- input: positionals[0],
52
- configPath: values.config,
53
- logLevel,
54
- watch: values.watch,
55
- })
56
- },
57
- })
@@ -1,20 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'init',
6
- description: 'Initialize a new Kubb project with interactive setup',
7
- options: {
8
- yes: {
9
- type: 'boolean',
10
- description: 'Skip prompts and use default options',
11
- short: 'y',
12
- default: false,
13
- },
14
- },
15
- async run({ values }) {
16
- const { runInit } = await import('../runners/init.ts')
17
-
18
- await runInit({ yes: values.yes, version })
19
- },
20
- })
@@ -1,12 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'mcp',
6
- description: 'Start the server to enable the MCP client to interact with the LLM.',
7
- async run() {
8
- const { runMcp } = await import('../runners/mcp.ts')
9
-
10
- await runMcp({ version })
11
- },
12
- })
@@ -1,20 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'validate',
6
- description: 'Validate a Swagger/OpenAPI file',
7
- options: {
8
- input: {
9
- type: 'string',
10
- description: 'Path to Swagger/OpenAPI file',
11
- short: 'i',
12
- required: true,
13
- },
14
- },
15
- async run({ values }) {
16
- const { runValidate } = await import('../runners/validate.ts')
17
-
18
- await runValidate({ input: values.input, version })
19
- },
20
- })
package/src/constants.ts DELETED
@@ -1,104 +0,0 @@
1
- /**
2
- * Default filename for the Kubb configuration file.
3
- *
4
- * Used by the `init` command when scaffolding new projects and by the `agent` default config.
5
- */
6
- export const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const
7
-
8
- /**
9
- * NPM registry endpoint used to check for @kubb/cli updates.
10
- */
11
- export const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const
12
-
13
- /**
14
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
15
- */
16
- export const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const
17
-
18
- /**
19
- * Horizontal rule rendered above/below the plain-logger generation summary.
20
- */
21
- export const SUMMARY_SEPARATOR = '─'.repeat(27)
22
-
23
- /**
24
- * Maximum number of █ characters in a plugin timing bar.
25
- */
26
- export const SUMMARY_MAX_BAR_LENGTH = 10 as const
27
-
28
- /**
29
- * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).
30
- */
31
- export const SUMMARY_TIME_SCALE_DIVISOR = 100 as const
32
-
33
- /**
34
- * Glob pattern for paths the file watcher ignores.
35
- */
36
- export const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const
37
-
38
- /**
39
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
40
- */
41
- export const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)
42
-
43
- export const agentDefaults = {
44
- port: '3000',
45
- host: 'localhost',
46
- configFile: KUBB_CONFIG_FILENAME,
47
- retryTimeout: '30000',
48
- studioUrl: 'https://studio.kubb.dev',
49
- /**
50
- * Relative path from the @kubb/agent package root to the server entry.
51
- */
52
- serverEntryPath: '.output/server/index.mjs',
53
- } as const
54
-
55
- /**
56
- * Default values used during interactive `init` scaffolding.
57
- */
58
- export const initDefaults = {
59
- inputPath: './openapi.yaml',
60
- outputPath: './src/gen',
61
- plugins: ['plugin-ts'],
62
- } as const
63
-
64
- /**
65
- * Maps each plugin value to the default config snippet inserted by `init`.
66
- * The `satisfies` constraint ensures all values remain plain strings while
67
- * `as const` keeps the object deeply immutable.
68
- */
69
- export const pluginDefaultConfigs = {
70
- 'plugin-ts': `pluginTs({
71
- output: { path: 'models' },
72
- })`,
73
- 'plugin-client': `pluginClient({
74
- output: { path: 'clients' },
75
- })`,
76
- 'plugin-react-query': `pluginReactQuery({
77
- output: { path: 'hooks' },
78
- })`,
79
- 'plugin-vue-query': `pluginVueQuery({
80
- output: { path: 'hooks' },
81
- })`,
82
- 'plugin-zod': `pluginZod({
83
- output: { path: 'zod' },
84
- })`,
85
- 'plugin-faker': `pluginFaker({
86
- output: { path: 'mocks' },
87
- })`,
88
- 'plugin-msw': `pluginMsw({
89
- output: { path: 'msw' },
90
- })`,
91
- 'plugin-cypress': `pluginCypress({
92
- output: { path: 'cypress' },
93
- })`,
94
- 'plugin-mcp': `pluginMcp({
95
- output: { path: 'mcp' },
96
- })`,
97
- 'plugin-redoc': `pluginRedoc({
98
- output: { path: 'redoc' },
99
- })`,
100
- } as const satisfies Record<string, string>
101
-
102
- /**
103
- * Color palette used by randomCliColor() for deterministic plugin name coloring.
104
- */
package/src/index.ts DELETED
@@ -1,43 +0,0 @@
1
- import { styleText } from 'node:util'
2
- import { createCLI } from '@internals/utils'
3
- import { version } from '../package.json'
4
- import { QUIET_FLAGS } from './constants.ts'
5
- import { isFlag } from './utils/flags.ts'
6
- import { isTelemetryDisabled } from './utils/telemetry.ts'
7
-
8
- const cli = createCLI()
9
-
10
- function shouldShowTelemetryNotice(argv: Array<string>): boolean {
11
- if (isTelemetryDisabled()) {
12
- return false
13
- }
14
- // Skip when the user is just asking for help or version info
15
- if (argv.some((arg) => isFlag(QUIET_FLAGS, arg))) {
16
- return false
17
- }
18
- // Skip in non-interactive / scripting contexts
19
- if (!process.stdout.isTTY) {
20
- return false
21
- }
22
- return true
23
- }
24
-
25
- export async function run(argv: Array<string> = process.argv): Promise<void> {
26
- if (shouldShowTelemetryNotice(argv)) {
27
- console.log(
28
- `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\n`,
29
- )
30
- }
31
-
32
- const { command: generateCommand } = await import('./commands/generate.ts')
33
- const { command: validateCommand } = await import('./commands/validate.ts')
34
- const { command: mcpCommand } = await import('./commands/mcp.ts')
35
- const { command: agentCommand } = await import('./commands/agent.ts')
36
- const { command: initCommand } = await import('./commands/init.ts')
37
-
38
- await cli.run([generateCommand, validateCommand, mcpCommand, agentCommand, initCommand], argv, {
39
- programName: 'kubb',
40
- defaultCommandName: 'generate',
41
- version,
42
- })
43
- }