@kubb/cli 5.0.0-beta.4 → 5.0.0-beta.41

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 (157) hide show
  1. package/README.md +209 -51
  2. package/dist/agent-D3K_-kiv.js +68 -0
  3. package/dist/agent-D3K_-kiv.js.map +1 -0
  4. package/dist/agent-DTqKBULa.cjs +70 -0
  5. package/dist/agent-DTqKBULa.cjs.map +1 -0
  6. package/dist/{chunk--u3MIqq1.js → chunk-CRm0XQPb.js} +1 -0
  7. package/dist/constants-84a47qA-.js +35 -0
  8. package/dist/constants-84a47qA-.js.map +1 -0
  9. package/dist/constants-AHhyFH15.cjs +139 -0
  10. package/dist/constants-AHhyFH15.cjs.map +1 -0
  11. package/dist/constants-BtmponZ3.cjs +58 -0
  12. package/dist/constants-BtmponZ3.cjs.map +1 -0
  13. package/dist/constants-C94RKp3A.js +116 -0
  14. package/dist/constants-C94RKp3A.js.map +1 -0
  15. package/dist/{define-Bdn8j5VM.cjs → define-C4AB3POr.cjs} +2 -2
  16. package/dist/{define-Bdn8j5VM.cjs.map → define-C4AB3POr.cjs.map} +1 -1
  17. package/dist/{define-Ctii4bel.js → define-DNG1U8ha.js} +2 -2
  18. package/dist/{define-Ctii4bel.js.map → define-DNG1U8ha.js.map} +1 -1
  19. package/dist/{errors-CjPmyZHy.js → errors-CoxrNXaA.js} +2 -2
  20. package/dist/{errors-CjPmyZHy.js.map → errors-CoxrNXaA.js.map} +1 -1
  21. package/dist/{errors-CLCjoSg0.cjs → errors-DykI11xo.cjs} +2 -2
  22. package/dist/{errors-CLCjoSg0.cjs.map → errors-DykI11xo.cjs.map} +1 -1
  23. package/dist/generate-CZYIOngX.cjs +76 -0
  24. package/dist/generate-CZYIOngX.cjs.map +1 -0
  25. package/dist/generate-HcvbU80u.js +77 -0
  26. package/dist/generate-HcvbU80u.js.map +1 -0
  27. package/dist/index.cjs +23 -14
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +23 -14
  31. package/dist/index.js.map +1 -1
  32. package/dist/init-BMtuczv8.js +53 -0
  33. package/dist/init-BMtuczv8.js.map +1 -0
  34. package/dist/init-DybfkgNy.cjs +53 -0
  35. package/dist/init-DybfkgNy.cjs.map +1 -0
  36. package/dist/mcp-BF9dnH_F.js +39 -0
  37. package/dist/mcp-BF9dnH_F.js.map +1 -0
  38. package/dist/mcp-YzKoU6_l.cjs +39 -0
  39. package/dist/mcp-YzKoU6_l.cjs.map +1 -0
  40. package/dist/package-BCwMApnr.js +6 -0
  41. package/dist/package-BCwMApnr.js.map +1 -0
  42. package/dist/{package-BapVyQ-w.cjs → package-DPe5CA4S.cjs} +2 -2
  43. package/dist/package-DPe5CA4S.cjs.map +1 -0
  44. package/dist/{agent-sdYBBgrd.js → run-BQ3Qj0xB.js} +46 -43
  45. package/dist/run-BQ3Qj0xB.js.map +1 -0
  46. package/dist/run-BQzoaxjR.js +32 -0
  47. package/dist/run-BQzoaxjR.js.map +1 -0
  48. package/dist/run-CGf0KEts.js +51 -0
  49. package/dist/run-CGf0KEts.js.map +1 -0
  50. package/dist/{init-CZ5Xq2Hd.cjs → run-C_NMctua.cjs} +107 -149
  51. package/dist/run-C_NMctua.cjs.map +1 -0
  52. package/dist/run-CkTpemme.cjs +52 -0
  53. package/dist/run-CkTpemme.cjs.map +1 -0
  54. package/dist/run-Cl4SrSob.cjs +33 -0
  55. package/dist/run-Cl4SrSob.cjs.map +1 -0
  56. package/dist/{agent-B4cAAab2.cjs → run-D-s2LdlW.cjs} +46 -43
  57. package/dist/run-D-s2LdlW.cjs.map +1 -0
  58. package/dist/{init-eNRlotJK.js → run-D8dCWepS.js} +107 -149
  59. package/dist/run-D8dCWepS.js.map +1 -0
  60. package/dist/run-DaV_NiKR.js +1509 -0
  61. package/dist/run-DaV_NiKR.js.map +1 -0
  62. package/dist/run-UWQ9wImP.cjs +1512 -0
  63. package/dist/run-UWQ9wImP.cjs.map +1 -0
  64. package/dist/{shell-DLzN4fRo.js → shell-BrqyJdB7.js} +2 -2
  65. package/dist/{shell-DLzN4fRo.js.map → shell-BrqyJdB7.js.map} +1 -1
  66. package/dist/{shell-475fQKaX.cjs → shell-Lh-vLWwH.cjs} +2 -2
  67. package/dist/{shell-475fQKaX.cjs.map → shell-Lh-vLWwH.cjs.map} +1 -1
  68. package/dist/validate-BHc3lUKB.js +26 -0
  69. package/dist/validate-BHc3lUKB.js.map +1 -0
  70. package/dist/validate-CqRqJxmQ.cjs +26 -0
  71. package/dist/validate-CqRqJxmQ.cjs.map +1 -0
  72. package/package.json +16 -15
  73. package/src/commands/agent/start.ts +10 -7
  74. package/src/commands/agent.ts +3 -1
  75. package/src/commands/generate.ts +21 -13
  76. package/src/commands/init.ts +34 -3
  77. package/src/commands/mcp.ts +28 -4
  78. package/src/commands/validate.ts +6 -4
  79. package/src/constants.ts +3 -74
  80. package/src/index.ts +6 -4
  81. package/src/loggers/clackLogger.ts +137 -178
  82. package/src/loggers/plainLogger.ts +49 -102
  83. package/src/loggers/types.ts +6 -1
  84. package/src/loggers/utils.ts +141 -26
  85. package/src/runners/agent/run.ts +113 -0
  86. package/src/runners/agent/utils.ts +98 -0
  87. package/src/runners/generate/run.ts +404 -0
  88. package/src/runners/generate/utils.ts +219 -0
  89. package/src/runners/init/run.ts +212 -0
  90. package/src/{utils/packageManager.ts → runners/init/utils.ts} +12 -2
  91. package/src/runners/mcp/run.ts +37 -0
  92. package/src/runners/validate/run.ts +63 -0
  93. package/dist/agent-B4cAAab2.cjs.map +0 -1
  94. package/dist/agent-CR6Z96og.js +0 -56
  95. package/dist/agent-CR6Z96og.js.map +0 -1
  96. package/dist/agent-Dmxzqg4d.cjs +0 -58
  97. package/dist/agent-Dmxzqg4d.cjs.map +0 -1
  98. package/dist/agent-sdYBBgrd.js.map +0 -1
  99. package/dist/constants-CnDXa1R6.cjs +0 -148
  100. package/dist/constants-CnDXa1R6.cjs.map +0 -1
  101. package/dist/constants-aL3CP_Wq.js +0 -95
  102. package/dist/constants-aL3CP_Wq.js.map +0 -1
  103. package/dist/generate-B1Pa2ho-.cjs +0 -1756
  104. package/dist/generate-B1Pa2ho-.cjs.map +0 -1
  105. package/dist/generate-BDGOOsBM.cjs +0 -65
  106. package/dist/generate-BDGOOsBM.cjs.map +0 -1
  107. package/dist/generate-CNrRLY4n.js +0 -1753
  108. package/dist/generate-CNrRLY4n.js.map +0 -1
  109. package/dist/generate-DuhxPLGr.js +0 -66
  110. package/dist/generate-DuhxPLGr.js.map +0 -1
  111. package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
  112. package/dist/init-CnZXHrbq.js +0 -25
  113. package/dist/init-CnZXHrbq.js.map +0 -1
  114. package/dist/init-NYJSZJSb.cjs +0 -25
  115. package/dist/init-NYJSZJSb.cjs.map +0 -1
  116. package/dist/init-eNRlotJK.js.map +0 -1
  117. package/dist/mcp-CYOgxB82.cjs +0 -47
  118. package/dist/mcp-CYOgxB82.cjs.map +0 -1
  119. package/dist/mcp-CdFWyrwi.cjs +0 -16
  120. package/dist/mcp-CdFWyrwi.cjs.map +0 -1
  121. package/dist/mcp-DhSxuDMD.js +0 -16
  122. package/dist/mcp-DhSxuDMD.js.map +0 -1
  123. package/dist/mcp-DmJm3TrU.js +0 -46
  124. package/dist/mcp-DmJm3TrU.js.map +0 -1
  125. package/dist/package-BapVyQ-w.cjs.map +0 -1
  126. package/dist/package-DyJE-qNq.js +0 -6
  127. package/dist/package-DyJE-qNq.js.map +0 -1
  128. package/dist/telemetry-DN95_2pF.cjs +0 -282
  129. package/dist/telemetry-DN95_2pF.cjs.map +0 -1
  130. package/dist/telemetry-LgT_sdPe.js +0 -245
  131. package/dist/telemetry-LgT_sdPe.js.map +0 -1
  132. package/dist/validate-C6npXzel.cjs +0 -25
  133. package/dist/validate-C6npXzel.cjs.map +0 -1
  134. package/dist/validate-kLJoT_hi.js +0 -33
  135. package/dist/validate-kLJoT_hi.js.map +0 -1
  136. package/dist/validate-n38Rh-Y7.js +0 -25
  137. package/dist/validate-n38Rh-Y7.js.map +0 -1
  138. package/dist/validate-yKKzqEZ5.cjs +0 -34
  139. package/dist/validate-yKKzqEZ5.cjs.map +0 -1
  140. package/src/loggers/fileSystemLogger.ts +0 -138
  141. package/src/loggers/githubActionsLogger.ts +0 -379
  142. package/src/runners/agent.ts +0 -155
  143. package/src/runners/generate.ts +0 -333
  144. package/src/runners/init.ts +0 -296
  145. package/src/runners/mcp.ts +0 -51
  146. package/src/runners/validate.ts +0 -39
  147. package/src/types.ts +0 -11
  148. package/src/utils/Writables.ts +0 -17
  149. package/src/utils/executeHooks.ts +0 -45
  150. package/src/utils/flags.ts +0 -9
  151. package/src/utils/getConfig.ts +0 -10
  152. package/src/utils/getCosmiConfig.ts +0 -80
  153. package/src/utils/getSummary.ts +0 -68
  154. package/src/utils/runHook.ts +0 -91
  155. package/src/utils/telemetry.ts +0 -273
  156. package/src/utils/watcher.ts +0 -19
  157. /package/dist/{chunk-ByKO4r7w.cjs → chunk-Bx3C2hgW.cjs} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-AHhyFH15.cjs","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: PluginOption[] = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-client',\n label: 'Client (Fetch/Axios)',\n packageName: '@kubb/plugin-client',\n importName: 'pluginClient',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,WAAW;AACvB;AAEA,MAAa,mBAAmC;CAC9C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;AACF;AAEA,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;AAGlB"}
@@ -0,0 +1,58 @@
1
+ const require_constants = require("./constants-AHhyFH15.cjs");
2
+ //#region src/constants.ts
3
+ /**
4
+ * NPM registry endpoint used to check for @kubb/cli updates.
5
+ */
6
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
7
+ "─".repeat(27);
8
+ /**
9
+ * Glob pattern for paths the file watcher ignores.
10
+ */
11
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
12
+ /**
13
+ * Flags that short-circuit execution (help/version), no telemetry notice is shown.
14
+ */
15
+ const QUIET_FLAGS = new Set([
16
+ "--help",
17
+ "-h",
18
+ "--version",
19
+ "-v"
20
+ ]);
21
+ const agentDefaults = {
22
+ port: "3000",
23
+ host: "localhost",
24
+ configFile: require_constants.KUBB_CONFIG_FILENAME,
25
+ retryTimeout: "30000",
26
+ studioUrl: "https://kubb.studio",
27
+ /**
28
+ * Relative path from the @kubb/agent package root to the server entry.
29
+ */
30
+ serverEntryPath: ".output/server/index.mjs"
31
+ };
32
+ //#endregion
33
+ Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
34
+ enumerable: true,
35
+ get: function() {
36
+ return KUBB_NPM_PACKAGE_URL;
37
+ }
38
+ });
39
+ Object.defineProperty(exports, "QUIET_FLAGS", {
40
+ enumerable: true,
41
+ get: function() {
42
+ return QUIET_FLAGS;
43
+ }
44
+ });
45
+ Object.defineProperty(exports, "WATCHER_IGNORED_PATHS", {
46
+ enumerable: true,
47
+ get: function() {
48
+ return WATCHER_IGNORED_PATHS;
49
+ }
50
+ });
51
+ Object.defineProperty(exports, "agentDefaults", {
52
+ enumerable: true,
53
+ get: function() {
54
+ return agentDefaults;
55
+ }
56
+ });
57
+
58
+ //# sourceMappingURL=constants-BtmponZ3.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-BtmponZ3.cjs","names":["KUBB_CONFIG_FILENAME"],"sources":["../src/constants.ts"],"sourcesContent":["import { KUBB_CONFIG_FILENAME } from '@internals/shared'\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version), no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://kubb.studio',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n"],"mappings":";;;;;AAKA,MAAa,uBAAuB;AAKH,IAAI,OAAO,EAAE;;;;AAK9C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;AAAI,CAAU;AAE/E,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAYA,kBAAAA;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;AACnB"}
@@ -0,0 +1,116 @@
1
+ //#region ../../internals/shared/src/constants.ts
2
+ const KUBB_CONFIG_FILENAME = "kubb.config.ts";
3
+ const initDefaults = {
4
+ inputPath: "./openapi.yaml",
5
+ outputPath: "./src/gen",
6
+ plugins: ["plugin-ts"]
7
+ };
8
+ const availablePlugins = [
9
+ {
10
+ value: "plugin-ts",
11
+ label: "TypeScript",
12
+ hint: "Recommended",
13
+ packageName: "@kubb/plugin-ts",
14
+ importName: "pluginTs",
15
+ category: "types"
16
+ },
17
+ {
18
+ value: "plugin-client",
19
+ label: "Client (Fetch/Axios)",
20
+ packageName: "@kubb/plugin-client",
21
+ importName: "pluginClient",
22
+ category: "client"
23
+ },
24
+ {
25
+ value: "plugin-react-query",
26
+ label: "React Query / TanStack Query",
27
+ packageName: "@kubb/plugin-react-query",
28
+ importName: "pluginReactQuery",
29
+ category: "framework"
30
+ },
31
+ {
32
+ value: "plugin-vue-query",
33
+ label: "Vue Query",
34
+ packageName: "@kubb/plugin-vue-query",
35
+ importName: "pluginVueQuery",
36
+ category: "framework"
37
+ },
38
+ {
39
+ value: "plugin-zod",
40
+ label: "Zod Schemas",
41
+ packageName: "@kubb/plugin-zod",
42
+ importName: "pluginZod",
43
+ category: "validation"
44
+ },
45
+ {
46
+ value: "plugin-faker",
47
+ label: "Faker.js Mocks",
48
+ packageName: "@kubb/plugin-faker",
49
+ importName: "pluginFaker",
50
+ category: "mocks"
51
+ },
52
+ {
53
+ value: "plugin-msw",
54
+ label: "MSW Handlers",
55
+ packageName: "@kubb/plugin-msw",
56
+ importName: "pluginMsw",
57
+ category: "mocks"
58
+ },
59
+ {
60
+ value: "plugin-cypress",
61
+ label: "Cypress Tests",
62
+ packageName: "@kubb/plugin-cypress",
63
+ importName: "pluginCypress",
64
+ category: "testing"
65
+ },
66
+ {
67
+ value: "plugin-mcp",
68
+ label: "MCP Server (AI / Model Context Protocol)",
69
+ packageName: "@kubb/plugin-mcp",
70
+ importName: "pluginMcp",
71
+ category: "ai"
72
+ },
73
+ {
74
+ value: "plugin-redoc",
75
+ label: "ReDoc Documentation",
76
+ packageName: "@kubb/plugin-redoc",
77
+ importName: "pluginRedoc",
78
+ category: "documentation"
79
+ }
80
+ ];
81
+ const pluginDefaultConfigs = {
82
+ "plugin-ts": `pluginTs({
83
+ output: { path: 'models' },
84
+ })`,
85
+ "plugin-client": `pluginClient({
86
+ output: { path: 'clients' },
87
+ })`,
88
+ "plugin-react-query": `pluginReactQuery({
89
+ output: { path: 'hooks' },
90
+ })`,
91
+ "plugin-vue-query": `pluginVueQuery({
92
+ output: { path: 'hooks' },
93
+ })`,
94
+ "plugin-zod": `pluginZod({
95
+ output: { path: 'zod' },
96
+ })`,
97
+ "plugin-faker": `pluginFaker({
98
+ output: { path: 'mocks' },
99
+ })`,
100
+ "plugin-msw": `pluginMsw({
101
+ output: { path: 'msw' },
102
+ })`,
103
+ "plugin-cypress": `pluginCypress({
104
+ output: { path: 'cypress' },
105
+ })`,
106
+ "plugin-mcp": `pluginMcp({
107
+ output: { path: 'mcp' },
108
+ })`,
109
+ "plugin-redoc": `pluginRedoc({
110
+ output: { path: 'redoc' },
111
+ })`
112
+ };
113
+ //#endregion
114
+ export { pluginDefaultConfigs as i, availablePlugins as n, initDefaults as r, KUBB_CONFIG_FILENAME as t };
115
+
116
+ //# sourceMappingURL=constants-C94RKp3A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-C94RKp3A.js","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: PluginOption[] = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-client',\n label: 'Client (Fetch/Axios)',\n packageName: '@kubb/plugin-client',\n importName: 'pluginClient',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,WAAW;AACvB;AAEA,MAAa,mBAAmC;CAC9C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;CACA;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;CACZ;AACF;AAEA,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;AAGlB"}
@@ -1,4 +1,4 @@
1
- require("./chunk-ByKO4r7w.cjs");
1
+ require("./chunk-Bx3C2hgW.cjs");
2
2
  //#region ../../internals/utils/src/cli/define.ts
3
3
  /**
4
4
  * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
@@ -51,4 +51,4 @@ Object.defineProperty(exports, "defineCommand", {
51
51
  }
52
52
  });
53
53
 
54
- //# sourceMappingURL=define-Bdn8j5VM.cjs.map
54
+ //# sourceMappingURL=define-C4AB3POr.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-Bdn8j5VM.cjs","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
1
+ {"version":3,"file":"define-C4AB3POr.cjs","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB,CAAC;CACL;AACF"}
@@ -1,4 +1,4 @@
1
- import "./chunk--u3MIqq1.js";
1
+ import "./chunk-CRm0XQPb.js";
2
2
  //#region ../../internals/utils/src/cli/define.ts
3
3
  /**
4
4
  * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
@@ -40,4 +40,4 @@ function defineCommand(def) {
40
40
  //#endregion
41
41
  export { defineCommand as n, defineCLIAdapter as t };
42
42
 
43
- //# sourceMappingURL=define-Ctii4bel.js.map
43
+ //# sourceMappingURL=define-DNG1U8ha.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-Ctii4bel.js","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
1
+ {"version":3,"file":"define-DNG1U8ha.js","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;AACT;;;;;;;;;;;;;;;AAgBA,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB,CAAC;CACL;AACF"}
@@ -1,4 +1,4 @@
1
- import "./chunk--u3MIqq1.js";
1
+ import "./chunk-CRm0XQPb.js";
2
2
  //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
4
  * Coerces an unknown thrown value to an `Error` instance.
@@ -40,4 +40,4 @@ function toCause(error) {
40
40
  //#endregion
41
41
  export { toCause as n, toError as r, getErrorMessage as t };
42
42
 
43
- //# sourceMappingURL=errors-CjPmyZHy.js.map
43
+ //# sourceMappingURL=errors-CoxrNXaA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-CjPmyZHy.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
1
+ {"version":3,"file":"errors-CoxrNXaA.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;;;;;;;AAUA,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA;AACtD"}
@@ -1,4 +1,4 @@
1
- require("./chunk-ByKO4r7w.cjs");
1
+ require("./chunk-Bx3C2hgW.cjs");
2
2
  //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
4
  * Coerces an unknown thrown value to an `Error` instance.
@@ -57,4 +57,4 @@ Object.defineProperty(exports, "toError", {
57
57
  }
58
58
  });
59
59
 
60
- //# sourceMappingURL=errors-CLCjoSg0.cjs.map
60
+ //# sourceMappingURL=errors-DykI11xo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-CLCjoSg0.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
1
+ {"version":3,"file":"errors-DykI11xo.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;;;;;;;AAUA,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA;AACtD"}
@@ -0,0 +1,76 @@
1
+ require("./chunk-Bx3C2hgW.cjs");
2
+ //#region src/commands/generate.ts
3
+ const command = require("./define-C4AB3POr.cjs").defineCommand({
4
+ name: "generate",
5
+ description: "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.",
6
+ arguments: ["[input]"],
7
+ examples: [
8
+ "kubb generate",
9
+ "kubb generate ./openapi.yaml",
10
+ "kubb generate --config kubb.config.ts",
11
+ "kubb generate --watch"
12
+ ],
13
+ options: {
14
+ config: {
15
+ type: "string",
16
+ description: "Path to the Kubb config",
17
+ short: "c"
18
+ },
19
+ logLevel: {
20
+ type: "string",
21
+ description: "Info, silent or verbose",
22
+ short: "l",
23
+ default: "info",
24
+ hint: "silent|info|verbose",
25
+ enum: [
26
+ "silent",
27
+ "info",
28
+ "verbose"
29
+ ]
30
+ },
31
+ watch: {
32
+ type: "boolean",
33
+ description: "Watch mode based on the input file",
34
+ short: "w",
35
+ default: false
36
+ },
37
+ verbose: {
38
+ type: "boolean",
39
+ description: "Override logLevel to verbose",
40
+ short: "v",
41
+ default: false
42
+ },
43
+ silent: {
44
+ type: "boolean",
45
+ description: "Override logLevel to silent",
46
+ short: "s",
47
+ default: false
48
+ },
49
+ reporter: {
50
+ type: "string",
51
+ description: "Reporters that render the run, comma-separated. Overrides config.reporters",
52
+ hint: "cli|json|file",
53
+ enum: [
54
+ "cli",
55
+ "json",
56
+ "file"
57
+ ]
58
+ }
59
+ },
60
+ async run({ values, positionals }) {
61
+ const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
62
+ const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
63
+ const { run } = await Promise.resolve().then(() => require("./run-UWQ9wImP.cjs"));
64
+ await run({
65
+ input: positionals[0],
66
+ configPath: values.config,
67
+ logLevel,
68
+ watch: values.watch,
69
+ reporters
70
+ });
71
+ }
72
+ });
73
+ //#endregion
74
+ exports.command = command;
75
+
76
+ //# sourceMappingURL=generate-CZYIOngX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-CZYIOngX.cjs","names":["defineCommand"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport type { ReporterName } from '@kubb/core'\n\nexport const command = defineCommand({\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 arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose',\n enum: ['silent', 'info', 'verbose'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\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: 'string',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n hint: 'cli|json|file',\n enum: ['cli', 'json', 'file'],\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const reporters = values.reporter\n ?.split(',')\n .map((name) => name.trim())\n .filter(Boolean) as Array<ReporterName> | undefined\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters,\n })\n },\n})\n"],"mappings":";;AAGA,MAAa,yCAAUA,EAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,SAAS;CACrB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;CAAuB;CAC5H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;GAAS;EACpC;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,MAAM;GACN,MAAM;IAAC;IAAO;IAAQ;GAAM;EAC9B;CACF;CACA,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EAChF,MAAM,YAAY,OAAO,UACrB,MAAM,GAAG,EACV,KAAK,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,OAAO;EACjB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,EAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd;EACF,CAAC;CACH;AACF,CAAC"}
@@ -0,0 +1,77 @@
1
+ import "./chunk-CRm0XQPb.js";
2
+ import { n as defineCommand } from "./define-DNG1U8ha.js";
3
+ //#region src/commands/generate.ts
4
+ const command = defineCommand({
5
+ name: "generate",
6
+ description: "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.",
7
+ arguments: ["[input]"],
8
+ examples: [
9
+ "kubb generate",
10
+ "kubb generate ./openapi.yaml",
11
+ "kubb generate --config kubb.config.ts",
12
+ "kubb generate --watch"
13
+ ],
14
+ options: {
15
+ config: {
16
+ type: "string",
17
+ description: "Path to the Kubb config",
18
+ short: "c"
19
+ },
20
+ logLevel: {
21
+ type: "string",
22
+ description: "Info, silent or verbose",
23
+ short: "l",
24
+ default: "info",
25
+ hint: "silent|info|verbose",
26
+ enum: [
27
+ "silent",
28
+ "info",
29
+ "verbose"
30
+ ]
31
+ },
32
+ watch: {
33
+ type: "boolean",
34
+ description: "Watch mode based on the input file",
35
+ short: "w",
36
+ default: false
37
+ },
38
+ verbose: {
39
+ type: "boolean",
40
+ description: "Override logLevel to verbose",
41
+ short: "v",
42
+ default: false
43
+ },
44
+ silent: {
45
+ type: "boolean",
46
+ description: "Override logLevel to silent",
47
+ short: "s",
48
+ default: false
49
+ },
50
+ reporter: {
51
+ type: "string",
52
+ description: "Reporters that render the run, comma-separated. Overrides config.reporters",
53
+ hint: "cli|json|file",
54
+ enum: [
55
+ "cli",
56
+ "json",
57
+ "file"
58
+ ]
59
+ }
60
+ },
61
+ async run({ values, positionals }) {
62
+ const logLevel = values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
63
+ const reporters = values.reporter?.split(",").map((name) => name.trim()).filter(Boolean);
64
+ const { run } = await import("./run-DaV_NiKR.js");
65
+ await run({
66
+ input: positionals[0],
67
+ configPath: values.config,
68
+ logLevel,
69
+ watch: values.watch,
70
+ reporters
71
+ });
72
+ }
73
+ });
74
+ //#endregion
75
+ export { command };
76
+
77
+ //# sourceMappingURL=generate-HcvbU80u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-HcvbU80u.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport type { ReporterName } from '@kubb/core'\n\nexport const command = defineCommand({\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 arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose',\n enum: ['silent', 'info', 'verbose'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\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: 'string',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n hint: 'cli|json|file',\n enum: ['cli', 'json', 'file'],\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const reporters = values.reporter\n ?.split(',')\n .map((name) => name.trim())\n .filter(Boolean) as Array<ReporterName> | undefined\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters,\n })\n },\n})\n"],"mappings":";;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,SAAS;CACrB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;CAAuB;CAC5H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;GAAS;EACpC;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,MAAM;GACN,MAAM;IAAC;IAAO;IAAQ;GAAM;EAC9B;CACF;CACA,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EAChF,MAAM,YAAY,OAAO,UACrB,MAAM,GAAG,EACV,KAAK,SAAS,KAAK,KAAK,CAAC,EACzB,OAAO,OAAO;EACjB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd;EACF,CAAC;CACH;AACF,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./chunk-ByKO4r7w.cjs");
3
- const require_define = require("./define-Bdn8j5VM.cjs");
4
- const require_telemetry = require("./telemetry-DN95_2pF.cjs");
5
- const require_package = require("./package-BapVyQ-w.cjs");
6
- const require_constants = require("./constants-CnDXa1R6.cjs");
2
+ require("./chunk-Bx3C2hgW.cjs");
3
+ const require_define = require("./define-C4AB3POr.cjs");
4
+ const require_package = require("./package-DPe5CA4S.cjs");
5
+ const require_constants = require("./constants-BtmponZ3.cjs");
7
6
  let node_util = require("node:util");
7
+ let _kubb_core = require("@kubb/core");
8
8
  //#region ../../internals/utils/src/cli/schema.ts
9
9
  /**
10
10
  * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.
@@ -24,6 +24,7 @@ function serializeCommand(def) {
24
24
  name: def.name,
25
25
  description: def.description,
26
26
  arguments: def.arguments,
27
+ ...def.examples?.length ? { examples: def.examples } : {},
27
28
  options: serializeOptions(def.options ?? {}),
28
29
  subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : []
29
30
  };
@@ -77,6 +78,11 @@ function renderHelp(def, parentName) {
77
78
  console.log(` ${flags}${opt.description}${defaultPart}`);
78
79
  }
79
80
  console.log();
81
+ if (schema.examples?.length) {
82
+ console.log((0, node_util.styleText)("bold", "Examples:"));
83
+ for (const ex of schema.examples) console.log(` ${(0, node_util.styleText)("dim", ex)}`);
84
+ console.log();
85
+ }
80
86
  }
81
87
  //#endregion
82
88
  //#region ../../internals/utils/src/cli/adapters/nodeAdapter.ts
@@ -133,7 +139,9 @@ async function runCommand(def, argv, parentName) {
133
139
  }
134
140
  function printRootHelp(programName, version, defs) {
135
141
  console.log(`\n${(0, node_util.styleText)("bold", "Usage:")} ${programName} <command> [options]\n`);
136
- console.log(` Kubb generation — v${version}\n`);
142
+ console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`);
143
+ console.log(` Zod schemas, and more from an OpenAPI specification.\n`);
144
+ console.log(` Quick start: ${(0, node_util.styleText)("cyan", `${programName} init`)} to scaffold a config, then ${(0, node_util.styleText)("cyan", `${programName} generate`)} to run.\n`);
137
145
  console.log((0, node_util.styleText)("bold", "Commands:"));
138
146
  for (const def of defs) console.log(` ${(0, node_util.styleText)("cyan", def.name.padEnd(16))}${def.description}`);
139
147
  console.log();
@@ -152,7 +160,8 @@ const nodeAdapter = require_define.defineCLIAdapter({
152
160
  },
153
161
  async run(defs, argv, opts) {
154
162
  const { programName, defaultCommandName, version } = opts;
155
- const args = argv.length >= 2 && argv[0]?.includes("node") ? argv.slice(2) : argv;
163
+ const firstArgIsExecutablePath = (argv[0]?.includes("/") || argv[0]?.includes("\\")) ?? false;
164
+ const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv;
156
165
  if (args[0] === "--version" || args[0] === "-v") {
157
166
  console.log(version);
158
167
  process.exit(0);
@@ -226,7 +235,7 @@ function createCLI(options) {
226
235
  } };
227
236
  }
228
237
  //#endregion
229
- //#region src/utils/flags.ts
238
+ //#region ../../internals/utils/src/isFlag.ts
230
239
  /**
231
240
  * Type guard that confirms `value` is a member of `set`. Avoids type assertions with `Set<T extends string>`.
232
241
  */
@@ -238,18 +247,18 @@ function isFlag(set, value) {
238
247
  //#region src/index.ts
239
248
  const cli = createCLI();
240
249
  function shouldShowTelemetryNotice(argv) {
241
- if (require_telemetry.isTelemetryDisabled()) return false;
250
+ if (_kubb_core.Telemetry.isDisabled()) return false;
242
251
  if (argv.some((arg) => isFlag(require_constants.QUIET_FLAGS, arg))) return false;
243
252
  if (!process.stdout.isTTY) return false;
244
253
  return true;
245
254
  }
246
255
  async function run(argv = process.argv) {
247
256
  if (shouldShowTelemetryNotice(argv)) console.log(`${(0, node_util.styleText)("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${(0, node_util.styleText)("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
248
- const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-BDGOOsBM.cjs"));
249
- const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-C6npXzel.cjs"));
250
- const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-CdFWyrwi.cjs"));
251
- const { command: agentCommand } = await Promise.resolve().then(() => require("./agent-Dmxzqg4d.cjs"));
252
- const { command: initCommand } = await Promise.resolve().then(() => require("./init-NYJSZJSb.cjs"));
257
+ const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-CZYIOngX.cjs"));
258
+ const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-CqRqJxmQ.cjs"));
259
+ const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-YzKoU6_l.cjs"));
260
+ const { command: agentCommand } = await Promise.resolve().then(() => require("./agent-DTqKBULa.cjs"));
261
+ const { command: initCommand } = await Promise.resolve().then(() => require("./init-DybfkgNy.cjs"));
253
262
  await cli.run([
254
263
  generateCommand,
255
264
  validateCommand,