@kubb/cli 5.9.0 → 5.9.1

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 (98) hide show
  1. package/bin/kubb.js +1 -1
  2. package/dist/{Telemetry-D1jiXfo2.cjs → Telemetry-BSuUeat7.cjs} +26 -66
  3. package/dist/Telemetry-BSuUeat7.cjs.map +1 -0
  4. package/dist/{Telemetry-BivZAaw9.js → Telemetry-DxSvCR-R.js} +26 -66
  5. package/dist/Telemetry-DxSvCR-R.js.map +1 -0
  6. package/dist/{background-Cd2TGkLg.cjs → background-Bztbu76P.cjs} +2 -2
  7. package/dist/{background-Cd2TGkLg.cjs.map → background-Bztbu76P.cjs.map} +1 -1
  8. package/dist/background-C5ADaF5O.js +1 -0
  9. package/dist/{background-uIIElWXl.js → background-DErMBYPd.js} +2 -2
  10. package/dist/{background-uIIElWXl.js.map → background-DErMBYPd.js.map} +1 -1
  11. package/dist/{commands-BlNFxWKB.js → commands-BATSnmRI.js} +3 -3
  12. package/dist/{commands-BlNFxWKB.js.map → commands-BATSnmRI.js.map} +1 -1
  13. package/dist/{commands-ID-cYLXW.cjs → commands-wWv2IyJV.cjs} +3 -3
  14. package/dist/{commands-ID-cYLXW.cjs.map → commands-wWv2IyJV.cjs.map} +1 -1
  15. package/dist/{config-DAdYwK_D.js → config-B6UIKcl1.js} +13 -16
  16. package/dist/config-B6UIKcl1.js.map +1 -0
  17. package/dist/{config-CRBZcWwg.cjs → config-Bo9ro7vg.cjs} +13 -16
  18. package/dist/config-Bo9ro7vg.cjs.map +1 -0
  19. package/dist/constants-Cii4HX64.js +12 -0
  20. package/dist/constants-Cii4HX64.js.map +1 -0
  21. package/dist/constants-Df449N47.cjs +29 -0
  22. package/dist/constants-Df449N47.cjs.map +1 -0
  23. package/dist/index.cjs +19 -28
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.js +19 -28
  26. package/dist/index.js.map +1 -1
  27. package/dist/{output-CWupdozw.cjs → output-BnK0scpX.cjs} +10 -15
  28. package/dist/output-BnK0scpX.cjs.map +1 -0
  29. package/dist/{output-B9Yw7vL0.js → output-qFt4vV7K.js} +10 -15
  30. package/dist/output-qFt4vV7K.js.map +1 -0
  31. package/dist/{reporters-C5HAypFq.cjs → reporters-B4rZOlo8.cjs} +2 -2
  32. package/dist/{reporters-C5HAypFq.cjs.map → reporters-B4rZOlo8.cjs.map} +1 -1
  33. package/dist/{reporters-CNZQUlXY.js → reporters-H21Jvrff.js} +2 -2
  34. package/dist/{reporters-CNZQUlXY.js.map → reporters-H21Jvrff.js.map} +1 -1
  35. package/dist/{run-VAkf24Cw.cjs → run-89YfZJuo.cjs} +3 -3
  36. package/dist/{run-VAkf24Cw.cjs.map → run-89YfZJuo.cjs.map} +1 -1
  37. package/dist/run-8HrdMihy.js +1 -0
  38. package/dist/{run-CNXBX4kr.cjs → run-BN1-GpZI.cjs} +10 -22
  39. package/dist/run-BN1-GpZI.cjs.map +1 -0
  40. package/dist/{run-D4cZ-1zg.cjs → run-BOmuzVe1.cjs} +2 -2
  41. package/dist/{run-D4cZ-1zg.cjs.map → run-BOmuzVe1.cjs.map} +1 -1
  42. package/dist/{run-Ey756UCd.js → run-BYff_byB.js} +2 -2
  43. package/dist/{run-Ey756UCd.js.map → run-BYff_byB.js.map} +1 -1
  44. package/dist/{run-ajUuT3vK.js → run-CFK9DYis.js} +2 -2
  45. package/dist/{run-ajUuT3vK.js.map → run-CFK9DYis.js.map} +1 -1
  46. package/dist/{run-USNnlQcA.js → run-CJHsZZB8.js} +41 -49
  47. package/dist/run-CJHsZZB8.js.map +1 -0
  48. package/dist/{run-yb2R1vt0.js → run-Ca_OX3WZ.js} +6 -7
  49. package/dist/run-Ca_OX3WZ.js.map +1 -0
  50. package/dist/{run-C5P5_H0R.cjs → run-Ct6kzKpg.cjs} +6 -6
  51. package/dist/run-Ct6kzKpg.cjs.map +1 -0
  52. package/dist/{run-DSeEZTnT.cjs → run-DAjjmDdw.cjs} +7 -7
  53. package/dist/{run-DSeEZTnT.cjs.map → run-DAjjmDdw.cjs.map} +1 -1
  54. package/dist/{run-E11sqsk0.cjs → run-DL2wLwBZ.cjs} +41 -49
  55. package/dist/run-DL2wLwBZ.cjs.map +1 -0
  56. package/dist/{run-DRR30f0e.js → run-Dej-hm91.js} +3 -3
  57. package/dist/{run-DRR30f0e.js.map → run-Dej-hm91.js.map} +1 -1
  58. package/dist/{run-BF2Wq1Io.js → run-DlQDj_SV.js} +7 -7
  59. package/dist/{run-BF2Wq1Io.js.map → run-DlQDj_SV.js.map} +1 -1
  60. package/dist/{run-DfkvTomI.cjs → run-Dm7nOUUF.cjs} +3 -5
  61. package/dist/run-Dm7nOUUF.cjs.map +1 -0
  62. package/dist/{run-CnBJroZW.cjs → run-DpAMfkm5.cjs} +2 -2
  63. package/dist/{run-CnBJroZW.cjs.map → run-DpAMfkm5.cjs.map} +1 -1
  64. package/dist/{run-DnXUzX34.js → run-DssKB_1f.js} +3 -5
  65. package/dist/run-DssKB_1f.js.map +1 -0
  66. package/dist/{run-mx0KM8y5.js → run-N37yeEmo.js} +10 -22
  67. package/dist/run-N37yeEmo.js.map +1 -0
  68. package/dist/{snapshot-D5OaRDf9.cjs → snapshot-B27W-HME.cjs} +5 -5
  69. package/dist/{snapshot-D5OaRDf9.cjs.map → snapshot-B27W-HME.cjs.map} +1 -1
  70. package/dist/{snapshot-CHKxNlYg.js → snapshot-Ctv0_Xwv.js} +5 -5
  71. package/dist/{snapshot-CHKxNlYg.js.map → snapshot-Ctv0_Xwv.js.map} +1 -1
  72. package/dist/studioWorker.js +2 -2
  73. package/dist/{utils-Dhx5PMpD.js → utils-BHW8kA8P.js} +11 -8
  74. package/dist/utils-BHW8kA8P.js.map +1 -0
  75. package/dist/{utils-ZcCFqERz.cjs → utils-BzQ46pgd.cjs} +16 -13
  76. package/dist/utils-BzQ46pgd.cjs.map +1 -0
  77. package/package.json +7 -7
  78. package/dist/Telemetry-BivZAaw9.js.map +0 -1
  79. package/dist/Telemetry-D1jiXfo2.cjs.map +0 -1
  80. package/dist/background-D0UaV1ZP.js +0 -1
  81. package/dist/config-CRBZcWwg.cjs.map +0 -1
  82. package/dist/config-DAdYwK_D.js.map +0 -1
  83. package/dist/constants-CdxpgX3_.cjs +0 -115
  84. package/dist/constants-CdxpgX3_.cjs.map +0 -1
  85. package/dist/constants-DHRspBTo.js +0 -92
  86. package/dist/constants-DHRspBTo.js.map +0 -1
  87. package/dist/output-B9Yw7vL0.js.map +0 -1
  88. package/dist/output-CWupdozw.cjs.map +0 -1
  89. package/dist/run-C5P5_H0R.cjs.map +0 -1
  90. package/dist/run-CNXBX4kr.cjs.map +0 -1
  91. package/dist/run-DfkvTomI.cjs.map +0 -1
  92. package/dist/run-DnXUzX34.js.map +0 -1
  93. package/dist/run-E11sqsk0.cjs.map +0 -1
  94. package/dist/run-USNnlQcA.js.map +0 -1
  95. package/dist/run-mx0KM8y5.js.map +0 -1
  96. package/dist/run-yb2R1vt0.js.map +0 -1
  97. package/dist/utils-Dhx5PMpD.js.map +0 -1
  98. package/dist/utils-ZcCFqERz.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-CRm0XQPb.js";
2
- import { r as version, t as isDisabled } from "./Telemetry-BivZAaw9.js";
2
+ import { r as version, t as isDisabled } from "./Telemetry-DxSvCR-R.js";
3
3
  import { styleText } from "node:util";
4
4
  import dryrun, { pluginId as dryRunId } from "@gunshi/plugin-dryrun";
5
5
  import { cli, define, defineWithTypes } from "gunshi";
@@ -91,7 +91,7 @@ const command$13 = define({
91
91
  }
92
92
  },
93
93
  async run({ values }) {
94
- const { run } = await import("./run-yb2R1vt0.js");
94
+ const { run } = await import("./run-8HrdMihy.js");
95
95
  await run({
96
96
  id: values.id,
97
97
  configPath: values.config,
@@ -174,7 +174,7 @@ const command$12 = defineWithTypes()({
174
174
  async run(ctx) {
175
175
  const { values } = ctx;
176
176
  const logLevel = resolveLogLevel(values);
177
- const { run } = await import("./run-mx0KM8y5.js");
177
+ const { run } = await import("./run-N37yeEmo.js");
178
178
  await run({
179
179
  input: values.input,
180
180
  configPath: values.config,
@@ -219,13 +219,13 @@ const command$11 = defineWithTypes()({
219
219
  },
220
220
  plugins: {
221
221
  type: "string",
222
- description: "Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)",
222
+ description: "Comma-separated Kubb registry ids of the plugins to add, the same ids `kubb add` takes (plugin-ts, plugin-zod, acme/plugin-x)",
223
223
  metavar: "plugin-ts,plugin-zod,..."
224
224
  }
225
225
  },
226
226
  async run(ctx) {
227
227
  const { values } = ctx;
228
- const { run } = await import("./run-USNnlQcA.js");
228
+ const { run } = await import("./run-CJHsZZB8.js");
229
229
  await run({
230
230
  yes: values.yes,
231
231
  version,
@@ -243,7 +243,7 @@ const command$10 = define({
243
243
  description: "List the installed Kubb extensions: their registry id, package, installed version, the version the Kubb registry pins, and whether an update exists.",
244
244
  examples: "kubb list",
245
245
  async run() {
246
- const { run } = await import("./run-Ey756UCd.js");
246
+ const { run } = await import("./run-BYff_byB.js");
247
247
  await run();
248
248
  }
249
249
  });
@@ -260,7 +260,7 @@ const command$9 = define({
260
260
  ].join("\n"),
261
261
  rendering: { header: null },
262
262
  async run() {
263
- const { run } = await import("./run-ajUuT3vK.js");
263
+ const { run } = await import("./run-CFK9DYis.js");
264
264
  await run();
265
265
  }
266
266
  });
@@ -289,7 +289,7 @@ const command$8 = define({
289
289
  ...logLevelArg
290
290
  },
291
291
  async run(ctx) {
292
- const { connectRunner } = await import("./commands-BlNFxWKB.js");
292
+ const { connectRunner } = await import("./commands-BATSnmRI.js");
293
293
  await connectRunner(ctx);
294
294
  }
295
295
  });
@@ -302,7 +302,7 @@ const command$7 = define({
302
302
  toKebab: true,
303
303
  args: command$8.args,
304
304
  async run(ctx) {
305
- const { loginRunner } = await import("./commands-BlNFxWKB.js");
305
+ const { loginRunner } = await import("./commands-BATSnmRI.js");
306
306
  await loginRunner(ctx);
307
307
  }
308
308
  });
@@ -320,7 +320,7 @@ const command$6 = define({
320
320
  ...logLevelArg
321
321
  },
322
322
  async run(ctx) {
323
- const { logoutRunner } = await import("./commands-BlNFxWKB.js");
323
+ const { logoutRunner } = await import("./commands-BATSnmRI.js");
324
324
  await logoutRunner(ctx);
325
325
  }
326
326
  });
@@ -360,7 +360,7 @@ const command$5 = define({
360
360
  ...logLevelArg
361
361
  },
362
362
  async run(ctx) {
363
- const { runner } = await import("./snapshot-CHKxNlYg.js");
363
+ const { runner } = await import("./snapshot-Ctv0_Xwv.js");
364
364
  await runner(ctx);
365
365
  }
366
366
  });
@@ -372,7 +372,7 @@ const command$4 = define({
372
372
  toKebab: true,
373
373
  args: command$8.args,
374
374
  async run(ctx) {
375
- const { startRunner } = await import("./commands-BlNFxWKB.js");
375
+ const { startRunner } = await import("./commands-BATSnmRI.js");
376
376
  await startRunner(ctx);
377
377
  }
378
378
  });
@@ -380,7 +380,7 @@ const stopCommand = define({
380
380
  name: "stop",
381
381
  description: "Stop this project's background connection and keep its pairing.",
382
382
  async run() {
383
- const { stopRunner } = await import("./commands-BlNFxWKB.js");
383
+ const { stopRunner } = await import("./commands-BATSnmRI.js");
384
384
  await stopRunner();
385
385
  }
386
386
  });
@@ -398,7 +398,7 @@ const command$3 = define({
398
398
  ...logLevelArg
399
399
  },
400
400
  async run(ctx) {
401
- const { statusRunner } = await import("./commands-BlNFxWKB.js");
401
+ const { statusRunner } = await import("./commands-BATSnmRI.js");
402
402
  await statusRunner(ctx);
403
403
  }
404
404
  });
@@ -418,7 +418,7 @@ const command$2 = define({
418
418
  toKebab: true,
419
419
  args: command$8.args,
420
420
  async run(ctx) {
421
- const { connectRunner } = await import("./commands-BlNFxWKB.js");
421
+ const { connectRunner } = await import("./commands-BATSnmRI.js");
422
422
  await connectRunner(ctx);
423
423
  },
424
424
  subCommands: {
@@ -468,7 +468,7 @@ const command$1 = define({
468
468
  ...yesArg
469
469
  },
470
470
  async run({ values }) {
471
- const { run } = await import("./run-DRR30f0e.js");
471
+ const { run } = await import("./run-Dej-hm91.js");
472
472
  await run({
473
473
  ids: values.ids ?? [],
474
474
  check: values.check,
@@ -489,7 +489,7 @@ const command = define({
489
489
  required: true
490
490
  } },
491
491
  async run({ values }) {
492
- const { run } = await import("./run-DnXUzX34.js");
492
+ const { run } = await import("./run-DssKB_1f.js");
493
493
  await run({ input: values.input });
494
494
  }
495
495
  });
@@ -534,20 +534,11 @@ const QUIET_FLAGS = /* @__PURE__ */ new Set([
534
534
  "--json"
535
535
  ]);
536
536
  /**
537
- * Strips the leading executable + script entries when `process.argv` is passed directly.
538
- * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime
539
- * executable paths contain a path separator; bare command names do not.
540
- */
541
- function stripExecArgs(argv) {
542
- const firstArgIsExecutablePath = (argv[0]?.includes("/") || argv[0]?.includes("\\")) ?? false;
543
- return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv;
544
- }
545
- /**
546
537
  * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
547
538
  * quiet flag is passed, then runs the given command, or `generate` when none is given.
548
539
  */
549
- async function run(argv = process.argv) {
550
- const args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)));
540
+ async function run(argv = process.argv.slice(2)) {
541
+ const args = routeStudioFlags(resolveDeprecatedFlags(argv));
551
542
  const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg));
552
543
  if (!isDisabled() && !isQuietFlag) console.error(`${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`);
553
544
  await cli(args, command$12, {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["command","command","command","command","command","command","command","connectCommand","command","command","command","connectCommand","command","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","command","isTelemetryDisabled","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand","addCommand","updateCommand","listCommand"],"sources":["../src/commands/shared.ts","../src/commands/add.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/list.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/update.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { define } from 'gunshi'\nimport { configArg, yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'add',\n description:\n 'Install a plugin, adapter, or parser from the Kubb registry at its reviewed version. A plugin is added to kubb.config.ts, an adapter or parser prints the code to add. Reads KUBB_REGISTRY to use another registry.',\n examples: ['kubb add plugin-zod', 'kubb add kubb-labs/plugin-react-query', 'kubb add acme/plugin-x --yes', 'kubb add plugin-zod --no-install'].join('\\n'),\n toKebab: true,\n args: {\n id: {\n type: 'positional',\n description: 'Registry id: owner/slug, or a slug for an official extension',\n required: true,\n },\n ...configArg,\n ...yesArg,\n install: {\n type: 'boolean',\n description: 'Install the package. Pass --no-install to only edit the config',\n negatable: true,\n default: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/add/run.ts')\n await run({ id: values.id, configPath: values.config, yes: values.yes, install: values.install })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\nexport const command = define({\n name: 'list',\n description:\n 'List the installed Kubb extensions: their registry id, package, installed version, the version the Kubb registry pins, and whether an update exists.',\n examples: 'kubb list',\n async run() {\n const { run } = await import('../runners/list/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n // gunshi prints the header to stdout, which the MCP stdio transport owns.\n rendering: { header: null },\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\nimport { yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'update',\n description:\n 'Update installed extensions to the version the Kubb registry pins. Pass ids to update only those, or --check to list the updates without installing.',\n examples: ['kubb update', 'kubb update --check', 'kubb update plugin-zod plugin-ts --yes'].join('\\n'),\n args: {\n ids: {\n type: 'positional',\n description: 'Registry ids to update, all installed extensions when omitted',\n multiple: true,\n },\n check: {\n type: 'boolean',\n description: 'List the available updates without installing them',\n default: false,\n },\n ...yesArg,\n },\n async run({ values }) {\n const { run } = await import('../runners/update/run.ts')\n await run({ ids: values.ids ?? [], check: values.check, yes: values.yes })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as addCommand } from './commands/add.ts'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as listCommand } from './commands/list.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as updateCommand } from './commands/update.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the given command, or `generate` when none is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, manage Kubb extensions, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n add: addCommand,\n update: updateCommand,\n list: listCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF;;;ACvEA,MAAaA,aAAU,OAAO;CAC5B,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAuB;EAAyC;EAAgC;CAAkC,CAAC,CAAC,KAAK,IAAI;CACxJ,SAAS;CACT,MAAM;EACJ,IAAI;GACF,MAAM;GACN,aAAa;GACb,UAAU;EACZ;EACA,GAAG;EACH,GAAG;EACH,SAAS;GACP,MAAM;GACN,aAAa;GACb,WAAW;GACX,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,MAAM,IAAI;GAAE,IAAI,OAAO;GAAI,YAAY,OAAO;GAAQ,KAAK,OAAO;GAAK,SA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E,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;AAMA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,OAAO,iBAAiB,uBAAuB,cAAc,IAAI,CAAC,CAAC;CACzE,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAG3D,IAAI,CAACC,WAAoB,KAAK,CAAC,aAC7B,QAAQ,MACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAIF,MAAM,IAAI,MAAMC,YAAiB;EAC/B,MAAM;EACN;EAGA,aAAa;EACb,aAAa;GACX,UAAUA;GACV,MAAMC;GACN,UAAUC;GACV,KAAKC;GACL,QAAQC;GACR,KAAKC;GACL,QAAQC;GACR,MAAMC;EACR;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,CAAC,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EACrC,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["command","command","command","command","command","command","command","connectCommand","command","command","command","connectCommand","command","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","command","isTelemetryDisabled","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand","addCommand","updateCommand","listCommand"],"sources":["../src/commands/shared.ts","../src/commands/add.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/list.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/update.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { define } from 'gunshi'\nimport { configArg, yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'add',\n description:\n 'Install a plugin, adapter, or parser from the Kubb registry at its reviewed version. A plugin is added to kubb.config.ts, an adapter or parser prints the code to add. Reads KUBB_REGISTRY to use another registry.',\n examples: ['kubb add plugin-zod', 'kubb add kubb-labs/plugin-react-query', 'kubb add acme/plugin-x --yes', 'kubb add plugin-zod --no-install'].join('\\n'),\n toKebab: true,\n args: {\n id: {\n type: 'positional',\n description: 'Registry id: owner/slug, or a slug for an official extension',\n required: true,\n },\n ...configArg,\n ...yesArg,\n install: {\n type: 'boolean',\n description: 'Install the package. Pass --no-install to only edit the config',\n negatable: true,\n default: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/add/run.ts')\n await run({ id: values.id, configPath: values.config, yes: values.yes, install: values.install })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description: 'Comma-separated Kubb registry ids of the plugins to add, the same ids `kubb add` takes (plugin-ts, plugin-zod, acme/plugin-x)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\nexport const command = define({\n name: 'list',\n description:\n 'List the installed Kubb extensions: their registry id, package, installed version, the version the Kubb registry pins, and whether an update exists.',\n examples: 'kubb list',\n async run() {\n const { run } = await import('../runners/list/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n // gunshi prints the header to stdout, which the MCP stdio transport owns.\n rendering: { header: null },\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\nimport { yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'update',\n description:\n 'Update installed extensions to the version the Kubb registry pins. Pass ids to update only those, or --check to list the updates without installing.',\n examples: ['kubb update', 'kubb update --check', 'kubb update plugin-zod plugin-ts --yes'].join('\\n'),\n args: {\n ids: {\n type: 'positional',\n description: 'Registry ids to update, all installed extensions when omitted',\n multiple: true,\n },\n check: {\n type: 'boolean',\n description: 'List the available updates without installing them',\n default: false,\n },\n ...yesArg,\n },\n async run({ values }) {\n const { run } = await import('../runners/update/run.ts')\n await run({ ids: values.ids ?? [], check: values.check, yes: values.yes })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as addCommand } from './commands/add.ts'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as listCommand } from './commands/list.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as updateCommand } from './commands/update.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the given command, or `generate` when none is given.\n */\nexport async function run(argv: Array<string> = process.argv.slice(2)): Promise<void> {\n const args = routeStudioFlags(resolveDeprecatedFlags(argv))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, manage Kubb extensions, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n add: addCommand,\n update: updateCommand,\n list: listCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,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ACnC,MAAM,OAAO,QAAQ;EACrB,MAAM,cAAc,OAAO,iBAAiB,QAAQ,KAAA;EAEpD,IAAI,CAAC,QAAQ,CAAC,aACZ,OAAO;EAGT,QAAQ,MACN,GAAG,UAAU,UAAU,UAAU,EAAE,KAAK,KAAK,wBAAwB,YAAY,cAAc,KAAK,4CACtG;EAEA,OAAO,KAAK,cAAc,QAAQ,MAAM;CAC1C,CAAC;AACH;;;;ACtBA,MAAM,8BAAc,IAAI,IAAY;CAAC;CAAU;CAAM;CAAa;CAAM;AAAQ,CAAC;;;;;AAMjF,eAAsB,IAAI,OAAsB,QAAQ,KAAK,MAAM,CAAC,GAAkB;CACpF,MAAM,OAAO,iBAAiB,uBAAuB,IAAI,CAAC;CAC1D,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAG3D,IAAI,CAACC,WAAoB,KAAK,CAAC,aAC7B,QAAQ,MACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAIF,MAAM,IAAI,MAAMC,YAAiB;EAC/B,MAAM;EACN;EAGA,aAAa;EACb,aAAa;GACX,UAAUA;GACV,MAAMC;GACN,UAAUC;GACV,KAAKC;GACL,QAAQC;GACR,KAAKC;GACL,QAAQC;GACR,MAAMC;EACR;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,CAAC,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EACrC,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
@@ -350,6 +350,12 @@ function createLogger(writer) {
350
350
  state.phase = null;
351
351
  state.groupOpen = false;
352
352
  }
353
+ function writeErrorFrames(error) {
354
+ const frames = logLevel >= _kubb_core.logLevel.verbose ? formatErrorFrames(error) : null;
355
+ if (!frames) return;
356
+ writer.block(frames.frames.map((frame) => text((0, node_util.styleText)("dim", frame))));
357
+ if (frames.cause) writer.block([(0, node_util.styleText)("dim", frames.cause.header), ...frames.cause.frames.map((frame) => text(` ${(0, node_util.styleText)("dim", frame)}`))]);
358
+ }
353
359
  function formatLine(symbol, message, info) {
354
360
  return text([
355
361
  symbol,
@@ -365,10 +371,7 @@ function createLogger(writer) {
365
371
  if (state.phase) state.phase.failed = true;
366
372
  if (state.spinner) stopSpinner(error.message, "failed");
367
373
  else writer.error(text(error.message));
368
- const frames = logLevel >= _kubb_core.logLevel.verbose ? formatErrorFrames(error) : null;
369
- if (!frames) return;
370
- writer.block(frames.frames.map((frame) => text((0, node_util.styleText)("dim", frame))));
371
- if (frames.cause) writer.block([(0, node_util.styleText)("dim", frames.cause.header), ...frames.cause.frames.map((frame) => text(` ${(0, node_util.styleText)("dim", frame)}`))]);
374
+ writeErrorFrames(error);
372
375
  });
373
376
  context.hook("kubb:diagnostic", ({ diagnostic }) => {
374
377
  if (silent && diagnostic.severity !== "error") return;
@@ -380,6 +383,7 @@ function createLogger(writer) {
380
383
  }
381
384
  const { headline, details } = _kubb_core.Diagnostics.format(diagnostic);
382
385
  writer.diagnostic([headline, ...details]);
386
+ if (_kubb_core.Diagnostics.isProblem(diagnostic) && diagnostic.cause) writeErrorFrames(diagnostic.cause);
383
387
  });
384
388
  context.hook("studio:disconnected", ({ code, reason }) => {
385
389
  if (logLevel < _kubb_core.logLevel.warn) return;
@@ -575,16 +579,7 @@ const clackWriter = {
575
579
  contentAlign: "center",
576
580
  titleAlign: "center"
577
581
  }),
578
- spinner() {
579
- const spinner = _clack_prompts.spinner();
580
- return {
581
- start: (text) => spinner.start(text),
582
- message: (text) => spinner.message(text),
583
- clear: () => spinner.clear(),
584
- stop: (text) => spinner.stop(text),
585
- error: (text) => spinner.error(text)
586
- };
587
- },
582
+ spinner: () => _clack_prompts.spinner(),
588
583
  progress(max) {
589
584
  const bar = _clack_prompts.progress({
590
585
  style: "block",
@@ -874,4 +869,4 @@ Object.defineProperty(exports, "pluralize", {
874
869
  }
875
870
  });
876
871
 
877
- //# sourceMappingURL=output-CWupdozw.cjs.map
872
+ //# sourceMappingURL=output-BnK0scpX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-BnK0scpX.cjs","names":["isCIEnvironment","getAgentName","styleText","formatMs","logLevelMap","styleText","formatMs","getElapsedMs","process","Diagnostics","relative","clack","styleText","styleText"],"sources":["../src/utils/env.ts","../src/loggers/banner.ts","../src/loggers/createLogger.ts","../src/loggers/clackLogger.ts","../src/loggers/plainLogger.ts","../src/loggers/output.ts"],"sourcesContent":["import { getAgentName } from '../agent.ts'\nimport { isCIEnvironment } from '@internals/utils'\n\n/**\n * Returns `true` when the process has an interactive TTY with a valid terminal\n * width and is not running in CI.\n *\n * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,\n * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`\n * with a negative count and throw a `RangeError`). A positive column count is\n * required before the TTY counts as usable.\n *\n * @example\n * ```ts\n * if (canUseTTY()) {\n * renderProgressBar()\n * }\n * ```\n */\nexport function canUseTTY(): boolean {\n return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment()\n}\n\n/**\n * Returns `true` when output can carry spinners and clack's gutter: an interactive TTY that no AI\n * coding agent is reading. Cursor-movement escapes are hard for an agent to parse even over a\n * pseudo-TTY, so it gets the plain writer.\n */\nexport function isRichOutput(): boolean {\n return canUseTTY() && !getAgentName()\n}\n","import { styleText } from 'node:util'\nimport { formatMs } from '@internals/utils'\n\n/**\n * Parsed RGB channels from a CSS hex color string.\n */\ntype RGB = { r: number; g: number; b: number }\n\n/**\n * Parses a CSS hex color string (`#RGB`) into its RGB channels.\n * Falls back to `255` for any channel that cannot be parsed.\n */\nfunction parseHex(color: string): RGB {\n const int = Number.parseInt(color.replace('#', ''), 16)\n return Number.isNaN(int) ? { r: 255, g: 255, b: 255 } : { r: (int >> 16) & 0xff, g: (int >> 8) & 0xff, b: int & 0xff }\n}\n\n/**\n * Returns a function that wraps a string in a 24-bit ANSI true-color escape sequence\n * for the given hex color.\n */\nfunction hex(color: string): (text: string) => string {\n const { r, g, b } = parseHex(color)\n return (text: string) => `\\x1b[38;2;${r};${g};${b}m${text}\\x1b[0m`\n}\n\nfunction gradient(colorStops: Array<string>, text: string): string {\n const chars = text.split('')\n return chars\n .map((char, i) => {\n const t = chars.length <= 1 ? 0 : i / (chars.length - 1)\n const seg = Math.min(Math.floor(t * (colorStops.length - 1)), colorStops.length - 2)\n const lt = t * (colorStops.length - 1) - seg\n const from = parseHex(colorStops[seg]!)\n const to = parseHex(colorStops[seg + 1]!)\n const r = Math.round(from.r + (to.r - from.r) * lt)\n const g = Math.round(from.g + (to.g - from.g) * lt)\n const b = Math.round(from.b + (to.b - from.b) * lt)\n return `\\x1b[38;2;${r};${g};${b}m${char}\\x1b[0m`\n })\n .join('')\n}\n\n/**\n * ANSI color functions for each part of the Kubb mascot illustration.\n */\nconst palette = {\n /**\n * Top cap of the skittle.\n */\n lid: hex('#F55A17'),\n /**\n * Upper wood body.\n */\n woodTop: hex('#F5A217'),\n /**\n * Middle wood body.\n */\n woodMid: hex('#F58517'),\n /**\n * Base wood body.\n */\n woodBase: hex('#B45309'),\n /**\n * Eye whites.\n */\n eye: hex('#FFFFFF'),\n /**\n * Highlight accent.\n */\n highlight: hex('#adadc6'),\n /**\n * Cheek blush.\n */\n blush: hex('#FDA4AF'),\n}\n\n/**\n * Generates the Kubb mascot welcome banner as an ANSI-colored string.\n *\n * @example\n * ```ts\n * console.log(getIntro({ title: 'kubb.config.ts', description: 'generating…', version: '5.0.0', areEyesOpen: true }))\n * ```\n */\nexport function getIntro({\n title,\n description,\n version,\n areEyesOpen,\n}: {\n /**\n * Name of the active configuration or tool being started.\n */\n title: string\n /**\n * Short subtitle shown next to the arrow prompt.\n */\n description: string\n /**\n * Kubb version string rendered in the gradient header.\n */\n version: string\n /**\n * When `false` the eyes are shown as closed dashes instead of open blocks.\n */\n areEyesOpen: boolean\n}): string {\n const kubbVersion = gradient(['#F58517', '#F5A217', '#F55A17'], `KUBB v${version}`)\n\n const eyeTop = areEyesOpen ? palette.eye('█▀█') : palette.eye('───')\n const eyeBottom = areEyesOpen ? palette.eye('▀▀▀') : palette.eye('───')\n\n return [\n ` ${palette.lid('▄▄▄▄▄▄▄▄▄▄▄▄▄')}`,\n ` ${palette.woodTop('█ ')}${palette.highlight('▄▄')}${palette.woodTop(' ')}${palette.highlight('▄▄')}${palette.woodTop(' █')} ${kubbVersion}`,\n ` ${palette.woodMid('█ ')}${eyeTop}${palette.woodMid(' ')}${eyeTop}${palette.woodMid(' █')} ${styleText('gray', title)}`,\n ` ${palette.woodMid('█ ')}${eyeBottom}${palette.woodMid(' ')}${palette.blush('◡')}${palette.woodMid(' ')}${eyeBottom}${palette.woodMid(' █')} ${styleText('yellow', '➜')} ${styleText('white', description)}`,\n ` ${palette.woodBase('▀▀▀▀▀▀▀▀▀▀▀▀▀')}`,\n ].join('\\n')\n}\n\n/**\n * Formats a millisecond duration with a threshold-based ANSI color.\n * `≤ 500 ms` → green · `≤ 1 000 ms` → yellow · `> 1 000 ms` → red.\n *\n * @example\n * ```ts\n * formatMsWithColor(200) // '\\x1b[32m200ms\\x1b[39m'\n * formatMsWithColor(800) // '\\x1b[33m800ms\\x1b[39m'\n * formatMsWithColor(1500) // '\\x1b[31m1.50s\\x1b[39m'\n * ```\n */\nexport function formatMsWithColor(ms: number): string {\n const formatted = formatMs(ms)\n if (ms <= 500) return styleText('green', formatted)\n if (ms <= 1000) return styleText('yellow', formatted)\n\n return styleText('red', formatted)\n}\n","import { relative } from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport { formatMs, getElapsedMs } from '@internals/utils'\nimport type { Config } from '@kubb/core'\nimport { Diagnostics, logLevel as logLevelMap } from '@kubb/core'\nimport type { StudioConnectedContext } from '@kubb/studio'\nimport { formatMsWithColor } from './banner.ts'\nimport type { Logger, LoggerWriter, LogStatus, WriterProgress, WriterSpinner } from './defineLogger.ts'\n\n/** Display path for a config's input: the string form, or its `path` field when the input is an object. */\nfunction getInputPath(config: Config): string | undefined {\n const { input } = config\n if (typeof input === 'string') return input\n return typeof input?.path === 'string' ? input.path : undefined\n}\n\n/** Counts a noun, so a message never reads `1 files`. */\nexport function pluralize(count: number, noun: string): string {\n return `${count} ${count === 1 ? noun : `${noun}s`}`\n}\n\n/** Prefixes a `[HH:MM:SS]` timestamp at verbose and above. */\nfunction formatMessage(message: string, logLevel: number): string {\n if (logLevel >= logLevelMap.verbose) {\n const timestamp = new Date().toLocaleTimeString('en-US', {\n hour12: false,\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n return `${styleText('dim', `[${timestamp}]`)} ${message}`\n }\n return message\n}\n\n/**\n * Renders a `studio:connected` event's versions: the runtime only when it differs from the host.\n */\nfunction formatVersions({ studio, kubb, agent }: StudioConnectedContext['versions']): string {\n return [`v${agent}`, kubb !== agent ? `runtime v${kubb}` : undefined, `Studio v${studio}`].filter(Boolean).join(', ')\n}\n\n/** The first three frames of a stack, without the message line. */\nfunction topFrames(stack: string): Array<string> {\n return stack\n .split('\\n')\n .slice(1, 4)\n .map((frame) => frame.trim())\n}\n\n/** First stack frames for verbose error output, including an optional `cause` chain. */\nfunction formatErrorFrames(error: Error): { frames: Array<string>; cause?: { header: string; frames: Array<string> } } | null {\n if (!error.stack) {\n return null\n }\n\n const frames = topFrames(error.stack)\n const caused = error.cause instanceof Error ? error.cause : undefined\n\n if (!caused?.stack) {\n return { frames }\n }\n\n return {\n frames,\n cause: {\n header: `└─ caused by ${caused.message}`,\n frames: topFrames(caused.stack),\n },\n }\n}\n\ntype ProgressState = {\n totalPlugins: number\n completedPlugins: number\n failedPlugins: number\n totalFiles: number\n processedFiles: number\n /** `process.hrtime()` snapshot taken at the start of generation, for the elapsed time. */\n hrStart: [number, number]\n}\n\n/** The progress summary line the clack logger shows, `null` when there is nothing to display. */\nfunction buildProgressLine(state: ProgressState): string | null {\n const parts: Array<string> = []\n const duration = formatMs(getElapsedMs(state.hrStart))\n\n if (state.totalPlugins > 0) {\n const pluginStr =\n state.failedPlugins > 0\n ? `Plugins ${styleText('green', state.completedPlugins.toString())}/${state.totalPlugins} ${styleText('red', `(${state.failedPlugins} failed)`)}`\n : `Plugins ${styleText('green', state.completedPlugins.toString())}/${state.totalPlugins}`\n parts.push(pluginStr)\n }\n\n if (state.totalFiles > 0) {\n parts.push(`Files ${styleText('green', state.processedFiles.toString())}/${state.totalFiles}`)\n }\n\n if (parts.length === 0) {\n return null\n }\n\n parts.push(`${styleText('green', duration)} elapsed`)\n return parts.join(styleText('dim', ' | '))\n}\n\nfunction createProgressCounters(): ProgressState {\n return {\n totalPlugins: 0,\n completedPlugins: 0,\n failedPlugins: 0,\n totalFiles: 0,\n processedFiles: 0,\n hrStart: process.hrtime(),\n }\n}\n\n/**\n * One output phase while its step owns the line. A phase buffers what it is told, because a spinner\n * redraws over anything written under it, and prints the lot once it knows its own result.\n */\ntype Phase = {\n successLabel: string\n failureLabel: string\n /**\n * Whether each hook's own result is worth a line. Format and lint run one command, so the phase\n * result already says everything; the post-generate phase runs several.\n */\n showHookResults: boolean\n failed: boolean\n hrStart: [number, number]\n lines: Array<string>\n /**\n * Raw lines a hook printed, drawn outside the group.\n */\n output: Array<string>\n}\n\ntype StartPhaseOptions = {\n /**\n * Shown while the phase runs.\n */\n running: string\n success: string\n failure: string\n showHookResults?: boolean\n}\n\n/**\n * The three output phases, in the order the generate runner runs them.\n */\nconst PHASES = {\n format: { running: 'Formatting', success: 'Formatted', failure: 'Formatting failed' },\n lint: { running: 'Linting', success: 'Linted', failure: 'Linting failed' },\n hooks: {\n running: 'Running post-generate hooks',\n success: 'Post-generate hooks completed',\n failure: 'Post-generate hooks failed',\n showHookResults: true,\n },\n} as const satisfies Record<string, StartPhaseOptions>\n\n/**\n * Drops the blank lines a subprocess leaves at either end of its output, so its block does not open\n * or close on an empty row.\n */\nfunction trimBlankEdges(lines: ReadonlyArray<string>): Array<string> {\n const start = lines.findIndex((line) => line.trim())\n if (start === -1) {\n return []\n }\n\n return lines.slice(start, lines.findLastIndex((line) => line.trim()) + 1)\n}\n\n/**\n * Wires a {@link LoggerWriter} onto the run's hooks. This owns what a run says and in what order:\n * one group per config, a step over the plugin work, a progress bar for the writes, one step per\n * output phase, then the summary and the group's closing result. The writer only decides how each\n * line looks, so every logger reports the same run the same way.\n *\n * @example\n * ```ts\n * export const plainLogger = createLogger(writer)\n * ```\n */\nexport function createLogger(writer: LoggerWriter): Logger {\n return function install(context, { logLevel }) {\n const silent = logLevel <= logLevelMap.silent\n const state = {\n ...createProgressCounters(),\n spinner: null as WriterSpinner | null,\n progress: null as WriterProgress | null,\n hooks: new Map<string, { hrStart: [number, number]; lines: Array<string> }>(),\n /**\n * Plugin results held back while the generation step owns the line.\n */\n pluginLines: [] as Array<string>,\n phase: null as Phase | null,\n groupOpen: false,\n /**\n * Whether this run keeps its files in memory, as a `kubb studio` run without `--allow-write` does.\n */\n inMemory: false,\n }\n\n function text(message: string): string {\n return formatMessage(message, logLevel)\n }\n\n function startSpinner(message: string) {\n if (silent) {\n return\n }\n\n state.spinner = writer.spinner()\n state.spinner.start(text(message))\n }\n\n function stopSpinner(message?: string, status: LogStatus = 'success') {\n const spinner = state.spinner\n if (!spinner) {\n return\n }\n state.spinner = null\n\n if (message === undefined) {\n spinner.clear()\n return\n }\n if (status === 'failed') {\n spinner.error(text(message))\n return\n }\n spinner.stop(text(message))\n }\n\n function stopProgress(message?: string) {\n const progress = state.progress\n if (!progress) {\n return\n }\n state.progress = null\n progress.stop(message === undefined ? '' : text(message))\n }\n\n function startPhase({ running, success, failure, showHookResults = false }: StartPhaseOptions) {\n state.phase = { successLabel: success, failureLabel: failure, showHookResults, failed: false, hrStart: process.hrtime(), lines: [], output: [] }\n startSpinner(running)\n }\n\n function endPhase() {\n const phase = state.phase\n state.phase = null\n\n if (!phase || silent) {\n return\n }\n\n const duration = formatMsWithColor(getElapsedMs(phase.hrStart))\n\n stopSpinner(phase.failed ? `${phase.failureLabel} after ${duration}` : `${phase.successLabel} in ${duration}`, phase.failed ? 'failed' : 'success')\n\n if (phase.lines.length) {\n writer.block(phase.lines)\n }\n writeOutput(phase.output)\n }\n\n function writeOutput(lines: ReadonlyArray<string>) {\n const output = trimBlankEdges(lines)\n if (output.length) {\n writer.raw(output)\n }\n }\n\n // A run that throws before `kubb:generation:end` never reaches the summary, so the lifecycle\n // end calls this too rather than leave a group without its closing line.\n function closeGroup(status: LogStatus) {\n if (!state.groupOpen) {\n return\n }\n state.groupOpen = false\n\n stopSpinner()\n stopProgress()\n writer.groupEnd(status === 'failed' ? styleText('red', '✗ Generation failed') : styleText('green', '✓ Generation succeeded'))\n }\n\n function reset() {\n stopSpinner()\n stopProgress()\n Object.assign(state, createProgressCounters())\n state.hooks.clear()\n state.pluginLines = []\n state.phase = null\n state.groupOpen = false\n }\n\n function writeErrorFrames(error: Error) {\n const frames = logLevel >= logLevelMap.verbose ? formatErrorFrames(error) : null\n if (!frames) {\n return\n }\n\n writer.block(frames.frames.map((frame) => text(styleText('dim', frame))))\n if (frames.cause) {\n writer.block([styleText('dim', frames.cause.header), ...frames.cause.frames.map((frame) => text(` ${styleText('dim', frame)}`))])\n }\n }\n\n function formatLine(symbol: string, message: string, info?: string): string {\n return text([symbol, message, info && styleText('dim', info)].filter(Boolean).join(' '))\n }\n\n context.hook('kubb:warn', ({ message, info }) => {\n if (logLevel < logLevelMap.warn) {\n return\n }\n\n writer.warn(formatLine(styleText('yellow', '⚠'), message, logLevel >= logLevelMap.info ? info : undefined))\n })\n\n // Unguarded: a failure stays visible even at silent.\n context.hook('kubb:error', ({ error }) => {\n if (state.phase) {\n state.phase.failed = true\n }\n\n // The writer draws the error symbol, so the message goes in bare.\n if (state.spinner) {\n stopSpinner(error.message, 'failed')\n } else {\n writer.error(text(error.message))\n }\n\n writeErrorFrames(error)\n })\n\n context.hook('kubb:diagnostic', ({ diagnostic }) => {\n // Silent still surfaces errors so failures stay visible. It drops warnings and info.\n if (silent && diagnostic.severity !== 'error') {\n return\n }\n\n stopSpinner()\n stopProgress()\n\n if (Diagnostics.isUpdate(diagnostic)) {\n writer.update(\n [`\\`v${diagnostic.currentVersion}\\` → \\`v${diagnostic.latestVersion}\\``, 'Run `npm install -g @kubb/cli` to update'],\n 'Update available for `Kubb`',\n )\n return\n }\n\n const { headline, details } = Diagnostics.format(diagnostic)\n writer.diagnostic([headline, ...details])\n // The stack of a crash is what its maintainers need in a bug report.\n if (Diagnostics.isProblem(diagnostic) && diagnostic.cause) {\n writeErrorFrames(diagnostic.cause)\n }\n })\n\n // A `kubb studio` session emits these on the same emitter as its generations, so one logger\n // renders the whole command.\n context.hook('studio:disconnected', ({ code, reason }) => {\n if (logLevel < logLevelMap.warn) {\n return\n }\n\n stopSpinner()\n // 4002 is `AgentCloseCode.SUPERSEDED`, spelled out because `@kubb/studio` is an optional peer.\n if (code === 4002) {\n writer.warn(text('⚠ Another process connected to Kubb Studio as this agent, so this one stopped'))\n return\n }\n writer.warn(text(`⚠ Kubb Studio ended the session (${reason || `code ${code}`})`))\n })\n\n context.hook('studio:warn', ({ message, permission }) => {\n if (logLevel < logLevelMap.warn) {\n return\n }\n const remedy = permission ? `; pass --${permission.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)} to allow it` : ''\n writer.warn(text(`⚠ ${message}${remedy}`))\n })\n\n // Unguarded, like `kubb:error`: a failure stays visible even at silent.\n context.hook('studio:error', ({ error }) => {\n if (state.spinner) {\n stopSpinner(error.message, 'failed')\n return\n }\n writer.error(text(error.message))\n })\n\n context.hook('kubb:lifecycle:start', () => {\n reset()\n })\n\n context.hook('kubb:generation:start', ({ config }) => {\n closeGroup('failed')\n reset()\n\n state.totalPlugins = config.plugins?.length ?? 0\n state.inMemory = config.storage?.name === 'memory'\n\n if (silent) {\n return\n }\n\n const inputPath = getInputPath(config)\n\n writer.group(text([styleText('bold', config.name ?? 'kubb'), inputPath ? styleText('dim', inputPath) : undefined].filter(Boolean).join(' ')))\n state.groupOpen = true\n\n startSpinner('Generating')\n })\n\n context.hook('kubb:format:start', () => startPhase(PHASES.format))\n context.hook('kubb:format:end', endPhase)\n context.hook('kubb:lint:start', () => startPhase(PHASES.lint))\n context.hook('kubb:lint:end', endPhase)\n context.hook('kubb:hooks:start', () => startPhase(PHASES.hooks))\n context.hook('kubb:hooks:end', endPhase)\n\n context.hook('kubb:hook:end', (ctx) => {\n const { id, command, name, args, success, error } = ctx\n if (!id) {\n return\n }\n\n if (!success && state.phase) {\n state.phase.failed = true\n }\n\n if (silent) {\n // Even when silent, surface a failed hook's captured output.\n if (!ctx.success) {\n if (ctx.stdout) console.log(ctx.stdout)\n if (ctx.stderr) console.error(ctx.stderr)\n }\n return\n }\n\n const active = state.hooks.get(id)\n if (!active) {\n return\n }\n state.hooks.delete(id)\n\n const label = styleText('dim', name ?? (args?.length ? `${command} ${args.join(' ')}` : command))\n const reason = error?.message ? ` (${error.message})` : ''\n const result = success\n ? `${styleText('green', '✓')} ${label} in ${formatMsWithColor(getElapsedMs(active.hrStart))}`\n : `${styleText('red', '✗')} ${label} failed${reason}`\n\n const phase = state.phase\n if (phase) {\n if (phase.showHookResults || !success) {\n phase.lines.push(result)\n }\n phase.output.push(...active.lines)\n return\n }\n\n stopSpinner()\n writer.step(text(result))\n writeOutput(active.lines)\n })\n\n context.hook('kubb:generation:end', () => {\n stopSpinner()\n stopProgress()\n })\n\n context.hook('kubb:lifecycle:end', () => {\n closeGroup('failed')\n reset()\n })\n\n // Not registered at silent: the missing `kubb:hook:line` listener is also what tells the runner not to stream.\n if (!silent) {\n context.hook('kubb:info', ({ message, info }) => {\n const line = formatLine(styleText('blue', 'ℹ'), message, info)\n\n // Info carries something new (the auto-detected tool), so inside a phase it waits for the phase to print.\n if (state.phase) {\n state.phase.lines.push(line)\n return\n }\n if (state.spinner) {\n state.spinner.message(line)\n return\n }\n writer.info(line)\n })\n\n context.hook('kubb:success', ({ message, info }) => {\n const line = formatLine(styleText('green', '✓'), message, logLevel >= logLevelMap.info ? info : undefined)\n\n // The phase step's own result already reports these successes, so let the step carry them.\n if (state.spinner) {\n state.spinner.message(line)\n return\n }\n writer.success(line)\n })\n\n context.hook('studio:connected', ({ url, versions }) => {\n stopSpinner()\n writer.success(text(`✓ Connected to ${styleText('cyan', url)} ${styleText('dim', `(${formatVersions(versions)})`)}`))\n startSpinner('✓ Ready to receive jobs')\n })\n\n context.hook('studio:command', ({ command, info }) => {\n stopSpinner()\n writer.success(text(`✓ Finished ${command} ${styleText('dim', `(${info})`)}`))\n startSpinner('✓ Ready to receive jobs')\n })\n\n context.hook('studio:reconnecting', ({ delayMs }) => {\n stopSpinner()\n writer.info(text(styleText('dim', `Retrying connection to Kubb Studio in ${formatMs(delayMs)}`)))\n })\n\n context.hook('kubb:plugin:start', ({ plugin }) => {\n state.spinner?.message(text(`Generating ${styleText('dim', plugin.name)}`))\n })\n\n // Buffered, not printed: a step redraws over anything written while it runs.\n context.hook('kubb:plugin:end', ({ plugin, duration, success }) => {\n if (success) {\n state.completedPlugins++\n }\n if (!success) {\n state.failedPlugins++\n }\n state.pluginLines.push(text(`${plugin.name} ${success ? 'completed' : 'failed'} in ${formatMsWithColor(duration)}`))\n })\n\n context.hook('kubb:plugins:end', () => {\n const failed = state.failedPlugins > 0\n stopSpinner(buildProgressLine(state) ?? 'No plugins ran', failed ? 'failed' : 'success')\n\n if (state.pluginLines.length) {\n writer.block(state.pluginLines)\n state.pluginLines = []\n }\n })\n\n context.hook('kubb:files:processing:start', ({ files }) => {\n stopSpinner()\n state.totalFiles = files.length\n state.processedFiles = 0\n\n state.progress = writer.progress(files.length)\n state.progress.start(text(`${state.inMemory ? 'Generating' : 'Writing'} ${pluralize(files.length, 'file')}`))\n })\n\n context.hook('kubb:files:processing:update', ({ files }) => {\n for (const { file, config } of files) {\n state.processedFiles++\n state.progress?.advance(`${state.inMemory ? 'Generating' : 'Writing'} ${relative(config.root, file.path)}`)\n }\n })\n\n context.hook('kubb:files:processing:end', () => {\n stopProgress(state.inMemory ? `Generated ${pluralize(state.processedFiles, 'file')} in memory` : `Wrote ${pluralize(state.processedFiles, 'file')}`)\n })\n\n context.hook('kubb:hook:start', ({ id }) => {\n if (!id) {\n return\n }\n state.hooks.set(id, { hrStart: process.hrtime(), lines: [] })\n })\n\n context.hook('kubb:hook:line', ({ id, line }) => {\n const active = state.hooks.get(id)\n if (!active) {\n return\n }\n\n // A phase step redraws its own line, so its output waits until the phase ends.\n if (state.phase) {\n active.lines.push(line)\n return\n }\n writer.raw([line])\n })\n }\n\n return {\n renderSummary(lines, { status }) {\n if (silent || !state.groupOpen) {\n return\n }\n\n closeGroup(status)\n writer.diagnostic([...lines])\n },\n }\n }\n}\n","import { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { createLogger } from './createLogger.ts'\nimport type { Logger, LoggerWriter } from './defineLogger.ts'\n\n/**\n * Draws with clack: a gutter bar per group, animated steps, and a progress bar for the writes.\n */\nexport const clackWriter: LoggerWriter = {\n group: (title) => clack.intro(title),\n groupEnd: (text) => clack.outro(text),\n step: (text) => clack.log.step(text, { spacing: 0 }),\n info: (text) => clack.log.info(text),\n success: (text) => clack.log.success(text),\n warn: (text) => clack.log.warn(text),\n error: (text) => clack.log.error(text),\n block: (lines) => clack.log.message(lines, { spacing: 0 }),\n // A subprocess's output is not Kubb's tree, so it goes out past clack and its gutter bar. The\n // step above it is already stopped by the time this runs.\n raw: (lines) => console.log(styleText('dim', lines.join('\\n'))),\n // The diagnostic carries its own code and indented rows, so clear clack's gutter and bar and let\n // the block stand on its own.\n diagnostic: (lines) => clack.log.message(lines, { symbol: '', secondarySymbol: '' }),\n update: (lines, title) =>\n clack.box(lines.join('\\n'), title, {\n width: 'auto',\n formatBorder: (border: string) => styleText('yellow', border),\n rounded: true,\n withGuide: false,\n contentAlign: 'center',\n titleAlign: 'center',\n }),\n spinner: () => clack.spinner(),\n progress(max) {\n const bar = clack.progress({ style: 'block', max, size: 30 })\n\n return {\n start: (text) => bar.start(text),\n advance: (text) => bar.advance(1, text),\n stop: (text) => bar.stop(text),\n }\n },\n}\n\n/**\n * TTY logger for local development, with animated steps and progress bars.\n */\nexport const clackLogger: Logger = createLogger(clackWriter)\n","import { createLogger } from './createLogger.ts'\nimport type { Logger, LoggerWriter } from './defineLogger.ts'\n\n/**\n * Prefixes that stand in for the symbols clack draws, so plain output reads the same way.\n */\nexport const SYMBOLS = { info: 'ℹ', warn: '⚠', error: '✗', step: '◇' } as const\n\n/** Draws with one `write` call per line. Nothing animates, so a step prints at start and end. */\nfunction createWriter(write: (line: string) => void): LoggerWriter {\n return {\n group: write,\n groupEnd: write,\n step: (text) => write(`${SYMBOLS.step} ${text}`),\n info: write,\n success: write,\n warn: write,\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n block: (lines) => write(lines.join('\\n')),\n raw: (lines) => write(lines.join('\\n')),\n diagnostic: (lines) => write(lines.join('\\n')),\n update: (lines, title) => write([title, ...lines].join('\\n')),\n spinner: () => ({\n start: write,\n message: write,\n clear: () => {},\n stop: (text) => text && write(text),\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n }),\n progress: () => ({\n start: write,\n advance: write,\n stop: (text) => text && write(text),\n }),\n }\n}\n\n/** The plain logger writing through `write`, e.g. `console.error` so stdout carries only JSON. */\nexport function createPlainLogger(write: (line: string) => void): Logger {\n return createLogger(createWriter(write))\n}\n\n/** Draws on the console, for non-TTY environments and for an AI coding agent reading the output. */\nexport const plainWriter = createWriter((line) => console.log(line))\n\n/**\n * Console adapter for non-TTY environments, and for an AI coding agent reading the output. Reports\n * the same run in the same order as `clackLogger`, without the animation.\n */\nexport const plainLogger = createLogger(plainWriter)\n","import { styleText } from 'node:util'\nimport * as prompts from '@clack/prompts'\nimport { isRichOutput } from '../utils/env.ts'\nimport { getIntro } from './banner.ts'\nimport { clackWriter } from './clackLogger.ts'\nimport type { LoggerWriter, WriterSpinner } from './defineLogger.ts'\nimport { plainWriter, SYMBOLS } from './plainLogger.ts'\n\nconst SPONSOR_TIPS = [\n 'Your sponsorship keeps Kubb codegen, plugins, and docs maintained',\n 'Sponsor faster generators and better Kubb Studio workflows',\n 'Help keep Kubb free for TypeScript teams building APIs',\n 'Support React Query, Zod, Faker, and MSW integrations',\n 'Back open-source tools that turn OpenAPI into TypeScript',\n 'Sponsor fixes, releases, and new plugins for your API workflow',\n 'Help Kubb stay independent and focused on developer tools',\n] as const\n\nconst SPONSOR_LINKS = ['https://github.com/sponsors/stijnvanhulle', 'https://opencollective.com/kubb', 'https://kubb.dev/sponsors'] as const\n\n/** The writer the loggers draw with on this terminal, so a command's own lines look like its run. */\nfunction writer(): LoggerWriter {\n return isRichOutput() ? clackWriter : plainWriter\n}\n\nfunction nextTip(): string {\n const tip = SPONSOR_TIPS[Math.floor(Math.random() * SPONSOR_TIPS.length)]!\n const link = SPONSOR_LINKS[Math.floor(Math.random() * SPONSOR_LINKS.length)]!\n return `${tip}: ${link}`\n}\n\nfunction formatTip(tip: string): string {\n return styleText('magenta', ' Tip ') + styleText('yellow', tip)\n}\n\n/**\n * Prints one random tip outside every group. Rich terminals get the styled variant;\n * plain/CI output gets a stable text-only line so the tip is still visible as final output.\n */\nexport function logTip(): void {\n const tip = nextTip()\n if (!isRichOutput()) {\n console.log(`Tip: ${tip}`)\n return\n }\n\n console.log(`${styleText('magenta', '✦')}${formatTip(tip)}`)\n}\n\ntype Level = keyof typeof SYMBOLS\n\n// Not through the writers: in plain output a command's own info and warning carry their symbol, and clack's step keeps its spacing.\nfunction write(level: Level, message: string): void {\n if (isRichOutput()) {\n prompts.log[level](message)\n\n return\n }\n\n console.log(`${SYMBOLS[level]} ${message}`)\n}\n\ntype IntroOptions = {\n title?: string\n /**\n * Printed under the title, for a command that has a caveat to lead with.\n */\n warning?: string\n /**\n * Whether to open a block a later {@link logOutro} closes. Pass `false` for a command that\n * prints and exits, since nothing would ever close the block.\n *\n * @default true\n */\n block?: boolean\n}\n\n/**\n * Opens a command's output with its title.\n */\nexport function logIntro({ title, warning, block = true }: IntroOptions): void {\n if (block && isRichOutput()) {\n if (title) {\n prompts.intro(title)\n }\n\n if (warning) {\n prompts.log.warn(warning)\n }\n\n return\n }\n\n if (title) {\n console.log(title)\n }\n\n if (warning) {\n console.warn(warning)\n }\n\n if (title || warning) {\n console.log()\n }\n}\n\n/**\n * Closes the block {@link logIntro} opened. The closing gutter is not a written line, so plain\n * output prints the text on its own.\n */\nexport function logOutro(text: string): void {\n writer().groupEnd(text)\n}\n\n/**\n * Prints one empty line between two groups, without clack's gutter bar, since the bar belongs to a\n * group and a spacer sits outside every one.\n */\nexport function logSpacer(): void {\n console.log('')\n}\n\n/**\n * Opens the command with the Kubb mascot and version, or a single version line where the terminal\n * cannot draw it.\n */\nexport function logBanner(version: string): void {\n if (isRichOutput()) {\n console.log(`\\n${getIntro({ title: 'Turn your API spec into type-safe code', description: 'Ready to start', version, areEyesOpen: true })}\\n`)\n\n return\n }\n\n console.log(`Kubb CLI v${version}`)\n}\n\n/** Prints lines as one block, without a symbol in front of them. Not the writer's block, which drops clack's spacing around it. */\nexport function logBlock(lines: string | Array<string>): void {\n if (isRichOutput()) {\n prompts.log.message(lines)\n\n return\n }\n\n console.log([lines].flat().join('\\n'))\n}\n\nexport function logInfo(message: string): void {\n write('info', message)\n}\n\nexport function logWarn(message: string): void {\n write('warn', message)\n}\n\nexport function logError(message: string): void {\n write('error', message)\n}\n\n/**\n * Reports a step the command is taking, rather than something it found.\n */\nexport function logStep(message: string): void {\n write('step', message)\n}\n\n/**\n * A progress spinner, or a writer that prints each message it is given when the terminal cannot\n * animate one. Callers drive both the same way, including the failure state.\n */\nexport function createSpinner(): WriterSpinner {\n return writer().spinner()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,YAAqB;CACnC,OAAO,QAAQ,OAAO,UAAU,QAAQ,OAAO,WAAW,KAAK,KAAK,CAACA,cAAAA,gBAAgB;AACvF;;;;;;AAOA,SAAgB,eAAwB;CACtC,OAAO,UAAU,KAAK,CAACC,c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;CAC3C,OAAO,CAAC,CAAC,SAAS,IAAI;AACxB;;;;;AAMA,SAAgB,YAAkB;CAChC,QAAQ,IAAI,EAAE;AAChB;;;;;AAMA,SAAgB,UAAU,SAAuB;CAC/C,IAAI,aAAa,GAAG;EAClB,QAAQ,IAAI,KAAK,SAAS;GAAE,OAAO;GAA0C,aAAa;GAAkB;GAAS,aAAa;EAAK,CAAC,EAAE,GAAG;EAE7I;CACF;CAEA,QAAQ,IAAI,aAAa,SAAS;AACpC;;AAGA,SAAgB,SAAS,OAAqC;CAC5D,IAAI,aAAa,GAAG;EAClB,eAAQ,IAAI,QAAQ,KAAK;EAEzB;CACF;CAEA,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;AACvC;AAEA,SAAgB,QAAQ,SAAuB;CAC7C,MAAM,QAAQ,OAAO;AACvB;AAEA,SAAgB,QAAQ,SAAuB;CAC7C,MAAM,QAAQ,OAAO;AACvB;AAEA,SAAgB,SAAS,SAAuB;CAC9C,MAAM,SAAS,OAAO;AACxB;;;;AAKA,SAAgB,QAAQ,SAAuB;CAC7C,MAAM,QAAQ,OAAO;AACvB;;;;;AAMA,SAAgB,gBAA+B;CAC7C,OAAO,OAAO,CAAC,CAAC,QAAQ;AAC1B"}
@@ -320,6 +320,12 @@ function createLogger(writer) {
320
320
  state.phase = null;
321
321
  state.groupOpen = false;
322
322
  }
323
+ function writeErrorFrames(error) {
324
+ const frames = logLevel$2 >= logLevel.verbose ? formatErrorFrames(error) : null;
325
+ if (!frames) return;
326
+ writer.block(frames.frames.map((frame) => text(styleText("dim", frame))));
327
+ if (frames.cause) writer.block([styleText("dim", frames.cause.header), ...frames.cause.frames.map((frame) => text(` ${styleText("dim", frame)}`))]);
328
+ }
323
329
  function formatLine(symbol, message, info) {
324
330
  return text([
325
331
  symbol,
@@ -335,10 +341,7 @@ function createLogger(writer) {
335
341
  if (state.phase) state.phase.failed = true;
336
342
  if (state.spinner) stopSpinner(error.message, "failed");
337
343
  else writer.error(text(error.message));
338
- const frames = logLevel$2 >= logLevel.verbose ? formatErrorFrames(error) : null;
339
- if (!frames) return;
340
- writer.block(frames.frames.map((frame) => text(styleText("dim", frame))));
341
- if (frames.cause) writer.block([styleText("dim", frames.cause.header), ...frames.cause.frames.map((frame) => text(` ${styleText("dim", frame)}`))]);
344
+ writeErrorFrames(error);
342
345
  });
343
346
  context.hook("kubb:diagnostic", ({ diagnostic }) => {
344
347
  if (silent && diagnostic.severity !== "error") return;
@@ -350,6 +353,7 @@ function createLogger(writer) {
350
353
  }
351
354
  const { headline, details } = Diagnostics.format(diagnostic);
352
355
  writer.diagnostic([headline, ...details]);
356
+ if (Diagnostics.isProblem(diagnostic) && diagnostic.cause) writeErrorFrames(diagnostic.cause);
353
357
  });
354
358
  context.hook("studio:disconnected", ({ code, reason }) => {
355
359
  if (logLevel$2 < logLevel.warn) return;
@@ -624,16 +628,7 @@ const clackWriter = {
624
628
  contentAlign: "center",
625
629
  titleAlign: "center"
626
630
  }),
627
- spinner() {
628
- const spinner = clack.spinner();
629
- return {
630
- start: (text) => spinner.start(text),
631
- message: (text) => spinner.message(text),
632
- clear: () => spinner.clear(),
633
- stop: (text) => spinner.stop(text),
634
- error: (text) => spinner.error(text)
635
- };
636
- },
631
+ spinner: () => clack.spinner(),
637
632
  progress(max) {
638
633
  const bar = clack.progress({
639
634
  style: "block",
@@ -772,4 +767,4 @@ function createSpinner() {
772
767
  //#endregion
773
768
  export { pluralize as _, logInfo as a, logSpacer as c, logWarn as d, clackLogger as f, plainLogger as g, createPlainLogger as h, logError as i, logStep as l, isRichOutput as m, logBanner as n, logIntro as o, canUseTTY as p, logBlock as r, logOutro as s, createSpinner as t, logTip as u };
774
769
 
775
- //# sourceMappingURL=output-B9Yw7vL0.js.map
770
+ //# sourceMappingURL=output-qFt4vV7K.js.map