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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +45 -77
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-CfPP7MYq.cjs +321 -0
  5. package/dist/Telemetry-CfPP7MYq.cjs.map +1 -0
  6. package/dist/Telemetry-uAr3lK_-.js +284 -0
  7. package/dist/Telemetry-uAr3lK_-.js.map +1 -0
  8. package/dist/{define-Bdn8j5VM.cjs → defineCommand-Bo3yZTWI.cjs} +3 -21
  9. package/dist/defineCommand-Bo3yZTWI.cjs.map +1 -0
  10. package/dist/{define-m_fp-Aqm.js → defineCommand-DMEeqliP.js} +4 -16
  11. package/dist/defineCommand-DMEeqliP.js.map +1 -0
  12. package/dist/{errors-CINO1EIv.js → errors-Dc_d7BfX.js} +2 -2
  13. package/dist/{errors-CINO1EIv.js.map → errors-Dc_d7BfX.js.map} +1 -1
  14. package/dist/{errors-CLCjoSg0.cjs → errors-gxFK0vrp.cjs} +2 -2
  15. package/dist/{errors-CLCjoSg0.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
  16. package/dist/{generate-Bod9YCbF.cjs → generate-Dj_ztXAk.cjs} +21 -16
  17. package/dist/generate-Dj_ztXAk.cjs.map +1 -0
  18. package/dist/{generate-BY-juRdH.js → generate-DqE96-AW.js} +21 -16
  19. package/dist/generate-DqE96-AW.js.map +1 -0
  20. package/dist/index.cjs +34 -81
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +6 -1
  23. package/dist/index.js +34 -81
  24. package/dist/index.js.map +1 -1
  25. package/dist/{init-BIkZU6mB.cjs → init-CT0QBOJR.cjs} +6 -6
  26. package/dist/{init-BIkZU6mB.cjs.map → init-CT0QBOJR.cjs.map} +1 -1
  27. package/dist/{init-Cs3Fp6nN.js → init-Dj-yuBT4.js} +5 -5
  28. package/dist/{init-Cs3Fp6nN.js.map → init-Dj-yuBT4.js.map} +1 -1
  29. package/dist/mcp-Bx5bWdkI.cjs +21 -0
  30. package/dist/mcp-Bx5bWdkI.cjs.map +1 -0
  31. package/dist/mcp-Dgf2OtCy.js +21 -0
  32. package/dist/mcp-Dgf2OtCy.js.map +1 -0
  33. package/dist/{package-DrUndPET.cjs → package-CK8o-iEe.cjs} +2 -2
  34. package/dist/package-CK8o-iEe.cjs.map +1 -0
  35. package/dist/package-DC0ALWof.js +6 -0
  36. package/dist/package-DC0ALWof.js.map +1 -0
  37. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  38. package/dist/{run-YsoCk5we.cjs → run-AYlRjIX5.cjs} +136 -98
  39. package/dist/run-AYlRjIX5.cjs.map +1 -0
  40. package/dist/run-B9R0rCqJ.cjs +1380 -0
  41. package/dist/run-B9R0rCqJ.cjs.map +1 -0
  42. package/dist/run-BM1t8CSM.cjs +33 -0
  43. package/dist/run-BM1t8CSM.cjs.map +1 -0
  44. package/dist/run-BlFVmIJl.js +32 -0
  45. package/dist/run-BlFVmIJl.js.map +1 -0
  46. package/dist/{run-CQbj3ley.cjs → run-CBc896in.cjs} +6 -6
  47. package/dist/run-CBc896in.cjs.map +1 -0
  48. package/dist/run-CxPZ9S4b.js +1377 -0
  49. package/dist/run-CxPZ9S4b.js.map +1 -0
  50. package/dist/{run-CF97BWVa.js → run-D9mQoQHA.js} +123 -85
  51. package/dist/run-D9mQoQHA.js.map +1 -0
  52. package/dist/{run-CCZ24VKk.js → run-D_dWNFhX.js} +5 -5
  53. package/dist/run-D_dWNFhX.js.map +1 -0
  54. package/dist/tools-CZT9wSA6.cjs +175 -0
  55. package/dist/tools-CZT9wSA6.cjs.map +1 -0
  56. package/dist/tools-D0UogMU3.js +152 -0
  57. package/dist/tools-D0UogMU3.js.map +1 -0
  58. package/dist/{validate-lbUkWQ5o.js → validate-CRXa_v3l.js} +5 -5
  59. package/dist/{validate-lbUkWQ5o.js.map → validate-CRXa_v3l.js.map} +1 -1
  60. package/dist/{validate-Bfpf_UIh.cjs → validate-CVqbA1lL.cjs} +6 -6
  61. package/dist/{validate-Bfpf_UIh.cjs.map → validate-CVqbA1lL.cjs.map} +1 -1
  62. package/package.json +13 -25
  63. package/dist/agent-DN7o8nlE.js +0 -68
  64. package/dist/agent-DN7o8nlE.js.map +0 -1
  65. package/dist/agent-Fm9_8BBH.cjs +0 -70
  66. package/dist/agent-Fm9_8BBH.cjs.map +0 -1
  67. package/dist/constants-B2JTeRBb.js +0 -42
  68. package/dist/constants-B2JTeRBb.js.map +0 -1
  69. package/dist/constants-BINTA5VZ.cjs +0 -77
  70. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  71. package/dist/constants-BYGmiFs0.cjs +0 -139
  72. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  73. package/dist/constants-DSJ-Xrbv.js +0 -116
  74. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  75. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  76. package/dist/define-m_fp-Aqm.js.map +0 -1
  77. package/dist/generate-BY-juRdH.js.map +0 -1
  78. package/dist/generate-Bod9YCbF.cjs.map +0 -1
  79. package/dist/mcp-BSNulBcC.js +0 -39
  80. package/dist/mcp-BSNulBcC.js.map +0 -1
  81. package/dist/mcp-DcSrFhhP.cjs +0 -39
  82. package/dist/mcp-DcSrFhhP.cjs.map +0 -1
  83. package/dist/package-D5wmvFl4.js +0 -6
  84. package/dist/package-D5wmvFl4.js.map +0 -1
  85. package/dist/package-DrUndPET.cjs.map +0 -1
  86. package/dist/run-BAJubgdA.js +0 -1735
  87. package/dist/run-BAJubgdA.js.map +0 -1
  88. package/dist/run-BzpYYOQs.js +0 -121
  89. package/dist/run-BzpYYOQs.js.map +0 -1
  90. package/dist/run-CCZ24VKk.js.map +0 -1
  91. package/dist/run-CF97BWVa.js.map +0 -1
  92. package/dist/run-CQbj3ley.cjs.map +0 -1
  93. package/dist/run-CqKd6JNc.cjs +0 -1738
  94. package/dist/run-CqKd6JNc.cjs.map +0 -1
  95. package/dist/run-D0hmRpHy.js +0 -49
  96. package/dist/run-D0hmRpHy.js.map +0 -1
  97. package/dist/run-DwdAwnLG.cjs +0 -125
  98. package/dist/run-DwdAwnLG.cjs.map +0 -1
  99. package/dist/run-Lr0Ctnu0.cjs +0 -50
  100. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  101. package/dist/run-YsoCk5we.cjs.map +0 -1
  102. package/dist/shell-475fQKaX.cjs +0 -62
  103. package/dist/shell-475fQKaX.cjs.map +0 -1
  104. package/dist/shell-CN6DNqeC.js +0 -51
  105. package/dist/shell-CN6DNqeC.js.map +0 -1
  106. package/dist/telemetry-B2iWkY5e.cjs +0 -280
  107. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  108. package/dist/telemetry-BkektVz6.js +0 -243
  109. package/dist/telemetry-BkektVz6.js.map +0 -1
  110. package/src/commands/agent/start.ts +0 -50
  111. package/src/commands/agent.ts +0 -10
  112. package/src/commands/generate.ts +0 -59
  113. package/src/commands/init.ts +0 -51
  114. package/src/commands/mcp.ts +0 -36
  115. package/src/commands/validate.ts +0 -22
  116. package/src/constants.ts +0 -48
  117. package/src/index.ts +0 -45
  118. package/src/loggers/clackLogger.ts +0 -460
  119. package/src/loggers/fileSystemLogger.ts +0 -148
  120. package/src/loggers/githubActionsLogger.ts +0 -367
  121. package/src/loggers/plainLogger.ts +0 -243
  122. package/src/loggers/types.ts +0 -7
  123. package/src/loggers/utils.ts +0 -252
  124. package/src/runners/agent/run.ts +0 -113
  125. package/src/runners/agent/utils.ts +0 -98
  126. package/src/runners/generate/run.ts +0 -276
  127. package/src/runners/generate/utils.ts +0 -209
  128. package/src/runners/init/run.ts +0 -211
  129. package/src/runners/init/utils.ts +0 -33
  130. package/src/runners/mcp/run.ts +0 -55
  131. package/src/runners/validate/run.ts +0 -63
  132. package/src/telemetry.ts +0 -280
  133. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
package/LICENSE CHANGED
@@ -1,14 +1,21 @@
1
- Copyright (c) 2026 Stijn Van Hulle
2
-
3
- This repository contains software under two licenses:
1
+ MIT License
4
2
 
5
- 1. Most of the code in this repository is licensed under the
6
- MIT License — see licenses/LICENSE-MIT for the full license text.
3
+ Copyright (c) 2026 Stijn Van Hulle
7
4
 
8
- 2. The following components are licensed under the
9
- GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later)
10
- see licenses/LICENSE-AGPL-3.0 for the full license text:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
11
 
12
- - packages/agent (published as @kubb/agent)
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
13
14
 
14
- Each package's own LICENSE file or package.json specifies its applicable license.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,27 +1,30 @@
1
1
  <div align="center">
2
- <h1>@kubb/cli</h1>
3
2
  <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
- <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
3
+ <img src="https://kubb.dev/og.png" alt="Kubb banner">
5
4
  </a>
6
5
 
7
6
  [![npm version][npm-version-src]][npm-version-href]
8
7
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
9
- [![Coverage][coverage-src]][coverage-href]
8
+ [![Stars][stars-src]][stars-href]
10
9
  [![License][license-src]][license-href]
11
- [![Sponsors][sponsors-src]][sponsors-href]
10
+ [![Node][node-src]][node-href]
12
11
 
13
12
  <h4>
14
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
15
- <span> · </span>
16
- <a href="https://kubb.dev/" target="_blank">Documentation</a>
17
- <span> · </span>
18
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
19
- <span> · </span>
20
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
21
- </h4>
13
+ <a href="https://kubb.dev" target="_blank">Documentation</a>
14
+ <span> · </span>
15
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
16
+ <span> · </span>
17
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
18
+ </h4>
22
19
  </div>
23
20
 
24
- Official CLI for Kubb. Run `kubb generate` to transform OpenAPI/Swagger specs into TypeScript types, API clients, hooks, validators, and mocks. Includes interactive project setup (`kubb init`), spec validation, watch mode, MCP server, and agent server commands.
21
+ <br />
22
+
23
+ # @kubb/cli
24
+
25
+ ### The command-line interface for Kubb
26
+
27
+ Official CLI for Kubb. Run `kubb generate` to produce TypeScript types, API clients, hooks, validators, and mocks. Includes interactive project setup (`kubb init`), spec validation, watch mode, and an MCP server.
25
28
 
26
29
  ## Installation
27
30
 
@@ -39,7 +42,6 @@ npm install -D @kubb/cli
39
42
  - [`kubb generate`](#kubb-generate) — run code generation
40
43
  - [`kubb validate`](#kubb-validate) — validate an OpenAPI spec
41
44
  - [`kubb mcp`](#kubb-mcp) — start the MCP server for AI assistants
42
- - [`kubb agent start`](#kubb-agent-start) — start the HTTP agent server
43
45
 
44
46
  ---
45
47
 
@@ -99,15 +101,15 @@ npx kubb generate
99
101
 
100
102
  #### Options
101
103
 
102
- | Flag | Short | Type | Default | Description |
103
- | -------------------- | ----- | ------- | ------- | -------------------------------------------------------- |
104
- | `[input]` | | string | | OpenAPI file path — overrides `input.path` in the config |
105
- | `--config <path>` | `-c` | string | | Path to the Kubb config file |
106
- | `--logLevel <level>` | `-l` | string | `info` | Log level: `silent`, `info`, `verbose`, or `debug` |
107
- | `--watch` | `-w` | boolean | `false` | Re-generate whenever the input file changes |
108
- | `--debug` | `-d` | boolean | `false` | Override log level to `debug` |
109
- | `--verbose` | `-v` | boolean | `false` | Override log level to `verbose` |
110
- | `--silent` | `-s` | boolean | `false` | Override log level to `silent` |
104
+ | Flag | Short | Type | Default | Description |
105
+ | -------------------- | ----- | ------- | ------- | --------------------------------------------------------------------------------------------------- |
106
+ | `[input]` | | string | | OpenAPI file path — overrides `input.path` in the config |
107
+ | `--config <path>` | `-c` | string | | Path to the Kubb config file |
108
+ | `--logLevel <level>` | `-l` | string | `info` | Log level: `silent`, `info`, or `verbose` |
109
+ | `--watch` | `-w` | boolean | `false` | Re-generate whenever the input file changes |
110
+ | `--verbose` | `-v` | boolean | `false` | Override log level to `verbose` |
111
+ | `--silent` | `-s` | boolean | `false` | Override log level to `silent` |
112
+ | `--reporter <names>` | | string | `cli` | Reporters that render the run, comma-separated: `cli`, `json`, `file`. Overrides `config.reporters` |
111
113
 
112
114
  #### Examples
113
115
 
@@ -124,8 +126,11 @@ npx kubb generate --config ./configs/kubb.config.ts
124
126
  # Watch for changes and regenerate automatically
125
127
  npx kubb generate --watch
126
128
 
127
- # Debug output
128
- npx kubb generate --debug
129
+ # Verbose output
130
+ npx kubb generate --verbose
131
+
132
+ # Write a JSON run report alongside the CLI output
133
+ npx kubb generate --reporter cli,json
129
134
  ```
130
135
 
131
136
  ---
@@ -198,49 +203,12 @@ Add the following to your MCP client config (e.g. Claude Desktop's `claude_deskt
198
203
  }
199
204
  ```
200
205
 
201
- ---
202
-
203
- ### `kubb agent start`
204
-
205
- Start the Kubb Agent HTTP server. Exposes a REST API that accepts a `kubb.config.ts` patch and returns generated code as a stream. Use `--allow-write` to also write files to disk.
206
-
207
- ```bash
208
- npx kubb agent start
209
- ```
210
-
211
- #### Options
212
-
213
- | Flag | Short | Type | Default | Description |
214
- | ------------------- | ----- | ------- | --------- | ----------------------------------------------------------------- |
215
- | `--config <path>` | `-c` | string | | Path to the Kubb config file |
216
- | `--port <number>` | `-p` | string | `3000` | Port the HTTP server listens on |
217
- | `--host <hostname>` | | string | `0.0.0.0` | Hostname the HTTP server binds to |
218
- | `--allow-write` | | boolean | `false` | Write generated files to disk (otherwise output is streamed only) |
219
- | `--allow-all` | | boolean | `false` | Grant all permissions (implies `--allow-write`) |
220
-
221
- #### Examples
222
-
223
- ```bash
224
- # Start with defaults
225
- npx kubb agent start
226
-
227
- # Custom port
228
- npx kubb agent start --port 4000
229
-
230
- # Allow writing files to disk
231
- npx kubb agent start --allow-write
232
-
233
- # Full permissions with custom config
234
- npx kubb agent start --config ./kubb.config.ts --allow-all
235
- ```
236
-
237
- See the [`@kubb/agent` README](../agent/README.md) for full environment variable reference, Docker setup, WebSocket API, and Studio integration.
238
-
239
206
  ## Supporting Kubb
240
207
 
241
- Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
208
+ Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
242
209
 
243
210
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
211
+ - [See sponsorship tiers and our sponsors](https://kubb.dev/sponsors)
244
212
 
245
213
  <p align="center">
246
214
  <a href="https://github.com/sponsors/stijnvanhulle">
@@ -248,19 +216,19 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
248
216
  </a>
249
217
  </p>
250
218
 
219
+ ## License
220
+
221
+ [MIT](https://github.com/kubb-labs/kubb/blob/main/licenses/LICENSE-MIT)
222
+
251
223
  <!-- Badges -->
252
224
 
253
- [npm-version-src]: https://img.shields.io/npm/v/@kubb/cli?flat&colorA=18181B&colorB=f58517
254
- [npm-version-href]: https://npmjs.com/package/@kubb/cli
255
- [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/cli?flat&colorA=18181B&colorB=f58517
256
- [npm-downloads-href]: https://npmjs.com/package/@kubb/cli
257
- [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
225
+ [npm-version-src]: https://shieldcn.dev/npm/v/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
226
+ [npm-version-href]: https://npmx.dev/package/@kubb/cli
227
+ [npm-downloads-src]: https://shieldcn.dev/npm/dm/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
228
+ [npm-downloads-href]: https://npmx.dev/package/@kubb/cli
229
+ [stars-src]: https://shieldcn.dev/github/stars/kubb-labs/kubb.svg?variant=secondary&size=xs&theme=zinc&mode=dark
230
+ [stars-href]: https://github.com/kubb-labs/kubb
231
+ [license-src]: https://shieldcn.dev/npm/license/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc
258
232
  [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
259
- [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
260
- [build-href]: https://www.npmjs.com/package/@kubb/cli
261
- [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/cli?style=flat&colorA=18181B&colorB=f58517
262
- [minified-href]: https://www.npmjs.com/package/@kubb/cli
263
- [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
264
- [coverage-href]: https://www.npmjs.com/package/@kubb/cli
265
- [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
266
- [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
233
+ [node-src]: https://shieldcn.dev/npm/node/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
234
+ [node-href]: https://npmx.dev/package/@kubb/cli
package/bin/kubb.js CHANGED
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
- process.setSourceMapsEnabled?.(true)
3
2
 
4
- const { run } = await import('../dist/index.js')
3
+ process.setSourceMapsEnabled?.(true)
5
4
  process.title = 'Kubb'
6
- run(process.argv)
5
+
6
+ try {
7
+ const { run } = await import('../dist/index.js')
8
+ await run(process.argv)
9
+ } catch (err) {
10
+ console.error(err)
11
+ process.exit(1)
12
+ }
@@ -0,0 +1,321 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-Bx3C2hgW.cjs");
2
+ let node_crypto = require("node:crypto");
3
+ let node_os = require("node:os");
4
+ node_os = require_rolldown_runtime.__toESM(node_os, 1);
5
+ let node_process = require("node:process");
6
+ node_process = require_rolldown_runtime.__toESM(node_process, 1);
7
+ //#region ../../internals/utils/src/env.ts
8
+ /**
9
+ * Returns `true` when the process is running in a CI environment.
10
+ * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
11
+ * TeamCity, Buildkite, and Azure Pipelines.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * if (isCIEnvironment()) {
16
+ * logger.level = 'error'
17
+ * }
18
+ * ```
19
+ */
20
+ function isCIEnvironment() {
21
+ 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);
22
+ }
23
+ /**
24
+ * Returns `true` when the process has an interactive TTY with a valid terminal
25
+ * width and is not running in CI.
26
+ *
27
+ * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
28
+ * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
29
+ * with a negative count and throw a `RangeError`). We therefore require a
30
+ * positive column count before declaring the TTY usable.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * if (canUseTTY()) {
35
+ * renderProgressBar()
36
+ * }
37
+ * ```
38
+ */
39
+ function canUseTTY() {
40
+ return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
41
+ }
42
+ //#endregion
43
+ //#region ../../internals/utils/src/runtime.ts
44
+ /**
45
+ * Detects the JavaScript runtime executing the current process and exposes its name and version.
46
+ *
47
+ * Prefer the shared {@link runtime} instance over constructing your own.
48
+ */
49
+ var Runtime = class {
50
+ /**
51
+ * `true` when the current process is running under Bun.
52
+ *
53
+ * Detection keys off the global `Bun` object rather than `process.versions`,
54
+ * because Bun polyfills `process.versions.node` for Node compatibility and would
55
+ * otherwise look like Node.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * if (runtime.isBun) {
60
+ * await Bun.write(path, data)
61
+ * }
62
+ * ```
63
+ */
64
+ get isBun() {
65
+ return typeof Bun !== "undefined";
66
+ }
67
+ /**
68
+ * `true` when the current process is running under Deno.
69
+ */
70
+ get isDeno() {
71
+ return typeof globalThis.Deno !== "undefined";
72
+ }
73
+ /**
74
+ * `true` when the current process is running under Node.
75
+ *
76
+ * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.
77
+ */
78
+ get isNode() {
79
+ return !this.isBun && !this.isDeno && typeof process !== "undefined" && process.versions?.node != null;
80
+ }
81
+ /**
82
+ * Name of the runtime executing the current process.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
87
+ * ```
88
+ */
89
+ get name() {
90
+ if (this.isBun) return "bun";
91
+ if (this.isDeno) return "deno";
92
+ return "node";
93
+ }
94
+ /**
95
+ * Version of the active runtime, or an empty string when it cannot be read.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * runtime.version // '1.3.11' under Bun, '22.22.2' under Node
100
+ * ```
101
+ */
102
+ get version() {
103
+ if (this.isBun) return process.versions.bun ?? "";
104
+ if (this.isDeno) return globalThis.Deno?.version?.deno ?? "";
105
+ return process.versions?.node ?? "";
106
+ }
107
+ };
108
+ /**
109
+ * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.
110
+ */
111
+ const runtime = new Runtime();
112
+ //#endregion
113
+ //#region src/constants.ts
114
+ /**
115
+ * NPM registry endpoint used to check for @kubb/cli updates.
116
+ */
117
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
118
+ /**
119
+ * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
120
+ */
121
+ const OTLP_ENDPOINT = "https://otlp.kubb.dev";
122
+ /**
123
+ * Glob pattern for paths the file watcher ignores.
124
+ */
125
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
126
+ /**
127
+ * Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these.
128
+ */
129
+ const QUIET_FLAGS = new Set([
130
+ "--help",
131
+ "-h",
132
+ "--version",
133
+ "-v"
134
+ ]);
135
+ //#endregion
136
+ //#region src/Telemetry.ts
137
+ /**
138
+ * Anonymous OTLP usage telemetry for a Kubb run. The API is static, so call it as `Telemetry.build(...)`
139
+ * and `Telemetry.send(...)`. No file paths, OpenAPI specs, or secrets are sent, and sending fails
140
+ * silently so a failed request never breaks the run.
141
+ */
142
+ var Telemetry = class Telemetry {
143
+ /**
144
+ * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.
145
+ */
146
+ static get isDisabled() {
147
+ return node_process.default.env["DO_NOT_TRACK"] === "1" || node_process.default.env["DO_NOT_TRACK"] === "true" || node_process.default.env["KUBB_DISABLE_TELEMETRY"] === "1" || node_process.default.env["KUBB_DISABLE_TELEMETRY"] === "true";
148
+ }
149
+ /**
150
+ * Build an anonymous telemetry payload from a completed generation run.
151
+ */
152
+ static build(options) {
153
+ const [seconds, nanoseconds] = node_process.default.hrtime(options.hrStart);
154
+ const duration = Math.round(seconds * 1e3 + nanoseconds / 1e6);
155
+ return {
156
+ command: options.command,
157
+ kubbVersion: options.kubbVersion,
158
+ nodeVersion: node_process.default.versions.node.split(".")[0],
159
+ runtime: runtime.name,
160
+ runtimeVersion: runtime.version.split(".")[0],
161
+ platform: node_os.default.platform(),
162
+ ci: isCIEnvironment(),
163
+ plugins: options.plugins ?? [],
164
+ duration,
165
+ filesCreated: options.filesCreated ?? 0,
166
+ status: options.status
167
+ };
168
+ }
169
+ /**
170
+ * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
171
+ *
172
+ * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
173
+ */
174
+ static buildOtlpPayload(event) {
175
+ const traceId = (0, node_crypto.randomBytes)(16).toString("hex");
176
+ const spanId = (0, node_crypto.randomBytes)(8).toString("hex");
177
+ const endTimeNs = BigInt(Date.now()) * 1000000n;
178
+ const startTimeNs = endTimeNs - BigInt(event.duration) * 1000000n;
179
+ const attributes = [
180
+ {
181
+ key: "kubb.command",
182
+ value: { stringValue: event.command }
183
+ },
184
+ {
185
+ key: "kubb.version",
186
+ value: { stringValue: event.kubbVersion }
187
+ },
188
+ {
189
+ key: "kubb.node_version",
190
+ value: { stringValue: event.nodeVersion }
191
+ },
192
+ {
193
+ key: "kubb.runtime",
194
+ value: { stringValue: event.runtime }
195
+ },
196
+ {
197
+ key: "kubb.runtime_version",
198
+ value: { stringValue: event.runtimeVersion }
199
+ },
200
+ {
201
+ key: "kubb.platform",
202
+ value: { stringValue: event.platform }
203
+ },
204
+ {
205
+ key: "kubb.ci",
206
+ value: { boolValue: event.ci }
207
+ },
208
+ {
209
+ key: "kubb.files_created",
210
+ value: { intValue: event.filesCreated }
211
+ },
212
+ {
213
+ key: "kubb.status",
214
+ value: { stringValue: event.status }
215
+ },
216
+ {
217
+ key: "kubb.plugins",
218
+ value: { arrayValue: { values: event.plugins.map((p) => ({ kvlistValue: { values: [{
219
+ key: "name",
220
+ value: { stringValue: p.name }
221
+ }, {
222
+ key: "options",
223
+ value: { stringValue: JSON.stringify({
224
+ ...p.options,
225
+ usedEnumNames: void 0
226
+ }) }
227
+ }] } })) } }
228
+ }
229
+ ];
230
+ return { resourceSpans: [{
231
+ resource: { attributes: [
232
+ {
233
+ key: "service.name",
234
+ value: { stringValue: "kubb-core" }
235
+ },
236
+ {
237
+ key: "service.version",
238
+ value: { stringValue: event.kubbVersion }
239
+ },
240
+ {
241
+ key: "telemetry.sdk.language",
242
+ value: { stringValue: "nodejs" }
243
+ }
244
+ ] },
245
+ scopeSpans: [{
246
+ scope: {
247
+ name: "kubb-core",
248
+ version: event.kubbVersion
249
+ },
250
+ spans: [{
251
+ traceId,
252
+ spanId,
253
+ name: event.command,
254
+ kind: 1,
255
+ startTimeUnixNano: String(startTimeNs),
256
+ endTimeUnixNano: String(endTimeNs),
257
+ attributes,
258
+ status: { code: event.status === "success" ? 1 : 2 }
259
+ }]
260
+ }]
261
+ }] };
262
+ }
263
+ /**
264
+ * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and
265
+ * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run.
266
+ */
267
+ static async send(event) {
268
+ if (Telemetry.isDisabled) return;
269
+ try {
270
+ await fetch(`${OTLP_ENDPOINT}/v1/traces`, {
271
+ method: "POST",
272
+ headers: {
273
+ "Content-Type": "application/json",
274
+ "Kubb-Telemetry-Version": "1",
275
+ "Kubb-Telemetry-Source": "kubb-core"
276
+ },
277
+ body: JSON.stringify(Telemetry.buildOtlpPayload(event)),
278
+ signal: AbortSignal.timeout(5e3)
279
+ });
280
+ } catch (_e) {}
281
+ }
282
+ };
283
+ //#endregion
284
+ Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
285
+ enumerable: true,
286
+ get: function() {
287
+ return KUBB_NPM_PACKAGE_URL;
288
+ }
289
+ });
290
+ Object.defineProperty(exports, "QUIET_FLAGS", {
291
+ enumerable: true,
292
+ get: function() {
293
+ return QUIET_FLAGS;
294
+ }
295
+ });
296
+ Object.defineProperty(exports, "Telemetry", {
297
+ enumerable: true,
298
+ get: function() {
299
+ return Telemetry;
300
+ }
301
+ });
302
+ Object.defineProperty(exports, "WATCHER_IGNORED_PATHS", {
303
+ enumerable: true,
304
+ get: function() {
305
+ return WATCHER_IGNORED_PATHS;
306
+ }
307
+ });
308
+ Object.defineProperty(exports, "canUseTTY", {
309
+ enumerable: true,
310
+ get: function() {
311
+ return canUseTTY;
312
+ }
313
+ });
314
+ Object.defineProperty(exports, "runtime", {
315
+ enumerable: true,
316
+ get: function() {
317
+ return runtime;
318
+ }
319
+ });
320
+
321
+ //# sourceMappingURL=Telemetry-CfPP7MYq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Telemetry-CfPP7MYq.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":"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"}