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

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 (61) hide show
  1. package/dist/{Telemetry-DrppRqqW.cjs → Telemetry-C6rbhJMo.cjs} +3 -2
  2. package/dist/Telemetry-C6rbhJMo.cjs.map +1 -0
  3. package/dist/{Telemetry-CVdyJarO.js → Telemetry-DTKcvgbx.js} +3 -2
  4. package/dist/Telemetry-DTKcvgbx.js.map +1 -0
  5. package/dist/{generate-DAePC4G2.js → generate-DC4--Iha.js} +2 -2
  6. package/dist/{generate-DAePC4G2.js.map → generate-DC4--Iha.js.map} +1 -1
  7. package/dist/{generate-CJuBlTeJ.cjs → generate-Dw7aWzeb.cjs} +2 -2
  8. package/dist/{generate-CJuBlTeJ.cjs.map → generate-Dw7aWzeb.cjs.map} +1 -1
  9. package/dist/index.cjs +11 -6
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +5 -0
  12. package/dist/index.js +11 -6
  13. package/dist/index.js.map +1 -1
  14. package/dist/{init-T1DC44PT.cjs → init-C7GC2NA8.cjs} +2 -2
  15. package/dist/{init-T1DC44PT.cjs.map → init-C7GC2NA8.cjs.map} +1 -1
  16. package/dist/{init-C8m7Z_W8.js → init-D2VvDsET.js} +2 -2
  17. package/dist/{init-C8m7Z_W8.js.map → init-D2VvDsET.js.map} +1 -1
  18. package/dist/{mcp-lEYflz1a.js → mcp-DKPUyzpK.js} +3 -3
  19. package/dist/{mcp-lEYflz1a.js.map → mcp-DKPUyzpK.js.map} +1 -1
  20. package/dist/{mcp-B60MeTmD.cjs → mcp-uTUssJam.cjs} +3 -3
  21. package/dist/{mcp-B60MeTmD.cjs.map → mcp-uTUssJam.cjs.map} +1 -1
  22. package/dist/package-DCrqV1yP.js +6 -0
  23. package/dist/package-DCrqV1yP.js.map +1 -0
  24. package/dist/{package-QUV6JOtx.cjs → package-IO7JFU8g.cjs} +2 -2
  25. package/dist/package-IO7JFU8g.cjs.map +1 -0
  26. package/dist/run-BG7Giryi.js.map +1 -1
  27. package/dist/{run-BQO_tPlc.cjs → run-BoXg14l_.cjs} +2 -2
  28. package/dist/{run-BQO_tPlc.cjs.map → run-BoXg14l_.cjs.map} +1 -1
  29. package/dist/{run-CYnDu3ch.js → run-Bp8sI6h0.js} +2 -2
  30. package/dist/{run-CYnDu3ch.js.map → run-Bp8sI6h0.js.map} +1 -1
  31. package/dist/{run-h8NTawHO.js → run-Ctz9-vGE.js} +7 -2
  32. package/dist/run-Ctz9-vGE.js.map +1 -0
  33. package/dist/{run-9ZhHuNZQ.cjs → run-D_sbcTfX.cjs} +7 -2
  34. package/dist/run-D_sbcTfX.cjs.map +1 -0
  35. package/dist/run-DpKny2hT.cjs.map +1 -1
  36. package/dist/{run-Da0AZlgo.js → run-DybX4Hpr.js} +18 -11
  37. package/dist/run-DybX4Hpr.js.map +1 -0
  38. package/dist/{run-C-5oRB_f.cjs → run-FiqbWZEH.cjs} +18 -11
  39. package/dist/run-FiqbWZEH.cjs.map +1 -0
  40. package/dist/{validate-BhDi3x5e.js → validate-C6tYZ5Bd.js} +3 -3
  41. package/dist/{validate-BhDi3x5e.js.map → validate-C6tYZ5Bd.js.map} +1 -1
  42. package/dist/{validate-CUEvWAyG.cjs → validate-DVYs1uzP.cjs} +3 -3
  43. package/dist/{validate-CUEvWAyG.cjs.map → validate-DVYs1uzP.cjs.map} +1 -1
  44. package/package.json +5 -5
  45. package/src/Telemetry.ts +8 -1
  46. package/src/index.ts +5 -0
  47. package/src/loggers/defineLogger.ts +3 -3
  48. package/src/loggers/utils.ts +6 -5
  49. package/src/runners/generate/run.ts +3 -3
  50. package/src/runners/generate/utils.ts +6 -0
  51. package/src/runners/init/run.ts +1 -1
  52. package/src/runners/mcp/run.ts +5 -0
  53. package/dist/Telemetry-CVdyJarO.js.map +0 -1
  54. package/dist/Telemetry-DrppRqqW.cjs.map +0 -1
  55. package/dist/package-BynuV_3t.js +0 -6
  56. package/dist/package-BynuV_3t.js.map +0 -1
  57. package/dist/package-QUV6JOtx.cjs.map +0 -1
  58. package/dist/run-9ZhHuNZQ.cjs.map +0 -1
  59. package/dist/run-C-5oRB_f.cjs.map +0 -1
  60. package/dist/run-Da0AZlgo.js.map +0 -1
  61. package/dist/run-h8NTawHO.js.map +0 -1
@@ -168,7 +168,8 @@ var Telemetry = class Telemetry {
168
168
  }
169
169
  /**
170
170
  * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
171
- * See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
171
+ *
172
+ * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
172
173
  */
173
174
  static buildOtlpPayload(event) {
174
175
  const traceId = (0, node_crypto.randomBytes)(16).toString("hex");
@@ -317,4 +318,4 @@ Object.defineProperty(exports, "runtime", {
317
318
  }
318
319
  });
319
320
 
320
- //# sourceMappingURL=Telemetry-DrppRqqW.cjs.map
321
+ //# sourceMappingURL=Telemetry-C6rbhJMo.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-C6rbhJMo.cjs","names":["process","os"],"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":";;;;;;;;;;;;;;;;;;;AAYA,SAAgB,kBAA2B;CACzC,OAAO,CAAC,EACN,QAAQ,IAAI,MACZ,QAAQ,IAAI,kBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,eACZ,QAAQ,IAAI,YACZ,QAAQ,IAAI,UACZ,QAAQ,IAAI,oBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI;AAEhB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAqB;CACnC,OAAO,QAAQ,OAAO,UAAU,QAAQ,OAAO,WAAW,KAAK,KAAK,CAAC,gBAAgB;AACvF;;;;;;;;ACnCA,IAAM,UAAN,MAAc;;;;;;;;;;;;;;;CAeZ,IAAI,QAAiB;EACnB,OAAO,OAAO,QAAQ;CACxB;;;;CAKA,IAAI,SAAkB;EACpB,OAAO,OAAQ,WAAkC,SAAS;CAC5D;;;;;;CAOA,IAAI,SAAkB;EACpB,OAAO,CAAC,KAAK,SAAS,CAAC,KAAK,UAAU,OAAO,YAAY,eAAe,QAAQ,UAAU,QAAQ;CACpG;;;;;;;;;CAUA,IAAI,OAAoB;EACtB,IAAI,KAAK,OAAO,OAAO;EACvB,IAAI,KAAK,QAAQ,OAAO;EAExB,OAAO;CACT;;;;;;;;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ACF;GACA,YAAY,CACV;IACE,OAAO;KAAE,MAAM;KAAa,SAAS,MAAM;IAAY;IACvD,OAAO,CACL;KACE;KACA;KACA,MAAM,MAAM;KACZ,MAAM;KACN,mBAAmB,OAAO,WAAW;KACrC,iBAAiB,OAAO,SAAS;KACjC;KACA,QAAQ,EACN,MAAO,MAAM,WAAW,YAAY,IAAI,EAC1C;IACF,CACF;GACF,CACF;EACF,CACF,EACF;CACF;;;;;CAMA,aAAa,KAAK,OAAsC;EACtD,IAAI,UAAU,YACZ;EAGF,IAAI;GACF,MAAM,MAAM,GAAG,cAAc,aAAa;IACxC,QAAQ;IACR,SAAS;KACP,gBAAgB;KAChB,0BAA0B;KAC1B,yBAAyB;IAC3B;IACA,MAAM,KAAK,UAAU,UAAU,iBAAiB,KAAK,CAAC;IACtD,QAAQ,YAAY,QAAQ,GAAK;GACnC,CAAC;EACH,SAAS,IAAI,CAEb;CACF;AACF"}
@@ -166,7 +166,8 @@ var Telemetry = class Telemetry {
166
166
  }
167
167
  /**
168
168
  * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
169
- * See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
169
+ *
170
+ * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
170
171
  */
171
172
  static buildOtlpPayload(event) {
172
173
  const traceId = randomBytes(16).toString("hex");
@@ -280,4 +281,4 @@ var Telemetry = class Telemetry {
280
281
  //#endregion
281
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 };
282
283
 
283
- //# sourceMappingURL=Telemetry-CVdyJarO.js.map
284
+ //# sourceMappingURL=Telemetry-DTKcvgbx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-DTKcvgbx.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":";;;;;;;;;;;;;;;;;AAYA,SAAgB,kBAA2B;CACzC,OAAO,CAAC,EACN,QAAQ,IAAI,MACZ,QAAQ,IAAI,kBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,eACZ,QAAQ,IAAI,YACZ,QAAQ,IAAI,UACZ,QAAQ,IAAI,oBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI;AAEhB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAqB;CACnC,OAAO,QAAQ,OAAO,UAAU,QAAQ,OAAO,WAAW,KAAK,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,KAAK,UAAU;MAC1B,GAAG,EAAE;MACL,eAAe,KAAA;KACjB,CAAC,EACH;IACF,CACF,EACF,EACF,EACF,EACF,EACF;GACF;EACF;EAEA,OAAO,EACL,eAAe,CACb;GACE,UAAU,EACR,YAAY;IACV;KAAE,KAAK;KAAgB,OAAO,EAAE,aAAa,YAAY;IAAE;IAC3D;KACE,KAAK;KACL,OAAO,EAAE,aAAa,MAAM,YAAY;IAC1C;IACA;KAAE,KAAK;KAA0B,OAAO,EAAE,aAAa,SAAS;IAAE;GACpE,EACF;GACA,YAAY,CACV;IACE,OAAO;KAAE,MAAM;KAAa,SAAS,MAAM;IAAY;IACvD,OAAO,CACL;KACE;KACA;KACA,MAAM,MAAM;KACZ,MAAM;KACN,mBAAmB,OAAO,WAAW;KACrC,iBAAiB,OAAO,SAAS;KACjC;KACA,QAAQ,EACN,MAAO,MAAM,WAAW,YAAY,IAAI,EAC1C;IACF,CACF;GACF,CACF;EACF,CACF,EACF;CACF;;;;;CAMA,aAAa,KAAK,OAAsC;EACtD,IAAI,UAAU,YACZ;EAGF,IAAI;GACF,MAAM,MAAM,GAAG,cAAc,aAAa;IACxC,QAAQ;IACR,SAAS;KACP,gBAAgB;KAChB,0BAA0B;KAC1B,yBAAyB;IAC3B;IACA,MAAM,KAAK,UAAU,UAAU,iBAAiB,KAAK,CAAC;IACtD,QAAQ,YAAY,QAAQ,GAAK;GACnC,CAAC;EACH,SAAS,IAAI,CAEb;CACF;AACF"}
@@ -61,7 +61,7 @@ const command = defineCommand({
61
61
  async run({ values, positionals }) {
62
62
  const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
63
63
  const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
64
- const { run } = await import("./run-Da0AZlgo.js");
64
+ const { run } = await import("./run-DybX4Hpr.js");
65
65
  await run({
66
66
  input: positionals[0],
67
67
  configPath: values.config,
@@ -74,4 +74,4 @@ const command = defineCommand({
74
74
  //#endregion
75
75
  export { command };
76
76
 
77
- //# sourceMappingURL=generate-DAePC4G2.js.map
77
+ //# sourceMappingURL=generate-DC4--Iha.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-DAePC4G2.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
+ {"version":3,"file":"generate-DC4--Iha.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"}
@@ -60,7 +60,7 @@ const command = require("./define-C4AB3POr.cjs").defineCommand({
60
60
  async run({ values, positionals }) {
61
61
  const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
62
62
  const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
63
- const { run } = await Promise.resolve().then(() => require("./run-C-5oRB_f.cjs"));
63
+ const { run } = await Promise.resolve().then(() => require("./run-FiqbWZEH.cjs"));
64
64
  await run({
65
65
  input: positionals[0],
66
66
  configPath: values.config,
@@ -73,4 +73,4 @@ const command = require("./define-C4AB3POr.cjs").defineCommand({
73
73
  //#endregion
74
74
  exports.command = command;
75
75
 
76
- //# sourceMappingURL=generate-CJuBlTeJ.cjs.map
76
+ //# sourceMappingURL=generate-Dw7aWzeb.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-CJuBlTeJ.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,yCAAUA,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"}
1
+ {"version":3,"file":"generate-Dw7aWzeb.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,yCAAUA,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"}
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-Bx3C2hgW.cjs");
3
3
  const require_define = require("./define-C4AB3POr.cjs");
4
- const require_Telemetry = require("./Telemetry-DrppRqqW.cjs");
5
- const require_package = require("./package-QUV6JOtx.cjs");
4
+ const require_Telemetry = require("./Telemetry-C6rbhJMo.cjs");
5
+ const require_package = require("./package-IO7JFU8g.cjs");
6
6
  let node_util = require("node:util");
7
7
  //#region ../../internals/utils/src/cli/schema.ts
8
8
  /**
@@ -236,13 +236,18 @@ function createCLI(options) {
236
236
  //#endregion
237
237
  //#region src/index.ts
238
238
  const cli = createCLI();
239
+ /**
240
+ * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
241
+ * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
242
+ * `generate` when no command is given.
243
+ */
239
244
  async function run(argv = process.argv) {
240
245
  const isQuietFlag = argv.some((arg) => require_Telemetry.QUIET_FLAGS.has(arg));
241
246
  if (!require_Telemetry.Telemetry.isDisabled && !isQuietFlag) console.log(`${(0, node_util.styleText)("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${(0, node_util.styleText)("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
242
- const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-CJuBlTeJ.cjs"));
243
- const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-CUEvWAyG.cjs"));
244
- const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-B60MeTmD.cjs"));
245
- const { command: initCommand } = await Promise.resolve().then(() => require("./init-T1DC44PT.cjs"));
247
+ const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-Dw7aWzeb.cjs"));
248
+ const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-DVYs1uzP.cjs"));
249
+ const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-uTUssJam.cjs"));
250
+ const { command: initCommand } = await Promise.resolve().then(() => require("./init-C7GC2NA8.cjs"));
246
251
  await cli.run([
247
252
  generateCommand,
248
253
  validateCommand,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["defineCLIAdapter","QUIET_FLAGS","Telemetry"],"sources":["../../../internals/utils/src/cli/schema.ts","../../../internals/utils/src/cli/help.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/parse.ts","../src/index.ts"],"sourcesContent":["import type { CommandDefinition, CommandSchema, OptionDefinition, OptionSchema } from './types.ts'\n\n/**\n * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.\n * Use to expose CLI capabilities to AI agents or MCP tools.\n *\n * @example\n * ```ts\n * getCommandSchema([generateCommand, agentCommand])\n * // [{ name: 'generate', options: [...], subCommands: [] }, ...]\n * ```\n */\nexport function getCommandSchema(defs: Array<CommandDefinition>): Array<CommandSchema> {\n return defs.map(serializeCommand)\n}\n\nfunction serializeCommand(def: CommandDefinition): CommandSchema {\n return {\n name: def.name,\n description: def.description,\n arguments: def.arguments,\n ...(def.examples?.length ? { examples: def.examples } : {}),\n options: serializeOptions(def.options ?? {}),\n subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : [],\n }\n}\n\nfunction serializeOptions(options: Record<string, OptionDefinition>): Array<OptionSchema> {\n return Object.entries(options).map(([name, opt]) => {\n const shortPart = opt.short ? `-${opt.short}, ` : ''\n const valuePart = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n const flags = `${shortPart}--${name}${valuePart}`\n\n return {\n name,\n flags,\n type: opt.type,\n description: opt.description,\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n ...(opt.hint ? { hint: opt.hint } : {}),\n ...(opt.enum ? { enum: opt.enum } : {}),\n ...(opt.required ? { required: opt.required } : {}),\n }\n })\n}\n","import { styleText } from 'node:util'\nimport { getCommandSchema } from './schema.ts'\nimport type { CommandDefinition, OptionSchema } from './types.ts'\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const schema = getCommandSchema([def])[0]!\n\n const programName = parentName ? `${parentName} ${schema.name}` : schema.name\n\n const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(' ')}` : ''\n const subCmdPart = schema.subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (schema.description) {\n console.log(` ${schema.description}\\n`)\n }\n\n if (schema.subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of schema.subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: Array<OptionSchema> = [\n ...schema.options,\n {\n name: 'help',\n flags: '-h, --help',\n type: 'boolean' as const,\n description: 'Show help',\n },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (schema.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of schema.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport { defineCLIAdapter } from '../define.ts'\nimport { renderHelp } from '../help.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs, RunOptions } from '../types.ts'\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: Array<string>, parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: Array<CommandDefinition>): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter = defineCLIAdapter({\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(defs: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: Array<string>\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n },\n})\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CLIAdapter, CommandDefinition, RunOptions } from './types.ts'\n\n/**\n * Creates a CLI runner bound to a specific adapter.\n *\n * @default nodeAdapter (Node.js `node:util parseArgs`)\n *\n * @example\n * ```ts\n * await createCLI().run(commands, process.argv.slice(2), {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport function createCLI(options?: { adapter?: CLIAdapter }): {\n run(commands: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void>\n} {\n const adapter = options?.adapter ?? nodeAdapter\n\n return {\n run(commands, argv, opts) {\n return adapter.run(commands, argv, opts)\n },\n }\n}\n","import { styleText } from 'node:util'\nimport { createCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\nconst cli = createCLI()\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!Telemetry.isDisabled && !isQuietFlag) {\n console.log(\n `${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`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,MAAsD;CACrF,OAAO,KAAK,IAAI,gBAAgB;AAClC;AAEA,SAAS,iBAAiB,KAAuC;CAC/D,OAAO;EACL,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,IAAI,UAAU,SAAS,EAAE,UAAU,IAAI,SAAS,IAAI,CAAC;EACzD,SAAS,iBAAiB,IAAI,WAAW,CAAC,CAAC;EAC3C,aAAa,IA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K,MAAM,QAAQC,kBAAAA,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAACC,kBAAAA,UAAU,cAAc,CAAC,aAC5B,QAAQ,IACN,IAAA,GAAA,UAAA,UAAA,CAAa,UAAU,SAAS,EAAE,wIAAA,GAAA,UAAA,UAAA,CAAiJ,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CAC3C,MAAM,EAAE,SAAS,oBAAoB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CAC3C,MAAM,EAAE,SAAS,eAAe,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;CACtC,MAAM,EAAE,SAAS,gBAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAEvC,MAAM,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC/E,aAAa;EACb,oBAAoB;EACpB,SAAA,gBAAA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.cjs","names":["defineCLIAdapter","QUIET_FLAGS","Telemetry"],"sources":["../../../internals/utils/src/cli/schema.ts","../../../internals/utils/src/cli/help.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/parse.ts","../src/index.ts"],"sourcesContent":["import type { CommandDefinition, CommandSchema, OptionDefinition, OptionSchema } from './types.ts'\n\n/**\n * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.\n * Use to expose CLI capabilities to AI agents or MCP tools.\n *\n * @example\n * ```ts\n * getCommandSchema([generateCommand, agentCommand])\n * // [{ name: 'generate', options: [...], subCommands: [] }, ...]\n * ```\n */\nexport function getCommandSchema(defs: Array<CommandDefinition>): Array<CommandSchema> {\n return defs.map(serializeCommand)\n}\n\nfunction serializeCommand(def: CommandDefinition): CommandSchema {\n return {\n name: def.name,\n description: def.description,\n arguments: def.arguments,\n ...(def.examples?.length ? { examples: def.examples } : {}),\n options: serializeOptions(def.options ?? {}),\n subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : [],\n }\n}\n\nfunction serializeOptions(options: Record<string, OptionDefinition>): Array<OptionSchema> {\n return Object.entries(options).map(([name, opt]) => {\n const shortPart = opt.short ? `-${opt.short}, ` : ''\n const valuePart = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n const flags = `${shortPart}--${name}${valuePart}`\n\n return {\n name,\n flags,\n type: opt.type,\n description: opt.description,\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n ...(opt.hint ? { hint: opt.hint } : {}),\n ...(opt.enum ? { enum: opt.enum } : {}),\n ...(opt.required ? { required: opt.required } : {}),\n }\n })\n}\n","import { styleText } from 'node:util'\nimport { getCommandSchema } from './schema.ts'\nimport type { CommandDefinition, OptionSchema } from './types.ts'\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const schema = getCommandSchema([def])[0]!\n\n const programName = parentName ? `${parentName} ${schema.name}` : schema.name\n\n const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(' ')}` : ''\n const subCmdPart = schema.subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (schema.description) {\n console.log(` ${schema.description}\\n`)\n }\n\n if (schema.subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of schema.subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: Array<OptionSchema> = [\n ...schema.options,\n {\n name: 'help',\n flags: '-h, --help',\n type: 'boolean' as const,\n description: 'Show help',\n },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (schema.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of schema.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport { defineCLIAdapter } from '../define.ts'\nimport { renderHelp } from '../help.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs, RunOptions } from '../types.ts'\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: Array<string>, parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: Array<CommandDefinition>): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter = defineCLIAdapter({\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(defs: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: Array<string>\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n },\n})\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CLIAdapter, CommandDefinition, RunOptions } from './types.ts'\n\n/**\n * Creates a CLI runner bound to a specific adapter.\n *\n * @default nodeAdapter (Node.js `node:util parseArgs`)\n *\n * @example\n * ```ts\n * await createCLI().run(commands, process.argv.slice(2), {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport function createCLI(options?: { adapter?: CLIAdapter }): {\n run(commands: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void>\n} {\n const adapter = options?.adapter ?? nodeAdapter\n\n return {\n run(commands, argv, opts) {\n return adapter.run(commands, argv, opts)\n },\n }\n}\n","import { styleText } from 'node:util'\nimport { createCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\nconst cli = createCLI()\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!Telemetry.isDisabled && !isQuietFlag) {\n console.log(\n `${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`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,MAAsD;CACrF,OAAO,KAAK,IAAI,gBAAgB;AAClC;AAEA,SAAS,iBAAiB,KAAuC;CAC/D,OAAO;EACL,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,IAAI,UAAU,SAAS,EAAE,UAAU,IAAI,SAAS,IAAI,CAAC;EACzD,SAAS,iBAAiB,IAAI,WAAW,CAAC,CAAC;EAC3C,aAAa,IAAI,cAAc,IAAI,YAAY,IAAI,gBAAgB,IAAI,CAAC;CAC1E;AACF;AAEA,SAAS,iBAAiB,SAAgE;CACxF,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS;EAKlD,OAAO;GACL;GACA,OAAA,GANgB,IAAI,QAAQ,IAAI,IAAI,MAAM,MAAM,GAEvB,IAAI,OADb,IAAI,SAAS,WAAW,KAAK,IAAI,QAAQ,KAAK,KAAK;GAMnE,MAAM,IAAI;GACV,aAAa,IAAI;GACjB,GAAI,IAAI,YAAY,KAAA,IAAY,EAAE,SAAS,IAAI,QAAQ,IAAI,CAAC;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A;CAC3C,MAAM,EAAE,SAAS,eAAe,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;CACtC,MAAM,EAAE,SAAS,gBAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAEvC,MAAM,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC/E,aAAa;EACb,oBAAoB;EACpB,SAAA,gBAAA;CACF,CAAC;AACH"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
2
 
3
3
  //#region src/index.d.ts
4
+ /**
5
+ * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
6
+ * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
7
+ * `generate` when no command is given.
8
+ */
4
9
  declare function run(argv?: Array<string>): Promise<void>;
5
10
  //#endregion
6
11
  export { run };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./chunk-C0LytTxp.js";
2
2
  import { t as defineCLIAdapter } from "./define-C63T4jp6.js";
3
- import { r as QUIET_FLAGS, t as Telemetry } from "./Telemetry-CVdyJarO.js";
4
- import { t as version } from "./package-BynuV_3t.js";
3
+ import { r as QUIET_FLAGS, t as Telemetry } from "./Telemetry-DTKcvgbx.js";
4
+ import { t as version } from "./package-DCrqV1yP.js";
5
5
  import { parseArgs, styleText } from "node:util";
6
6
  //#region ../../internals/utils/src/cli/schema.ts
7
7
  /**
@@ -235,13 +235,18 @@ function createCLI(options) {
235
235
  //#endregion
236
236
  //#region src/index.ts
237
237
  const cli = createCLI();
238
+ /**
239
+ * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
240
+ * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
241
+ * `generate` when no command is given.
242
+ */
238
243
  async function run(argv = process.argv) {
239
244
  const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg));
240
245
  if (!Telemetry.isDisabled && !isQuietFlag) console.log(`${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`);
241
- const { command: generateCommand } = await import("./generate-DAePC4G2.js");
242
- const { command: validateCommand } = await import("./validate-BhDi3x5e.js");
243
- const { command: mcpCommand } = await import("./mcp-lEYflz1a.js");
244
- const { command: initCommand } = await import("./init-C8m7Z_W8.js");
246
+ const { command: generateCommand } = await import("./generate-DC4--Iha.js");
247
+ const { command: validateCommand } = await import("./validate-C6tYZ5Bd.js");
248
+ const { command: mcpCommand } = await import("./mcp-DKPUyzpK.js");
249
+ const { command: initCommand } = await import("./init-D2VvDsET.js");
245
250
  await cli.run([
246
251
  generateCommand,
247
252
  validateCommand,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/cli/schema.ts","../../../internals/utils/src/cli/help.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/parse.ts","../src/index.ts"],"sourcesContent":["import type { CommandDefinition, CommandSchema, OptionDefinition, OptionSchema } from './types.ts'\n\n/**\n * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.\n * Use to expose CLI capabilities to AI agents or MCP tools.\n *\n * @example\n * ```ts\n * getCommandSchema([generateCommand, agentCommand])\n * // [{ name: 'generate', options: [...], subCommands: [] }, ...]\n * ```\n */\nexport function getCommandSchema(defs: Array<CommandDefinition>): Array<CommandSchema> {\n return defs.map(serializeCommand)\n}\n\nfunction serializeCommand(def: CommandDefinition): CommandSchema {\n return {\n name: def.name,\n description: def.description,\n arguments: def.arguments,\n ...(def.examples?.length ? { examples: def.examples } : {}),\n options: serializeOptions(def.options ?? {}),\n subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : [],\n }\n}\n\nfunction serializeOptions(options: Record<string, OptionDefinition>): Array<OptionSchema> {\n return Object.entries(options).map(([name, opt]) => {\n const shortPart = opt.short ? `-${opt.short}, ` : ''\n const valuePart = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n const flags = `${shortPart}--${name}${valuePart}`\n\n return {\n name,\n flags,\n type: opt.type,\n description: opt.description,\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n ...(opt.hint ? { hint: opt.hint } : {}),\n ...(opt.enum ? { enum: opt.enum } : {}),\n ...(opt.required ? { required: opt.required } : {}),\n }\n })\n}\n","import { styleText } from 'node:util'\nimport { getCommandSchema } from './schema.ts'\nimport type { CommandDefinition, OptionSchema } from './types.ts'\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const schema = getCommandSchema([def])[0]!\n\n const programName = parentName ? `${parentName} ${schema.name}` : schema.name\n\n const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(' ')}` : ''\n const subCmdPart = schema.subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (schema.description) {\n console.log(` ${schema.description}\\n`)\n }\n\n if (schema.subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of schema.subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: Array<OptionSchema> = [\n ...schema.options,\n {\n name: 'help',\n flags: '-h, --help',\n type: 'boolean' as const,\n description: 'Show help',\n },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (schema.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of schema.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport { defineCLIAdapter } from '../define.ts'\nimport { renderHelp } from '../help.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs, RunOptions } from '../types.ts'\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: Array<string>, parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: Array<CommandDefinition>): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter = defineCLIAdapter({\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(defs: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: Array<string>\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n },\n})\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CLIAdapter, CommandDefinition, RunOptions } from './types.ts'\n\n/**\n * Creates a CLI runner bound to a specific adapter.\n *\n * @default nodeAdapter (Node.js `node:util parseArgs`)\n *\n * @example\n * ```ts\n * await createCLI().run(commands, process.argv.slice(2), {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport function createCLI(options?: { adapter?: CLIAdapter }): {\n run(commands: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void>\n} {\n const adapter = options?.adapter ?? nodeAdapter\n\n return {\n run(commands, argv, opts) {\n return adapter.run(commands, argv, opts)\n },\n }\n}\n","import { styleText } from 'node:util'\nimport { createCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\nconst cli = createCLI()\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!Telemetry.isDisabled && !isQuietFlag) {\n console.log(\n `${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`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,MAAsD;CACrF,OAAO,KAAK,IAAI,gBAAgB;AAClC;AAEA,SAAS,iBAAiB,KAAuC;CAC/D,OAAO;EACL,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,IAAI,UAAU,SAAS,EAAE,UAAU,IAAI,SAAS,IAAI,CAAC;EACzD,SAAS,iBAAiB,IAAI,WAAW,CAAC,CAAC;EAC3C,aAAa,IAAI,cAAc,IAAI,YAAY,IAAI,gBAAgB,IAAI,CAAC;CAC1E;AACF;AAEA,SAAS,iBAAiB,SAAgE;CACxF,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS;EAKlD,OAAO;GACL;GACA,OAAA,GANgB,IAAI,QAAQ,IAAI,IAAI,MAAM,MAAM,GAEvB,IAAI,OADb,IAAI,SAAS,WAAW,KAAK,IAAI,QAAQ,KAAK,KAAK;GAMnE,MAAM,IAAI;GACV,aAAa,IAAI;GACjB,GAAI,IAAI,YAAY,KAAA,IAAY,EAAE,SAAS,IAAI,QAAQ,IAAI,CAAC;GAC5D,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GACrC,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GACrC,GAAI,IAAI,WAAW,EAAE,UAAU,IAAI,SAAS,IAAI,CAAC;EACnD;CACF,CAAC;AACH;;;;;;;;;;;AChCA,SAAgB,WAAW,KAAwB,YAA2B;CAC5E,MAAM,SAAS,iBAAiB,CAAC,GAAG,C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MAAM,MAAM;EACxB,OAAO,QAAQ,IAAI,UAAU,MAAM,IAAI;CACzC,EACF;AACF;;;ACrBA,MAAM,MAAM,UAAU;AACtB,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAAC,UAAU,cAAc,CAAC,aAC5B,QAAQ,IACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,eAAe,MAAM,OAAO;CAC7C,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAE9C,MAAM,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC/E,aAAa;EACb,oBAAoB;EACpB;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/cli/schema.ts","../../../internals/utils/src/cli/help.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/parse.ts","../src/index.ts"],"sourcesContent":["import type { CommandDefinition, CommandSchema, OptionDefinition, OptionSchema } from './types.ts'\n\n/**\n * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.\n * Use to expose CLI capabilities to AI agents or MCP tools.\n *\n * @example\n * ```ts\n * getCommandSchema([generateCommand, agentCommand])\n * // [{ name: 'generate', options: [...], subCommands: [] }, ...]\n * ```\n */\nexport function getCommandSchema(defs: Array<CommandDefinition>): Array<CommandSchema> {\n return defs.map(serializeCommand)\n}\n\nfunction serializeCommand(def: CommandDefinition): CommandSchema {\n return {\n name: def.name,\n description: def.description,\n arguments: def.arguments,\n ...(def.examples?.length ? { examples: def.examples } : {}),\n options: serializeOptions(def.options ?? {}),\n subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : [],\n }\n}\n\nfunction serializeOptions(options: Record<string, OptionDefinition>): Array<OptionSchema> {\n return Object.entries(options).map(([name, opt]) => {\n const shortPart = opt.short ? `-${opt.short}, ` : ''\n const valuePart = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n const flags = `${shortPart}--${name}${valuePart}`\n\n return {\n name,\n flags,\n type: opt.type,\n description: opt.description,\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n ...(opt.hint ? { hint: opt.hint } : {}),\n ...(opt.enum ? { enum: opt.enum } : {}),\n ...(opt.required ? { required: opt.required } : {}),\n }\n })\n}\n","import { styleText } from 'node:util'\nimport { getCommandSchema } from './schema.ts'\nimport type { CommandDefinition, OptionSchema } from './types.ts'\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const schema = getCommandSchema([def])[0]!\n\n const programName = parentName ? `${parentName} ${schema.name}` : schema.name\n\n const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(' ')}` : ''\n const subCmdPart = schema.subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (schema.description) {\n console.log(` ${schema.description}\\n`)\n }\n\n if (schema.subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of schema.subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: Array<OptionSchema> = [\n ...schema.options,\n {\n name: 'help',\n flags: '-h, --help',\n type: 'boolean' as const,\n description: 'Show help',\n },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (schema.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of schema.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport { defineCLIAdapter } from '../define.ts'\nimport { renderHelp } from '../help.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs, RunOptions } from '../types.ts'\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: Array<string>, parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: Array<CommandDefinition>): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter = defineCLIAdapter({\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(defs: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: Array<string>\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n },\n})\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CLIAdapter, CommandDefinition, RunOptions } from './types.ts'\n\n/**\n * Creates a CLI runner bound to a specific adapter.\n *\n * @default nodeAdapter (Node.js `node:util parseArgs`)\n *\n * @example\n * ```ts\n * await createCLI().run(commands, process.argv.slice(2), {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport function createCLI(options?: { adapter?: CLIAdapter }): {\n run(commands: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void>\n} {\n const adapter = options?.adapter ?? nodeAdapter\n\n return {\n run(commands, argv, opts) {\n return adapter.run(commands, argv, opts)\n },\n }\n}\n","import { styleText } from 'node:util'\nimport { createCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\nconst cli = createCLI()\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!Telemetry.isDisabled && !isQuietFlag) {\n console.log(\n `${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`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,MAAsD;CACrF,OAAO,KAAK,IAAI,gBAAgB;AAClC;AAEA,SAAS,iBAAiB,KAAuC;CAC/D,OAAO;EACL,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,IAAI,UAAU,SAAS,EAAE,UAAU,IAAI,SAAS,IAAI,CAAC;EACzD,SAAS,iBAAiB,IAAI,WAAW,CAAC,CAAC;EAC3C,aAAa,IAAI,cAAc,IAAI,YAAY,IAAI,gBAAgB,IAAI,CAAC;CAC1E;AACF;AAEA,SAAS,iBAAiB,SAAgE;CACxF,OAAO,OAAO,QAAQ,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS;EAKlD,OAAO;GACL;GACA,OAAA,GANgB,IAAI,QAAQ,IAAI,IAAI,MAAM,MAAM,GAEvB,IAAI,OADb,IAAI,SAAS,WAAW,KAAK,IAAI,QAAQ,KAAK,KAAK;GAMnE,MAAM,IAAI;GACV,aAAa,IAAI;GACjB,GAAI,IAAI,YAAY,KAAA,IAAY,EAAE,SAAS,IAAI,QAAQ,IAAI,CAAC;GAC5D,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GACrC,GAAI,IAAI,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,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AM;GAC7D;EACF;EAEA,MAAM,WAAW,KAAK,aAAa,UAAU;CAC/C;AACF,CAAC;;;;;;;;;;;;;;;;;AC5JD,SAAgB,UAAU,SAExB;CACA,MAAM,UAAU,SAAS,WAAW;CAEpC,OAAO,EACL,IAAI,UAAU,MAAM,MAAM;EACxB,OAAO,QAAQ,IAAI,UAAU,MAAM,IAAI;CACzC,EACF;AACF;;;ACrBA,MAAM,MAAM,UAAU;;;;;;AAMtB,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAAC,UAAU,cAAc,CAAC,aAC5B,QAAQ,IACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,eAAe,MAAM,OAAO;CAC7C,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAE9C,MAAM,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC/E,aAAa;EACb,oBAAoB;EACpB;CACF,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
1
  require("./chunk-Bx3C2hgW.cjs");
2
2
  const require_define = require("./define-C4AB3POr.cjs");
3
- const require_package = require("./package-QUV6JOtx.cjs");
3
+ const require_package = require("./package-IO7JFU8g.cjs");
4
4
  //#region src/commands/init.ts
5
5
  const command = require_define.defineCommand({
6
6
  name: "init",
@@ -50,4 +50,4 @@ const command = require_define.defineCommand({
50
50
  //#endregion
51
51
  exports.command = command;
52
52
 
53
- //# sourceMappingURL=init-T1DC44PT.cjs.map
53
+ //# sourceMappingURL=init-C7GC2NA8.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-T1DC44PT.cjs","names":["defineCommand"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
1
+ {"version":3,"file":"init-C7GC2NA8.cjs","names":["defineCommand"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import "./chunk-C0LytTxp.js";
2
2
  import { n as defineCommand } from "./define-C63T4jp6.js";
3
- import { t as version } from "./package-BynuV_3t.js";
3
+ import { t as version } from "./package-DCrqV1yP.js";
4
4
  //#region src/commands/init.ts
5
5
  const command = defineCommand({
6
6
  name: "init",
@@ -50,4 +50,4 @@ const command = defineCommand({
50
50
  //#endregion
51
51
  export { command };
52
52
 
53
- //# sourceMappingURL=init-C8m7Z_W8.js.map
53
+ //# sourceMappingURL=init-D2VvDsET.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-C8m7Z_W8.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
1
+ {"version":3,"file":"init-D2VvDsET.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import "./chunk-C0LytTxp.js";
2
2
  import { n as defineCommand } from "./define-C63T4jp6.js";
3
- import { t as version } from "./package-BynuV_3t.js";
3
+ import { t as version } from "./package-DCrqV1yP.js";
4
4
  //#region src/commands/mcp.ts
5
5
  const command = defineCommand({
6
6
  name: "mcp",
@@ -25,7 +25,7 @@ const command = defineCommand({
25
25
  }
26
26
  },
27
27
  async run({ values }) {
28
- const { run } = await import("./run-h8NTawHO.js");
28
+ const { run } = await import("./run-Ctz9-vGE.js");
29
29
  await run({
30
30
  version,
31
31
  port: values.port,
@@ -36,4 +36,4 @@ const command = defineCommand({
36
36
  //#endregion
37
37
  export { command };
38
38
 
39
- //# sourceMappingURL=mcp-lEYflz1a.js.map
39
+ //# sourceMappingURL=mcp-DKPUyzpK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-lEYflz1a.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;EACR;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR;GACA,MAAM,OAAO;GACb,MAAM,OAAO;EACf,CAAC;CACH;AACF,CAAC"}
1
+ {"version":3,"file":"mcp-DKPUyzpK.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;EACR;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR;GACA,MAAM,OAAO;GACb,MAAM,OAAO;EACf,CAAC;CACH;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  require("./chunk-Bx3C2hgW.cjs");
2
2
  const require_define = require("./define-C4AB3POr.cjs");
3
- const require_package = require("./package-QUV6JOtx.cjs");
3
+ const require_package = require("./package-IO7JFU8g.cjs");
4
4
  //#region src/commands/mcp.ts
5
5
  const command = require_define.defineCommand({
6
6
  name: "mcp",
@@ -25,7 +25,7 @@ const command = require_define.defineCommand({
25
25
  }
26
26
  },
27
27
  async run({ values }) {
28
- const { run } = await Promise.resolve().then(() => require("./run-9ZhHuNZQ.cjs"));
28
+ const { run } = await Promise.resolve().then(() => require("./run-D_sbcTfX.cjs"));
29
29
  await run({
30
30
  version: require_package.version,
31
31
  port: values.port,
@@ -36,4 +36,4 @@ const command = require_define.defineCommand({
36
36
  //#endregion
37
37
  exports.command = command;
38
38
 
39
- //# sourceMappingURL=mcp-B60MeTmD.cjs.map
39
+ //# sourceMappingURL=mcp-uTUssJam.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-B60MeTmD.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;EACR;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,SAAA,gBAAA;GACA,MAAM,OAAO;GACb,MAAM,OAAO;EACf,CAAC;CACH;AACF,CAAC"}
1
+ {"version":3,"file":"mcp-uTUssJam.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;EACR;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,SAAA,gBAAA;GACA,MAAM,OAAO;GACb,MAAM,OAAO;EACf,CAAC;CACH;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "5.0.0-beta.63";
3
+ //#endregion
4
+ export { version as t };
5
+
6
+ //# sourceMappingURL=package-DCrqV1yP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-DCrqV1yP.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}