@kubb/cli 5.0.0-beta.63 → 5.0.0-beta.64

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 (87) hide show
  1. package/bin/kubb.js +9 -3
  2. package/dist/{Telemetry-C6rbhJMo.cjs → Telemetry-CfPP7MYq.cjs} +4 -4
  3. package/dist/{Telemetry-C6rbhJMo.cjs.map → Telemetry-CfPP7MYq.cjs.map} +1 -1
  4. package/dist/{Telemetry-DTKcvgbx.js → Telemetry-uAr3lK_-.js} +2 -2
  5. package/dist/{Telemetry-DTKcvgbx.js.map → Telemetry-uAr3lK_-.js.map} +1 -1
  6. package/dist/{define-C4AB3POr.cjs → define-Cq9hOxpK.cjs} +2 -2
  7. package/dist/{define-C4AB3POr.cjs.map → define-Cq9hOxpK.cjs.map} +1 -1
  8. package/dist/{define-C63T4jp6.js → define-GYXr00ky.js} +2 -2
  9. package/dist/{define-C63T4jp6.js.map → define-GYXr00ky.js.map} +1 -1
  10. package/dist/{errors-BsemQCMn.js → errors-Dc_d7BfX.js} +2 -2
  11. package/dist/{errors-BsemQCMn.js.map → errors-Dc_d7BfX.js.map} +1 -1
  12. package/dist/{errors-DykI11xo.cjs → errors-gxFK0vrp.cjs} +2 -2
  13. package/dist/{errors-DykI11xo.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
  14. package/dist/{generate-DC4--Iha.js → generate-DHQnl_F1.js} +4 -4
  15. package/dist/{generate-DC4--Iha.js.map → generate-DHQnl_F1.js.map} +1 -1
  16. package/dist/{generate-Dw7aWzeb.cjs → generate-svfhwhEK.cjs} +4 -4
  17. package/dist/{generate-Dw7aWzeb.cjs.map → generate-svfhwhEK.cjs.map} +1 -1
  18. package/dist/index.cjs +8 -8
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +8 -8
  21. package/dist/{init-D2VvDsET.js → init-B02NN_88.js} +5 -5
  22. package/dist/{init-D2VvDsET.js.map → init-B02NN_88.js.map} +1 -1
  23. package/dist/{init-C7GC2NA8.cjs → init-Bg_68Ok6.cjs} +5 -5
  24. package/dist/{init-C7GC2NA8.cjs.map → init-Bg_68Ok6.cjs.map} +1 -1
  25. package/dist/{mcp-uTUssJam.cjs → mcp-DUzIXdRV.cjs} +7 -25
  26. package/dist/mcp-DUzIXdRV.cjs.map +1 -0
  27. package/dist/mcp-ZJQksVUU.js +21 -0
  28. package/dist/mcp-ZJQksVUU.js.map +1 -0
  29. package/dist/package-BoXPsuNH.js +6 -0
  30. package/dist/package-BoXPsuNH.js.map +1 -0
  31. package/dist/{package-IO7JFU8g.cjs → package-Cdu8eJMb.cjs} +2 -2
  32. package/dist/package-Cdu8eJMb.cjs.map +1 -0
  33. package/dist/{run-DpKny2hT.cjs → run-B4rIAnch.cjs} +7 -7
  34. package/dist/{run-DpKny2hT.cjs.map → run-B4rIAnch.cjs.map} +1 -1
  35. package/dist/{run-D_sbcTfX.cjs → run-BM1t8CSM.cjs} +8 -13
  36. package/dist/run-BM1t8CSM.cjs.map +1 -0
  37. package/dist/{run-Ctz9-vGE.js → run-BlFVmIJl.js} +7 -12
  38. package/dist/run-BlFVmIJl.js.map +1 -0
  39. package/dist/{run-BoXg14l_.cjs → run-CBc896in.cjs} +5 -5
  40. package/dist/{run-BoXg14l_.cjs.map → run-CBc896in.cjs.map} +1 -1
  41. package/dist/{run-FiqbWZEH.cjs → run-CD3BE8yP.cjs} +55 -62
  42. package/dist/run-CD3BE8yP.cjs.map +1 -0
  43. package/dist/{run-Bp8sI6h0.js → run-D_dWNFhX.js} +4 -4
  44. package/dist/{run-Bp8sI6h0.js.map → run-D_dWNFhX.js.map} +1 -1
  45. package/dist/{run-DybX4Hpr.js → run-DkW2VQBq.js} +53 -60
  46. package/dist/run-DkW2VQBq.js.map +1 -0
  47. package/dist/{run-BG7Giryi.js → run-DzYeru-0.js} +3 -3
  48. package/dist/{run-BG7Giryi.js.map → run-DzYeru-0.js.map} +1 -1
  49. package/dist/{tools-_Xp8-_zy.cjs → tools-CZT9wSA6.cjs} +2 -2
  50. package/dist/{tools-_Xp8-_zy.cjs.map → tools-CZT9wSA6.cjs.map} +1 -1
  51. package/dist/{tools-BU99bhi8.js → tools-D0UogMU3.js} +2 -2
  52. package/dist/{tools-BU99bhi8.js.map → tools-D0UogMU3.js.map} +1 -1
  53. package/dist/{validate-DVYs1uzP.cjs → validate-B3EwltHu.cjs} +5 -5
  54. package/dist/{validate-DVYs1uzP.cjs.map → validate-B3EwltHu.cjs.map} +1 -1
  55. package/dist/{validate-C6tYZ5Bd.js → validate-DXYcZCm_.js} +5 -5
  56. package/dist/{validate-C6tYZ5Bd.js.map → validate-DXYcZCm_.js.map} +1 -1
  57. package/package.json +7 -8
  58. package/dist/mcp-DKPUyzpK.js +0 -39
  59. package/dist/mcp-DKPUyzpK.js.map +0 -1
  60. package/dist/mcp-uTUssJam.cjs.map +0 -1
  61. package/dist/package-DCrqV1yP.js +0 -6
  62. package/dist/package-DCrqV1yP.js.map +0 -1
  63. package/dist/package-IO7JFU8g.cjs.map +0 -1
  64. package/dist/run-Ctz9-vGE.js.map +0 -1
  65. package/dist/run-D_sbcTfX.cjs.map +0 -1
  66. package/dist/run-DybX4Hpr.js.map +0 -1
  67. package/dist/run-FiqbWZEH.cjs.map +0 -1
  68. package/src/Telemetry.ts +0 -304
  69. package/src/commands/generate.ts +0 -65
  70. package/src/commands/init.ts +0 -51
  71. package/src/commands/mcp.ts +0 -36
  72. package/src/commands/validate.ts +0 -22
  73. package/src/constants.ts +0 -19
  74. package/src/index.ts +0 -32
  75. package/src/loggers/clackLogger.ts +0 -392
  76. package/src/loggers/defineLogger.ts +0 -59
  77. package/src/loggers/plainLogger.ts +0 -199
  78. package/src/loggers/types.ts +0 -6
  79. package/src/loggers/utils.ts +0 -250
  80. package/src/runners/generate/run.ts +0 -399
  81. package/src/runners/generate/utils.ts +0 -235
  82. package/src/runners/init/run.ts +0 -210
  83. package/src/runners/init/utils.ts +0 -39
  84. package/src/runners/mcp/run.ts +0 -42
  85. package/src/runners/validate/run.ts +0 -63
  86. /package/dist/{chunk-Bx3C2hgW.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
  87. /package/dist/{chunk-C0LytTxp.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/src/Telemetry.ts DELETED
@@ -1,304 +0,0 @@
1
- import { randomBytes } from 'node:crypto'
2
- import os from 'node:os'
3
- import process from 'node:process'
4
- import { isCIEnvironment, runtime } from '@internals/utils'
5
- import { OTLP_ENDPOINT } from './constants.ts'
6
-
7
- // OpenTelemetry OTLP JSON types
8
- // https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto
9
- // https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/common/v1/common.proto
10
-
11
- type OtlpStringValue = { stringValue: string }
12
- type OtlpBoolValue = { boolValue: boolean }
13
- type OtlpIntValue = { intValue: number }
14
- type OtlpDoubleValue = { doubleValue: number }
15
- type OtlpBytesValue = { bytesValue: string }
16
- type OtlpArrayValue = { arrayValue: { values: Array<OtlpAnyValue> } }
17
- type OtlpKvListValue = { kvlistValue: { values: Array<OtlpKeyValue> } }
18
-
19
- type OtlpAnyValue = OtlpStringValue | OtlpBoolValue | OtlpIntValue | OtlpDoubleValue | OtlpBytesValue | OtlpArrayValue | OtlpKvListValue
20
-
21
- type OtlpKeyValue = {
22
- key: string
23
- value: OtlpAnyValue
24
- }
25
-
26
- type OtlpResource = {
27
- attributes: Array<OtlpKeyValue>
28
- droppedAttributesCount?: number
29
- }
30
-
31
- type OtlpInstrumentationScope = {
32
- name: string
33
- version?: string
34
- attributes?: Array<OtlpKeyValue>
35
- droppedAttributesCount?: number
36
- }
37
-
38
- /**
39
- * @see https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103
40
- */
41
- type OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5
42
-
43
- /**
44
- * Span status code.
45
- * - `0` is unset
46
- * - `1` is OK
47
- * - `2` is error
48
- */
49
- type OtlpStatusCode = 0 | 1 | 2
50
-
51
- type OtlpStatus = {
52
- code: OtlpStatusCode
53
- message?: string
54
- }
55
-
56
- type OtlpSpan = {
57
- traceId: string
58
- spanId: string
59
- traceState?: string
60
- parentSpanId?: string
61
- name: string
62
- kind: OtlpSpanKind
63
- startTimeUnixNano: string
64
- endTimeUnixNano: string
65
- attributes?: Array<OtlpKeyValue>
66
- droppedAttributesCount?: number
67
- events?: Array<OtlpSpanEvent>
68
- droppedEventsCount?: number
69
- links?: Array<OtlpSpanLink>
70
- droppedLinksCount?: number
71
- status?: OtlpStatus
72
- }
73
-
74
- type OtlpSpanEvent = {
75
- timeUnixNano: string
76
- name: string
77
- attributes?: Array<OtlpKeyValue>
78
- droppedAttributesCount?: number
79
- }
80
-
81
- type OtlpSpanLink = {
82
- traceId: string
83
- spanId: string
84
- traceState?: string
85
- attributes?: Array<OtlpKeyValue>
86
- droppedAttributesCount?: number
87
- }
88
-
89
- type OtlpScopeSpans = {
90
- scope: OtlpInstrumentationScope
91
- spans: Array<OtlpSpan>
92
- schemaUrl?: string
93
- }
94
-
95
- type OtlpResourceSpans = {
96
- resource: OtlpResource
97
- scopeSpans: Array<OtlpScopeSpans>
98
- schemaUrl?: string
99
- }
100
-
101
- /**
102
- * Root payload sent to POST /v1/traces.
103
- */
104
- type OtlpExportTraceServiceRequest = {
105
- resourceSpans: Array<OtlpResourceSpans>
106
- }
107
-
108
- /**
109
- * Anonymous plugin name and options snapshot sent with each telemetry event.
110
- */
111
- export type TelemetryPlugin = {
112
- /**
113
- * Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.
114
- */
115
- name: string
116
- /**
117
- * Anonymized snapshot of the plugin options. Values are included but cannot be traced back to a user.
118
- */
119
- options: Record<string, unknown>
120
- }
121
-
122
- /**
123
- * Anonymous snapshot of a single Kubb run, built by {@link Telemetry.build} and sent by {@link Telemetry.send}.
124
- */
125
- export type TelemetryEvent = {
126
- command: string
127
- kubbVersion: string
128
- /**
129
- * Major version of Node that executed the run, e.g. `'22'`.
130
- */
131
- nodeVersion: string
132
- /**
133
- * Name of the JavaScript runtime that executed the run, `'bun'`, `'deno'`, or `'node'`.
134
- */
135
- runtime: string
136
- /**
137
- * Major version of the active runtime, e.g. `'1'` under Bun or `'22'` under Node.
138
- */
139
- runtimeVersion: string
140
- platform: string
141
- ci: boolean
142
- plugins: Array<TelemetryPlugin>
143
- duration: number
144
- filesCreated: number
145
- status: 'success' | 'failed'
146
- }
147
-
148
- /**
149
- * Anonymous OTLP usage telemetry for a Kubb run. The API is static, so call it as `Telemetry.build(...)`
150
- * and `Telemetry.send(...)`. No file paths, OpenAPI specs, or secrets are sent, and sending fails
151
- * silently so a failed request never breaks the run.
152
- */
153
- export class Telemetry {
154
- /**
155
- * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.
156
- */
157
- static get isDisabled(): boolean {
158
- return (
159
- process.env['DO_NOT_TRACK'] === '1' ||
160
- process.env['DO_NOT_TRACK'] === 'true' ||
161
- process.env['KUBB_DISABLE_TELEMETRY'] === '1' ||
162
- process.env['KUBB_DISABLE_TELEMETRY'] === 'true'
163
- )
164
- }
165
-
166
- /**
167
- * Build an anonymous telemetry payload from a completed generation run.
168
- */
169
- static build(options: {
170
- command: 'generate' | 'mcp' | 'validate' | 'agent'
171
- kubbVersion: string
172
- plugins?: Array<TelemetryPlugin>
173
- hrStart: [number, number]
174
- filesCreated?: number
175
- status: 'success' | 'failed'
176
- }): TelemetryEvent {
177
- const [seconds, nanoseconds] = process.hrtime(options.hrStart)
178
- const duration = Math.round(seconds * 1000 + nanoseconds / 1e6)
179
-
180
- return {
181
- command: options.command,
182
- kubbVersion: options.kubbVersion,
183
- nodeVersion: process.versions.node.split('.')[0] as string,
184
- runtime: runtime.name,
185
- runtimeVersion: runtime.version.split('.')[0] as string,
186
- platform: os.platform(),
187
- ci: isCIEnvironment(),
188
- plugins: options.plugins ?? [],
189
- duration,
190
- filesCreated: options.filesCreated ?? 0,
191
- status: options.status,
192
- }
193
- }
194
-
195
- /**
196
- * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
197
- *
198
- * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
199
- */
200
- static buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceRequest {
201
- const traceId = randomBytes(16).toString('hex')
202
- const spanId = randomBytes(8).toString('hex')
203
- const endTimeNs = BigInt(Date.now()) * 1_000_000n
204
- const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n
205
-
206
- const attributes: Array<OtlpKeyValue> = [
207
- { key: 'kubb.command', value: { stringValue: event.command } },
208
- { key: 'kubb.version', value: { stringValue: event.kubbVersion } },
209
- { key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },
210
- { key: 'kubb.runtime', value: { stringValue: event.runtime } },
211
- { key: 'kubb.runtime_version', value: { stringValue: event.runtimeVersion } },
212
- { key: 'kubb.platform', value: { stringValue: event.platform } },
213
- { key: 'kubb.ci', value: { boolValue: event.ci } },
214
- { key: 'kubb.files_created', value: { intValue: event.filesCreated } },
215
- { key: 'kubb.status', value: { stringValue: event.status } },
216
- {
217
- key: 'kubb.plugins',
218
- value: {
219
- arrayValue: {
220
- values: event.plugins.map(
221
- (p): OtlpKvListValue => ({
222
- kvlistValue: {
223
- values: [
224
- { key: 'name', value: { stringValue: p.name } },
225
- {
226
- key: 'options',
227
- value: {
228
- stringValue: JSON.stringify({
229
- ...p.options,
230
- usedEnumNames: undefined,
231
- }),
232
- },
233
- },
234
- ],
235
- },
236
- }),
237
- ),
238
- },
239
- },
240
- },
241
- ]
242
-
243
- return {
244
- resourceSpans: [
245
- {
246
- resource: {
247
- attributes: [
248
- { key: 'service.name', value: { stringValue: 'kubb-core' } },
249
- {
250
- key: 'service.version',
251
- value: { stringValue: event.kubbVersion },
252
- },
253
- { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },
254
- ],
255
- },
256
- scopeSpans: [
257
- {
258
- scope: { name: 'kubb-core', version: event.kubbVersion },
259
- spans: [
260
- {
261
- traceId,
262
- spanId,
263
- name: event.command,
264
- kind: 1 satisfies OtlpSpanKind,
265
- startTimeUnixNano: String(startTimeNs),
266
- endTimeUnixNano: String(endTimeNs),
267
- attributes,
268
- status: {
269
- code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode,
270
- },
271
- },
272
- ],
273
- },
274
- ],
275
- },
276
- ],
277
- }
278
- }
279
-
280
- /**
281
- * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and
282
- * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run.
283
- */
284
- static async send(event: TelemetryEvent): Promise<void> {
285
- if (Telemetry.isDisabled) {
286
- return
287
- }
288
-
289
- try {
290
- await fetch(`${OTLP_ENDPOINT}/v1/traces`, {
291
- method: 'POST',
292
- headers: {
293
- 'Content-Type': 'application/json',
294
- 'Kubb-Telemetry-Version': '1',
295
- 'Kubb-Telemetry-Source': 'kubb-core',
296
- },
297
- body: JSON.stringify(Telemetry.buildOtlpPayload(event)),
298
- signal: AbortSignal.timeout(5_000),
299
- })
300
- } catch (_e) {
301
- // Fail silently, telemetry must never break the run
302
- }
303
- }
304
- }
@@ -1,65 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import type { ReporterName } from '@kubb/core'
3
-
4
- export const command = defineCommand({
5
- name: 'generate',
6
- description:
7
- '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.',
8
- arguments: ['[input]'],
9
- examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],
10
- options: {
11
- config: {
12
- type: 'string',
13
- description: 'Path to the Kubb config',
14
- short: 'c',
15
- },
16
- logLevel: {
17
- type: 'string',
18
- description: 'Info, silent or verbose',
19
- short: 'l',
20
- default: 'info',
21
- hint: 'silent|info|verbose',
22
- enum: ['silent', 'info', 'verbose'],
23
- },
24
- watch: {
25
- type: 'boolean',
26
- description: 'Watch mode based on the input file',
27
- short: 'w',
28
- default: false,
29
- },
30
- verbose: {
31
- type: 'boolean',
32
- description: 'Override logLevel to verbose',
33
- short: 'v',
34
- default: false,
35
- },
36
- silent: {
37
- type: 'boolean',
38
- description: 'Override logLevel to silent',
39
- short: 's',
40
- default: false,
41
- },
42
- reporter: {
43
- type: 'string',
44
- description: 'Reporters that render the run, comma-separated. Overrides config.reporters',
45
- hint: 'cli|json|file',
46
- enum: ['cli', 'json', 'file'],
47
- },
48
- },
49
- async run({ values, positionals }) {
50
- const logLevel = values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel
51
- const reporters = values.reporter
52
- ?.split(',')
53
- .map((name) => name.trim())
54
- .filter(Boolean) as Array<ReporterName> | undefined
55
- const { run } = await import('../runners/generate/run.ts')
56
-
57
- await run({
58
- input: positionals[0],
59
- configPath: values.config,
60
- logLevel,
61
- watch: values.watch,
62
- reporters,
63
- })
64
- },
65
- })
@@ -1,51 +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:
7
- 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',
8
- examples: [
9
- 'kubb init',
10
- 'kubb init --yes',
11
- 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',
12
- 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',
13
- ],
14
- options: {
15
- yes: {
16
- type: 'boolean',
17
- description: 'Skip prompts and use default options',
18
- short: 'y',
19
- default: false,
20
- },
21
- input: {
22
- type: 'string',
23
- description: 'Path to the OpenAPI specification',
24
- short: 'i',
25
- hint: 'path',
26
- },
27
- output: {
28
- type: 'string',
29
- description: 'Output directory for generated files',
30
- short: 'o',
31
- hint: 'path',
32
- },
33
- plugins: {
34
- type: 'string',
35
- description:
36
- 'Comma-separated list of plugins to use (plugin-ts, plugin-client, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',
37
- hint: 'plugin-ts,plugin-zod,...',
38
- },
39
- },
40
- async run({ values }) {
41
- const { run } = await import('../runners/init/run.ts')
42
-
43
- await run({
44
- yes: values.yes,
45
- version,
46
- input: values.input,
47
- output: values.output,
48
- plugins: values.plugins,
49
- })
50
- },
51
- })
@@ -1,36 +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:
7
- 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',
8
- examples: [
9
- 'kubb mcp',
10
- 'kubb mcp --port 3001',
11
- '# Then add to your MCP client config:',
12
- '# { "mcpServers": { "kubb": { "command": "npx", "args": ["kubb", "mcp"] } } }',
13
- ],
14
- options: {
15
- port: {
16
- type: 'string',
17
- short: 'p',
18
- description: 'Port for HTTP MCP server (omit for stdio)',
19
- hint: 'number',
20
- },
21
- host: {
22
- type: 'string',
23
- description: 'Hostname to bind to (HTTP mode only)',
24
- default: 'localhost',
25
- },
26
- },
27
- async run({ values }) {
28
- const { run } = await import('../runners/mcp/run.ts')
29
-
30
- await run({
31
- version,
32
- port: values.port,
33
- host: values.host,
34
- })
35
- },
36
- })
@@ -1,22 +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:
7
- 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',
8
- examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],
9
- options: {
10
- input: {
11
- type: 'string',
12
- description: 'Path or URL to the OpenAPI/Swagger file to validate',
13
- short: 'i',
14
- required: true,
15
- },
16
- },
17
- async run({ values }) {
18
- const { run } = await import('../runners/validate/run.ts')
19
-
20
- await run({ input: values.input, version })
21
- },
22
- })
package/src/constants.ts DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * NPM registry endpoint used to check for @kubb/cli updates.
3
- */
4
- export const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const
5
-
6
- /**
7
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
8
- */
9
- export const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const
10
-
11
- /**
12
- * Glob pattern for paths the file watcher ignores.
13
- */
14
- export const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const
15
-
16
- /**
17
- * Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these.
18
- */
19
- export const QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v'])
package/src/index.ts DELETED
@@ -1,32 +0,0 @@
1
- import { styleText } from 'node:util'
2
- import { createCLI } from '@internals/utils'
3
- import { Telemetry } from './Telemetry.ts'
4
- import { version } from '../package.json'
5
- import { QUIET_FLAGS } from './constants.ts'
6
-
7
- const cli = createCLI()
8
- /**
9
- * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
10
- * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
11
- * `generate` when no command is given.
12
- */
13
- export async function run(argv: Array<string> = process.argv): Promise<void> {
14
- const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))
15
-
16
- if (!Telemetry.isDisabled && !isQuietFlag) {
17
- console.log(
18
- `${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`,
19
- )
20
- }
21
-
22
- const { command: generateCommand } = await import('./commands/generate.ts')
23
- const { command: validateCommand } = await import('./commands/validate.ts')
24
- const { command: mcpCommand } = await import('./commands/mcp.ts')
25
- const { command: initCommand } = await import('./commands/init.ts')
26
-
27
- await cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {
28
- programName: 'kubb',
29
- defaultCommandName: 'generate',
30
- version,
31
- })
32
- }