@kubb/cli 5.14.5 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/bin/kubb.js +2 -1
  2. package/dist/{Telemetry-Dc79_cIA.js → Telemetry-B3edcFoB.js} +12 -86
  3. package/dist/Telemetry-B3edcFoB.js.map +1 -0
  4. package/dist/{Telemetry-Dc9DVxKQ.cjs → Telemetry-COWGqYmh.cjs} +14 -118
  5. package/dist/Telemetry-COWGqYmh.cjs.map +1 -0
  6. package/dist/{background-v5pDy3IJ.cjs → background-B24lIehn.cjs} +5 -6
  7. package/dist/{background-v5pDy3IJ.cjs.map → background-B24lIehn.cjs.map} +1 -1
  8. package/dist/{background-C877JFxE.js → background-D-7OGjvg.js} +1 -1
  9. package/dist/{background-3_KudPH-.js → background-_dKcGjM7.js} +5 -6
  10. package/dist/{background-3_KudPH-.js.map → background-_dKcGjM7.js.map} +1 -1
  11. package/dist/banner-BdTTDFkG.js +140 -0
  12. package/dist/banner-BdTTDFkG.js.map +1 -0
  13. package/dist/banner-wJFk-L-c.cjs +163 -0
  14. package/dist/banner-wJFk-L-c.cjs.map +1 -0
  15. package/dist/config-BL3HnFhb.js +1 -0
  16. package/dist/config-BWj9jBVj.cjs +62 -0
  17. package/dist/config-BWj9jBVj.cjs.map +1 -0
  18. package/dist/{config-CNqgDSu3.js → config-CQTxXvIG.js} +6 -52
  19. package/dist/config-CQTxXvIG.js.map +1 -0
  20. package/dist/{config-BG_Nr2CZ.cjs → config-CRrmj88c.cjs} +15 -62
  21. package/dist/config-CRrmj88c.cjs.map +1 -0
  22. package/dist/config-Uk3rbZfb.js +49 -0
  23. package/dist/config-Uk3rbZfb.js.map +1 -0
  24. package/dist/configFile-C0DIXNMD.js +993 -0
  25. package/dist/configFile-C0DIXNMD.js.map +1 -0
  26. package/dist/configFile-CoEpHdXG.cjs +1028 -0
  27. package/dist/configFile-CoEpHdXG.cjs.map +1 -0
  28. package/dist/{credentials-C8tjAhTo.js → credentials-B77iJx9H.js} +1 -1
  29. package/dist/{credentials-DDaKqtJn.cjs → credentials-DEsGwcGD.cjs} +3 -4
  30. package/dist/{credentials-DDaKqtJn.cjs.map → credentials-DEsGwcGD.cjs.map} +1 -1
  31. package/dist/{credentials-CZK6zPLv.js → credentials-osgjujE_.js} +3 -4
  32. package/dist/{credentials-CZK6zPLv.js.map → credentials-osgjujE_.js.map} +1 -1
  33. package/dist/env-C3xHRMez.js +1 -0
  34. package/dist/env-eu3XyKqJ.cjs +55 -0
  35. package/dist/env-eu3XyKqJ.cjs.map +1 -0
  36. package/dist/env-rv-VgSGN.js +34 -0
  37. package/dist/env-rv-VgSGN.js.map +1 -0
  38. package/dist/{errors-Cl69p_vI.cjs → errors-BponpdjN.cjs} +3 -4
  39. package/dist/{errors-Cl69p_vI.cjs.map → errors-BponpdjN.cjs.map} +1 -1
  40. package/dist/{errors-DmC83ALX.js → errors-wzqmMpMo.js} +3 -4
  41. package/dist/{errors-DmC83ALX.js.map → errors-wzqmMpMo.js.map} +1 -1
  42. package/dist/index.cjs +37 -2719
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.cts +0 -2
  45. package/dist/index.d.ts +0 -2
  46. package/dist/index.js +35 -2713
  47. package/dist/index.js.map +1 -1
  48. package/dist/installWithSpinner-DpnpxHq5.js +49 -0
  49. package/dist/installWithSpinner-DpnpxHq5.js.map +1 -0
  50. package/dist/installWithSpinner-ONGfIVUJ.cjs +56 -0
  51. package/dist/installWithSpinner-ONGfIVUJ.cjs.map +1 -0
  52. package/dist/{text-CEyJhBnh.js → intro-9PB8sE8z.js} +8 -52
  53. package/dist/intro-9PB8sE8z.js.map +1 -0
  54. package/dist/{text-CC2xdpGL.cjs → intro-YPaf1Imr.cjs} +12 -80
  55. package/dist/intro-YPaf1Imr.cjs.map +1 -0
  56. package/dist/isCIEnvironment-D6xtAAZ2.js +14 -0
  57. package/dist/isCIEnvironment-D6xtAAZ2.js.map +1 -0
  58. package/dist/isCIEnvironment-DiVOMI5Q.cjs +20 -0
  59. package/dist/isCIEnvironment-DiVOMI5Q.cjs.map +1 -0
  60. package/dist/mascot--q1xjKw1.js +63 -0
  61. package/dist/mascot--q1xjKw1.js.map +1 -0
  62. package/dist/mascot-JSA0j3Q_.cjs +80 -0
  63. package/dist/mascot-JSA0j3Q_.cjs.map +1 -0
  64. package/dist/mcp-CYPOFKnP.cjs +20 -0
  65. package/dist/mcp-CYPOFKnP.cjs.map +1 -0
  66. package/dist/mcp-CxeZR5vb.js +21 -0
  67. package/dist/mcp-CxeZR5vb.js.map +1 -0
  68. package/dist/package-D3Yss9Bb.js +5 -0
  69. package/dist/package-D3Yss9Bb.js.map +1 -0
  70. package/dist/package-aX0q9SZr.cjs +10 -0
  71. package/dist/package-aX0q9SZr.cjs.map +1 -0
  72. package/dist/{registry-ov1RYcD4.js → registry-B3eYk4LN.js} +7 -67
  73. package/dist/registry-B3eYk4LN.js.map +1 -0
  74. package/dist/{registry-BInbtBm7.cjs → registry-YE1pFWL-.cjs} +4 -82
  75. package/dist/registry-YE1pFWL-.cjs.map +1 -0
  76. package/dist/{reporters-DQz--AdE.cjs → reporters-2cgjvXwR.cjs} +32 -40
  77. package/dist/{reporters-DQz--AdE.cjs.map → reporters-2cgjvXwR.cjs.map} +1 -1
  78. package/dist/{reporters-BtD41K-C.js → reporters-BM430HdQ.js} +19 -27
  79. package/dist/{reporters-BtD41K-C.js.map → reporters-BM430HdQ.js.map} +1 -1
  80. package/dist/{rolldown-runtime-CPE0t6oh.cjs → rolldown-runtime-C3-Zg-KD.cjs} +1 -2
  81. package/dist/{rolldown-runtime-CRm0XQPb.js → rolldown-runtime-xo6NMXYd.js} +1 -2
  82. package/dist/run-1H9TGT8v.js +77 -0
  83. package/dist/run-1H9TGT8v.js.map +1 -0
  84. package/dist/run-B4zvF9WY.cjs +233 -0
  85. package/dist/run-B4zvF9WY.cjs.map +1 -0
  86. package/dist/run-BYP_t9dR.cjs +324 -0
  87. package/dist/run-BYP_t9dR.cjs.map +1 -0
  88. package/dist/{run-1oXPIkli.cjs → run-Bb19PlwV.cjs} +44 -37
  89. package/dist/run-Bb19PlwV.cjs.map +1 -0
  90. package/dist/{run-B03V0Poj.cjs → run-BoO7H8RA.cjs} +49 -41
  91. package/dist/run-BoO7H8RA.cjs.map +1 -0
  92. package/dist/run-BrM7-NSV.js +181 -0
  93. package/dist/run-BrM7-NSV.js.map +1 -0
  94. package/dist/{run-UsAMlUyy.js → run-C0KI-NE3.js} +9 -9
  95. package/dist/{run-UsAMlUyy.js.map → run-C0KI-NE3.js.map} +1 -1
  96. package/dist/run-CCLPt4hr.js +1 -0
  97. package/dist/run-CCsdLz3X.js +385 -0
  98. package/dist/run-CCsdLz3X.js.map +1 -0
  99. package/dist/{run-YMSJnvYl.js → run-CbX6tpqB.js} +31 -23
  100. package/dist/run-CbX6tpqB.js.map +1 -0
  101. package/dist/run-CrM4jsix.cjs +80 -0
  102. package/dist/run-CrM4jsix.cjs.map +1 -0
  103. package/dist/run-CvFakE3B.cjs +185 -0
  104. package/dist/run-CvFakE3B.cjs.map +1 -0
  105. package/dist/run-D-nn9-Wq.js +319 -0
  106. package/dist/run-D-nn9-Wq.js.map +1 -0
  107. package/dist/{run-cBSr2F1q.cjs → run-D5Z6nfzK.cjs} +5 -6
  108. package/dist/{run-cBSr2F1q.cjs.map → run-D5Z6nfzK.cjs.map} +1 -1
  109. package/dist/{run-BUzdEUaE.cjs → run-DCqmf5W1.cjs} +10 -10
  110. package/dist/{run-BUzdEUaE.cjs.map → run-DCqmf5W1.cjs.map} +1 -1
  111. package/dist/{run-BK-A9JDf.js → run-DFXhBS64.js} +5 -6
  112. package/dist/{run-BK-A9JDf.js.map → run-DFXhBS64.js.map} +1 -1
  113. package/dist/run-DgGZOC_x.cjs +389 -0
  114. package/dist/run-DgGZOC_x.cjs.map +1 -0
  115. package/dist/{run-DDwdeHgU.js → run-KqdudiWQ.js} +26 -20
  116. package/dist/run-KqdudiWQ.js.map +1 -0
  117. package/dist/run-RN_31Q4u.js +228 -0
  118. package/dist/run-RN_31Q4u.js.map +1 -0
  119. package/dist/shared-C0EtrdUm.cjs +123 -0
  120. package/dist/shared-C0EtrdUm.cjs.map +1 -0
  121. package/dist/shared-Ct9stKpp.js +94 -0
  122. package/dist/shared-Ct9stKpp.js.map +1 -0
  123. package/dist/{snapshot-BrwynBfC.cjs → snapshot-D7Ytw8S0.cjs} +13 -14
  124. package/dist/{snapshot-BrwynBfC.cjs.map → snapshot-D7Ytw8S0.cjs.map} +1 -1
  125. package/dist/{snapshot-D2E7nhEf.js → snapshot-n7dJGCWv.js} +10 -11
  126. package/dist/{snapshot-D2E7nhEf.js.map → snapshot-n7dJGCWv.js.map} +1 -1
  127. package/dist/spinner-BZaln7O8.js +160 -0
  128. package/dist/spinner-BZaln7O8.js.map +1 -0
  129. package/dist/spinner-CfB0sIPy.cjs +208 -0
  130. package/dist/spinner-CfB0sIPy.cjs.map +1 -0
  131. package/dist/{status-CxzhvjKs.cjs → status-Bc0_4T41.cjs} +7 -8
  132. package/dist/{status-CxzhvjKs.cjs.map → status-Bc0_4T41.cjs.map} +1 -1
  133. package/dist/{status-BHIOMCM0.js → status-DxSkp1cH.js} +6 -7
  134. package/dist/{status-BHIOMCM0.js.map → status-DxSkp1cH.js.map} +1 -1
  135. package/dist/studio-BpYwgFb0.cjs +218 -0
  136. package/dist/studio-BpYwgFb0.cjs.map +1 -0
  137. package/dist/studio-mw6HaPkr.js +215 -0
  138. package/dist/studio-mw6HaPkr.js.map +1 -0
  139. package/dist/studioWorker.js +4 -5
  140. package/dist/{summary-B219y888.js → summary-CbmQKA8l.js} +5 -6
  141. package/dist/{summary-B219y888.js.map → summary-CbmQKA8l.js.map} +1 -1
  142. package/dist/{summary-BOYsqub3.cjs → summary-Clvl5Hxs.cjs} +7 -8
  143. package/dist/{summary-BOYsqub3.cjs.map → summary-Clvl5Hxs.cjs.map} +1 -1
  144. package/dist/table-BlRe9YTZ.cjs +15 -0
  145. package/dist/table-BlRe9YTZ.cjs.map +1 -0
  146. package/dist/table-CR7iZJGo.js +10 -0
  147. package/dist/table-CR7iZJGo.js.map +1 -0
  148. package/dist/text-BmiI4s6N.js +13 -0
  149. package/dist/text-BmiI4s6N.js.map +1 -0
  150. package/dist/text-Ep3AulAS.cjs +24 -0
  151. package/dist/text-Ep3AulAS.cjs.map +1 -0
  152. package/dist/time-3BKoci3G.cjs +82 -0
  153. package/dist/time-3BKoci3G.cjs.map +1 -0
  154. package/dist/time-C-wU7VhC.js +65 -0
  155. package/dist/time-C-wU7VhC.js.map +1 -0
  156. package/dist/utils-BdibacYq.js +244 -0
  157. package/dist/utils-BdibacYq.js.map +1 -0
  158. package/dist/utils-CO89mxRU.cjs +290 -0
  159. package/dist/utils-CO89mxRU.cjs.map +1 -0
  160. package/dist/utils-CbJ6hS_t.js +222 -0
  161. package/dist/utils-CbJ6hS_t.js.map +1 -0
  162. package/dist/utils-CcARPB45.cjs +286 -0
  163. package/dist/utils-CcARPB45.cjs.map +1 -0
  164. package/dist/validate-8ZcWXfMt.js +28 -0
  165. package/dist/validate-8ZcWXfMt.js.map +1 -0
  166. package/dist/validate-CMSeDpGT.cjs +27 -0
  167. package/dist/validate-CMSeDpGT.cjs.map +1 -0
  168. package/package.json +7 -7
  169. package/dist/Telemetry-Dc79_cIA.js.map +0 -1
  170. package/dist/Telemetry-Dc9DVxKQ.cjs.map +0 -1
  171. package/dist/config-BG_Nr2CZ.cjs.map +0 -1
  172. package/dist/config-CNqgDSu3.js.map +0 -1
  173. package/dist/config-DWDpFSn1.js +0 -1
  174. package/dist/registry-BInbtBm7.cjs.map +0 -1
  175. package/dist/registry-ov1RYcD4.js.map +0 -1
  176. package/dist/run-1oXPIkli.cjs.map +0 -1
  177. package/dist/run-B03V0Poj.cjs.map +0 -1
  178. package/dist/run-DDwdeHgU.js.map +0 -1
  179. package/dist/run-YMSJnvYl.js.map +0 -1
  180. package/dist/run-v5aW1jjQ.js +0 -1
  181. package/dist/text-CC2xdpGL.cjs.map +0 -1
  182. package/dist/text-CEyJhBnh.js.map +0 -1
  183. package/dist/utils-8E1nF4C1.cjs +0 -645
  184. package/dist/utils-8E1nF4C1.cjs.map +0 -1
  185. package/dist/utils-D8VN40bN.js +0 -536
  186. package/dist/utils-D8VN40bN.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mascot-JSA0j3Q_.cjs","names":["getIntro","isRichOutput","stripVTControlCharacters","isInteractiveRun","wakeUp","sleep"],"sources":["../src/ui/mascot.ts"],"sourcesContent":["import { setTimeout as sleep } from 'node:timers/promises'\nimport { stripVTControlCharacters } from 'node:util'\nimport { isRichOutput } from '../utils/env.ts'\nimport { type Expression, getIntro, wakeUp } from '../loggers/banner.ts'\nimport { isInteractiveRun } from './intro.ts'\n\nfunction bannerIntro(version: string, expression: Expression, command: string): string {\n return getIntro({ title: 'Turn your API spec into type-safe code', description: `kubb ${command}`, version, expression })\n}\n\n/** Whether the mascot can be drawn: a rich, 256-color terminal wide enough that no line wraps and throws off a redraw. */\nfunction canDrawMascot(version: string, command: string): boolean {\n if (!isRichOutput() || !process.stdout.hasColors(256)) return false\n\n return stripVTControlCharacters(bannerIntro(version, 'open', command))\n .split('\\n')\n .every((line) => line.length <= process.stdout.columns)\n}\n\n/**\n * Whether a command opens with the mascot. Only the long-running ones do: `generate`, a Studio\n * session or pairing, and `add` or `update` while they ask questions. Quick commands print only\n * their result.\n */\nexport function wantsMascot({ commandPath, values }: { commandPath: ReadonlyArray<string>; values: Record<string, unknown> }): boolean {\n const [command, subCommand] = commandPath\n if (values.help || values.version) return false\n if (command === 'studio') return subCommand === undefined || subCommand === 'connect' || subCommand === 'login'\n if (command === 'add' || command === 'update' || command === 'init') return isInteractiveRun({ yes: values.yes, dryRun: values.dryRun ?? values['dry-run'] })\n\n return command === undefined || command === 'generate'\n}\n\n/**\n * The still Kubb mascot with the version and the running command, such as `studio connect`, or a\n * single version line where the terminal cannot draw it. Commands print it as their header; it\n * draws at once, with no wake-up frames.\n */\nexport function getBanner(version: string, command: string): string {\n return canDrawMascot(version, command) ? `\\n${bannerIntro(version, 'open', command)}` : `Kubb CLI v${version}`\n}\n\n/**\n * Opens `kubb generate` with the mascot playing its wake-up frames in place, which takes under a\n * second and overlaps the config load. Elsewhere the still {@link getBanner} is the header.\n */\nexport async function logBanner(version: string): Promise<void> {\n if (!canDrawMascot(version, 'generate')) {\n console.log(getBanner(version, 'generate'))\n\n return\n }\n\n console.log('')\n for (const [index, [expression, ms]] of wakeUp.entries()) {\n const frame = bannerIntro(version, expression, 'generate')\n if (index > 0) process.stdout.moveCursor(0, -frame.split('\\n').length)\n console.log(frame)\n await sleep(ms)\n }\n}\n"],"mappings":";;;;;;;AAMA,SAAS,YAAY,SAAiB,YAAwB,SAAyB;CACrF,OAAOA,eAAAA,SAAS;EAAE,OAAO;EAA0C,aAAa,QAAQ;EAAW;EAAS;CAAW,CAAC;AAC1H;;AAGA,SAAS,cAAc,SAAiB,SAA0B;CAChE,IAAI,CAACC,YAAAA,aAAa,KAAK,CAAC,QAAQ,OAAO,UAAU,GAAG,GAAG,OAAO;CAE9D,QAAA,GAAOC,UAAAA,yBAAAA,CAAyB,YAAY,SAAS,QAAQ,OAAO,CAAC,CAAC,CACnE,MAAM,IAAI,CAAC,CACX,OAAO,SAAS,KAAK,UAAU,QAAQ,OAAO,OAAO;AAC1D;;;;;;AAOA,SAAgB,YAAY,EAAE,aAAa,UAA4F;CACrI,MAAM,CAAC,SAAS,cAAc;CAC9B,IAAI,OAAO,QAAQ,OAAO,SAAS,OAAO;CAC1C,IAAI,YAAY,UAAU,OAAO,eAAe,KAAA,KAAa,eAAe,aAAa,eAAe;CACxG,IAAI,YAAY,SAAS,YAAY,YAAY,YAAY,QAAQ,OAAOC,cAAAA,iBAAiB;EAAE,KAAK,OAAO;EAAK,QAAQ,OAAO,UAAU,OAAO;CAAW,CAAC;CAE5J,OAAO,YAAY,KAAA,KAAa,YAAY;AAC9C;;;;;;AAOA,SAAgB,UAAU,SAAiB,SAAyB;CAClE,OAAO,cAAc,SAAS,OAAO,IAAI,KAAK,YAAY,SAAS,QAAQ,OAAO,MAAM,aAAa;AACvG;;;;;AAMA,eAAsB,UAAU,SAAgC;CAC9D,IAAI,CAAC,cAAc,SAAS,UAAU,GAAG;EACvC,QAAQ,IAAI,UAAU,SAAS,UAAU,CAAC;EAE1C;CACF;CAEA,QAAQ,IAAI,EAAE;CACd,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,QAAQC,eAAAA,OAAO,QAAQ,GAAG;EACxD,MAAM,QAAQ,YAAY,SAAS,YAAY,UAAU;EACzD,IAAI,QAAQ,GAAG,QAAQ,OAAO,WAAW,GAAG,CAAC,MAAM,MAAM,IAAI,CAAC,CAAC,MAAM;EACrE,QAAQ,IAAI,KAAK;EACjB,OAAA,GAAMC,qBAAAA,WAAAA,CAAM,EAAE;CAChB;AACF"}
@@ -0,0 +1,20 @@
1
+ require("./rolldown-runtime-C3-Zg-KD.cjs");
2
+ // src/commands/mcp.ts
3
+ /** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */
4
+ const command = (0, require("gunshi").define)({
5
+ name: "mcp",
6
+ description: "Start an MCP server for code generation from an AI assistant.",
7
+ examples: [
8
+ "kubb mcp",
9
+ "# Then add to your MCP client config:",
10
+ "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
11
+ ].join("\n"),
12
+ rendering: { header: null },
13
+ async run() {
14
+ const { run } = await Promise.resolve().then(() => require("./run-D5Z6nfzK.cjs"));
15
+ await run();
16
+ }
17
+ });
18
+ exports.command = command;
19
+
20
+ //# sourceMappingURL=mcp-CYPOFKnP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-CYPOFKnP.cjs","names":["define"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["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: 'Start an MCP server for code generation from an AI assistant.',\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"],"mappings":";;;AAGA,MAAa,WAAA,G,gBAAUA,CAAAA,CAAAA,OAAAA,CAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;CAE1J,WAAW,EAAE,QAAQ,KAAK;CAC1B,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EACtB,MAAM,IAAI;CACZ;AACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import "./rolldown-runtime-xo6NMXYd.js";
2
+ import { define } from "gunshi";
3
+ // src/commands/mcp.ts
4
+ /** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */
5
+ const command = define({
6
+ name: "mcp",
7
+ description: "Start an MCP server for code generation from an AI assistant.",
8
+ examples: [
9
+ "kubb mcp",
10
+ "# Then add to your MCP client config:",
11
+ "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
12
+ ].join("\n"),
13
+ rendering: { header: null },
14
+ async run() {
15
+ const { run } = await import("./run-DFXhBS64.js");
16
+ await run();
17
+ }
18
+ });
19
+ export { command };
20
+
21
+ //# sourceMappingURL=mcp-CxeZR5vb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-CxeZR5vb.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["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: 'Start an MCP server for code generation from an AI assistant.',\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"],"mappings":";;;;AAGA,MAAa,UAAU,OAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;CAE1J,WAAW,EAAE,QAAQ,KAAK;CAC1B,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,MAAM,IAAI;CACZ;AACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ // package.json
2
+ var version = "5.15.0";
3
+ export { version as t };
4
+
5
+ //# sourceMappingURL=package-D3Yss9Bb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-D3Yss9Bb.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,10 @@
1
+ // package.json
2
+ var version = "5.15.0";
3
+ Object.defineProperty(exports, "version", {
4
+ enumerable: true,
5
+ get: function() {
6
+ return version;
7
+ }
8
+ });
9
+
10
+ //# sourceMappingURL=package-aX0q9SZr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-aX0q9SZr.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,74 +1,15 @@
1
- import "./rolldown-runtime-CRm0XQPb.js";
2
- import { n as toError, t as getErrorMessage } from "./errors-DmC83ALX.js";
3
- import { f as getIntro, p as wakeUp } from "./utils-D8VN40bN.js";
4
- import { _ as isRichOutput, r as isInteractiveRun } from "./text-CEyJhBnh.js";
5
- import { stripVTControlCharacters } from "node:util";
6
- import process$1 from "node:process";
7
- import { setTimeout } from "node:timers/promises";
1
+ import "./rolldown-runtime-xo6NMXYd.js";
2
+ import { n as toError, t as getErrorMessage } from "./errors-wzqmMpMo.js";
3
+ import process from "node:process";
8
4
  import { Diagnostics, checkCompatibility, isRegistryEntry } from "@kubb/core";
9
5
  import { difference, isLessThan, isValid } from "verkit";
10
- //#region src/ui/mascot.ts
11
- function bannerIntro(version, expression, command) {
12
- return getIntro({
13
- title: "Turn your API spec into type-safe code",
14
- description: `kubb ${command}`,
15
- version,
16
- expression
17
- });
18
- }
19
- /** Whether the mascot can be drawn: a rich, 256-color terminal wide enough that no line wraps and throws off a redraw. */
20
- function canDrawMascot(version, command) {
21
- if (!isRichOutput() || !process.stdout.hasColors(256)) return false;
22
- return stripVTControlCharacters(bannerIntro(version, "open", command)).split("\n").every((line) => line.length <= process.stdout.columns);
23
- }
24
- /**
25
- * Whether a command opens with the mascot. Only the long-running ones do: `generate`, a Studio
26
- * session or pairing, and `add` or `update` while they ask questions. Quick commands print only
27
- * their result.
28
- */
29
- function wantsMascot({ commandPath, values }) {
30
- const [command, subCommand] = commandPath;
31
- if (values.help || values.version) return false;
32
- if (command === "studio") return subCommand === void 0 || subCommand === "connect" || subCommand === "login";
33
- if (command === "add" || command === "update" || command === "init") return isInteractiveRun({
34
- yes: values.yes,
35
- dryRun: values.dryRun ?? values["dry-run"]
36
- });
37
- return command === void 0 || command === "generate";
38
- }
39
- /**
40
- * The still Kubb mascot with the version and the running command, such as `studio connect`, or a
41
- * single version line where the terminal cannot draw it. Commands print it as their header; it
42
- * draws at once, with no wake-up frames.
43
- */
44
- function getBanner(version, command) {
45
- return canDrawMascot(version, command) ? `\n${bannerIntro(version, "open", command)}` : `Kubb CLI v${version}`;
46
- }
47
- /**
48
- * Opens `kubb generate` with the mascot playing its wake-up frames in place, which takes under a
49
- * second and overlaps the config load. Elsewhere the still {@link getBanner} is the header.
50
- */
51
- async function logBanner(version) {
52
- if (!canDrawMascot(version, "generate")) {
53
- console.log(getBanner(version, "generate"));
54
- return;
55
- }
56
- console.log("");
57
- for (const [index, [expression, ms]] of wakeUp.entries()) {
58
- const frame = bannerIntro(version, expression, "generate");
59
- if (index > 0) process.stdout.moveCursor(0, -frame.split("\n").length);
60
- console.log(frame);
61
- await setTimeout(ms);
62
- }
63
- }
64
- //#endregion
65
- //#region src/utils/registry.ts
6
+ // src/utils/registry.ts
66
7
  const DEFAULT_REGISTRY = "https://kubb.dev/registry";
67
8
  const SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*";
68
9
  const ID = new RegExp(`^${SLUG}(\\/${SLUG})?$`);
69
10
  /** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */
70
11
  function registryUrl() {
71
- const url = process$1.env.KUBB_REGISTRY || DEFAULT_REGISTRY;
12
+ const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY;
72
13
  if (!/^https?:\/\//.test(url)) throw new Diagnostics.Error({
73
14
  code: Diagnostics.code.unknown,
74
15
  severity: "error",
@@ -194,7 +135,6 @@ function closestIds({ input, ids }) {
194
135
  shared: slug(id).split("-").some((token) => tokens.has(token))
195
136
  })).filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4))).sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance).slice(0, 3).map(({ id }) => id);
196
137
  }
197
- //#endregion
198
- export { installSpec as a, toRegistryId as c, logBanner as d, wantsMascot as f, incompatibility as i, toShortId as l, closestIds as n, isOutdated as o, fetchRegistryIndex as r, registryUrl as s, bumpOf as t, getBanner as u };
138
+ export { installSpec as a, toRegistryId as c, incompatibility as i, toShortId as l, closestIds as n, isOutdated as o, fetchRegistryIndex as r, registryUrl as s, bumpOf as t };
199
139
 
200
- //# sourceMappingURL=registry-ov1RYcD4.js.map
140
+ //# sourceMappingURL=registry-B3eYk4LN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-B3eYk4LN.js","names":[],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage, toError } from '@internals/utils'\nimport { checkCompatibility, Diagnostics, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryEntry } from '@kubb/core'\nimport { difference, isLessThan, isValid } from 'verkit'\n\nconst DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`,\n help: 'Set `KUBB_REGISTRY` to an http(s) URL, or unset it to use https://kubb.dev/registry.',\n })\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`,\n })\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** The shortest id `kubb add` and `kubb update` accept: the slug for an official extension, else `owner/slug`. */\nexport function toShortId(id: string): string {\n return id.startsWith('kubb-labs/') ? id.slice('kubb-labs/'.length) : id\n}\n\n/**\n * GETs `url` as JSON. A non-2xx answer or a body that is not JSON returns no `body`.\n * A network error throws with the URL.\n */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n let response: Response\n try {\n response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n } catch (cause) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputUnreachable,\n severity: 'error',\n message: `Could not read ${url}: ${getErrorMessage(cause)}`,\n help: 'Check your network connection and that the registry is reachable.',\n cause: toError(cause),\n })\n }\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: await response.json().catch(() => undefined) }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputRequestFailed,\n severity: 'error',\n message: `The registry at ${registry} sent an invalid index (HTTP ${status}).`,\n help: 'Try again later, or check that `KUBB_REGISTRY` points at a Kubb registry.',\n })\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n\n/** `major`, `minor`, or `patch` from `installed` to `latest`, or `undefined` when either is unknown or invalid. */\nexport function bumpOf({ installed, latest }: { installed: string | undefined; latest: string }): 'major' | 'minor' | 'patch' | undefined {\n if (!installed || !isValid(installed) || !isValid(latest)) return undefined\n const kind = difference(installed, latest)\n if (!kind) return undefined\n if (kind.endsWith('major')) return 'major'\n return kind.endsWith('minor') ? 'minor' : 'patch'\n}\n\nfunction editDistance(a: string, b: string): number {\n const row = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i++) {\n let previous = row[0]!\n row[0] = i\n for (let j = 1; j <= b.length; j++) {\n const current = row[j]!\n row[j] = Math.min(row[j]! + 1, row[j - 1]! + 1, previous + (a[i - 1] === b[j - 1] ? 0 : 1))\n previous = current\n }\n }\n return row[b.length]!\n}\n\n/** Words every extension shares, so they never make two ids look alike. */\nconst COMMON_TOKENS = new Set(['kubb', 'plugin', 'adapter', 'parser'])\n\n/**\n * The ids closest to a mistyped `input`, best first, at most three: those within a few edits of it,\n * or sharing a word such as `zod` in any order. Compares slugs, so the owner may be left out.\n */\nexport function closestIds({ input, ids }: { input: string; ids: Array<string> }): Array<string> {\n const slug = (id: string) => id.slice(id.indexOf('/') + 1)\n const tokens = new Set(\n slug(input)\n .split('-')\n .filter((token) => !COMMON_TOKENS.has(token)),\n )\n return ids\n .map((id) => ({\n id,\n distance: editDistance(slug(input), slug(id)),\n shared: slug(id)\n .split('-')\n .some((token) => tokens.has(token)),\n }))\n .filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4)))\n .sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance)\n .slice(0, 3)\n .map(({ id }) => id)\n}\n"],"mappings":";;;;;;AAKA,MAAM,mBAAmB;AAEzB,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAM,QAAQ,IAAI,iBAAiB;CACzC,IAAI,CAAC,eAAe,KAAK,GAAG,GAC1B,MAAM,IAAI,YAAY,MAAM;EAC1B,MAAM,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,8CAA8C,IAAI;EAC3D,MAAM;CACR,CAAC;CACH,OAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;;;;;;AAOA,SAAgB,a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AMrE,SAAgB,WAAW,EAAE,OAAO,OAA6D;CAC/F,MAAM,QAAQ,OAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;CACzD,MAAM,SAAS,IAAI,IACjB,KAAK,KAAK,CAAC,CACR,MAAM,GAAG,CAAC,CACV,QAAQ,UAAU,CAAC,cAAc,IAAI,KAAK,CAAC,CAChD;CACA,OAAO,IACJ,KAAK,QAAQ;EACZ;EACA,UAAU,aAAa,KAAK,KAAK,GAAG,KAAK,EAAE,CAAC;EAC5C,QAAQ,KAAK,EAAE,CAAC,CACb,MAAM,GAAG,CAAC,CACV,MAAM,UAAU,OAAO,IAAI,KAAK,CAAC;CACtC,EAAE,CAAC,CACF,QAAQ,EAAE,UAAU,aAAa,UAAU,YAAY,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACvG,MAAM,GAAG,MAAM,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAC9E,MAAM,GAAG,CAAC,CAAC,CACX,KAAK,EAAE,SAAS,EAAE;AACvB"}
@@ -1,69 +1,10 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
2
- const require_errors = require("./errors-Cl69p_vI.cjs");
3
- const require_utils = require("./utils-8E1nF4C1.cjs");
4
- const require_text = require("./text-CC2xdpGL.cjs");
5
- let node_util = require("node:util");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
2
+ const require_errors = require("./errors-BponpdjN.cjs");
6
3
  let node_process = require("node:process");
7
4
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
8
- let node_timers_promises = require("node:timers/promises");
9
5
  let _kubb_core = require("@kubb/core");
10
6
  let verkit = require("verkit");
11
- //#region src/ui/mascot.ts
12
- function bannerIntro(version, expression, command) {
13
- return require_utils.getIntro({
14
- title: "Turn your API spec into type-safe code",
15
- description: `kubb ${command}`,
16
- version,
17
- expression
18
- });
19
- }
20
- /** Whether the mascot can be drawn: a rich, 256-color terminal wide enough that no line wraps and throws off a redraw. */
21
- function canDrawMascot(version, command) {
22
- if (!require_text.isRichOutput() || !process.stdout.hasColors(256)) return false;
23
- return (0, node_util.stripVTControlCharacters)(bannerIntro(version, "open", command)).split("\n").every((line) => line.length <= process.stdout.columns);
24
- }
25
- /**
26
- * Whether a command opens with the mascot. Only the long-running ones do: `generate`, a Studio
27
- * session or pairing, and `add` or `update` while they ask questions. Quick commands print only
28
- * their result.
29
- */
30
- function wantsMascot({ commandPath, values }) {
31
- const [command, subCommand] = commandPath;
32
- if (values.help || values.version) return false;
33
- if (command === "studio") return subCommand === void 0 || subCommand === "connect" || subCommand === "login";
34
- if (command === "add" || command === "update" || command === "init") return require_text.isInteractiveRun({
35
- yes: values.yes,
36
- dryRun: values.dryRun ?? values["dry-run"]
37
- });
38
- return command === void 0 || command === "generate";
39
- }
40
- /**
41
- * The still Kubb mascot with the version and the running command, such as `studio connect`, or a
42
- * single version line where the terminal cannot draw it. Commands print it as their header; it
43
- * draws at once, with no wake-up frames.
44
- */
45
- function getBanner(version, command) {
46
- return canDrawMascot(version, command) ? `\n${bannerIntro(version, "open", command)}` : `Kubb CLI v${version}`;
47
- }
48
- /**
49
- * Opens `kubb generate` with the mascot playing its wake-up frames in place, which takes under a
50
- * second and overlaps the config load. Elsewhere the still {@link getBanner} is the header.
51
- */
52
- async function logBanner(version) {
53
- if (!canDrawMascot(version, "generate")) {
54
- console.log(getBanner(version, "generate"));
55
- return;
56
- }
57
- console.log("");
58
- for (const [index, [expression, ms]] of require_utils.wakeUp.entries()) {
59
- const frame = bannerIntro(version, expression, "generate");
60
- if (index > 0) process.stdout.moveCursor(0, -frame.split("\n").length);
61
- console.log(frame);
62
- await (0, node_timers_promises.setTimeout)(ms);
63
- }
64
- }
65
- //#endregion
66
- //#region src/utils/registry.ts
7
+ // src/utils/registry.ts
67
8
  const DEFAULT_REGISTRY = "https://kubb.dev/registry";
68
9
  const SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*";
69
10
  const ID = new RegExp(`^${SLUG}(\\/${SLUG})?$`);
@@ -195,7 +136,6 @@ function closestIds({ input, ids }) {
195
136
  shared: slug(id).split("-").some((token) => tokens.has(token))
196
137
  })).filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4))).sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance).slice(0, 3).map(({ id }) => id);
197
138
  }
198
- //#endregion
199
139
  Object.defineProperty(exports, "bumpOf", {
200
140
  enumerable: true,
201
141
  get: function() {
@@ -214,12 +154,6 @@ Object.defineProperty(exports, "fetchRegistryIndex", {
214
154
  return fetchRegistryIndex;
215
155
  }
216
156
  });
217
- Object.defineProperty(exports, "getBanner", {
218
- enumerable: true,
219
- get: function() {
220
- return getBanner;
221
- }
222
- });
223
157
  Object.defineProperty(exports, "incompatibility", {
224
158
  enumerable: true,
225
159
  get: function() {
@@ -238,12 +172,6 @@ Object.defineProperty(exports, "isOutdated", {
238
172
  return isOutdated;
239
173
  }
240
174
  });
241
- Object.defineProperty(exports, "logBanner", {
242
- enumerable: true,
243
- get: function() {
244
- return logBanner;
245
- }
246
- });
247
175
  Object.defineProperty(exports, "registryUrl", {
248
176
  enumerable: true,
249
177
  get: function() {
@@ -262,11 +190,5 @@ Object.defineProperty(exports, "toShortId", {
262
190
  return toShortId;
263
191
  }
264
192
  });
265
- Object.defineProperty(exports, "wantsMascot", {
266
- enumerable: true,
267
- get: function() {
268
- return wantsMascot;
269
- }
270
- });
271
193
 
272
- //# sourceMappingURL=registry-BInbtBm7.cjs.map
194
+ //# sourceMappingURL=registry-YE1pFWL-.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-YE1pFWL-.cjs","names":["process","Diagnostics","getErrorMessage","toError","isRegistryEntry","isValid","isLessThan","difference"],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage, toError } from '@internals/utils'\nimport { checkCompatibility, Diagnostics, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryEntry } from '@kubb/core'\nimport { difference, isLessThan, isValid } from 'verkit'\n\nconst DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`,\n help: 'Set `KUBB_REGISTRY` to an http(s) URL, or unset it to use https://kubb.dev/registry.',\n })\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`,\n })\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** The shortest id `kubb add` and `kubb update` accept: the slug for an official extension, else `owner/slug`. */\nexport function toShortId(id: string): string {\n return id.startsWith('kubb-labs/') ? id.slice('kubb-labs/'.length) : id\n}\n\n/**\n * GETs `url` as JSON. A non-2xx answer or a body that is not JSON returns no `body`.\n * A network error throws with the URL.\n */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n let response: Response\n try {\n response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n } catch (cause) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputUnreachable,\n severity: 'error',\n message: `Could not read ${url}: ${getErrorMessage(cause)}`,\n help: 'Check your network connection and that the registry is reachable.',\n cause: toError(cause),\n })\n }\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: await response.json().catch(() => undefined) }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputRequestFailed,\n severity: 'error',\n message: `The registry at ${registry} sent an invalid index (HTTP ${status}).`,\n help: 'Try again later, or check that `KUBB_REGISTRY` points at a Kubb registry.',\n })\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n\n/** `major`, `minor`, or `patch` from `installed` to `latest`, or `undefined` when either is unknown or invalid. */\nexport function bumpOf({ installed, latest }: { installed: string | undefined; latest: string }): 'major' | 'minor' | 'patch' | undefined {\n if (!installed || !isValid(installed) || !isValid(latest)) return undefined\n const kind = difference(installed, latest)\n if (!kind) return undefined\n if (kind.endsWith('major')) return 'major'\n return kind.endsWith('minor') ? 'minor' : 'patch'\n}\n\nfunction editDistance(a: string, b: string): number {\n const row = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i++) {\n let previous = row[0]!\n row[0] = i\n for (let j = 1; j <= b.length; j++) {\n const current = row[j]!\n row[j] = Math.min(row[j]! + 1, row[j - 1]! + 1, previous + (a[i - 1] === b[j - 1] ? 0 : 1))\n previous = current\n }\n }\n return row[b.length]!\n}\n\n/** Words every extension shares, so they never make two ids look alike. */\nconst COMMON_TOKENS = new Set(['kubb', 'plugin', 'adapter', 'parser'])\n\n/**\n * The ids closest to a mistyped `input`, best first, at most three: those within a few edits of it,\n * or sharing a word such as `zod` in any order. Compares slugs, so the owner may be left out.\n */\nexport function closestIds({ input, ids }: { input: string; ids: Array<string> }): Array<string> {\n const slug = (id: string) => id.slice(id.indexOf('/') + 1)\n const tokens = new Set(\n slug(input)\n .split('-')\n .filter((token) => !COMMON_TOKENS.has(token)),\n )\n return ids\n .map((id) => ({\n id,\n distance: editDistance(slug(input), slug(id)),\n shared: slug(id)\n .split('-')\n .some((token) => tokens.has(token)),\n }))\n .filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4)))\n .sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance)\n .slice(0, 3)\n .map(({ id }) => id)\n}\n"],"mappings":";;;;;;;AAKA,MAAM,mBAAmB;AAEzB,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAMA,aAAAA,QAAQ,IAAI,iBAAiB;CACzC,IAAI,CAAC,eAAe,KAAK,GAAG,GAC1B,MAAM,IAAIC,WAAAA,YAAY,MAAM;EAC1B,MAAMA,WAAAA,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,8CAA8C,IAAI;EAC3D,MAAM;CACR,CAAC;CACH,OAAO,IAAI,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K;GAClC,MAAM,UAAU,IAAI;GACpB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAM,GAAG,IAAI,IAAI,KAAM,GAAG,YAAY,EAAE,IAAI,OAAO,EAAE,IAAI,KAAK,IAAI,EAAE;GAC1F,WAAW;EACb;CACF;CACA,OAAO,IAAI,EAAE;AACf;;AAGA,MAAM,gCAAgB,IAAI,IAAI;CAAC;CAAQ;CAAU;CAAW;AAAQ,CAAC;;;;;AAMrE,SAAgB,WAAW,EAAE,OAAO,OAA6D;CAC/F,MAAM,QAAQ,OAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;CACzD,MAAM,SAAS,IAAI,IACjB,KAAK,KAAK,CAAC,CACR,MAAM,GAAG,CAAC,CACV,QAAQ,UAAU,CAAC,cAAc,IAAI,KAAK,CAAC,CAChD;CACA,OAAO,IACJ,KAAK,QAAQ;EACZ;EACA,UAAU,aAAa,KAAK,KAAK,GAAG,KAAK,EAAE,CAAC;EAC5C,QAAQ,KAAK,EAAE,CAAC,CACb,MAAM,GAAG,CAAC,CACV,MAAM,UAAU,OAAO,IAAI,KAAK,CAAC;CACtC,EAAE,CAAC,CACF,QAAQ,EAAE,UAAU,aAAa,UAAU,YAAY,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACvG,MAAM,GAAG,MAAM,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAC9E,MAAM,GAAG,CAAC,CAAC,CACX,KAAK,EAAE,SAAS,EAAE;AACvB"}
@@ -1,14 +1,17 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
2
- const require_Telemetry = require("./Telemetry-Dc9DVxKQ.cjs");
3
- const require_utils = require("./utils-8E1nF4C1.cjs");
4
- const require_text = require("./text-CC2xdpGL.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
2
+ const require_time = require("./time-3BKoci3G.cjs");
3
+ const require_spinner = require("./spinner-CfB0sIPy.cjs");
4
+ const require_utils = require("./utils-CcARPB45.cjs");
5
+ const require_banner = require("./banner-wJFk-L-c.cjs");
6
+ const require_intro = require("./intro-YPaf1Imr.cjs");
7
+ const require_text = require("./text-Ep3AulAS.cjs");
5
8
  let node_util = require("node:util");
6
9
  let node_process = require("node:process");
7
10
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
8
11
  let node_fs_promises = require("node:fs/promises");
9
12
  let node_path = require("node:path");
10
13
  let _kubb_core = require("@kubb/core");
11
- //#region src/loggers/features/context.ts
14
+ // src/loggers/features/context.ts
12
15
  function createLoggerContext({ hooks, writer, logLevel }) {
13
16
  const text = (message) => logLevel >= _kubb_core.logLevel.verbose ? `${(0, node_util.styleText)("dim", `[${clock()}]`)} ${message}` : message;
14
17
  const ctx = {
@@ -46,8 +49,7 @@ function getInputPath(config) {
46
49
  if (typeof input === "string") return input;
47
50
  return typeof input?.path === "string" ? input.path : void 0;
48
51
  }
49
- //#endregion
50
- //#region src/loggers/features/generation.ts
52
+ // src/loggers/features/generation.ts
51
53
  /**
52
54
  * One config's run: the group it opens, the state every feature resets at its start, and the
53
55
  * closing line, which the lifecycle end draws too for a run that threw before its summary.
@@ -104,8 +106,7 @@ function createGeneration(ctx, { spinner, progress, walk, phases, problems }) {
104
106
  };
105
107
  return { renderSummary };
106
108
  }
107
- //#endregion
108
- //#region src/loggers/features/phases.ts
109
+ // src/loggers/features/phases.ts
109
110
  /**
110
111
  * The three output phases, in the order the generate runner runs them.
111
112
  */
@@ -160,7 +161,7 @@ function createPhases({ writer, silent, logLevel, text, line, onRun }, spinner)
160
161
  const phase = state.phase;
161
162
  state.phase = null;
162
163
  if (!phase || silent) return;
163
- const duration = require_utils.formatMsWithColor(require_Telemetry.getElapsedMs(phase.hrStart));
164
+ const duration = require_banner.formatMsWithColor(require_time.getElapsedMs(phase.hrStart));
164
165
  spinner.stop(phase.failed ? `${phase.failure} after ${duration}` : `${phase.success} in ${duration}`, phase.failed ? "failed" : "success");
165
166
  if (phase.lines.length) writer.block(phase.lines);
166
167
  writeOutput(phase.output);
@@ -195,7 +196,7 @@ function createPhases({ writer, silent, logLevel, text, line, onRun }, spinner)
195
196
  args
196
197
  }));
197
198
  const reason = error?.message ? ` (${error.message})` : "";
198
- const result = success ? `${(0, node_util.styleText)("green", "✓")} ${label} in ${require_utils.formatMsWithColor(require_Telemetry.getElapsedMs(active.hrStart))}` : `${(0, node_util.styleText)("red", "✗")} ${label} failed${reason}`;
199
+ const result = success ? `${(0, node_util.styleText)("green", "✓")} ${label} in ${require_banner.formatMsWithColor(require_time.getElapsedMs(active.hrStart))}` : `${(0, node_util.styleText)("red", "✗")} ${label} failed${reason}`;
199
200
  const phase = state.phase;
200
201
  if (phase) {
201
202
  if (phase.showHookResults || !success) phase.lines.push(result);
@@ -254,8 +255,7 @@ function createPhases({ writer, silent, logLevel, text, line, onRun }, spinner)
254
255
  }
255
256
  };
256
257
  }
257
- //#endregion
258
- //#region src/loggers/specFrame.ts
258
+ // src/loggers/specFrame.ts
259
259
  /**
260
260
  * Where `location` sits in `source` according to its adapter, with a code frame. `undefined` when the adapter cannot place it.
261
261
  */
@@ -284,8 +284,7 @@ function locateInSpec({ adapter, source, location }) {
284
284
  return;
285
285
  }
286
286
  }
287
- //#endregion
288
- //#region src/loggers/features/problems.ts
287
+ // src/loggers/features/problems.ts
289
288
  /** Warnings, errors and diagnostics: printed as they come, or held back and grouped by plugin once a human's build ends. */
290
289
  function createProblems(ctx, spinner, progress, phases) {
291
290
  const { writer, silent, human, logLevel, text, line, hooks } = ctx;
@@ -392,7 +391,7 @@ function createProblems(ctx, spinner, progress, phases) {
392
391
  path,
393
392
  adapter: config.adapter,
394
393
  get source() {
395
- return source ??= require_utils.read(path).catch(() => void 0);
394
+ return source ??= require_spinner.read(path).catch(() => void 0);
396
395
  }
397
396
  };
398
397
  }
@@ -418,8 +417,7 @@ function createProblems(ctx, spinner, progress, phases) {
418
417
  }
419
418
  };
420
419
  }
421
- //#endregion
422
- //#region src/loggers/features/progress.ts
420
+ // src/loggers/features/progress.ts
423
421
  /** The progress bar over the file writes, and the counts the summary line shows. */
424
422
  function createProgress({ writer, silent, text, onRun }, spinner) {
425
423
  const state = {
@@ -467,8 +465,7 @@ function createProgress({ writer, silent, text, onRun }, spinner) {
467
465
  }
468
466
  };
469
467
  }
470
- //#endregion
471
- //#region src/loggers/features/session.ts
468
+ // src/loggers/features/session.ts
472
469
  /** One line of a Studio session's job log: the time, the command, who asked for it, and how it ended. */
473
470
  function formatJobLine({ command, result, requestedBy }) {
474
471
  const by = requestedBy ? `${(0, node_util.styleText)("dim", `by ${requestedBy}`.padEnd(16))} ` : "";
@@ -523,13 +520,13 @@ function createSession(ctx, spinner) {
523
520
  hooks.hook("kubb:generation:end", ({ diagnostics = [], filesCreated = 0, status, hrStart = node_process.default.hrtime() }) => {
524
521
  job = {
525
522
  fileCount: filesCreated,
526
- ms: require_Telemetry.getElapsedMs(hrStart),
523
+ ms: require_time.getElapsedMs(hrStart),
527
524
  errors: status === "failed" ? _kubb_core.Diagnostics.count(diagnostics).errors : 0
528
525
  };
529
526
  });
530
527
  hooks.hook("studio:command", ({ command, info, requestedBy, failed }) => {
531
528
  spinner.stop();
532
- const took = command === "generate" && job ? `${require_text.pluralize(job.fileCount, "file")} in ${require_Telemetry.formatMs(job.ms)} ` : "";
529
+ const took = command === "generate" && job ? `${require_text.pluralize(job.fileCount, "file")} in ${require_time.formatMs(job.ms)} ` : "";
533
530
  const result = failed ? `${(0, node_util.styleText)("red", "✖")} ${job?.errors ? require_text.pluralize(job.errors, "error") : "failed"}, see Studio` : `${(0, node_util.styleText)("green", "✓")} ${took}${(0, node_util.styleText)("dim", `(${info})`)}`;
534
531
  writer.info(formatJobLine({
535
532
  command,
@@ -541,11 +538,10 @@ function createSession(ctx, spinner) {
541
538
  });
542
539
  hooks.hook("studio:reconnecting", ({ delayMs }) => {
543
540
  spinner.stop();
544
- writer.info(text((0, node_util.styleText)("dim", `Retrying connection to Kubb Studio in ${require_Telemetry.formatMs(delayMs)}`)));
541
+ writer.info(text((0, node_util.styleText)("dim", `Retrying connection to Kubb Studio in ${require_time.formatMs(delayMs)}`)));
545
542
  });
546
543
  }
547
- //#endregion
548
- //#region src/loggers/features/spinner.ts
544
+ // src/loggers/features/spinner.ts
549
545
  /** The step whose end is not known when it starts: the spec parse, the node walk, a phase, or a Studio session waiting for jobs. */
550
546
  function createSpinner({ writer, silent, text }) {
551
547
  let spinner = null;
@@ -583,8 +579,7 @@ function createSpinner({ writer, silent, text }) {
583
579
  reset: () => stop()
584
580
  };
585
581
  }
586
- //#endregion
587
- //#region src/loggers/features/walk.ts
582
+ // src/loggers/features/walk.ts
588
583
  /** Milliseconds between redraws of the live generation block, about clack's spinner frame rate. */
589
584
  const WALK_REDRAW_MS = 80;
590
585
  function createState() {
@@ -611,7 +606,7 @@ function createWalk({ writer, silent, human, text, onRun }, spinner, progress) {
611
606
  /** The progress summary line the clack logger shows, `null` when there is nothing to display. */
612
607
  function buildProgressLine() {
613
608
  const parts = [];
614
- const duration = require_Telemetry.formatMs(require_Telemetry.getElapsedMs(state.hrStart));
609
+ const duration = require_time.formatMs(require_time.getElapsedMs(state.hrStart));
615
610
  const { totalFiles, processedFiles } = progress.state;
616
611
  if (state.totalPlugins > 0) {
617
612
  const failed = state.failedPlugins > 0 ? ` ${(0, node_util.styleText)("red", `(${state.failedPlugins} failed)`)}` : "";
@@ -625,7 +620,7 @@ function createWalk({ writer, silent, human, text, onRun }, spinner, progress) {
625
620
  if (!silent) {
626
621
  onRun("kubb:build:start", ({ nodeCounts: { schemas, operations } }) => {
627
622
  state.walk.total = schemas + operations;
628
- const details = `${require_text.pluralize(schemas, "schema")} · ${require_text.pluralize(operations, "operation")} · ${require_Telemetry.formatMs(require_Telemetry.getElapsedMs(state.hrStart))}`;
623
+ const details = `${require_text.pluralize(schemas, "schema")} · ${require_text.pluralize(operations, "operation")} · ${require_time.formatMs(require_time.getElapsedMs(state.hrStart))}`;
629
624
  spinner.stop(`Parsed spec ${(0, node_util.styleText)("dim", details)}`);
630
625
  spinner.start("Generating");
631
626
  });
@@ -640,8 +635,8 @@ function createWalk({ writer, silent, human, text, onRun }, spinner, progress) {
640
635
  const now = Date.now();
641
636
  if (now - state.lastWalkDraw < WALK_REDRAW_MS) return;
642
637
  state.lastWalkDraw = now;
643
- const elapsed = (0, node_util.styleText)("dim", require_Telemetry.formatMs(require_Telemetry.getElapsedMs(state.hrStart)));
644
- const head = total ? `Generating ${require_utils.formatBar(visited.size, total)} ${visited.size}/${total} nodes ${elapsed}` : `Generating ${require_text.pluralize(visited.size, "node")} ${elapsed}`;
638
+ const elapsed = (0, node_util.styleText)("dim", require_time.formatMs(require_time.getElapsedMs(state.hrStart)));
639
+ const head = total ? `Generating ${require_banner.formatBar(visited.size, total)} ${visited.size}/${total} nodes ${elapsed}` : `Generating ${require_text.pluralize(visited.size, "node")} ${elapsed}`;
645
640
  const width = Math.max(...[...plugins.keys()].map((pluginName) => pluginName.length));
646
641
  const rows = [...plugins].map(([pluginName, row]) => `${(0, node_util.styleText)("dim", "│")} ${pluginName.padEnd(width)} ${(0, node_util.styleText)("dim", String(row.count).padStart(4))} ${(0, node_util.styleText)("cyan", row.current)}`);
647
642
  spinner.message(text([head, ...rows].join("\n")));
@@ -651,7 +646,7 @@ function createWalk({ writer, silent, human, text, onRun }, spinner, progress) {
651
646
  }
652
647
  onRun("kubb:plugin:end", ({ plugin, duration, success }) => {
653
648
  state[success ? "completedPlugins" : "failedPlugins"]++;
654
- state.pluginLines.push(text(`${plugin.name} ${success ? "completed" : "failed"} in ${require_utils.formatMsWithColor(duration)}`));
649
+ state.pluginLines.push(text(`${plugin.name} ${success ? "completed" : "failed"} in ${require_banner.formatMsWithColor(duration)}`));
655
650
  });
656
651
  onRun("kubb:plugins:end", () => {
657
652
  const failed = state.failedPlugins > 0;
@@ -669,8 +664,7 @@ function createWalk({ writer, silent, human, text, onRun }, spinner, progress) {
669
664
  }
670
665
  };
671
666
  }
672
- //#endregion
673
- //#region src/loggers/features/index.ts
667
+ // src/loggers/features/index.ts
674
668
  /**
675
669
  * Wires a {@link LoggerWriter} onto the run's hooks. Each feature registers the hooks for one
676
670
  * concern, so every writer reports the same run in the same order: one group per config, a step
@@ -698,10 +692,9 @@ function installLogger({ hooks, writer, logLevel }) {
698
692
  problems
699
693
  });
700
694
  }
701
- //#endregion
702
- //#region src/loggers/reporters.ts
695
+ // src/loggers/reporters.ts
703
696
  /** Installs the live logger and wires the selected reporters. `cli` renders its summary through the logger, and is skipped when `json` owns stdout. */
704
- function setupReporters(context, { logLevel, reporters, writer: writer$1 = require_text.writer(), dryRun = false }) {
697
+ function setupReporters(context, { logLevel, reporters, writer: writer$1 = require_intro.writer(), dryRun = false }) {
705
698
  const hasJson = reporters.some((reporter) => reporter.name === "json");
706
699
  const selected = reporters.flatMap((reporter) => {
707
700
  if (reporter.name !== "cli") return [reporter];
@@ -740,7 +733,7 @@ function setupReporters(context, { logLevel, reporters, writer: writer$1 = requi
740
733
  context.hook("kubb:files:processing:start", async ({ files }) => {
741
734
  if (!previous) return;
742
735
  for (const file of files) {
743
- if (previous.has(file.path) || require_utils.isPathInside(outputPath, file.path)) continue;
736
+ if (previous.has(file.path) || require_spinner.isPathInside(outputPath, file.path)) continue;
744
737
  const source = await (0, node_fs_promises.readFile)(file.path, "utf8").catch(() => null);
745
738
  if (source !== null) previous.set(file.path, source);
746
739
  }
@@ -812,7 +805,6 @@ function setupReporters(context, { logLevel, reporters, writer: writer$1 = requi
812
805
  function selectReporters(reporters, names) {
813
806
  return [...new Set(names)].flatMap((name) => reporters.find((reporter) => reporter.name === name) ?? []);
814
807
  }
815
- //#endregion
816
808
  Object.defineProperty(exports, "selectReporters", {
817
809
  enumerable: true,
818
810
  get: function() {
@@ -826,4 +818,4 @@ Object.defineProperty(exports, "setupReporters", {
826
818
  }
827
819
  });
828
820
 
829
- //# sourceMappingURL=reporters-DQz--AdE.cjs.map
821
+ //# sourceMappingURL=reporters-2cgjvXwR.cjs.map