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

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 (133) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +45 -77
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-CfPP7MYq.cjs +321 -0
  5. package/dist/Telemetry-CfPP7MYq.cjs.map +1 -0
  6. package/dist/Telemetry-uAr3lK_-.js +284 -0
  7. package/dist/Telemetry-uAr3lK_-.js.map +1 -0
  8. package/dist/{define-Bdn8j5VM.cjs → defineCommand-Bo3yZTWI.cjs} +3 -21
  9. package/dist/defineCommand-Bo3yZTWI.cjs.map +1 -0
  10. package/dist/{define-m_fp-Aqm.js → defineCommand-DMEeqliP.js} +4 -16
  11. package/dist/defineCommand-DMEeqliP.js.map +1 -0
  12. package/dist/{errors-CINO1EIv.js → errors-Dc_d7BfX.js} +2 -2
  13. package/dist/{errors-CINO1EIv.js.map → errors-Dc_d7BfX.js.map} +1 -1
  14. package/dist/{errors-CLCjoSg0.cjs → errors-gxFK0vrp.cjs} +2 -2
  15. package/dist/{errors-CLCjoSg0.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
  16. package/dist/{generate-BY-juRdH.js → generate-BdxIouwm.js} +21 -16
  17. package/dist/generate-BdxIouwm.js.map +1 -0
  18. package/dist/{generate-Bod9YCbF.cjs → generate-tRupKbnI.cjs} +21 -16
  19. package/dist/generate-tRupKbnI.cjs.map +1 -0
  20. package/dist/index.cjs +34 -81
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +6 -1
  23. package/dist/index.js +34 -81
  24. package/dist/index.js.map +1 -1
  25. package/dist/{init-Cs3Fp6nN.js → init-D_9I495E.js} +5 -5
  26. package/dist/{init-Cs3Fp6nN.js.map → init-D_9I495E.js.map} +1 -1
  27. package/dist/{init-BIkZU6mB.cjs → init-XlS3aia7.cjs} +6 -6
  28. package/dist/{init-BIkZU6mB.cjs.map → init-XlS3aia7.cjs.map} +1 -1
  29. package/dist/mcp-BlKi3z04.js +21 -0
  30. package/dist/mcp-BlKi3z04.js.map +1 -0
  31. package/dist/mcp-DSo5Ccwz.cjs +21 -0
  32. package/dist/mcp-DSo5Ccwz.cjs.map +1 -0
  33. package/dist/package-CsDaFmfZ.js +6 -0
  34. package/dist/package-CsDaFmfZ.js.map +1 -0
  35. package/dist/{package-DrUndPET.cjs → package-HWZRLSO4.cjs} +2 -2
  36. package/dist/package-HWZRLSO4.cjs.map +1 -0
  37. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  38. package/dist/{run-YsoCk5we.cjs → run-AYlRjIX5.cjs} +136 -98
  39. package/dist/run-AYlRjIX5.cjs.map +1 -0
  40. package/dist/run-BM1t8CSM.cjs +33 -0
  41. package/dist/run-BM1t8CSM.cjs.map +1 -0
  42. package/dist/run-BlFVmIJl.js +32 -0
  43. package/dist/run-BlFVmIJl.js.map +1 -0
  44. package/dist/{run-CQbj3ley.cjs → run-CBc896in.cjs} +6 -6
  45. package/dist/run-CBc896in.cjs.map +1 -0
  46. package/dist/{run-CF97BWVa.js → run-D9mQoQHA.js} +123 -85
  47. package/dist/run-D9mQoQHA.js.map +1 -0
  48. package/dist/{run-CCZ24VKk.js → run-D_dWNFhX.js} +5 -5
  49. package/dist/run-D_dWNFhX.js.map +1 -0
  50. package/dist/run-DwylXpzM.cjs +1380 -0
  51. package/dist/run-DwylXpzM.cjs.map +1 -0
  52. package/dist/run-KlHwxNTr.js +1377 -0
  53. package/dist/run-KlHwxNTr.js.map +1 -0
  54. package/dist/tools-CZT9wSA6.cjs +175 -0
  55. package/dist/tools-CZT9wSA6.cjs.map +1 -0
  56. package/dist/tools-D0UogMU3.js +152 -0
  57. package/dist/tools-D0UogMU3.js.map +1 -0
  58. package/dist/{validate-Bfpf_UIh.cjs → validate-3gu3yglv.cjs} +6 -6
  59. package/dist/{validate-Bfpf_UIh.cjs.map → validate-3gu3yglv.cjs.map} +1 -1
  60. package/dist/{validate-lbUkWQ5o.js → validate-DBqdV14W.js} +5 -5
  61. package/dist/{validate-lbUkWQ5o.js.map → validate-DBqdV14W.js.map} +1 -1
  62. package/package.json +13 -25
  63. package/dist/agent-DN7o8nlE.js +0 -68
  64. package/dist/agent-DN7o8nlE.js.map +0 -1
  65. package/dist/agent-Fm9_8BBH.cjs +0 -70
  66. package/dist/agent-Fm9_8BBH.cjs.map +0 -1
  67. package/dist/constants-B2JTeRBb.js +0 -42
  68. package/dist/constants-B2JTeRBb.js.map +0 -1
  69. package/dist/constants-BINTA5VZ.cjs +0 -77
  70. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  71. package/dist/constants-BYGmiFs0.cjs +0 -139
  72. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  73. package/dist/constants-DSJ-Xrbv.js +0 -116
  74. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  75. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  76. package/dist/define-m_fp-Aqm.js.map +0 -1
  77. package/dist/generate-BY-juRdH.js.map +0 -1
  78. package/dist/generate-Bod9YCbF.cjs.map +0 -1
  79. package/dist/mcp-BSNulBcC.js +0 -39
  80. package/dist/mcp-BSNulBcC.js.map +0 -1
  81. package/dist/mcp-DcSrFhhP.cjs +0 -39
  82. package/dist/mcp-DcSrFhhP.cjs.map +0 -1
  83. package/dist/package-D5wmvFl4.js +0 -6
  84. package/dist/package-D5wmvFl4.js.map +0 -1
  85. package/dist/package-DrUndPET.cjs.map +0 -1
  86. package/dist/run-BAJubgdA.js +0 -1735
  87. package/dist/run-BAJubgdA.js.map +0 -1
  88. package/dist/run-BzpYYOQs.js +0 -121
  89. package/dist/run-BzpYYOQs.js.map +0 -1
  90. package/dist/run-CCZ24VKk.js.map +0 -1
  91. package/dist/run-CF97BWVa.js.map +0 -1
  92. package/dist/run-CQbj3ley.cjs.map +0 -1
  93. package/dist/run-CqKd6JNc.cjs +0 -1738
  94. package/dist/run-CqKd6JNc.cjs.map +0 -1
  95. package/dist/run-D0hmRpHy.js +0 -49
  96. package/dist/run-D0hmRpHy.js.map +0 -1
  97. package/dist/run-DwdAwnLG.cjs +0 -125
  98. package/dist/run-DwdAwnLG.cjs.map +0 -1
  99. package/dist/run-Lr0Ctnu0.cjs +0 -50
  100. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  101. package/dist/run-YsoCk5we.cjs.map +0 -1
  102. package/dist/shell-475fQKaX.cjs +0 -62
  103. package/dist/shell-475fQKaX.cjs.map +0 -1
  104. package/dist/shell-CN6DNqeC.js +0 -51
  105. package/dist/shell-CN6DNqeC.js.map +0 -1
  106. package/dist/telemetry-B2iWkY5e.cjs +0 -280
  107. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  108. package/dist/telemetry-BkektVz6.js +0 -243
  109. package/dist/telemetry-BkektVz6.js.map +0 -1
  110. package/src/commands/agent/start.ts +0 -50
  111. package/src/commands/agent.ts +0 -10
  112. package/src/commands/generate.ts +0 -59
  113. package/src/commands/init.ts +0 -51
  114. package/src/commands/mcp.ts +0 -36
  115. package/src/commands/validate.ts +0 -22
  116. package/src/constants.ts +0 -48
  117. package/src/index.ts +0 -45
  118. package/src/loggers/clackLogger.ts +0 -460
  119. package/src/loggers/fileSystemLogger.ts +0 -148
  120. package/src/loggers/githubActionsLogger.ts +0 -367
  121. package/src/loggers/plainLogger.ts +0 -243
  122. package/src/loggers/types.ts +0 -7
  123. package/src/loggers/utils.ts +0 -252
  124. package/src/runners/agent/run.ts +0 -113
  125. package/src/runners/agent/utils.ts +0 -98
  126. package/src/runners/generate/run.ts +0 -276
  127. package/src/runners/generate/utils.ts +0 -209
  128. package/src/runners/init/run.ts +0 -211
  129. package/src/runners/init/utils.ts +0 -33
  130. package/src/runners/mcp/run.ts +0 -55
  131. package/src/runners/validate/run.ts +0 -63
  132. package/src/telemetry.ts +0 -280
  133. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
@@ -0,0 +1,284 @@
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ import { randomBytes } from "node:crypto";
3
+ import os from "node:os";
4
+ import process$1 from "node:process";
5
+ //#region ../../internals/utils/src/env.ts
6
+ /**
7
+ * Returns `true` when the process is running in a CI environment.
8
+ * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
9
+ * TeamCity, Buildkite, and Azure Pipelines.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * if (isCIEnvironment()) {
14
+ * logger.level = 'error'
15
+ * }
16
+ * ```
17
+ */
18
+ function isCIEnvironment() {
19
+ return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.BITBUCKET_BUILD_NUMBER || process.env.JENKINS_URL || process.env.CIRCLECI || process.env.TRAVIS || process.env.TEAMCITY_VERSION || process.env.BUILDKITE || process.env.TF_BUILD);
20
+ }
21
+ /**
22
+ * Returns `true` when the process has an interactive TTY with a valid terminal
23
+ * width and is not running in CI.
24
+ *
25
+ * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
26
+ * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
27
+ * with a negative count and throw a `RangeError`). We therefore require a
28
+ * positive column count before declaring the TTY usable.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * if (canUseTTY()) {
33
+ * renderProgressBar()
34
+ * }
35
+ * ```
36
+ */
37
+ function canUseTTY() {
38
+ return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
39
+ }
40
+ //#endregion
41
+ //#region ../../internals/utils/src/runtime.ts
42
+ /**
43
+ * Detects the JavaScript runtime executing the current process and exposes its name and version.
44
+ *
45
+ * Prefer the shared {@link runtime} instance over constructing your own.
46
+ */
47
+ var Runtime = class {
48
+ /**
49
+ * `true` when the current process is running under Bun.
50
+ *
51
+ * Detection keys off the global `Bun` object rather than `process.versions`,
52
+ * because Bun polyfills `process.versions.node` for Node compatibility and would
53
+ * otherwise look like Node.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * if (runtime.isBun) {
58
+ * await Bun.write(path, data)
59
+ * }
60
+ * ```
61
+ */
62
+ get isBun() {
63
+ return typeof Bun !== "undefined";
64
+ }
65
+ /**
66
+ * `true` when the current process is running under Deno.
67
+ */
68
+ get isDeno() {
69
+ return typeof globalThis.Deno !== "undefined";
70
+ }
71
+ /**
72
+ * `true` when the current process is running under Node.
73
+ *
74
+ * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.
75
+ */
76
+ get isNode() {
77
+ return !this.isBun && !this.isDeno && typeof process !== "undefined" && process.versions?.node != null;
78
+ }
79
+ /**
80
+ * Name of the runtime executing the current process.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
85
+ * ```
86
+ */
87
+ get name() {
88
+ if (this.isBun) return "bun";
89
+ if (this.isDeno) return "deno";
90
+ return "node";
91
+ }
92
+ /**
93
+ * Version of the active runtime, or an empty string when it cannot be read.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * runtime.version // '1.3.11' under Bun, '22.22.2' under Node
98
+ * ```
99
+ */
100
+ get version() {
101
+ if (this.isBun) return process.versions.bun ?? "";
102
+ if (this.isDeno) return globalThis.Deno?.version?.deno ?? "";
103
+ return process.versions?.node ?? "";
104
+ }
105
+ };
106
+ /**
107
+ * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.
108
+ */
109
+ const runtime = new Runtime();
110
+ //#endregion
111
+ //#region src/constants.ts
112
+ /**
113
+ * NPM registry endpoint used to check for @kubb/cli updates.
114
+ */
115
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
116
+ /**
117
+ * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
118
+ */
119
+ const OTLP_ENDPOINT = "https://otlp.kubb.dev";
120
+ /**
121
+ * Glob pattern for paths the file watcher ignores.
122
+ */
123
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
124
+ /**
125
+ * Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these.
126
+ */
127
+ const QUIET_FLAGS = new Set([
128
+ "--help",
129
+ "-h",
130
+ "--version",
131
+ "-v"
132
+ ]);
133
+ //#endregion
134
+ //#region src/Telemetry.ts
135
+ /**
136
+ * Anonymous OTLP usage telemetry for a Kubb run. The API is static, so call it as `Telemetry.build(...)`
137
+ * and `Telemetry.send(...)`. No file paths, OpenAPI specs, or secrets are sent, and sending fails
138
+ * silently so a failed request never breaks the run.
139
+ */
140
+ var Telemetry = class Telemetry {
141
+ /**
142
+ * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.
143
+ */
144
+ static get isDisabled() {
145
+ return process$1.env["DO_NOT_TRACK"] === "1" || process$1.env["DO_NOT_TRACK"] === "true" || process$1.env["KUBB_DISABLE_TELEMETRY"] === "1" || process$1.env["KUBB_DISABLE_TELEMETRY"] === "true";
146
+ }
147
+ /**
148
+ * Build an anonymous telemetry payload from a completed generation run.
149
+ */
150
+ static build(options) {
151
+ const [seconds, nanoseconds] = process$1.hrtime(options.hrStart);
152
+ const duration = Math.round(seconds * 1e3 + nanoseconds / 1e6);
153
+ return {
154
+ command: options.command,
155
+ kubbVersion: options.kubbVersion,
156
+ nodeVersion: process$1.versions.node.split(".")[0],
157
+ runtime: runtime.name,
158
+ runtimeVersion: runtime.version.split(".")[0],
159
+ platform: os.platform(),
160
+ ci: isCIEnvironment(),
161
+ plugins: options.plugins ?? [],
162
+ duration,
163
+ filesCreated: options.filesCreated ?? 0,
164
+ status: options.status
165
+ };
166
+ }
167
+ /**
168
+ * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
169
+ *
170
+ * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
171
+ */
172
+ static buildOtlpPayload(event) {
173
+ const traceId = randomBytes(16).toString("hex");
174
+ const spanId = randomBytes(8).toString("hex");
175
+ const endTimeNs = BigInt(Date.now()) * 1000000n;
176
+ const startTimeNs = endTimeNs - BigInt(event.duration) * 1000000n;
177
+ const attributes = [
178
+ {
179
+ key: "kubb.command",
180
+ value: { stringValue: event.command }
181
+ },
182
+ {
183
+ key: "kubb.version",
184
+ value: { stringValue: event.kubbVersion }
185
+ },
186
+ {
187
+ key: "kubb.node_version",
188
+ value: { stringValue: event.nodeVersion }
189
+ },
190
+ {
191
+ key: "kubb.runtime",
192
+ value: { stringValue: event.runtime }
193
+ },
194
+ {
195
+ key: "kubb.runtime_version",
196
+ value: { stringValue: event.runtimeVersion }
197
+ },
198
+ {
199
+ key: "kubb.platform",
200
+ value: { stringValue: event.platform }
201
+ },
202
+ {
203
+ key: "kubb.ci",
204
+ value: { boolValue: event.ci }
205
+ },
206
+ {
207
+ key: "kubb.files_created",
208
+ value: { intValue: event.filesCreated }
209
+ },
210
+ {
211
+ key: "kubb.status",
212
+ value: { stringValue: event.status }
213
+ },
214
+ {
215
+ key: "kubb.plugins",
216
+ value: { arrayValue: { values: event.plugins.map((p) => ({ kvlistValue: { values: [{
217
+ key: "name",
218
+ value: { stringValue: p.name }
219
+ }, {
220
+ key: "options",
221
+ value: { stringValue: JSON.stringify({
222
+ ...p.options,
223
+ usedEnumNames: void 0
224
+ }) }
225
+ }] } })) } }
226
+ }
227
+ ];
228
+ return { resourceSpans: [{
229
+ resource: { attributes: [
230
+ {
231
+ key: "service.name",
232
+ value: { stringValue: "kubb-core" }
233
+ },
234
+ {
235
+ key: "service.version",
236
+ value: { stringValue: event.kubbVersion }
237
+ },
238
+ {
239
+ key: "telemetry.sdk.language",
240
+ value: { stringValue: "nodejs" }
241
+ }
242
+ ] },
243
+ scopeSpans: [{
244
+ scope: {
245
+ name: "kubb-core",
246
+ version: event.kubbVersion
247
+ },
248
+ spans: [{
249
+ traceId,
250
+ spanId,
251
+ name: event.command,
252
+ kind: 1,
253
+ startTimeUnixNano: String(startTimeNs),
254
+ endTimeUnixNano: String(endTimeNs),
255
+ attributes,
256
+ status: { code: event.status === "success" ? 1 : 2 }
257
+ }]
258
+ }]
259
+ }] };
260
+ }
261
+ /**
262
+ * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and
263
+ * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run.
264
+ */
265
+ static async send(event) {
266
+ if (Telemetry.isDisabled) return;
267
+ try {
268
+ await fetch(`${OTLP_ENDPOINT}/v1/traces`, {
269
+ method: "POST",
270
+ headers: {
271
+ "Content-Type": "application/json",
272
+ "Kubb-Telemetry-Version": "1",
273
+ "Kubb-Telemetry-Source": "kubb-core"
274
+ },
275
+ body: JSON.stringify(Telemetry.buildOtlpPayload(event)),
276
+ signal: AbortSignal.timeout(5e3)
277
+ });
278
+ } catch (_e) {}
279
+ }
280
+ };
281
+ //#endregion
282
+ export { runtime as a, WATCHER_IGNORED_PATHS as i, KUBB_NPM_PACKAGE_URL as n, canUseTTY as o, QUIET_FLAGS as r, Telemetry as t };
283
+
284
+ //# sourceMappingURL=Telemetry-uAr3lK_-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-uAr3lK_-.js","names":["process"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/runtime.ts","../src/constants.ts","../src/Telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when the process is running in a CI environment.\n * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,\n * TeamCity, Buildkite, and Azure Pipelines.\n *\n * @example\n * ```ts\n * if (isCIEnvironment()) {\n * logger.level = 'error'\n * }\n * ```\n */\nexport function isCIEnvironment(): boolean {\n return !!(\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.GITLAB_CI ||\n process.env.BITBUCKET_BUILD_NUMBER ||\n process.env.JENKINS_URL ||\n process.env.CIRCLECI ||\n process.env.TRAVIS ||\n process.env.TEAMCITY_VERSION ||\n process.env.BUILDKITE ||\n process.env.TF_BUILD\n )\n}\n\n/**\n * Returns `true` when the process has an interactive TTY with a valid terminal\n * width and is not running in CI.\n *\n * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,\n * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`\n * with a negative count and throw a `RangeError`). We therefore require a\n * positive column count before declaring the TTY usable.\n *\n * @example\n * ```ts\n * if (canUseTTY()) {\n * renderProgressBar()\n * }\n * ```\n */\nexport function canUseTTY(): boolean {\n return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment()\n}\n","/**\n * Name of the JavaScript runtime executing the current process.\n */\ntype RuntimeName = 'bun' | 'deno' | 'node'\n\n/**\n * Detects the JavaScript runtime executing the current process and exposes its name and version.\n *\n * Prefer the shared {@link runtime} instance over constructing your own.\n */\nclass Runtime {\n /**\n * `true` when the current process is running under Bun.\n *\n * Detection keys off the global `Bun` object rather than `process.versions`,\n * because Bun polyfills `process.versions.node` for Node compatibility and would\n * otherwise look like Node.\n *\n * @example\n * ```ts\n * if (runtime.isBun) {\n * await Bun.write(path, data)\n * }\n * ```\n */\n get isBun(): boolean {\n return typeof Bun !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Deno.\n */\n get isDeno(): boolean {\n return typeof (globalThis as { Deno?: unknown }).Deno !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Node.\n *\n * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.\n */\n get isNode(): boolean {\n return !this.isBun && !this.isDeno && typeof process !== 'undefined' && process.versions?.node != null\n }\n\n /**\n * Name of the runtime executing the current process.\n *\n * @example\n * ```ts\n * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise\n * ```\n */\n get name(): RuntimeName {\n if (this.isBun) return 'bun'\n if (this.isDeno) return 'deno'\n\n return 'node'\n }\n\n /**\n * Version of the active runtime, or an empty string when it cannot be read.\n *\n * @example\n * ```ts\n * runtime.version // '1.3.11' under Bun, '22.22.2' under Node\n * ```\n */\n get version(): string {\n if (this.isBun) return process.versions.bun ?? ''\n if (this.isDeno) return (globalThis as { Deno?: { version?: { deno?: string } } }).Deno?.version?.deno ?? ''\n\n return process.versions?.node ?? ''\n }\n}\n\n/**\n * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.\n */\nexport const runtime = new Runtime()\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 * 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 and version). The telemetry notice is suppressed for these.\n */\nexport const QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v'])\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { isCIEnvironment, runtime } from '@internals/utils'\nimport { OTLP_ENDPOINT } from './constants.ts'\n\n// OpenTelemetry OTLP JSON types\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/common/v1/common.proto\n\ntype OtlpStringValue = { stringValue: string }\ntype OtlpBoolValue = { boolValue: boolean }\ntype OtlpIntValue = { intValue: number }\ntype OtlpDoubleValue = { doubleValue: number }\ntype OtlpBytesValue = { bytesValue: string }\ntype OtlpArrayValue = { arrayValue: { values: Array<OtlpAnyValue> } }\ntype OtlpKvListValue = { kvlistValue: { values: Array<OtlpKeyValue> } }\n\ntype OtlpAnyValue = OtlpStringValue | OtlpBoolValue | OtlpIntValue | OtlpDoubleValue | OtlpBytesValue | OtlpArrayValue | OtlpKvListValue\n\ntype OtlpKeyValue = {\n key: string\n value: OtlpAnyValue\n}\n\ntype OtlpResource = {\n attributes: Array<OtlpKeyValue>\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: Array<OtlpKeyValue>\n droppedAttributesCount?: number\n}\n\n/**\n * @see https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103\n */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/**\n * Span status code.\n * - `0` is unset\n * - `1` is OK\n * - `2` is error\n */\ntype OtlpStatusCode = 0 | 1 | 2\n\ntype OtlpStatus = {\n code: OtlpStatusCode\n message?: string\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n traceState?: string\n parentSpanId?: string\n name: string\n kind: OtlpSpanKind\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes?: Array<OtlpKeyValue>\n droppedAttributesCount?: number\n events?: Array<OtlpSpanEvent>\n droppedEventsCount?: number\n links?: Array<OtlpSpanLink>\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: Array<OtlpKeyValue>\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: Array<OtlpKeyValue>\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: Array<OtlpSpan>\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: Array<OtlpScopeSpans>\n schemaUrl?: string\n}\n\n/**\n * Root payload sent to POST /v1/traces.\n */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<OtlpResourceSpans>\n}\n\n/**\n * Anonymous plugin name and options snapshot sent with each telemetry event.\n */\nexport type TelemetryPlugin = {\n /**\n * Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.\n */\n name: string\n /**\n * Anonymized snapshot of the plugin options. Values are included but cannot be traced back to a user.\n */\n options: Record<string, unknown>\n}\n\n/**\n * Anonymous snapshot of a single Kubb run, built by {@link Telemetry.build} and sent by {@link Telemetry.send}.\n */\nexport type TelemetryEvent = {\n command: string\n kubbVersion: string\n /**\n * Major version of Node that executed the run, e.g. `'22'`.\n */\n nodeVersion: string\n /**\n * Name of the JavaScript runtime that executed the run, `'bun'`, `'deno'`, or `'node'`.\n */\n runtime: string\n /**\n * Major version of the active runtime, e.g. `'1'` under Bun or `'22'` under Node.\n */\n runtimeVersion: string\n platform: string\n ci: boolean\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Anonymous OTLP usage telemetry for a Kubb run. The API is static, so call it as `Telemetry.build(...)`\n * and `Telemetry.send(...)`. No file paths, OpenAPI specs, or secrets are sent, and sending fails\n * silently so a failed request never breaks the run.\n */\nexport class Telemetry {\n /**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\n static get isDisabled(): boolean {\n return (\n process.env['DO_NOT_TRACK'] === '1' ||\n process.env['DO_NOT_TRACK'] === 'true' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === '1' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === 'true'\n )\n }\n\n /**\n * Build an anonymous telemetry payload from a completed generation run.\n */\n static build(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: Array<TelemetryPlugin>\n hrStart: [number, number]\n filesCreated?: number\n status: 'success' | 'failed'\n }): TelemetryEvent {\n const [seconds, nanoseconds] = process.hrtime(options.hrStart)\n const duration = Math.round(seconds * 1000 + nanoseconds / 1e6)\n\n return {\n command: options.command,\n kubbVersion: options.kubbVersion,\n nodeVersion: process.versions.node.split('.')[0] as string,\n runtime: runtime.name,\n runtimeVersion: runtime.version.split('.')[0] as string,\n platform: os.platform(),\n ci: isCIEnvironment(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n }\n\n /**\n * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.\n *\n * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/\n */\n static buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceRequest {\n const traceId = randomBytes(16).toString('hex')\n const spanId = randomBytes(8).toString('hex')\n const endTimeNs = BigInt(Date.now()) * 1_000_000n\n const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n\n\n const attributes: Array<OtlpKeyValue> = [\n { key: 'kubb.command', value: { stringValue: event.command } },\n { key: 'kubb.version', value: { stringValue: event.kubbVersion } },\n { key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },\n { key: 'kubb.runtime', value: { stringValue: event.runtime } },\n { key: 'kubb.runtime_version', value: { stringValue: event.runtimeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n { key: 'kubb.files_created', value: { intValue: event.filesCreated } },\n { key: 'kubb.status', value: { stringValue: event.status } },\n {\n key: 'kubb.plugins',\n value: {\n arrayValue: {\n values: event.plugins.map(\n (p): OtlpKvListValue => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n {\n key: 'options',\n value: {\n stringValue: JSON.stringify({\n ...p.options,\n usedEnumNames: undefined,\n }),\n },\n },\n ],\n },\n }),\n ),\n },\n },\n },\n ]\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: [\n { key: 'service.name', value: { stringValue: 'kubb-core' } },\n {\n key: 'service.version',\n value: { stringValue: event.kubbVersion },\n },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-core', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1 satisfies OtlpSpanKind,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode,\n },\n },\n ],\n },\n ],\n },\n ],\n }\n }\n\n /**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and\n * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run.\n */\n static async send(event: TelemetryEvent): Promise<void> {\n if (Telemetry.isDisabled) {\n return\n }\n\n try {\n await fetch(`${OTLP_ENDPOINT}/v1/traces`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Kubb-Telemetry-Version': '1',\n 'Kubb-Telemetry-Source': 'kubb-core',\n },\n body: JSON.stringify(Telemetry.buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently, telemetry must never break the run\n }\n }\n}\n"],"mappings":"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"}
@@ -1,17 +1,5 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /**
4
- * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
5
- *
6
- * @example
7
- * ```ts
8
- * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
9
- * createCLI({ adapter }).run(commands, argv, opts)
10
- * ```
11
- */
12
- function defineCLIAdapter(adapter) {
13
- return adapter;
14
- }
1
+ require("./rolldown-runtime-Bx3C2hgW.cjs");
2
+ //#region ../../internals/utils/src/cli/defineCommand.ts
15
3
  /**
16
4
  * Returns a `CommandDefinition` with typed `values` in `run()`.
17
5
  * The callback receives `values` inferred from the declared options — no casts needed.
@@ -38,12 +26,6 @@ function defineCommand(def) {
38
26
  };
39
27
  }
40
28
  //#endregion
41
- Object.defineProperty(exports, "defineCLIAdapter", {
42
- enumerable: true,
43
- get: function() {
44
- return defineCLIAdapter;
45
- }
46
- });
47
29
  Object.defineProperty(exports, "defineCommand", {
48
30
  enumerable: true,
49
31
  get: function() {
@@ -51,4 +33,4 @@ Object.defineProperty(exports, "defineCommand", {
51
33
  }
52
34
  });
53
35
 
54
- //# sourceMappingURL=define-Bdn8j5VM.cjs.map
36
+ //# sourceMappingURL=defineCommand-Bo3yZTWI.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineCommand-Bo3yZTWI.cjs","names":[],"sources":["../../../internals/utils/src/cli/defineCommand.ts"],"sourcesContent":["type BaseOption = {\n /**\n * Single-character short alias, e.g. `'c'` for `--config`.\n */\n short?: string\n description: string\n hint?: string\n required?: boolean\n /**\n * Allowed values for string options. Used in help output and AI/MCP tool schemas.\n */\n enum?: Array<string>\n}\n\ntype StringOption = BaseOption & { type: 'string'; default?: string }\ntype BooleanOption = BaseOption & { type: 'boolean'; default?: boolean }\n\n/**\n * A single CLI option — either a string value or a boolean flag.\n */\nexport type OptionDefinition = StringOption | BooleanOption\n\n/**\n * The primitive type of a CLI option value.\n */\nexport type OptionType = OptionDefinition['type']\n\n/**\n * Parsed result of `parseArgs` — typed values map plus positional arguments.\n */\nexport type ParsedArgs = {\n values: Record<string, string | boolean | undefined>\n positionals: Array<string>\n}\n\n/**\n * Full definition of a CLI command including its options, sub-commands, and run handler.\n */\nexport type CommandDefinition = {\n name: string\n description: string\n /**\n * Positional argument labels shown in usage line, e.g. `['[input]']`.\n */\n arguments?: Array<string>\n /**\n * Usage examples shown in help output and exposed to AI/MCP tools.\n */\n examples?: Array<string>\n options?: Record<string, OptionDefinition>\n subCommands?: Array<CommandDefinition>\n run?: (args: ParsedArgs) => Promise<void>\n}\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: Array<string>\n examples?: Array<string>\n options?: O\n subCommands?: Array<CommandDefinition>\n run?: (args: { values: InferValues<O>; positionals: Array<string> }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiFA,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB,CAAC;CACL;AACF"}
@@ -1,17 +1,5 @@
1
- import "./chunk-BvFE5Tac.js";
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /**
4
- * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
5
- *
6
- * @example
7
- * ```ts
8
- * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
9
- * createCLI({ adapter }).run(commands, argv, opts)
10
- * ```
11
- */
12
- function defineCLIAdapter(adapter) {
13
- return adapter;
14
- }
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ //#region ../../internals/utils/src/cli/defineCommand.ts
15
3
  /**
16
4
  * Returns a `CommandDefinition` with typed `values` in `run()`.
17
5
  * The callback receives `values` inferred from the declared options — no casts needed.
@@ -38,6 +26,6 @@ function defineCommand(def) {
38
26
  };
39
27
  }
40
28
  //#endregion
41
- export { defineCommand as n, defineCLIAdapter as t };
29
+ export { defineCommand as t };
42
30
 
43
- //# sourceMappingURL=define-m_fp-Aqm.js.map
31
+ //# sourceMappingURL=defineCommand-DMEeqliP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineCommand-DMEeqliP.js","names":[],"sources":["../../../internals/utils/src/cli/defineCommand.ts"],"sourcesContent":["type BaseOption = {\n /**\n * Single-character short alias, e.g. `'c'` for `--config`.\n */\n short?: string\n description: string\n hint?: string\n required?: boolean\n /**\n * Allowed values for string options. Used in help output and AI/MCP tool schemas.\n */\n enum?: Array<string>\n}\n\ntype StringOption = BaseOption & { type: 'string'; default?: string }\ntype BooleanOption = BaseOption & { type: 'boolean'; default?: boolean }\n\n/**\n * A single CLI option — either a string value or a boolean flag.\n */\nexport type OptionDefinition = StringOption | BooleanOption\n\n/**\n * The primitive type of a CLI option value.\n */\nexport type OptionType = OptionDefinition['type']\n\n/**\n * Parsed result of `parseArgs` — typed values map plus positional arguments.\n */\nexport type ParsedArgs = {\n values: Record<string, string | boolean | undefined>\n positionals: Array<string>\n}\n\n/**\n * Full definition of a CLI command including its options, sub-commands, and run handler.\n */\nexport type CommandDefinition = {\n name: string\n description: string\n /**\n * Positional argument labels shown in usage line, e.g. `['[input]']`.\n */\n arguments?: Array<string>\n /**\n * Usage examples shown in help output and exposed to AI/MCP tools.\n */\n examples?: Array<string>\n options?: Record<string, OptionDefinition>\n subCommands?: Array<CommandDefinition>\n run?: (args: ParsedArgs) => Promise<void>\n}\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: Array<string>\n examples?: Array<string>\n options?: O\n subCommands?: Array<CommandDefinition>\n run?: (args: { values: InferValues<O>; positionals: Array<string> }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiFA,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB,CAAC;CACL;AACF"}
@@ -1,4 +1,4 @@
1
- import "./chunk-BvFE5Tac.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
2
  //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
4
  * Coerces an unknown thrown value to an `Error` instance.
@@ -40,4 +40,4 @@ function toCause(error) {
40
40
  //#endregion
41
41
  export { toCause as n, toError as r, getErrorMessage as t };
42
42
 
43
- //# sourceMappingURL=errors-CINO1EIv.js.map
43
+ //# sourceMappingURL=errors-Dc_d7BfX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-CINO1EIv.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
1
+ {"version":3,"file":"errors-Dc_d7BfX.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;;;;;;;AAUA,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA;AACtD"}
@@ -1,4 +1,4 @@
1
- require("./chunk-ByKO4r7w.cjs");
1
+ require("./rolldown-runtime-Bx3C2hgW.cjs");
2
2
  //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
4
  * Coerces an unknown thrown value to an `Error` instance.
@@ -57,4 +57,4 @@ Object.defineProperty(exports, "toError", {
57
57
  }
58
58
  });
59
59
 
60
- //# sourceMappingURL=errors-CLCjoSg0.cjs.map
60
+ //# sourceMappingURL=errors-gxFK0vrp.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-CLCjoSg0.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
1
+ {"version":3,"file":"errors-gxFK0vrp.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;;;;;;;AAUA,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA;AACtD"}
@@ -1,5 +1,5 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { n as defineCommand } from "./define-m_fp-Aqm.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
3
3
  //#region src/commands/generate.ts
4
4
  const command = defineCommand({
5
5
  name: "generate",
@@ -19,15 +19,14 @@ const command = defineCommand({
19
19
  },
20
20
  logLevel: {
21
21
  type: "string",
22
- description: "Info, silent, verbose or debug",
22
+ description: "Info, silent or verbose",
23
23
  short: "l",
24
24
  default: "info",
25
- hint: "silent|info|verbose|debug",
25
+ hint: "silent|info|verbose",
26
26
  enum: [
27
27
  "silent",
28
28
  "info",
29
- "verbose",
30
- "debug"
29
+ "verbose"
31
30
  ]
32
31
  },
33
32
  watch: {
@@ -36,12 +35,6 @@ const command = defineCommand({
36
35
  short: "w",
37
36
  default: false
38
37
  },
39
- debug: {
40
- type: "boolean",
41
- description: "Override logLevel to debug",
42
- short: "d",
43
- default: false
44
- },
45
38
  verbose: {
46
39
  type: "boolean",
47
40
  description: "Override logLevel to verbose",
@@ -53,20 +46,32 @@ const command = defineCommand({
53
46
  description: "Override logLevel to silent",
54
47
  short: "s",
55
48
  default: false
49
+ },
50
+ reporter: {
51
+ type: "string",
52
+ description: "Reporters that render the run, comma-separated. Overrides config.reporters",
53
+ hint: "cli|json|file",
54
+ enum: [
55
+ "cli",
56
+ "json",
57
+ "file"
58
+ ]
56
59
  }
57
60
  },
58
61
  async run({ values, positionals }) {
59
- const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
60
- const { run } = await import("./run-BAJubgdA.js");
62
+ const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
63
+ const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
64
+ const { run } = await import("./run-KlHwxNTr.js");
61
65
  await run({
62
66
  input: positionals[0],
63
67
  configPath: values.config,
64
68
  logLevel,
65
- watch: values.watch
69
+ watch: values.watch,
70
+ reporters
66
71
  });
67
72
  }
68
73
  });
69
74
  //#endregion
70
75
  export { command };
71
76
 
72
- //# sourceMappingURL=generate-BY-juRdH.js.map
77
+ //# sourceMappingURL=generate-BdxIouwm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-BdxIouwm.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport type { ReporterName } from '@kubb/core'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\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 or verbose',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose',\n enum: ['silent', 'info', 'verbose'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\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 reporter: {\n type: 'string',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n hint: 'cli|json|file',\n enum: ['cli', 'json', 'file'],\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const reporters = values.reporter\n ?.split(',')\n .map((name) => name.trim())\n .filter(Boolean) as Array<ReporterName> | undefined\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters,\n })\n },\n})\n"],"mappings":";;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,SAAS;CACrB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;CAAuB;CAC5H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;GAAS;EACpC;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,MAAM;GACN,MAAM;IAAC;IAAO;IAAQ;GAAM;EAC9B;CACF;CACA,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EAChF,MAAM,YAAY,OAAO,UACrB,MAAM,GAAG,CAAC,CACX,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;EACjB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd;EACF,CAAC;CACH;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
- require("./chunk-ByKO4r7w.cjs");
1
+ require("./rolldown-runtime-Bx3C2hgW.cjs");
2
2
  //#region src/commands/generate.ts
3
- const command = require("./define-Bdn8j5VM.cjs").defineCommand({
3
+ const command = require("./defineCommand-Bo3yZTWI.cjs").defineCommand({
4
4
  name: "generate",
5
5
  description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
6
6
  arguments: ["[input]"],
@@ -18,15 +18,14 @@ const command = require("./define-Bdn8j5VM.cjs").defineCommand({
18
18
  },
19
19
  logLevel: {
20
20
  type: "string",
21
- description: "Info, silent, verbose or debug",
21
+ description: "Info, silent or verbose",
22
22
  short: "l",
23
23
  default: "info",
24
- hint: "silent|info|verbose|debug",
24
+ hint: "silent|info|verbose",
25
25
  enum: [
26
26
  "silent",
27
27
  "info",
28
- "verbose",
29
- "debug"
28
+ "verbose"
30
29
  ]
31
30
  },
32
31
  watch: {
@@ -35,12 +34,6 @@ const command = require("./define-Bdn8j5VM.cjs").defineCommand({
35
34
  short: "w",
36
35
  default: false
37
36
  },
38
- debug: {
39
- type: "boolean",
40
- description: "Override logLevel to debug",
41
- short: "d",
42
- default: false
43
- },
44
37
  verbose: {
45
38
  type: "boolean",
46
39
  description: "Override logLevel to verbose",
@@ -52,20 +45,32 @@ const command = require("./define-Bdn8j5VM.cjs").defineCommand({
52
45
  description: "Override logLevel to silent",
53
46
  short: "s",
54
47
  default: false
48
+ },
49
+ reporter: {
50
+ type: "string",
51
+ description: "Reporters that render the run, comma-separated. Overrides config.reporters",
52
+ hint: "cli|json|file",
53
+ enum: [
54
+ "cli",
55
+ "json",
56
+ "file"
57
+ ]
55
58
  }
56
59
  },
57
60
  async run({ values, positionals }) {
58
- const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
59
- const { run } = await Promise.resolve().then(() => require("./run-CqKd6JNc.cjs"));
61
+ const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
62
+ const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
63
+ const { run } = await Promise.resolve().then(() => require("./run-DwylXpzM.cjs"));
60
64
  await run({
61
65
  input: positionals[0],
62
66
  configPath: values.config,
63
67
  logLevel,
64
- watch: values.watch
68
+ watch: values.watch,
69
+ reporters
65
70
  });
66
71
  }
67
72
  });
68
73
  //#endregion
69
74
  exports.command = command;
70
75
 
71
- //# sourceMappingURL=generate-Bod9YCbF.cjs.map
76
+ //# sourceMappingURL=generate-tRupKbnI.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-tRupKbnI.cjs","names":["defineCommand"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport type { ReporterName } from '@kubb/core'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\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 or verbose',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose',\n enum: ['silent', 'info', 'verbose'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\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 reporter: {\n type: 'string',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n hint: 'cli|json|file',\n enum: ['cli', 'json', 'file'],\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const reporters = values.reporter\n ?.split(',')\n .map((name) => name.trim())\n .filter(Boolean) as Array<ReporterName> | undefined\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters,\n })\n },\n})\n"],"mappings":";;AAGA,MAAa,gDAAUA,CAAAA,CAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,SAAS;CACrB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;CAAuB;CAC5H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;GAAS;EACpC;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,MAAM;GACN,MAAM;IAAC;IAAO;IAAQ;GAAM;EAC9B;CACF;CACA,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EAChF,MAAM,YAAY,OAAO,UACrB,MAAM,GAAG,CAAC,CACX,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;EACjB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd;EACF,CAAC;CACH;AACF,CAAC"}