@kubb/cli 5.0.0-alpha.7 → 5.0.0-alpha.9

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 (70) hide show
  1. package/dist/{agent-CjXjyuPe.js → agent-5mmp7QzF.js} +4 -4
  2. package/dist/{agent-CjXjyuPe.js.map → agent-5mmp7QzF.js.map} +1 -1
  3. package/dist/{agent-Cc-0-A8t.cjs → agent-BKphjOIF.cjs} +4 -4
  4. package/dist/{agent-Cc-0-A8t.cjs.map → agent-BKphjOIF.cjs.map} +1 -1
  5. package/dist/{agent-C6o_6GSJ.cjs → agent-BapvKB4r.cjs} +3 -3
  6. package/dist/{agent-C6o_6GSJ.cjs.map → agent-BapvKB4r.cjs.map} +1 -1
  7. package/dist/{agent-L50VNhXv.js → agent-CBrpIMMU.js} +3 -3
  8. package/dist/{agent-L50VNhXv.js.map → agent-CBrpIMMU.js.map} +1 -1
  9. package/dist/{constants-BTUap0zs.cjs → constants-D0XHAHeZ.cjs} +78 -8
  10. package/dist/constants-D0XHAHeZ.cjs.map +1 -0
  11. package/dist/{constants-CM3dJzjK.js → constants-DJM9zCXm.js} +73 -9
  12. package/dist/constants-DJM9zCXm.js.map +1 -0
  13. package/dist/{generate-BYqhZfbq.js → generate-BHNyeQXl.js} +4 -4
  14. package/dist/generate-BHNyeQXl.js.map +1 -0
  15. package/dist/{generate-yOyKmo19.cjs → generate-Cq5RDTBL.cjs} +4 -4
  16. package/dist/{generate-BYqhZfbq.js.map → generate-Cq5RDTBL.cjs.map} +1 -1
  17. package/dist/{generate-BP0WpC20.cjs → generate-DU5zzc54.cjs} +2 -2
  18. package/dist/{generate-BP0WpC20.cjs.map → generate-DU5zzc54.cjs.map} +1 -1
  19. package/dist/{generate-BX6LmxKo.js → generate-Rly1EXBN.js} +2 -2
  20. package/dist/{generate-BX6LmxKo.js.map → generate-Rly1EXBN.js.map} +1 -1
  21. package/dist/index.cjs +19 -14
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +19 -14
  25. package/dist/index.js.map +1 -1
  26. package/dist/{init-hmolV6B4.cjs → init-BK6inBTR.cjs} +2 -2
  27. package/dist/{init-hmolV6B4.cjs.map → init-BK6inBTR.cjs.map} +1 -1
  28. package/dist/{init-C-InrmSY.js → init-BQ6zfsnw.js} +2 -2
  29. package/dist/{init-C-InrmSY.js.map → init-BQ6zfsnw.js.map} +1 -1
  30. package/dist/{init-DkwG4Gbs.cjs → init-CN1JFyGX.cjs} +3 -3
  31. package/dist/{init-DkwG4Gbs.cjs.map → init-CN1JFyGX.cjs.map} +1 -1
  32. package/dist/{init-BqkRvRTM.js → init-iN7e1XwI.js} +3 -3
  33. package/dist/{init-BqkRvRTM.js.map → init-iN7e1XwI.js.map} +1 -1
  34. package/dist/{mcp-D2SHEg_d.js → mcp-BiGUvbWP.js} +2 -2
  35. package/dist/{mcp-D2SHEg_d.js.map → mcp-BiGUvbWP.js.map} +1 -1
  36. package/dist/{mcp-ChHFPRzD.cjs → mcp-CONmm_xT.cjs} +2 -2
  37. package/dist/{mcp-ChHFPRzD.cjs.map → mcp-CONmm_xT.cjs.map} +1 -1
  38. package/dist/{mcp-BnEafD5r.cjs → mcp-T7Q4nWbT.cjs} +3 -3
  39. package/dist/{mcp-BnEafD5r.cjs.map → mcp-T7Q4nWbT.cjs.map} +1 -1
  40. package/dist/{mcp-Cqn_PHUg.js → mcp-eP1S40LZ.js} +3 -3
  41. package/dist/{mcp-Cqn_PHUg.js.map → mcp-eP1S40LZ.js.map} +1 -1
  42. package/dist/{package-DZb6I8FQ.cjs → package-BJ6ionm6.cjs} +2 -2
  43. package/dist/package-BJ6ionm6.cjs.map +1 -0
  44. package/dist/package-BKZ0H3Zf.js +6 -0
  45. package/dist/package-BKZ0H3Zf.js.map +1 -0
  46. package/dist/{telemetry-DxiR7clS.js → telemetry-BF3SMlH6.js} +2 -2
  47. package/dist/{telemetry-DxiR7clS.js.map → telemetry-BF3SMlH6.js.map} +1 -1
  48. package/dist/{telemetry-Cn9X1I5B.cjs → telemetry-DZ7IrLAU.cjs} +2 -2
  49. package/dist/{telemetry-Cn9X1I5B.cjs.map → telemetry-DZ7IrLAU.cjs.map} +1 -1
  50. package/dist/{validate-l8vLmwKA.js → validate-BImbbx1t.js} +2 -2
  51. package/dist/{validate-l8vLmwKA.js.map → validate-BImbbx1t.js.map} +1 -1
  52. package/dist/{validate-Bgqwmhir.js → validate-DAZdX_0i.js} +3 -3
  53. package/dist/{validate-Bgqwmhir.js.map → validate-DAZdX_0i.js.map} +1 -1
  54. package/dist/{validate-9FoHgtvi.cjs → validate-DucFMytl.cjs} +3 -3
  55. package/dist/{validate-9FoHgtvi.cjs.map → validate-DucFMytl.cjs.map} +1 -1
  56. package/dist/{validate-Bbrn3Q-A.cjs → validate-ujLCYSWU.cjs} +2 -2
  57. package/dist/{validate-Bbrn3Q-A.cjs.map → validate-ujLCYSWU.cjs.map} +1 -1
  58. package/package.json +5 -5
  59. package/src/constants.ts +57 -10
  60. package/src/index.ts +5 -4
  61. package/src/loggers/clackLogger.ts +1 -2
  62. package/src/types.ts +11 -0
  63. package/src/utils/flags.ts +10 -0
  64. package/dist/constants-BTUap0zs.cjs.map +0 -1
  65. package/dist/constants-CM3dJzjK.js.map +0 -1
  66. package/dist/generate-yOyKmo19.cjs.map +0 -1
  67. package/dist/package-DLd3fZNd.js +0 -6
  68. package/dist/package-DLd3fZNd.js.map +0 -1
  69. package/dist/package-DZb6I8FQ.cjs.map +0 -1
  70. package/src/utils/getIntro.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
2
  const require_errors = require("./errors-DBW0N9w4.cjs");
3
- const require_telemetry = require("./telemetry-Cn9X1I5B.cjs");
3
+ const require_telemetry = require("./telemetry-DZ7IrLAU.cjs");
4
4
  const require_jiti = require("./jiti-Cd3S0xwr.cjs");
5
5
  let node_util = require("node:util");
6
6
  let node_process = require("node:process");
@@ -39,4 +39,4 @@ async function runMcp({ version }) {
39
39
  //#endregion
40
40
  exports.runMcp = runMcp;
41
41
 
42
- //# sourceMappingURL=mcp-ChHFPRzD.cjs.map
42
+ //# sourceMappingURL=mcp-CONmm_xT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-ChHFPRzD.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/mcp.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype McpOptions = {\n version: string\n}\n\nexport async function runMcp({ version }: McpOptions): Promise<void> {\n let mod: typeof McpModule\n try {\n mod = (await jiti.import('@kubb/mcp', { default: true })) as typeof McpModule\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n process.exit(1)\n }\n\n const { run } = mod\n const hrStart = process.hrtime()\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(styleText('yellow', 'This feature is still under development — use with caution'))\n run()\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'failed' }))\n console.error(getErrorMessage(error))\n }\n}\n"],"mappings":";;;;;;;;AAWA,eAAsB,OAAO,EAAE,WAAsC;CACnE,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,4DAA4D;AAC1E,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,QAAQ;CAChB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AACF,UAAQ,IAAI,2BAA2B;AACvC,UAAQ,MAAA,GAAA,UAAA,WAAe,UAAU,6DAA6D,CAAC;AAC/F,OAAK;AACL,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACvG,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC7G,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC"}
1
+ {"version":3,"file":"mcp-CONmm_xT.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/mcp.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype McpOptions = {\n version: string\n}\n\nexport async function runMcp({ version }: McpOptions): Promise<void> {\n let mod: typeof McpModule\n try {\n mod = (await jiti.import('@kubb/mcp', { default: true })) as typeof McpModule\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n process.exit(1)\n }\n\n const { run } = mod\n const hrStart = process.hrtime()\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(styleText('yellow', 'This feature is still under development — use with caution'))\n run()\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'failed' }))\n console.error(getErrorMessage(error))\n }\n}\n"],"mappings":";;;;;;;;AAWA,eAAsB,OAAO,EAAE,WAAsC;CACnE,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,4DAA4D;AAC1E,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,QAAQ;CAChB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AACF,UAAQ,IAAI,2BAA2B;AACvC,UAAQ,MAAA,GAAA,UAAA,WAAe,UAAU,6DAA6D,CAAC;AAC/F,OAAK;AACL,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACvG,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC7G,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC"}
@@ -1,16 +1,16 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
2
  const require_define = require("./define-D6Kfm7-Z.cjs");
3
- const require_package = require("./package-DZb6I8FQ.cjs");
3
+ const require_package = require("./package-BJ6ionm6.cjs");
4
4
  //#region src/commands/mcp.ts
5
5
  const command = require_define.defineCommand({
6
6
  name: "mcp",
7
7
  description: "Start the server to enable the MCP client to interact with the LLM.",
8
8
  async run() {
9
- const { runMcp } = await Promise.resolve().then(() => require("./mcp-ChHFPRzD.cjs"));
9
+ const { runMcp } = await Promise.resolve().then(() => require("./mcp-CONmm_xT.cjs"));
10
10
  await runMcp({ version: require_package.version });
11
11
  }
12
12
  });
13
13
  //#endregion
14
14
  exports.command = command;
15
15
 
16
- //# sourceMappingURL=mcp-BnEafD5r.cjs.map
16
+ //# sourceMappingURL=mcp-T7Q4nWbT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-BnEafD5r.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;AAEzB,QAAM,OAAO,EAAE,SAAA,gBAAA,SAAS,CAAC;;CAE5B,CAAC"}
1
+ {"version":3,"file":"mcp-T7Q4nWbT.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;AAEzB,QAAM,OAAO,EAAE,SAAA,gBAAA,SAAS,CAAC;;CAE5B,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import "./chunk--u3MIqq1.js";
2
2
  import { n as defineCommand } from "./define--M_JMcDC.js";
3
- import { t as version } from "./package-DLd3fZNd.js";
3
+ import { t as version } from "./package-BKZ0H3Zf.js";
4
4
  //#region src/commands/mcp.ts
5
5
  const command = defineCommand({
6
6
  name: "mcp",
7
7
  description: "Start the server to enable the MCP client to interact with the LLM.",
8
8
  async run() {
9
- const { runMcp } = await import("./mcp-D2SHEg_d.js");
9
+ const { runMcp } = await import("./mcp-BiGUvbWP.js");
10
10
  await runMcp({ version });
11
11
  }
12
12
  });
13
13
  //#endregion
14
14
  export { command };
15
15
 
16
- //# sourceMappingURL=mcp-Cqn_PHUg.js.map
16
+ //# sourceMappingURL=mcp-eP1S40LZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-Cqn_PHUg.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,QAAM,OAAO,EAAE,SAAS,CAAC;;CAE5B,CAAC"}
1
+ {"version":3,"file":"mcp-eP1S40LZ.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,QAAM,OAAO,EAAE,SAAS,CAAC;;CAE5B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "5.0.0-alpha.7";
2
+ var version = "5.0.0-alpha.9";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "version", {
8
8
  }
9
9
  });
10
10
 
11
- //# sourceMappingURL=package-DZb6I8FQ.cjs.map
11
+ //# sourceMappingURL=package-BJ6ionm6.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-BJ6ionm6.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "5.0.0-alpha.9";
3
+ //#endregion
4
+ export { version as t };
5
+
6
+ //# sourceMappingURL=package-BKZ0H3Zf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-BKZ0H3Zf.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { n as OTLP_ENDPOINT } from "./constants-CM3dJzjK.js";
2
+ import { n as OTLP_ENDPOINT } from "./constants-DJM9zCXm.js";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { promises } from "node:dns";
5
5
  import os from "node:os";
@@ -200,4 +200,4 @@ function buildTelemetryEvent(options) {
200
200
  //#endregion
201
201
  export { canUseTTY as a, executeIfOnline as i, isTelemetryDisabled as n, isGitHubActions as o, sendTelemetry as r, buildTelemetryEvent as t };
202
202
 
203
- //# sourceMappingURL=telemetry-DxiR7clS.js.map
203
+ //# sourceMappingURL=telemetry-BF3SMlH6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-DxiR7clS.js","names":["dnsPromises","process"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\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 */\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 and is not running in CI.\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/** Well-known stable domains used as DNS probes to check internet connectivity. */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Uses DNS resolution against well-known stable domains as a lightweight probe.\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } 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: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: 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: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\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?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): 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 * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\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: 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.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 { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\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-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', 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: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\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-cli',\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 CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: 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 platform: os.platform(),\n ci: isCi(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,kBAA2B;AACzC,QAAO,CAAC,CAAC,QAAQ,IAAI;;;;;;;AAQvB,SAAgB,kBAA2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P,gBAAgB;KAChB,0BAA0B;KAC1B,yBAAyB;KAC1B;IACD,MAAM,KAAK,UAAU,iBAAiB,MAAM,CAAC;IAC7C,QAAQ,YAAY,QAAQ,IAAM;IACnC,CAAC;WACK,IAAI;GAGb;;;;;;AAOJ,SAAgB,oBAAoB,SAOjB;CACjB,MAAM,CAAC,SAAS,eAAeA,UAAQ,OAAO,QAAQ,QAAQ;CAC9D,MAAM,WAAW,KAAK,MAAM,UAAU,MAAO,cAAc,IAAI;AAE/D,QAAO;EACL,SAAS,QAAQ;EACjB,aAAa,QAAQ;EACrB,aAAaA,UAAQ,SAAS,KAAK,MAAM,IAAI,CAAC;EAC9C,UAAU,GAAG,UAAU;EACvB,IAAI,MAAM;EACV,SAAS,QAAQ,WAAW,EAAE;EAC9B;EACA,cAAc,QAAQ,gBAAgB;EACtC,QAAQ,QAAQ;EACjB"}
1
+ {"version":3,"file":"telemetry-BF3SMlH6.js","names":["dnsPromises","process"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\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 */\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 and is not running in CI.\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/** Well-known stable domains used as DNS probes to check internet connectivity. */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Uses DNS resolution against well-known stable domains as a lightweight probe.\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } 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: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: 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: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\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?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): 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 * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\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: 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.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 { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\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-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', 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: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\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-cli',\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 CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: 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 platform: os.platform(),\n ci: isCi(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,kBAA2B;AACzC,QAAO,CAAC,CAAC,QAAQ,IAAI;;;;;;;AAQvB,SAAgB,kBAA2B;AACzC,QAAO,CAAC,EACN,QAAQ,IAAI,MACZ,QAAQ,IAAI,kBACZ,QAAQ,IAAI,aACZ,QAAQ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C;IAC7C,QAAQ,YAAY,QAAQ,IAAM;IACnC,CAAC;WACK,IAAI;GAGb;;;;;;AAOJ,SAAgB,oBAAoB,SAOjB;CACjB,MAAM,CAAC,SAAS,eAAeA,UAAQ,OAAO,QAAQ,QAAQ;CAC9D,MAAM,WAAW,KAAK,MAAM,UAAU,MAAO,cAAc,IAAI;AAE/D,QAAO;EACL,SAAS,QAAQ;EACjB,aAAa,QAAQ;EACrB,aAAaA,UAAQ,SAAS,KAAK,MAAM,IAAI,CAAC;EAC9C,UAAU,GAAG,UAAU;EACvB,IAAI,MAAM;EACV,SAAS,QAAQ,WAAW,EAAE;EAC9B;EACA,cAAc,QAAQ,gBAAgB;EACtC,QAAQ,QAAQ;EACjB"}
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
- const require_constants = require("./constants-BTUap0zs.cjs");
2
+ const require_constants = require("./constants-D0XHAHeZ.cjs");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_dns = require("node:dns");
5
5
  let node_os = require("node:os");
@@ -237,4 +237,4 @@ Object.defineProperty(exports, "sendTelemetry", {
237
237
  }
238
238
  });
239
239
 
240
- //# sourceMappingURL=telemetry-Cn9X1I5B.cjs.map
240
+ //# sourceMappingURL=telemetry-DZ7IrLAU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-Cn9X1I5B.cjs","names":["dnsPromises","process","OTLP_ENDPOINT","os"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\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 */\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 and is not running in CI.\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/** Well-known stable domains used as DNS probes to check internet connectivity. */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Uses DNS resolution against well-known stable domains as a lightweight probe.\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } 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: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: 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: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\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?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): 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 * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\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: 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.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 { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\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-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', 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: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\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-cli',\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 CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: 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('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iBAAiB,OAAO,UAAU;IAClC;IACA,QAAQ,EAAE,MAAO,MAAM,WAAW,YAAY,IAAI,GAA6B;IAChF,CACF;GACF,CACF;EACF,CACF,EACF;;;;;;;AAQH,eAAsB,cAAc,OAAsC;AACxE,KAAI,qBAAqB,CACvB;AAGF,OAAM,gBAAgB,YAAY;AAChC,MAAI;AACF,SAAM,MAAM,GAAGC,kBAAAA,cAAc,aAAa;IACxC,QAAQ;IACR,SAAS;KACP,gBAAgB;KAChB,0BAA0B;KAC1B,yBAAyB;KAC1B;IACD,MAAM,KAAK,UAAU,iBAAiB,MAAM,CAAC;IAC7C,QAAQ,YAAY,QAAQ,IAAM;IACnC,CAAC;WACK,IAAI;GAGb;;;;;;AAOJ,SAAgB,oBAAoB,SAOjB;CACjB,MAAM,CAAC,SAAS,eAAeD,aAAAA,QAAQ,OAAO,QAAQ,QAAQ;CAC9D,MAAM,WAAW,KAAK,MAAM,UAAU,MAAO,cAAc,IAAI;AAE/D,QAAO;EACL,SAAS,QAAQ;EACjB,aAAa,QAAQ;EACrB,aAAaA,aAAAA,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC;EAC9C,UAAUE,QAAAA,QAAG,UAAU;EACvB,IAAI,MAAM;EACV,SAAS,QAAQ,WAAW,EAAE;EAC9B;EACA,cAAc,QAAQ,gBAAgB;EACtC,QAAQ,QAAQ;EACjB"}
1
+ {"version":3,"file":"telemetry-DZ7IrLAU.cjs","names":["dnsPromises","process","OTLP_ENDPOINT","os"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\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 */\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 and is not running in CI.\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/** Well-known stable domains used as DNS probes to check internet connectivity. */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Uses DNS resolution against well-known stable domains as a lightweight probe.\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } 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: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: 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: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\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?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): 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 * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\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: 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.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 { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\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-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', 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: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\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-cli',\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 CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: 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 platform: os.platform(),\n ci: isCi(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n"],"mappings":";;;;;;;;;;;;AAGA,SAAgB,kBAA2B;AACzC,QAAO,CAAC,CAAC,QAAQ,IAAI;;;;;;;AAQvB,SAAgB,kBAA2B;AACzC,QAAO,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;;;;;AAOhB,SAAgB,YAAqB;AACnC,QAAO,CAAC,CAAC,QAAQ,OAAO,SAAS,CAAC,iBAAiB;;;;;AC5BrD,MAAM,eAAe;CAAC;CAAkB;CAAkB;CAAkB;;;;;AAM5E,eAAsB,WAA6B;AACjD,MAAK,MAAM,UAAU,aACnB,KAAI;AACF,QAAMA,SAAAA,SAAY,QAAQ,OAAO;AACjC,SAAO;SACD;AAKV,QAAO;;;;;AAMT,eAAsB,gBAAmB,IAAyC;AAChF,KAAI,CAAE,MAAM,UAAU,CAAG,QAAO;AAEhC,KAAI;AACF,SAAO,MAAM,IAAI;SACX;AACN,SAAO;;;;;;;;;ACwFX,SAAgB,OAAgB;AAC9B,QAAO,iBAAiB;;;;;;AAO1B,SAAgB,sBAA+B;AAC7C,QACEC,aAAAA,QAAQ,IAAI,oBAAoB,OAChCA,aAAAA,QAAQ,IAAI,oBAAoB,UAChCA,aAAAA,QAAQ,IAAI,8BAA8B,OAC1CA,aAAAA,QAAQ,IAAI,8BAA8B;;;;;;AAQ9C,SAAgB,iBAAiB,OAAsD;CACrF,MAAM,WAAA,GAAA,YAAA,aAAsB,GAAG,CAAC,SAAS,MAAM;CAC/C,MAAM,UAAA,GAAA,YAAA,aAAqB,EAAE,C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ACN,mBAAmB,OAAO,YAAY;IACtC,iBAAiB,OAAO,UAAU;IAClC;IACA,QAAQ,EAAE,MAAO,MAAM,WAAW,YAAY,IAAI,GAA6B;IAChF,CACF;GACF,CACF;EACF,CACF,EACF;;;;;;;AAQH,eAAsB,cAAc,OAAsC;AACxE,KAAI,qBAAqB,CACvB;AAGF,OAAM,gBAAgB,YAAY;AAChC,MAAI;AACF,SAAM,MAAM,GAAGC,kBAAAA,cAAc,aAAa;IACxC,QAAQ;IACR,SAAS;KACP,gBAAgB;KAChB,0BAA0B;KAC1B,yBAAyB;KAC1B;IACD,MAAM,KAAK,UAAU,iBAAiB,MAAM,CAAC;IAC7C,QAAQ,YAAY,QAAQ,IAAM;IACnC,CAAC;WACK,IAAI;GAGb;;;;;;AAOJ,SAAgB,oBAAoB,SAOjB;CACjB,MAAM,CAAC,SAAS,eAAeD,aAAAA,QAAQ,OAAO,QAAQ,QAAQ;CAC9D,MAAM,WAAW,KAAK,MAAM,UAAU,MAAO,cAAc,IAAI;AAE/D,QAAO;EACL,SAAS,QAAQ;EACjB,aAAa,QAAQ;EACrB,aAAaA,aAAAA,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC;EAC9C,UAAUE,QAAAA,QAAG,UAAU;EACvB,IAAI,MAAM;EACV,SAAS,QAAQ,WAAW,EAAE;EAC9B;EACA,cAAc,QAAQ,gBAAgB;EACtC,QAAQ,QAAQ;EACjB"}
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
2
  import { t as getErrorMessage } from "./errors-6mF_WKxg.js";
3
- import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-DxiR7clS.js";
3
+ import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-BF3SMlH6.js";
4
4
  import { t as jiti } from "./jiti-e08mD2Ph.js";
5
5
  import process from "node:process";
6
6
  //#region src/runners/validate.ts
@@ -38,4 +38,4 @@ async function runValidate({ input, version }) {
38
38
  //#endregion
39
39
  export { runValidate };
40
40
 
41
- //# sourceMappingURL=validate-l8vLmwKA.js.map
41
+ //# sourceMappingURL=validate-BImbbx1t.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-l8vLmwKA.js","names":[],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as OasModule from '@kubb/oas'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n let mod: typeof OasModule\n try {\n mod = (await jiti.import('@kubb/oas', { default: true })) as typeof OasModule\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n process.exit(1)\n }\n\n const { parse } = mod\n const hrStart = process.hrtime()\n try {\n const oas = await parse(input)\n await oas.validate()\n\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'success' }))\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'failed' }))\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;AAWA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,IAAI;AACJ,KAAI;AACF,QAAO,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,qDAAqD;AACnE,UAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,UAAU;CAClB,MAAM,UAAU,QAAQ,QAAQ;AAChC,KAAI;AAEF,SADY,MAAM,MAAM,MAAM,EACpB,UAAU;AAEpB,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;AACnH,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAClH,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAM,gBAAgB,MAAM,CAAC;AACrC,UAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"validate-BImbbx1t.js","names":[],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as OasModule from '@kubb/oas'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n let mod: typeof OasModule\n try {\n mod = (await jiti.import('@kubb/oas', { default: true })) as typeof OasModule\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n process.exit(1)\n }\n\n const { parse } = mod\n const hrStart = process.hrtime()\n try {\n const oas = await parse(input)\n await oas.validate()\n\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'success' }))\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'failed' }))\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;AAWA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,IAAI;AACJ,KAAI;AACF,QAAO,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,qDAAqD;AACnE,UAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,UAAU;CAClB,MAAM,UAAU,QAAQ,QAAQ;AAChC,KAAI;AAEF,SADY,MAAM,MAAM,MAAM,EACpB,UAAU;AAEpB,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;AACnH,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAClH,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAM,gBAAgB,MAAM,CAAC;AACrC,UAAQ,KAAK,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
2
  import { n as defineCommand } from "./define--M_JMcDC.js";
3
- import { t as version } from "./package-DLd3fZNd.js";
3
+ import { t as version } from "./package-BKZ0H3Zf.js";
4
4
  //#region src/commands/validate.ts
5
5
  const command = defineCommand({
6
6
  name: "validate",
@@ -12,7 +12,7 @@ const command = defineCommand({
12
12
  required: true
13
13
  } },
14
14
  async run({ values }) {
15
- const { runValidate } = await import("./validate-l8vLmwKA.js");
15
+ const { runValidate } = await import("./validate-BImbbx1t.js");
16
16
  await runValidate({
17
17
  input: values.input,
18
18
  version
@@ -22,4 +22,4 @@ const command = defineCommand({
22
22
  //#endregion
23
23
  export { command };
24
24
 
25
- //# sourceMappingURL=validate-Bgqwmhir.js.map
25
+ //# sourceMappingURL=validate-DAZdX_0i.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-Bgqwmhir.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAM,OAAO;AAErC,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO;GAAS,CAAC;;CAEtD,CAAC"}
1
+ {"version":3,"file":"validate-DAZdX_0i.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAM,OAAO;AAErC,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO;GAAS,CAAC;;CAEtD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
2
  const require_define = require("./define-D6Kfm7-Z.cjs");
3
- const require_package = require("./package-DZb6I8FQ.cjs");
3
+ const require_package = require("./package-BJ6ionm6.cjs");
4
4
  //#region src/commands/validate.ts
5
5
  const command = require_define.defineCommand({
6
6
  name: "validate",
@@ -12,7 +12,7 @@ const command = require_define.defineCommand({
12
12
  required: true
13
13
  } },
14
14
  async run({ values }) {
15
- const { runValidate } = await Promise.resolve().then(() => require("./validate-Bbrn3Q-A.cjs"));
15
+ const { runValidate } = await Promise.resolve().then(() => require("./validate-ujLCYSWU.cjs"));
16
16
  await runValidate({
17
17
  input: values.input,
18
18
  version: require_package.version
@@ -22,4 +22,4 @@ const command = require_define.defineCommand({
22
22
  //#endregion
23
23
  exports.command = command;
24
24
 
25
- //# sourceMappingURL=validate-9FoHgtvi.cjs.map
25
+ //# sourceMappingURL=validate-DucFMytl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-9FoHgtvi.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAE9B,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;GAAS,CAAC;;CAEtD,CAAC"}
1
+ {"version":3,"file":"validate-DucFMytl.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAE9B,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;GAAS,CAAC;;CAEtD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
2
  const require_errors = require("./errors-DBW0N9w4.cjs");
3
- const require_telemetry = require("./telemetry-Cn9X1I5B.cjs");
3
+ const require_telemetry = require("./telemetry-DZ7IrLAU.cjs");
4
4
  const require_jiti = require("./jiti-Cd3S0xwr.cjs");
5
5
  let node_process = require("node:process");
6
6
  node_process = require_chunk.__toESM(node_process);
@@ -39,4 +39,4 @@ async function runValidate({ input, version }) {
39
39
  //#endregion
40
40
  exports.runValidate = runValidate;
41
41
 
42
- //# sourceMappingURL=validate-Bbrn3Q-A.cjs.map
42
+ //# sourceMappingURL=validate-ujLCYSWU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-Bbrn3Q-A.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as OasModule from '@kubb/oas'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n let mod: typeof OasModule\n try {\n mod = (await jiti.import('@kubb/oas', { default: true })) as typeof OasModule\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n process.exit(1)\n }\n\n const { parse } = mod\n const hrStart = process.hrtime()\n try {\n const oas = await parse(input)\n await oas.validate()\n\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'success' }))\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'failed' }))\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;AAWA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,qDAAqD;AACnE,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,UAAU;CAClB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AAEF,SADY,MAAM,MAAM,MAAM,EACpB,UAAU;AAEpB,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;AACnH,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAClH,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC;AACrC,eAAA,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"validate-ujLCYSWU.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as OasModule from '@kubb/oas'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n let mod: typeof OasModule\n try {\n mod = (await jiti.import('@kubb/oas', { default: true })) as typeof OasModule\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n process.exit(1)\n }\n\n const { parse } = mod\n const hrStart = process.hrtime()\n try {\n const oas = await parse(input)\n await oas.validate()\n\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'success' }))\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'failed' }))\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;AAWA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,qDAAqD;AACnE,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,UAAU;CAClB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AAEF,SADY,MAAM,MAAM,MAAM,EACpB,UAAU;AAEpB,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;AACnH,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAClH,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC;AACrC,eAAA,QAAQ,KAAK,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "5.0.0-alpha.7",
3
+ "version": "5.0.0-alpha.9",
4
4
  "description": "Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "cli",
@@ -58,14 +58,14 @@
58
58
  "cosmiconfig": "^9.0.1",
59
59
  "jiti": "2.5.1",
60
60
  "tinyexec": "^1.0.4",
61
- "@kubb/core": "5.0.0-alpha.7"
61
+ "@kubb/core": "5.0.0-alpha.9"
62
62
  },
63
63
  "devDependencies": {
64
64
  "source-map-support": "^0.5.21",
65
65
  "@internals/utils": "0.0.0",
66
- "@kubb/agent": "5.0.0-alpha.7",
67
- "@kubb/mcp": "5.0.0-alpha.7",
68
- "@kubb/oas": "5.0.0-alpha.7"
66
+ "@kubb/agent": "5.0.0-alpha.9",
67
+ "@kubb/mcp": "5.0.0-alpha.9",
68
+ "@kubb/oas": "5.0.0-alpha.9"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=22"
package/src/constants.ts CHANGED
@@ -1,33 +1,78 @@
1
- /** NPM registry endpoint used to check for @kubb/cli updates. */
1
+ /**
2
+ * NPM registry endpoint used to check for @kubb/cli updates.
3
+ */
2
4
  export const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const
3
5
 
4
- /** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */
6
+ /**
7
+ * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
8
+ */
5
9
  export const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const
6
10
 
7
- /** Horizontal rule rendered above/below the plain-logger generation summary. */
11
+ /**
12
+ * Horizontal rule rendered above/below the plain-logger generation summary.
13
+ */
8
14
  export const SUMMARY_SEPARATOR = '─'.repeat(27)
9
15
 
10
- /** Maximum number of █ characters in a plugin timing bar. */
16
+ /**
17
+ * Maximum number of █ characters in a plugin timing bar.
18
+ */
11
19
  export const SUMMARY_MAX_BAR_LENGTH = 10 as const
12
20
 
13
- /** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */
21
+ /**
22
+ * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).
23
+ */
14
24
  export const SUMMARY_TIME_SCALE_DIVISOR = 100 as const
15
25
 
16
- /** Glob pattern for paths the file watcher ignores. */
26
+ /**
27
+ * Glob pattern for paths the file watcher ignores.
28
+ */
17
29
  export const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const
18
30
 
19
- /** Default runtime values for the `agent start` command. */
31
+ /**
32
+ * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
33
+ */
34
+ export const QUITE_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)
35
+
36
+ /**
37
+ * Flags accepted by the `generate` command.
38
+ */
39
+ export const GENERATE_FLAGS = new Set(['--config', '-c', '--log-level', '-l', '--watch', '-w', '--debug', '-d', '--verbose', '-v', '--silent', '-s'] as const)
40
+
41
+ /**
42
+ * Flags accepted by the `validate` command.
43
+ */
44
+ export const VALIDATE_FLAGS = new Set(['--input', '-i'] as const)
45
+
46
+ /**
47
+ * Flags accepted by the `init` command.
48
+ */
49
+ export const INIT_FLAGS = new Set(['--yes', '-y'] as const)
50
+
51
+ /**
52
+ * Flags accepted by the `agent start` command.
53
+ */
54
+ export const AGENT_START_FLAGS = new Set(['--config', '-c', '--port', '-p', '--host', '--allow-write', '--allow-all'] as const)
55
+
56
+ /**
57
+ * All known CLI flags across every command.
58
+ */
59
+ export const ARGS = new Set([...QUITE_FLAGS, ...GENERATE_FLAGS, ...VALIDATE_FLAGS, ...INIT_FLAGS, ...AGENT_START_FLAGS] as const)
60
+
20
61
  export const agentDefaults = {
21
62
  port: '3000',
22
63
  host: 'localhost',
23
64
  configFile: 'kubb.config.ts',
24
65
  retryTimeout: '30000',
25
66
  studioUrl: 'https://studio.kubb.dev',
26
- /** Relative path from the @kubb/agent package root to the server entry. */
67
+ /**
68
+ * Relative path from the @kubb/agent package root to the server entry.
69
+ */
27
70
  serverEntryPath: '.output/server/index.mjs',
28
71
  } as const
29
72
 
30
- /** Default values used during interactive `init` scaffolding. */
73
+ /**
74
+ * Default values used during interactive `init` scaffolding.
75
+ */
31
76
  export const initDefaults = {
32
77
  inputPath: './openapi.yaml',
33
78
  outputPath: './src/gen',
@@ -73,4 +118,6 @@ export const pluginDefaultConfigs = {
73
118
  })`,
74
119
  } as const satisfies Record<string, string>
75
120
 
76
- /** Color palette used by randomCliColor() for deterministic plugin name coloring. */
121
+ /**
122
+ * Color palette used by randomCliColor() for deterministic plugin name coloring.
123
+ */
package/src/index.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import { styleText } from 'node:util'
2
2
  import { createCLI } from '@internals/utils'
3
3
  import { version } from '../package.json'
4
+ import { QUITE_FLAGS } from './constants.ts'
5
+ import { isFlag } from './utils/flags.ts'
4
6
  import { isTelemetryDisabled } from './utils/telemetry.ts'
5
7
 
6
8
  const cli = createCLI()
7
9
 
8
- function shouldShowTelemetryNotice(argv: string[]): boolean {
10
+ function shouldShowTelemetryNotice(argv: Array<string>): boolean {
9
11
  if (isTelemetryDisabled()) {
10
12
  return false
11
13
  }
12
14
  // Skip when the user is just asking for help or version info
13
- const quietFlags = new Set(['--help', '-h', '--version', '-v'])
14
- if (argv.some((arg) => quietFlags.has(arg))) {
15
+ if (argv.some((arg) => isFlag(QUITE_FLAGS, arg))) {
15
16
  return false
16
17
  }
17
18
  // Skip in non-interactive / scripting contexts
@@ -21,7 +22,7 @@ function shouldShowTelemetryNotice(argv: string[]): boolean {
21
22
  return true
22
23
  }
23
24
 
24
- export async function run(argv: string[] = process.argv): Promise<void> {
25
+ export async function run(argv: Array<string> = process.argv): Promise<void> {
25
26
  if (shouldShowTelemetryNotice(argv)) {
26
27
  console.log(
27
28
  `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\n`,
@@ -2,9 +2,8 @@ import { relative } from 'node:path'
2
2
  import process from 'node:process'
3
3
  import { styleText } from 'node:util'
4
4
  import * as clack from '@clack/prompts'
5
- import { formatMs, formatMsWithColor, toCause } from '@internals/utils'
5
+ import { formatMs, formatMsWithColor, getIntro, toCause } from '@internals/utils'
6
6
  import { defineLogger, logLevel as logLevelMap } from '@kubb/core'
7
- import { getIntro } from '../utils/getIntro.ts'
8
7
  import { getSummary } from '../utils/getSummary.ts'
9
8
  import { runHook } from '../utils/runHook.ts'
10
9
  import { ClackWritable } from '../utils/Writables.ts'
package/src/types.ts ADDED
@@ -0,0 +1,11 @@
1
+ export type QuiteFlag = '--help' | '-h' | '--version' | '-v'
2
+
3
+ export type GenerateFlag = '--config' | '-c' | '--log-level' | '-l' | '--watch' | '-w' | '--debug' | '-d' | '--verbose' | '-v' | '--silent' | '-s'
4
+
5
+ export type ValidateFlag = '--input' | '-i'
6
+
7
+ export type InitFlag = '--yes' | '-y'
8
+
9
+ export type AgentStartFlag = '--config' | '-c' | '--port' | '-p' | '--host' | '--allow-write' | '--allow-all'
10
+
11
+ export type Arg = QuiteFlag | GenerateFlag | ValidateFlag | InitFlag | AgentStartFlag
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type guard that checks whether a raw string is a member of a typed flag set.
3
+ * Avoids the need for type assertions when working with `Set<T extends string>`.
4
+ */
5
+ export function isFlag<T extends string>(set: ReadonlySet<T>, value: string): value is T {
6
+ for (const flag of set) {
7
+ if (flag === value) return true
8
+ }
9
+ return false
10
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-BTUap0zs.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-CM3dJzjK.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}