@kubb/cli 5.1.0 → 5.2.0

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 (101) hide show
  1. package/README.md +66 -0
  2. package/dist/{Telemetry-Fiymfxez.js → Telemetry-BCTY-Nzq.js} +3 -49
  3. package/dist/Telemetry-BCTY-Nzq.js.map +1 -0
  4. package/dist/{Telemetry-D-Jpt27O.cjs → Telemetry-DKfJQxnC.cjs} +8 -60
  5. package/dist/Telemetry-DKfJQxnC.cjs.map +1 -0
  6. package/dist/constants-CdxpgX3_.cjs +115 -0
  7. package/dist/constants-CdxpgX3_.cjs.map +1 -0
  8. package/dist/constants-DHRspBTo.js +92 -0
  9. package/dist/constants-DHRspBTo.js.map +1 -0
  10. package/dist/env-DHaFBZTX.cjs +82 -0
  11. package/dist/env-DHaFBZTX.cjs.map +1 -0
  12. package/dist/env-DqPKEL59.js +59 -0
  13. package/dist/env-DqPKEL59.js.map +1 -0
  14. package/dist/{errors-CZtH2dKk.cjs → errors-C-wEou02.cjs} +2 -19
  15. package/dist/errors-C-wEou02.cjs.map +1 -0
  16. package/dist/errors-C8yNfV7w.js +20 -0
  17. package/dist/errors-C8yNfV7w.js.map +1 -0
  18. package/dist/{generate-BO_Gv-vi.cjs → generate-Btnbf2_0.cjs} +9 -6
  19. package/dist/generate-Btnbf2_0.cjs.map +1 -0
  20. package/dist/{generate-HzSh9v2l.js → generate-PT8_WDJZ.js} +9 -6
  21. package/dist/generate-PT8_WDJZ.js.map +1 -0
  22. package/dist/index.cjs +14 -9
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +2 -3
  25. package/dist/index.js +15 -10
  26. package/dist/index.js.map +1 -1
  27. package/dist/{init-EJOY4K6y.cjs → init-BwuaIvJr.cjs} +3 -3
  28. package/dist/{init-EJOY4K6y.cjs.map → init-BwuaIvJr.cjs.map} +1 -1
  29. package/dist/{init-BslRoYhh.js → init-dkS7T-wO.js} +3 -3
  30. package/dist/{init-BslRoYhh.js.map → init-dkS7T-wO.js.map} +1 -1
  31. package/dist/{mcp-CtV0d0Dc.js → mcp-B-GxGgVr.js} +8 -10
  32. package/dist/mcp-B-GxGgVr.js.map +1 -0
  33. package/dist/{mcp-BIcX2H1u.cjs → mcp-B3B-rE7W.cjs} +8 -10
  34. package/dist/mcp-B3B-rE7W.cjs.map +1 -0
  35. package/dist/output-B2V2MN_C.cjs +137 -0
  36. package/dist/output-B2V2MN_C.cjs.map +1 -0
  37. package/dist/output-LZvrgF3z.js +89 -0
  38. package/dist/output-LZvrgF3z.js.map +1 -0
  39. package/dist/package-CrOAfe1h.js +6 -0
  40. package/dist/package-CrOAfe1h.js.map +1 -0
  41. package/dist/{package-CnUMuss9.cjs → package-Dzjrfs0O.cjs} +2 -2
  42. package/dist/package-Dzjrfs0O.cjs.map +1 -0
  43. package/dist/{run-DSgLksGj.js → run-BzvsJ0Ek.js} +80 -112
  44. package/dist/run-BzvsJ0Ek.js.map +1 -0
  45. package/dist/run-CHfPmjaA.cjs +283 -0
  46. package/dist/run-CHfPmjaA.cjs.map +1 -0
  47. package/dist/{run-FPqeAEF4.cjs → run-DRBqVXX0.cjs} +93 -125
  48. package/dist/run-DRBqVXX0.cjs.map +1 -0
  49. package/dist/{run-ChKPZlIB.js → run-DReizVV9.js} +15 -4
  50. package/dist/run-DReizVV9.js.map +1 -0
  51. package/dist/run-DUY0lV8l.js +499 -0
  52. package/dist/run-DUY0lV8l.js.map +1 -0
  53. package/dist/run-DXPXPj4B.js +281 -0
  54. package/dist/run-DXPXPj4B.js.map +1 -0
  55. package/dist/{run-DCfdTu52.js → run-DvRhuqUM.js} +11 -4
  56. package/dist/run-DvRhuqUM.js.map +1 -0
  57. package/dist/run-Wkl7oK6Q.cjs +502 -0
  58. package/dist/run-Wkl7oK6Q.cjs.map +1 -0
  59. package/dist/{run-BV2tMjuz.cjs → run-aIkuYiQ6.cjs} +15 -4
  60. package/dist/run-aIkuYiQ6.cjs.map +1 -0
  61. package/dist/{run-Cs5FunVC.cjs → run-y7oTgJI3.cjs} +11 -4
  62. package/dist/run-y7oTgJI3.cjs.map +1 -0
  63. package/dist/studio-DKv2YLJZ.js +77 -0
  64. package/dist/studio-DKv2YLJZ.js.map +1 -0
  65. package/dist/studio-PDMxqFN0.cjs +76 -0
  66. package/dist/studio-PDMxqFN0.cjs.map +1 -0
  67. package/dist/{run-DAGbErY0.cjs → utils-B0SrWoNh.cjs} +303 -323
  68. package/dist/utils-B0SrWoNh.cjs.map +1 -0
  69. package/dist/{run-CLGgnrjg.js → utils-CzoNURwq.js} +274 -364
  70. package/dist/utils-CzoNURwq.js.map +1 -0
  71. package/dist/{validate-BxCwQou-.cjs → validate-BcB0tFQ6.cjs} +8 -13
  72. package/dist/validate-BcB0tFQ6.cjs.map +1 -0
  73. package/dist/{validate-DD2S9ffV.js → validate-QpkCbIFJ.js} +8 -13
  74. package/dist/validate-QpkCbIFJ.js.map +1 -0
  75. package/package.json +14 -9
  76. package/dist/Telemetry-D-Jpt27O.cjs.map +0 -1
  77. package/dist/Telemetry-Fiymfxez.js.map +0 -1
  78. package/dist/errors-CMvLO2NE.js +0 -31
  79. package/dist/errors-CMvLO2NE.js.map +0 -1
  80. package/dist/errors-CZtH2dKk.cjs.map +0 -1
  81. package/dist/generate-BO_Gv-vi.cjs.map +0 -1
  82. package/dist/generate-HzSh9v2l.js.map +0 -1
  83. package/dist/mcp-BIcX2H1u.cjs.map +0 -1
  84. package/dist/mcp-CtV0d0Dc.js.map +0 -1
  85. package/dist/package-CnUMuss9.cjs.map +0 -1
  86. package/dist/package-DiBDd6nT.js +0 -6
  87. package/dist/package-DiBDd6nT.js.map +0 -1
  88. package/dist/run-BV2tMjuz.cjs.map +0 -1
  89. package/dist/run-CLGgnrjg.js.map +0 -1
  90. package/dist/run-ChKPZlIB.js.map +0 -1
  91. package/dist/run-Cs5FunVC.cjs.map +0 -1
  92. package/dist/run-DAGbErY0.cjs.map +0 -1
  93. package/dist/run-DCfdTu52.js.map +0 -1
  94. package/dist/run-DSgLksGj.js.map +0 -1
  95. package/dist/run-FPqeAEF4.cjs.map +0 -1
  96. package/dist/tools-DH1a7ZJH.js +0 -152
  97. package/dist/tools-DH1a7ZJH.js.map +0 -1
  98. package/dist/tools-bwKAf_r-.cjs +0 -175
  99. package/dist/tools-bwKAf_r-.cjs.map +0 -1
  100. package/dist/validate-BxCwQou-.cjs.map +0 -1
  101. package/dist/validate-DD2S9ffV.js.map +0 -1
package/README.md CHANGED
@@ -41,6 +41,7 @@ npm install -D @kubb/cli
41
41
 
42
42
  - [`kubb init`](#kubb-init) — scaffold a new project
43
43
  - [`kubb generate`](#kubb-generate) — run code generation
44
+ - [`kubb studio`](#kubb-studio) — connect this project to Kubb Studio
44
45
  - [`kubb validate`](#kubb-validate) — validate an OpenAPI spec
45
46
  - [`kubb mcp`](#kubb-mcp) — start the MCP server for AI assistants
46
47
 
@@ -136,6 +137,71 @@ npx kubb generate --reporter cli,json
136
137
 
137
138
  ---
138
139
 
140
+ ### `kubb studio`
141
+
142
+ Connect this project to [Kubb Studio](https://kubb.studio) and generate from the browser. Kubb runs
143
+ on your machine, reads your config and spec from disk, and streams progress and files back to
144
+ Studio over a WebSocket.
145
+
146
+ ```bash
147
+ npx kubb studio
148
+ ```
149
+
150
+ The first run pairs the machine. The CLI prints a short code, you approve it in Studio, and the CLI
151
+ stores the agent token in `~/.kubb/credentials.json` at mode `0600`. Later runs reuse it. Set
152
+ `KUBB_HOME` to store it, the machine secret, and the session registry somewhere other than
153
+ `~/.kubb`.
154
+
155
+ The connection is read-only by default. On the first connect to a project the CLI asks yes/no
156
+ for each permission separately: writing generated files, editing `kubb.config.ts`, accepting a
157
+ spec from Studio, and running the formatter, linter, or `postGenerate`. Each `--allow*` flag
158
+ skips the question for that one permission.
159
+
160
+ #### Arguments
161
+
162
+ | Argument | Required | Description |
163
+ | ---------- | -------- | -------------------------------------------------- |
164
+ | `[action]` | No | `connect` (default), `login`, `logout` or `status` |
165
+
166
+ #### Options
167
+
168
+ | Flag | Short | Type | Default | Description |
169
+ | -------------------- | ----- | ------- | --------------------- | --------------------------------------------------------------------------------------------- |
170
+ | `--config <path>` | `-c` | string | | Path to the Kubb config file |
171
+ | `--url <url>` | | string | `https://kubb.studio` | Base URL of the Kubb Studio instance |
172
+ | `--allowWrite` | | boolean | `false` | Write generated files to disk. Asked for once per project when omitted |
173
+ | `--allowConfigEdit` | | boolean | `false` | Edit plugin options in `kubb.config.ts`. Asked for once per project when omitted |
174
+ | `--allowInput` | | boolean | `false` | Generate from a spec sent by Studio. Asked for once per project when omitted |
175
+ | `--allowExec` | | boolean | `false` | Run the formatter, the linter, and `output.postGenerate`. Asked once per project when omitted |
176
+ | `--no-open` | | boolean | | Do not open the approval page in a browser while pairing |
177
+ | `--logLevel <level>` | `-l` | string | `info` | Log level: `silent`, `info`, or `verbose` |
178
+
179
+ #### Examples
180
+
181
+ ```bash
182
+ # Pair on first run, then connect read-only
183
+ npx kubb studio
184
+
185
+ # Let Studio write generated files to disk
186
+ npx kubb studio --allowWrite
187
+
188
+ # Pair without connecting
189
+ npx kubb studio login
190
+
191
+ # Show which machine is paired, and with which Studio
192
+ npx kubb studio status
193
+
194
+ # Forget the stored token
195
+ npx kubb studio logout
196
+
197
+ # Point at a self-hosted Studio
198
+ npx kubb studio --url http://localhost:3000
199
+ ```
200
+
201
+ Flags are camelCase. `--allow-write` is not recognized and is silently ignored.
202
+
203
+ ---
204
+
139
205
  ### `kubb validate`
140
206
 
141
207
  Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running `generate` to catch spec issues early.
@@ -1,44 +1,8 @@
1
1
  import "./rolldown-runtime-C0LytTxp.js";
2
+ import { i as getAgentName, n as isCIEnvironment } from "./env-DqPKEL59.js";
2
3
  import { randomBytes } from "node:crypto";
3
4
  import os from "node:os";
4
5
  import process$1 from "node:process";
5
- import { getAgentProfile } from "gunshi/agent";
6
- //#region ../../internals/utils/src/env.ts
7
- /**
8
- * Returns `true` when the process is running in a CI environment.
9
- * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
10
- * TeamCity, Buildkite, and Azure Pipelines.
11
- *
12
- * @example
13
- * ```ts
14
- * if (isCIEnvironment()) {
15
- * logger.level = 'error'
16
- * }
17
- * ```
18
- */
19
- function isCIEnvironment() {
20
- return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.BITBUCKET_BUILD_NUMBER || process.env.JENKINS_URL || process.env.CIRCLECI || process.env.TRAVIS || process.env.TEAMCITY_VERSION || process.env.BUILDKITE || process.env.TF_BUILD);
21
- }
22
- /**
23
- * Returns `true` when the process has an interactive TTY with a valid terminal
24
- * width and is not running in CI.
25
- *
26
- * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
27
- * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
28
- * with a negative count and throw a `RangeError`). We therefore require a
29
- * positive column count before declaring the TTY usable.
30
- *
31
- * @example
32
- * ```ts
33
- * if (canUseTTY()) {
34
- * renderProgressBar()
35
- * }
36
- * ```
37
- */
38
- function canUseTTY() {
39
- return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
40
- }
41
- //#endregion
42
6
  //#region ../../internals/utils/src/runtime.ts
43
7
  /**
44
8
  * Detects the JavaScript runtime executing the current process and exposes its name and version.
@@ -109,16 +73,6 @@ var Runtime = class {
109
73
  */
110
74
  const runtime = new Runtime();
111
75
  //#endregion
112
- //#region src/agent.ts
113
- /**
114
- * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
115
- * `'cursor'`). `undefined` when run by a human or an unrecognized caller.
116
- */
117
- function getAgentName() {
118
- const profile = getAgentProfile();
119
- return profile.isAgent ? profile.name : void 0;
120
- }
121
- //#endregion
122
76
  //#region src/constants.ts
123
77
  /**
124
78
  * NPM registry endpoint used to check for @kubb/cli updates.
@@ -293,6 +247,6 @@ async function sendTelemetry(event) {
293
247
  } catch (_e) {}
294
248
  }
295
249
  //#endregion
296
- export { QUIET_FLAGS as a, getAgentName as c, KUBB_NPM_PACKAGE_URL as i, canUseTTY as l, isDisabled as n, UPDATE_CHECK_TIMEOUT_MS as o, sendTelemetry as r, WATCHER_IGNORED_PATHS as s, buildTelemetryEvent as t };
250
+ export { QUIET_FLAGS as a, runtime as c, KUBB_NPM_PACKAGE_URL as i, isDisabled as n, UPDATE_CHECK_TIMEOUT_MS as o, sendTelemetry as r, WATCHER_IGNORED_PATHS as s, buildTelemetryEvent as t };
297
251
 
298
- //# sourceMappingURL=Telemetry-Fiymfxez.js.map
252
+ //# sourceMappingURL=Telemetry-BCTY-Nzq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-BCTY-Nzq.js","names":["process"],"sources":["../../../internals/utils/src/runtime.ts","../src/constants.ts","../src/Telemetry.ts"],"sourcesContent":["/**\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 * Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits\n * several) into a single rebuild.\n */\nexport const WATCHER_DEBOUNCE_MS = 100\n\n/**\n * Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run.\n */\nexport const UPDATE_CHECK_TIMEOUT_MS = 3_000\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 { runtime } from '@internals/utils'\nimport { getAgentName } from './agent.ts'\nimport { OTLP_ENDPOINT } from './constants.ts'\nimport { isCIEnvironment } from './utils/env.ts'\n\ntype OtlpKeyValue = {\n key: string\n value:\n | { stringValue: string }\n | { boolValue: boolean }\n | { intValue: number }\n | { arrayValue: { values: Array<{ kvlistValue: { values: Array<OtlpKeyValue> } }> } }\n | { kvlistValue: { values: Array<OtlpKeyValue> } }\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n name: string\n kind: 1\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes: Array<OtlpKeyValue>\n status: { code: 1 | 2 }\n}\n\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<{\n resource: { attributes: Array<OtlpKeyValue> }\n scopeSpans: Array<{\n scope: { name: string; version: string }\n spans: Array<OtlpSpan>\n }>\n }>\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 buildTelemetryEvent} and sent by {@link sendTelemetry}.\n */\ntype 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 /**\n * Name of the detected AI coding agent (e.g. `'claude'`, `'cursor'`), when the CLI is invoked\n * by one. `undefined` when run by a human or an unrecognized caller.\n */\n agent?: string\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\nexport function 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 */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'studio' | 'validate'\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 agent: getAgentName(),\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 */\nexport function 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 ...(event.agent ? [{ key: 'kubb.agent', value: { stringValue: event.agent } }] : []),\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((p) => ({\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 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,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: event.status === 'success' ? 1 : 2,\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. No file\n * paths, OpenAPI specs, or secrets are sent.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (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(buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently, telemetry must never break the run\n }\n}\n"],"mappings":";;;;;;;;;;;AAUA,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,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AAY;GACV;IAAE,KAAK;IAAgB,OAAO,EAAE,aAAa,YAAY;GAAE;GAC3D;IACE,KAAK;IACL,OAAO,EAAE,aAAa,MAAM,YAAY;GAC1C;GACA;IAAE,KAAK;IAA0B,OAAO,EAAE,aAAa,SAAS;GAAE;EACpE,EACF;EACA,YAAY,CACV;GACE,OAAO;IAAE,MAAM;IAAa,SAAS,MAAM;GAAY;GACvD,OAAO,CACL;IACE;IACA;IACA,MAAM,MAAM;IACZ,MAAM;IACN,mBAAmB,OAAO,WAAW;IACrC,iBAAiB,OAAO,SAAS;IACjC;IACA,QAAQ,EACN,MAAM,MAAM,WAAW,YAAY,IAAI,EACzC;GACF,CACF;EACF,CACF;CACF,CACF,EACF;AACF;;;;;;AAOA,eAAsB,cAAc,OAAsC;CACxE,IAAI,WAAW,GACb;CAGF,IAAI;EACF,MAAM,MAAM,GAAG,cAAc,aAAa;GACxC,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,0BAA0B;IAC1B,yBAAyB;GAC3B;GACA,MAAM,KAAK,UAAU,iBAAiB,KAAK,CAAC;GAC5C,QAAQ,YAAY,QAAQ,GAAK;EACnC,CAAC;CACH,SAAS,IAAI,CAEb;AACF"}
@@ -1,46 +1,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-qbf5tadS.cjs");
2
+ const require_env = require("./env-DHaFBZTX.cjs");
2
3
  let node_crypto = require("node:crypto");
3
4
  let node_os = require("node:os");
4
5
  node_os = require_rolldown_runtime.__toESM(node_os, 1);
5
6
  let node_process = require("node:process");
6
7
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
7
- let gunshi_agent = require("gunshi/agent");
8
- //#region ../../internals/utils/src/env.ts
9
- /**
10
- * Returns `true` when the process is running in a CI environment.
11
- * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
12
- * TeamCity, Buildkite, and Azure Pipelines.
13
- *
14
- * @example
15
- * ```ts
16
- * if (isCIEnvironment()) {
17
- * logger.level = 'error'
18
- * }
19
- * ```
20
- */
21
- function isCIEnvironment() {
22
- return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.BITBUCKET_BUILD_NUMBER || process.env.JENKINS_URL || process.env.CIRCLECI || process.env.TRAVIS || process.env.TEAMCITY_VERSION || process.env.BUILDKITE || process.env.TF_BUILD);
23
- }
24
- /**
25
- * Returns `true` when the process has an interactive TTY with a valid terminal
26
- * width and is not running in CI.
27
- *
28
- * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
29
- * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
30
- * with a negative count and throw a `RangeError`). We therefore require a
31
- * positive column count before declaring the TTY usable.
32
- *
33
- * @example
34
- * ```ts
35
- * if (canUseTTY()) {
36
- * renderProgressBar()
37
- * }
38
- * ```
39
- */
40
- function canUseTTY() {
41
- return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
42
- }
43
- //#endregion
44
8
  //#region ../../internals/utils/src/runtime.ts
45
9
  /**
46
10
  * Detects the JavaScript runtime executing the current process and exposes its name and version.
@@ -111,16 +75,6 @@ var Runtime = class {
111
75
  */
112
76
  const runtime = new Runtime();
113
77
  //#endregion
114
- //#region src/agent.ts
115
- /**
116
- * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
117
- * `'cursor'`). `undefined` when run by a human or an unrecognized caller.
118
- */
119
- function getAgentName() {
120
- const profile = (0, gunshi_agent.getAgentProfile)();
121
- return profile.isAgent ? profile.name : void 0;
122
- }
123
- //#endregion
124
78
  //#region src/constants.ts
125
79
  /**
126
80
  * NPM registry endpoint used to check for @kubb/cli updates.
@@ -168,8 +122,8 @@ function buildTelemetryEvent(options) {
168
122
  runtime: runtime.name,
169
123
  runtimeVersion: runtime.version.split(".")[0],
170
124
  platform: node_os.default.platform(),
171
- ci: isCIEnvironment(),
172
- agent: getAgentName(),
125
+ ci: require_env.isCIEnvironment(),
126
+ agent: require_env.getAgentName(),
173
127
  plugins: options.plugins ?? [],
174
128
  duration,
175
129
  filesCreated: options.filesCreated ?? 0,
@@ -325,22 +279,16 @@ Object.defineProperty(exports, "buildTelemetryEvent", {
325
279
  return buildTelemetryEvent;
326
280
  }
327
281
  });
328
- Object.defineProperty(exports, "canUseTTY", {
329
- enumerable: true,
330
- get: function() {
331
- return canUseTTY;
332
- }
333
- });
334
- Object.defineProperty(exports, "getAgentName", {
282
+ Object.defineProperty(exports, "isDisabled", {
335
283
  enumerable: true,
336
284
  get: function() {
337
- return getAgentName;
285
+ return isDisabled;
338
286
  }
339
287
  });
340
- Object.defineProperty(exports, "isDisabled", {
288
+ Object.defineProperty(exports, "runtime", {
341
289
  enumerable: true,
342
290
  get: function() {
343
- return isDisabled;
291
+ return runtime;
344
292
  }
345
293
  });
346
294
  Object.defineProperty(exports, "sendTelemetry", {
@@ -350,4 +298,4 @@ Object.defineProperty(exports, "sendTelemetry", {
350
298
  }
351
299
  });
352
300
 
353
- //# sourceMappingURL=Telemetry-D-Jpt27O.cjs.map
301
+ //# sourceMappingURL=Telemetry-DKfJQxnC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-DKfJQxnC.cjs","names":["process","os","isCIEnvironment","getAgentName","randomBytes"],"sources":["../../../internals/utils/src/runtime.ts","../src/constants.ts","../src/Telemetry.ts"],"sourcesContent":["/**\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 * Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits\n * several) into a single rebuild.\n */\nexport const WATCHER_DEBOUNCE_MS = 100\n\n/**\n * Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run.\n */\nexport const UPDATE_CHECK_TIMEOUT_MS = 3_000\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 { runtime } from '@internals/utils'\nimport { getAgentName } from './agent.ts'\nimport { OTLP_ENDPOINT } from './constants.ts'\nimport { isCIEnvironment } from './utils/env.ts'\n\ntype OtlpKeyValue = {\n key: string\n value:\n | { stringValue: string }\n | { boolValue: boolean }\n | { intValue: number }\n | { arrayValue: { values: Array<{ kvlistValue: { values: Array<OtlpKeyValue> } }> } }\n | { kvlistValue: { values: Array<OtlpKeyValue> } }\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n name: string\n kind: 1\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes: Array<OtlpKeyValue>\n status: { code: 1 | 2 }\n}\n\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<{\n resource: { attributes: Array<OtlpKeyValue> }\n scopeSpans: Array<{\n scope: { name: string; version: string }\n spans: Array<OtlpSpan>\n }>\n }>\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 buildTelemetryEvent} and sent by {@link sendTelemetry}.\n */\ntype 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 /**\n * Name of the detected AI coding agent (e.g. `'claude'`, `'cursor'`), when the CLI is invoked\n * by one. `undefined` when run by a human or an unrecognized caller.\n */\n agent?: string\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\nexport function 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 */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'studio' | 'validate'\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 agent: getAgentName(),\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 */\nexport function 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 ...(event.agent ? [{ key: 'kubb.agent', value: { stringValue: event.agent } }] : []),\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((p) => ({\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 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,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: event.status === 'success' ? 1 : 2,\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. No file\n * paths, OpenAPI specs, or secrets are sent.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (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(buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently,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AO,EAAE,aAAa,MAAM,OAAO;EAAE;EAC3D;GACE,KAAK;GACL,OAAO,EACL,YAAY,EACV,QAAQ,MAAM,QAAQ,KAAK,OAAO,EAChC,aAAa,EACX,QAAQ,CACN;IAAE,KAAK;IAAQ,OAAO,EAAE,aAAa,EAAE,KAAK;GAAE,GAC9C;IACE,KAAK;IACL,OAAO,EACL,aAAa,KAAK,UAAU;KAC1B,GAAG,EAAE;KACL,eAAe,KAAA;IACjB,CAAC,EACH;GACF,CACF,EACF,EACF,EAAE,EACJ,EACF;EACF;CACF;CAEA,OAAO,EACL,eAAe,CACb;EACE,UAAU,EACR,YAAY;GACV;IAAE,KAAK;IAAgB,OAAO,EAAE,aAAa,YAAY;GAAE;GAC3D;IACE,KAAK;IACL,OAAO,EAAE,aAAa,MAAM,YAAY;GAC1C;GACA;IAAE,KAAK;IAA0B,OAAO,EAAE,aAAa,SAAS;GAAE;EACpE,EACF;EACA,YAAY,CACV;GACE,OAAO;IAAE,MAAM;IAAa,SAAS,MAAM;GAAY;GACvD,OAAO,CACL;IACE;IACA;IACA,MAAM,MAAM;IACZ,MAAM;IACN,mBAAmB,OAAO,WAAW;IACrC,iBAAiB,OAAO,SAAS;IACjC;IACA,QAAQ,EACN,MAAM,MAAM,WAAW,YAAY,IAAI,EACzC;GACF,CACF;EACF,CACF;CACF,CACF,EACF;AACF;;;;;;AAOA,eAAsB,cAAc,OAAsC;CACxE,IAAI,WAAW,GACb;CAGF,IAAI;EACF,MAAM,MAAM,GAAG,cAAc,aAAa;GACxC,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,0BAA0B;IAC1B,yBAAyB;GAC3B;GACA,MAAM,KAAK,UAAU,iBAAiB,KAAK,CAAC;GAC5C,QAAQ,YAAY,QAAQ,GAAK;EACnC,CAAC;CACH,SAAS,IAAI,CAEb;AACF"}
@@ -0,0 +1,115 @@
1
+ //#region ../../internals/shared/src/constants.ts
2
+ const KUBB_CONFIG_FILENAME = "kubb.config.ts";
3
+ const KUBB_PACKAGE_NAME = "kubb";
4
+ const initDefaults = {
5
+ inputPath: "./openapi.yaml",
6
+ outputPath: "./src/gen",
7
+ plugins: ["plugin-ts"]
8
+ };
9
+ const availablePlugins = [
10
+ {
11
+ value: "plugin-ts",
12
+ label: "TypeScript",
13
+ hint: "Recommended",
14
+ packageName: "@kubb/plugin-ts",
15
+ importName: "pluginTs",
16
+ category: "types"
17
+ },
18
+ {
19
+ value: "plugin-axios",
20
+ label: "Axios Client",
21
+ packageName: "@kubb/plugin-axios",
22
+ importName: "pluginAxios",
23
+ category: "client"
24
+ },
25
+ {
26
+ value: "plugin-fetch",
27
+ label: "Fetch Client",
28
+ packageName: "@kubb/plugin-fetch",
29
+ importName: "pluginFetch",
30
+ category: "client"
31
+ },
32
+ {
33
+ value: "plugin-react-query",
34
+ label: "React Query / TanStack Query",
35
+ packageName: "@kubb/plugin-react-query",
36
+ importName: "pluginReactQuery",
37
+ category: "framework"
38
+ },
39
+ {
40
+ value: "plugin-vue-query",
41
+ label: "Vue Query",
42
+ packageName: "@kubb/plugin-vue-query",
43
+ importName: "pluginVueQuery",
44
+ category: "framework"
45
+ },
46
+ {
47
+ value: "plugin-zod",
48
+ label: "Zod Schemas",
49
+ packageName: "@kubb/plugin-zod",
50
+ importName: "pluginZod",
51
+ category: "validation"
52
+ },
53
+ {
54
+ value: "plugin-faker",
55
+ label: "Faker.js Mocks",
56
+ packageName: "@kubb/plugin-faker",
57
+ importName: "pluginFaker",
58
+ category: "mocks"
59
+ },
60
+ {
61
+ value: "plugin-msw",
62
+ label: "MSW Handlers",
63
+ packageName: "@kubb/plugin-msw",
64
+ importName: "pluginMsw",
65
+ category: "mocks"
66
+ },
67
+ {
68
+ value: "plugin-cypress",
69
+ label: "Cypress Tests",
70
+ packageName: "@kubb/plugin-cypress",
71
+ importName: "pluginCypress",
72
+ category: "testing"
73
+ },
74
+ {
75
+ value: "plugin-mcp",
76
+ label: "MCP Server (AI / Model Context Protocol)",
77
+ packageName: "@kubb/plugin-mcp",
78
+ importName: "pluginMcp",
79
+ category: "ai"
80
+ },
81
+ {
82
+ value: "plugin-redoc",
83
+ label: "ReDoc Documentation",
84
+ packageName: "@kubb/plugin-redoc",
85
+ importName: "pluginRedoc",
86
+ category: "documentation"
87
+ }
88
+ ];
89
+ //#endregion
90
+ Object.defineProperty(exports, "KUBB_CONFIG_FILENAME", {
91
+ enumerable: true,
92
+ get: function() {
93
+ return KUBB_CONFIG_FILENAME;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "KUBB_PACKAGE_NAME", {
97
+ enumerable: true,
98
+ get: function() {
99
+ return KUBB_PACKAGE_NAME;
100
+ }
101
+ });
102
+ Object.defineProperty(exports, "availablePlugins", {
103
+ enumerable: true,
104
+ get: function() {
105
+ return availablePlugins;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "initDefaults", {
109
+ enumerable: true,
110
+ get: function() {
111
+ return initDefaults;
112
+ }
113
+ });
114
+
115
+ //# sourceMappingURL=constants-CdxpgX3_.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-CdxpgX3_.cjs","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const KUBB_PACKAGE_NAME = 'kubb' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: Array<PluginOption> = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-axios',\n label: 'Axios Client',\n packageName: '@kubb/plugin-axios',\n importName: 'pluginAxios',\n category: 'client',\n },\n {\n value: 'plugin-fetch',\n label: 'Fetch Client',\n packageName: '@kubb/plugin-fetch',\n importName: 'pluginFetch',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,oBAAoB;AAEjC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,WAAW;AACvB;AAEA,MAAa,mBAAwC;CACnD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;AACF"}
@@ -0,0 +1,92 @@
1
+ //#region ../../internals/shared/src/constants.ts
2
+ const KUBB_CONFIG_FILENAME = "kubb.config.ts";
3
+ const KUBB_PACKAGE_NAME = "kubb";
4
+ const initDefaults = {
5
+ inputPath: "./openapi.yaml",
6
+ outputPath: "./src/gen",
7
+ plugins: ["plugin-ts"]
8
+ };
9
+ const availablePlugins = [
10
+ {
11
+ value: "plugin-ts",
12
+ label: "TypeScript",
13
+ hint: "Recommended",
14
+ packageName: "@kubb/plugin-ts",
15
+ importName: "pluginTs",
16
+ category: "types"
17
+ },
18
+ {
19
+ value: "plugin-axios",
20
+ label: "Axios Client",
21
+ packageName: "@kubb/plugin-axios",
22
+ importName: "pluginAxios",
23
+ category: "client"
24
+ },
25
+ {
26
+ value: "plugin-fetch",
27
+ label: "Fetch Client",
28
+ packageName: "@kubb/plugin-fetch",
29
+ importName: "pluginFetch",
30
+ category: "client"
31
+ },
32
+ {
33
+ value: "plugin-react-query",
34
+ label: "React Query / TanStack Query",
35
+ packageName: "@kubb/plugin-react-query",
36
+ importName: "pluginReactQuery",
37
+ category: "framework"
38
+ },
39
+ {
40
+ value: "plugin-vue-query",
41
+ label: "Vue Query",
42
+ packageName: "@kubb/plugin-vue-query",
43
+ importName: "pluginVueQuery",
44
+ category: "framework"
45
+ },
46
+ {
47
+ value: "plugin-zod",
48
+ label: "Zod Schemas",
49
+ packageName: "@kubb/plugin-zod",
50
+ importName: "pluginZod",
51
+ category: "validation"
52
+ },
53
+ {
54
+ value: "plugin-faker",
55
+ label: "Faker.js Mocks",
56
+ packageName: "@kubb/plugin-faker",
57
+ importName: "pluginFaker",
58
+ category: "mocks"
59
+ },
60
+ {
61
+ value: "plugin-msw",
62
+ label: "MSW Handlers",
63
+ packageName: "@kubb/plugin-msw",
64
+ importName: "pluginMsw",
65
+ category: "mocks"
66
+ },
67
+ {
68
+ value: "plugin-cypress",
69
+ label: "Cypress Tests",
70
+ packageName: "@kubb/plugin-cypress",
71
+ importName: "pluginCypress",
72
+ category: "testing"
73
+ },
74
+ {
75
+ value: "plugin-mcp",
76
+ label: "MCP Server (AI / Model Context Protocol)",
77
+ packageName: "@kubb/plugin-mcp",
78
+ importName: "pluginMcp",
79
+ category: "ai"
80
+ },
81
+ {
82
+ value: "plugin-redoc",
83
+ label: "ReDoc Documentation",
84
+ packageName: "@kubb/plugin-redoc",
85
+ importName: "pluginRedoc",
86
+ category: "documentation"
87
+ }
88
+ ];
89
+ //#endregion
90
+ export { initDefaults as i, KUBB_PACKAGE_NAME as n, availablePlugins as r, KUBB_CONFIG_FILENAME as t };
91
+
92
+ //# sourceMappingURL=constants-DHRspBTo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-DHRspBTo.js","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const KUBB_PACKAGE_NAME = 'kubb' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: Array<PluginOption> = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-axios',\n label: 'Axios Client',\n packageName: '@kubb/plugin-axios',\n importName: 'pluginAxios',\n category: 'client',\n },\n {\n value: 'plugin-fetch',\n label: 'Fetch Client',\n packageName: '@kubb/plugin-fetch',\n importName: 'pluginFetch',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,oBAAoB;AAEjC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,WAAW;AACvB;AAEA,MAAa,mBAAwC;CACnD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;AACF"}
@@ -0,0 +1,82 @@
1
+ require("./rolldown-runtime-qbf5tadS.cjs");
2
+ let gunshi_agent = require("gunshi/agent");
3
+ //#region src/agent.ts
4
+ /**
5
+ * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
6
+ * `'cursor'`). `undefined` when run by a human or an unrecognized caller.
7
+ */
8
+ function getAgentName() {
9
+ const profile = (0, gunshi_agent.getAgentProfile)();
10
+ return profile.isAgent ? profile.name : void 0;
11
+ }
12
+ //#endregion
13
+ //#region src/utils/env.ts
14
+ /**
15
+ * Returns `true` when the process is running in a CI environment.
16
+ * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
17
+ * TeamCity, Buildkite, and Azure Pipelines.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * if (isCIEnvironment()) {
22
+ * logger.level = 'error'
23
+ * }
24
+ * ```
25
+ */
26
+ function isCIEnvironment() {
27
+ return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.BITBUCKET_BUILD_NUMBER || process.env.JENKINS_URL || process.env.CIRCLECI || process.env.TRAVIS || process.env.TEAMCITY_VERSION || process.env.BUILDKITE || process.env.TF_BUILD);
28
+ }
29
+ /**
30
+ * Returns `true` when the process has an interactive TTY with a valid terminal
31
+ * width and is not running in CI.
32
+ *
33
+ * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
34
+ * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
35
+ * with a negative count and throw a `RangeError`). A positive column count is
36
+ * required before the TTY counts as usable.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * if (canUseTTY()) {
41
+ * renderProgressBar()
42
+ * }
43
+ * ```
44
+ */
45
+ function canUseTTY() {
46
+ return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
47
+ }
48
+ /**
49
+ * Returns `true` when output can carry spinners and clack's gutter: an interactive TTY that no AI
50
+ * coding agent is reading. Cursor-movement escapes are hard for an agent to parse even over a
51
+ * pseudo-TTY, so it gets the plain writer.
52
+ */
53
+ function isRichOutput() {
54
+ return canUseTTY() && !getAgentName();
55
+ }
56
+ //#endregion
57
+ Object.defineProperty(exports, "canUseTTY", {
58
+ enumerable: true,
59
+ get: function() {
60
+ return canUseTTY;
61
+ }
62
+ });
63
+ Object.defineProperty(exports, "getAgentName", {
64
+ enumerable: true,
65
+ get: function() {
66
+ return getAgentName;
67
+ }
68
+ });
69
+ Object.defineProperty(exports, "isCIEnvironment", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return isCIEnvironment;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, "isRichOutput", {
76
+ enumerable: true,
77
+ get: function() {
78
+ return isRichOutput;
79
+ }
80
+ });
81
+
82
+ //# sourceMappingURL=env-DHaFBZTX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-DHaFBZTX.cjs","names":["getAgentProfile"],"sources":["../src/agent.ts","../src/utils/env.ts"],"sourcesContent":["import { getAgentProfile } from 'gunshi/agent'\n\n/**\n * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,\n * `'cursor'`). `undefined` when run by a human or an unrecognized caller.\n */\nexport function getAgentName(): string | undefined {\n const profile = getAgentProfile()\n return profile.isAgent ? profile.name : undefined\n}\n","import { getAgentName } from '../agent.ts'\n\n/**\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`). A positive column count is\n * required before the TTY counts as 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/**\n * Returns `true` when output can carry spinners and clack's gutter: an interactive TTY that no AI\n * coding agent is reading. Cursor-movement escapes are hard for an agent to parse even over a\n * pseudo-TTY, so it gets the plain writer.\n */\nexport function isRichOutput(): boolean {\n return canUseTTY() && !getAgentName()\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAmC;CACjD,MAAM,WAAA,GAAUA,aAAAA,gBAAAA,CAAgB;CAChC,OAAO,QAAQ,UAAU,QAAQ,OAAO,KAAA;AAC1C;;;;;;;;;;;;;;;ACKA,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;;;;;;AAOA,SAAgB,eAAwB;CACtC,OAAO,UAAU,KAAK,CAAC,aAAa;AACtC"}