@kubb/cli 5.0.0-beta.8 → 5.0.0-beta.81

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 (135) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +48 -79
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-jtbchpQE.cjs +315 -0
  5. package/dist/Telemetry-jtbchpQE.cjs.map +1 -0
  6. package/dist/Telemetry-ugO-B77y.js +284 -0
  7. package/dist/Telemetry-ugO-B77y.js.map +1 -0
  8. package/dist/{define-Bdn8j5VM.cjs → defineCommand-Bo3yZTWI.cjs} +3 -21
  9. package/dist/defineCommand-Bo3yZTWI.cjs.map +1 -0
  10. package/dist/{define-m_fp-Aqm.js → defineCommand-DMEeqliP.js} +4 -16
  11. package/dist/defineCommand-DMEeqliP.js.map +1 -0
  12. package/dist/{errors-CINO1EIv.js → errors-Dc_d7BfX.js} +2 -2
  13. package/dist/{errors-CINO1EIv.js.map → errors-Dc_d7BfX.js.map} +1 -1
  14. package/dist/{errors-CLCjoSg0.cjs → errors-gxFK0vrp.cjs} +2 -2
  15. package/dist/{errors-CLCjoSg0.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
  16. package/dist/{generate-DzC1brc9.js → generate-C-J93nyx.js} +21 -16
  17. package/dist/generate-C-J93nyx.js.map +1 -0
  18. package/dist/{generate-CiBa5UMJ.cjs → generate-ONVXJYuR.cjs} +21 -16
  19. package/dist/generate-ONVXJYuR.cjs.map +1 -0
  20. package/dist/index.cjs +87 -152
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +6 -1
  23. package/dist/index.js +87 -152
  24. package/dist/index.js.map +1 -1
  25. package/dist/{init-BYlb-ua0.js → init-B-vyaxN4.js} +7 -7
  26. package/dist/init-B-vyaxN4.js.map +1 -0
  27. package/dist/{init-BVYkUQ-b.cjs → init-jpDYabNs.cjs} +8 -8
  28. package/dist/init-jpDYabNs.cjs.map +1 -0
  29. package/dist/mcp-CEKfNLNk.js +21 -0
  30. package/dist/mcp-CEKfNLNk.js.map +1 -0
  31. package/dist/mcp-FhVeNd9X.cjs +21 -0
  32. package/dist/mcp-FhVeNd9X.cjs.map +1 -0
  33. package/dist/package-CWDzRwvR.js +6 -0
  34. package/dist/package-CWDzRwvR.js.map +1 -0
  35. package/dist/{package-BvBzYG6c.cjs → package-CuDwndsr.cjs} +2 -2
  36. package/dist/package-CuDwndsr.cjs.map +1 -0
  37. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  38. package/dist/{run-CF97BWVa.js → run-44Zxh8Ec.js} +130 -85
  39. package/dist/run-44Zxh8Ec.js.map +1 -0
  40. package/dist/run-BBLhhWZu.js +32 -0
  41. package/dist/run-BBLhhWZu.js.map +1 -0
  42. package/dist/run-Bz6ZUrhp.cjs +33 -0
  43. package/dist/run-Bz6ZUrhp.cjs.map +1 -0
  44. package/dist/run-CJMruw7K.cjs +1326 -0
  45. package/dist/run-CJMruw7K.cjs.map +1 -0
  46. package/dist/{run-CCZ24VKk.js → run-CPBFfbI7.js} +5 -5
  47. package/dist/run-CPBFfbI7.js.map +1 -0
  48. package/dist/run-Ccii8MpO.js +1323 -0
  49. package/dist/run-Ccii8MpO.js.map +1 -0
  50. package/dist/{run-YsoCk5we.cjs → run-DXEMoDFa.cjs} +143 -98
  51. package/dist/run-DXEMoDFa.cjs.map +1 -0
  52. package/dist/{run-CQbj3ley.cjs → run-DYkciQ4u.cjs} +6 -6
  53. package/dist/run-DYkciQ4u.cjs.map +1 -0
  54. package/dist/tools-CZT9wSA6.cjs +175 -0
  55. package/dist/tools-CZT9wSA6.cjs.map +1 -0
  56. package/dist/tools-D0UogMU3.js +152 -0
  57. package/dist/tools-D0UogMU3.js.map +1 -0
  58. package/dist/{validate-Da2LIDVc.js → validate-BKsUlm03.js} +5 -5
  59. package/dist/{validate-Da2LIDVc.js.map → validate-BKsUlm03.js.map} +1 -1
  60. package/dist/{validate-BYuHYBhg.cjs → validate-FY50bAV1.cjs} +6 -6
  61. package/dist/{validate-BYuHYBhg.cjs.map → validate-FY50bAV1.cjs.map} +1 -1
  62. package/package.json +13 -25
  63. package/dist/agent-DPLjUza1.cjs +0 -70
  64. package/dist/agent-DPLjUza1.cjs.map +0 -1
  65. package/dist/agent-DTeGTNl7.js +0 -68
  66. package/dist/agent-DTeGTNl7.js.map +0 -1
  67. package/dist/constants-B2JTeRBb.js +0 -42
  68. package/dist/constants-B2JTeRBb.js.map +0 -1
  69. package/dist/constants-BINTA5VZ.cjs +0 -77
  70. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  71. package/dist/constants-BYGmiFs0.cjs +0 -139
  72. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  73. package/dist/constants-DSJ-Xrbv.js +0 -116
  74. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  75. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  76. package/dist/define-m_fp-Aqm.js.map +0 -1
  77. package/dist/generate-CiBa5UMJ.cjs.map +0 -1
  78. package/dist/generate-DzC1brc9.js.map +0 -1
  79. package/dist/init-BVYkUQ-b.cjs.map +0 -1
  80. package/dist/init-BYlb-ua0.js.map +0 -1
  81. package/dist/mcp-Bm2Q7YdS.js +0 -39
  82. package/dist/mcp-Bm2Q7YdS.js.map +0 -1
  83. package/dist/mcp-CiNoagVX.cjs +0 -39
  84. package/dist/mcp-CiNoagVX.cjs.map +0 -1
  85. package/dist/package-BvBzYG6c.cjs.map +0 -1
  86. package/dist/package-s8PvCnk-.js +0 -6
  87. package/dist/package-s8PvCnk-.js.map +0 -1
  88. package/dist/run-BzpYYOQs.js +0 -121
  89. package/dist/run-BzpYYOQs.js.map +0 -1
  90. package/dist/run-CCZ24VKk.js.map +0 -1
  91. package/dist/run-CF97BWVa.js.map +0 -1
  92. package/dist/run-CQbj3ley.cjs.map +0 -1
  93. package/dist/run-CXTVu3Wl.js +0 -1738
  94. package/dist/run-CXTVu3Wl.js.map +0 -1
  95. package/dist/run-D0hmRpHy.js +0 -49
  96. package/dist/run-D0hmRpHy.js.map +0 -1
  97. package/dist/run-DwdAwnLG.cjs +0 -125
  98. package/dist/run-DwdAwnLG.cjs.map +0 -1
  99. package/dist/run-Lr0Ctnu0.cjs +0 -50
  100. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  101. package/dist/run-QyqW2rPC.cjs +0 -1741
  102. package/dist/run-QyqW2rPC.cjs.map +0 -1
  103. package/dist/run-YsoCk5we.cjs.map +0 -1
  104. package/dist/shell-475fQKaX.cjs +0 -62
  105. package/dist/shell-475fQKaX.cjs.map +0 -1
  106. package/dist/shell-CN6DNqeC.js +0 -51
  107. package/dist/shell-CN6DNqeC.js.map +0 -1
  108. package/dist/telemetry-B2iWkY5e.cjs +0 -280
  109. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  110. package/dist/telemetry-BkektVz6.js +0 -243
  111. package/dist/telemetry-BkektVz6.js.map +0 -1
  112. package/src/commands/agent/start.ts +0 -50
  113. package/src/commands/agent.ts +0 -10
  114. package/src/commands/generate.ts +0 -59
  115. package/src/commands/init.ts +0 -51
  116. package/src/commands/mcp.ts +0 -36
  117. package/src/commands/validate.ts +0 -22
  118. package/src/constants.ts +0 -48
  119. package/src/index.ts +0 -45
  120. package/src/loggers/clackLogger.ts +0 -460
  121. package/src/loggers/fileSystemLogger.ts +0 -151
  122. package/src/loggers/githubActionsLogger.ts +0 -367
  123. package/src/loggers/plainLogger.ts +0 -243
  124. package/src/loggers/types.ts +0 -7
  125. package/src/loggers/utils.ts +0 -252
  126. package/src/runners/agent/run.ts +0 -113
  127. package/src/runners/agent/utils.ts +0 -98
  128. package/src/runners/generate/run.ts +0 -276
  129. package/src/runners/generate/utils.ts +0 -209
  130. package/src/runners/init/run.ts +0 -211
  131. package/src/runners/init/utils.ts +0 -33
  132. package/src/runners/mcp/run.ts +0 -55
  133. package/src/runners/validate/run.ts +0 -63
  134. package/src/telemetry.ts +0 -280
  135. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
package/dist/index.js CHANGED
@@ -1,49 +1,11 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { t as defineCLIAdapter } from "./define-m_fp-Aqm.js";
3
- import { n as isTelemetryDisabled } from "./telemetry-BkektVz6.js";
4
- import { t as version } from "./package-s8PvCnk-.js";
5
- import { r as QUIET_FLAGS } from "./constants-B2JTeRBb.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ import { r as QUIET_FLAGS, t as Telemetry } from "./Telemetry-ugO-B77y.js";
3
+ import { t as version } from "./package-CWDzRwvR.js";
6
4
  import { parseArgs, styleText } from "node:util";
7
- //#region ../../internals/utils/src/cli/schema.ts
8
- /**
9
- * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.
10
- * Use to expose CLI capabilities to AI agents or MCP tools.
11
- *
12
- * @example
13
- * ```ts
14
- * getCommandSchema([generateCommand, agentCommand])
15
- * // [{ name: 'generate', options: [...], subCommands: [] }, ...]
16
- * ```
17
- */
18
- function getCommandSchema(defs) {
19
- return defs.map(serializeCommand);
5
+ //#region ../../internals/utils/src/cli/renderHelp.ts
6
+ function formatFlags(name, opt) {
7
+ return `${opt.short ? `-${opt.short}, ` : ""}--${name}${opt.type === "string" ? ` <${opt.hint ?? name}>` : ""}`;
20
8
  }
21
- function serializeCommand(def) {
22
- return {
23
- name: def.name,
24
- description: def.description,
25
- arguments: def.arguments,
26
- ...def.examples?.length ? { examples: def.examples } : {},
27
- options: serializeOptions(def.options ?? {}),
28
- subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : []
29
- };
30
- }
31
- function serializeOptions(options) {
32
- return Object.entries(options).map(([name, opt]) => {
33
- return {
34
- name,
35
- flags: `${opt.short ? `-${opt.short}, ` : ""}--${name}${opt.type === "string" ? ` <${opt.hint ?? name}>` : ""}`,
36
- type: opt.type,
37
- description: opt.description,
38
- ...opt.default !== void 0 ? { default: opt.default } : {},
39
- ...opt.hint ? { hint: opt.hint } : {},
40
- ...opt.enum ? { enum: opt.enum } : {},
41
- ...opt.required ? { required: opt.required } : {}
42
- };
43
- });
44
- }
45
- //#endregion
46
- //#region ../../internals/utils/src/cli/help.ts
47
9
  /** Prints formatted help output for `def` using its `CommandDefinition`.
48
10
  *
49
11
  * @example
@@ -53,21 +15,23 @@ function serializeOptions(options) {
53
15
  * ```
54
16
  */
55
17
  function renderHelp(def, parentName) {
56
- const schema = getCommandSchema([def])[0];
57
- const programName = parentName ? `${parentName} ${schema.name}` : schema.name;
58
- const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(" ")}` : "";
59
- const subCmdPart = schema.subCommands.length ? " <command>" : "";
18
+ const programName = parentName ? `${parentName} ${def.name}` : def.name;
19
+ const subCommands = def.subCommands ?? [];
20
+ const argsPart = def.arguments?.length ? ` ${def.arguments.join(" ")}` : "";
21
+ const subCmdPart = subCommands.length ? " <command>" : "";
60
22
  console.log(`\n${styleText("bold", "Usage:")} ${programName}${argsPart}${subCmdPart} [options]\n`);
61
- if (schema.description) console.log(` ${schema.description}\n`);
62
- if (schema.subCommands.length) {
23
+ if (def.description) console.log(` ${def.description}\n`);
24
+ if (subCommands.length) {
63
25
  console.log(styleText("bold", "Commands:"));
64
- for (const sub of schema.subCommands) console.log(` ${styleText("cyan", sub.name.padEnd(16))}${sub.description}`);
26
+ for (const sub of subCommands) console.log(` ${styleText("cyan", sub.name.padEnd(16))}${sub.description}`);
65
27
  console.log();
66
28
  }
67
- const options = [...schema.options, {
68
- name: "help",
29
+ const options = [...Object.entries(def.options ?? {}).map(([name, opt]) => ({
30
+ flags: formatFlags(name, opt),
31
+ description: opt.description,
32
+ default: opt.default
33
+ })), {
69
34
  flags: "-h, --help",
70
- type: "boolean",
71
35
  description: "Show help"
72
36
  }];
73
37
  console.log(styleText("bold", "Options:"));
@@ -77,14 +41,14 @@ function renderHelp(def, parentName) {
77
41
  console.log(` ${flags}${opt.description}${defaultPart}`);
78
42
  }
79
43
  console.log();
80
- if (schema.examples?.length) {
44
+ if (def.examples?.length) {
81
45
  console.log(styleText("bold", "Examples:"));
82
- for (const ex of schema.examples) console.log(` ${styleText("dim", ex)}`);
46
+ for (const ex of def.examples) console.log(` ${styleText("dim", ex)}`);
83
47
  console.log();
84
48
  }
85
49
  }
86
50
  //#endregion
87
- //#region ../../internals/utils/src/cli/adapters/nodeAdapter.ts
51
+ //#region ../../internals/utils/src/cli/runCLI.ts
88
52
  function buildParseOptions(def) {
89
53
  const result = { help: {
90
54
  type: "boolean",
@@ -151,118 +115,89 @@ function printRootHelp(programName, version, defs) {
151
115
  console.log(`Run ${styleText("cyan", `${programName} <command> --help`)} for command-specific help.\n`);
152
116
  }
153
117
  /**
154
- * CLI adapter using `node:util parseArgs`. No external dependencies.
155
- */
156
- const nodeAdapter = defineCLIAdapter({
157
- renderHelp(def, parentName) {
158
- renderHelp(def, parentName);
159
- },
160
- async run(defs, argv, opts) {
161
- const { programName, defaultCommandName, version } = opts;
162
- const firstArgIsExecutablePath = (argv[0]?.includes("/") || argv[0]?.includes("\\")) ?? false;
163
- const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv;
164
- if (args[0] === "--version" || args[0] === "-v") {
165
- console.log(version);
166
- process.exit(0);
167
- }
168
- if (args[0] === "--help" || args[0] === "-h") {
169
- printRootHelp(programName, version, defs);
170
- process.exit(0);
171
- }
172
- if (args.length === 0) {
173
- const defaultDef = defs.find((d) => d.name === defaultCommandName);
174
- if (defaultDef?.run) await runCommand(defaultDef, [], programName);
175
- else printRootHelp(programName, version, defs);
176
- return;
177
- }
178
- const [first, ...rest] = args;
179
- const isKnownSubcommand = defs.some((d) => d.name === first);
180
- let def;
181
- let commandArgv;
182
- let parentName;
183
- if (isKnownSubcommand) {
184
- def = defs.find((d) => d.name === first);
185
- commandArgv = rest;
186
- parentName = programName;
187
- } else {
188
- def = defs.find((d) => d.name === defaultCommandName);
189
- commandArgv = args;
190
- parentName = programName;
191
- }
192
- if (!def) {
193
- console.error(`Unknown command: ${first}`);
194
- printRootHelp(programName, version, defs);
195
- process.exit(1);
196
- }
197
- if (def.subCommands?.length) {
198
- const [subName, ...subRest] = commandArgv;
199
- const subDef = def.subCommands.find((s) => s.name === subName);
200
- if (subName === "--help" || subName === "-h") {
201
- renderHelp(def, parentName);
202
- process.exit(0);
203
- }
204
- if (!subDef) {
205
- renderHelp(def, parentName);
206
- process.exit(subName ? 1 : 0);
207
- }
208
- await runCommand(subDef, subRest, `${parentName} ${def.name}`);
209
- return;
210
- }
211
- await runCommand(def, commandArgv, parentName);
212
- }
213
- });
214
- //#endregion
215
- //#region ../../internals/utils/src/cli/parse.ts
216
- /**
217
- * Creates a CLI runner bound to a specific adapter.
218
- *
219
- * @default nodeAdapter (Node.js `node:util parseArgs`)
118
+ * Parses `argv` and runs the matching command using `node:util parseArgs`. No external dependencies.
119
+ * Falls back to `defaultCommandName` when no command is given.
220
120
  *
221
121
  * @example
222
122
  * ```ts
223
- * await createCLI().run(commands, process.argv.slice(2), {
123
+ * await runCLI(commands, process.argv, {
224
124
  * programName: 'kubb',
225
125
  * defaultCommandName: 'generate',
226
126
  * version: '5.0.0',
227
127
  * })
228
128
  * ```
229
129
  */
230
- function createCLI(options) {
231
- const adapter = options?.adapter ?? nodeAdapter;
232
- return { run(commands, argv, opts) {
233
- return adapter.run(commands, argv, opts);
234
- } };
130
+ async function runCLI(defs, argv, opts) {
131
+ const { programName, defaultCommandName, version } = opts;
132
+ const firstArgIsExecutablePath = (argv[0]?.includes("/") || argv[0]?.includes("\\")) ?? false;
133
+ const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv;
134
+ if (args[0] === "--version" || args[0] === "-v") {
135
+ console.log(version);
136
+ process.exit(0);
137
+ }
138
+ if (args[0] === "--help" || args[0] === "-h") {
139
+ printRootHelp(programName, version, defs);
140
+ process.exit(0);
141
+ }
142
+ if (args.length === 0) {
143
+ const defaultDef = defs.find((d) => d.name === defaultCommandName);
144
+ if (defaultDef?.run) await runCommand(defaultDef, [], programName);
145
+ else printRootHelp(programName, version, defs);
146
+ return;
147
+ }
148
+ const [first, ...rest] = args;
149
+ const isKnownSubcommand = defs.some((d) => d.name === first);
150
+ let def;
151
+ let commandArgv;
152
+ let parentName;
153
+ if (isKnownSubcommand) {
154
+ def = defs.find((d) => d.name === first);
155
+ commandArgv = rest;
156
+ parentName = programName;
157
+ } else {
158
+ def = defs.find((d) => d.name === defaultCommandName);
159
+ commandArgv = args;
160
+ parentName = programName;
161
+ }
162
+ if (!def) {
163
+ console.error(`Unknown command: ${first}`);
164
+ printRootHelp(programName, version, defs);
165
+ process.exit(1);
166
+ }
167
+ if (def.subCommands?.length) {
168
+ const [subName, ...subRest] = commandArgv;
169
+ const subDef = def.subCommands.find((s) => s.name === subName);
170
+ if (subName === "--help" || subName === "-h") {
171
+ renderHelp(def, parentName);
172
+ process.exit(0);
173
+ }
174
+ if (!subDef) {
175
+ renderHelp(def, parentName);
176
+ process.exit(subName ? 1 : 0);
177
+ }
178
+ await runCommand(subDef, subRest, `${parentName} ${def.name}`);
179
+ return;
180
+ }
181
+ await runCommand(def, commandArgv, parentName);
235
182
  }
236
183
  //#endregion
237
- //#region ../../internals/utils/src/isFlag.ts
184
+ //#region src/index.ts
238
185
  /**
239
- * Type guard that confirms `value` is a member of `set`. Avoids type assertions with `Set<T extends string>`.
186
+ * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
187
+ * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
188
+ * `generate` when no command is given.
240
189
  */
241
- function isFlag(set, value) {
242
- for (const flag of set) if (flag === value) return true;
243
- return false;
244
- }
245
- //#endregion
246
- //#region src/index.ts
247
- const cli = createCLI();
248
- function shouldShowTelemetryNotice(argv) {
249
- if (isTelemetryDisabled()) return false;
250
- if (argv.some((arg) => isFlag(QUIET_FLAGS, arg))) return false;
251
- if (!process.stdout.isTTY) return false;
252
- return true;
253
- }
254
190
  async function run(argv = process.argv) {
255
- if (shouldShowTelemetryNotice(argv)) console.log(`${styleText("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
256
- const { command: generateCommand } = await import("./generate-DzC1brc9.js");
257
- const { command: validateCommand } = await import("./validate-Da2LIDVc.js");
258
- const { command: mcpCommand } = await import("./mcp-Bm2Q7YdS.js");
259
- const { command: agentCommand } = await import("./agent-DTeGTNl7.js");
260
- const { command: initCommand } = await import("./init-BYlb-ua0.js");
261
- await cli.run([
191
+ const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg));
192
+ if (!Telemetry.isDisabled && !isQuietFlag) console.log(`${styleText("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
193
+ const { command: generateCommand } = await import("./generate-C-J93nyx.js");
194
+ const { command: validateCommand } = await import("./validate-BKsUlm03.js");
195
+ const { command: mcpCommand } = await import("./mcp-CEKfNLNk.js");
196
+ const { command: initCommand } = await import("./init-B-vyaxN4.js");
197
+ await runCLI([
262
198
  generateCommand,
263
199
  validateCommand,
264
200
  mcpCommand,
265
- agentCommand,
266
201
  initCommand
267
202
  ], argv, {
268
203
  programName: "kubb",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/cli/schema.ts","../../../internals/utils/src/cli/help.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/parse.ts","../../../internals/utils/src/isFlag.ts","../src/index.ts"],"sourcesContent":["import type { CommandDefinition, CommandSchema, OptionDefinition, OptionSchema } from './types.ts'\n\n/**\n * Serializes `CommandDefinition[]` to a plain, JSON-serializable structure.\n * Use to expose CLI capabilities to AI agents or MCP tools.\n *\n * @example\n * ```ts\n * getCommandSchema([generateCommand, agentCommand])\n * // [{ name: 'generate', options: [...], subCommands: [] }, ...]\n * ```\n */\nexport function getCommandSchema(defs: CommandDefinition[]): CommandSchema[] {\n return defs.map(serializeCommand)\n}\n\nfunction serializeCommand(def: CommandDefinition): CommandSchema {\n return {\n name: def.name,\n description: def.description,\n arguments: def.arguments,\n ...(def.examples?.length ? { examples: def.examples } : {}),\n options: serializeOptions(def.options ?? {}),\n subCommands: def.subCommands ? def.subCommands.map(serializeCommand) : [],\n }\n}\n\nfunction serializeOptions(options: Record<string, OptionDefinition>): OptionSchema[] {\n return Object.entries(options).map(([name, opt]) => {\n const shortPart = opt.short ? `-${opt.short}, ` : ''\n const valuePart = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n const flags = `${shortPart}--${name}${valuePart}`\n\n return {\n name,\n flags,\n type: opt.type,\n description: opt.description,\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n ...(opt.hint ? { hint: opt.hint } : {}),\n ...(opt.enum ? { enum: opt.enum } : {}),\n ...(opt.required ? { required: opt.required } : {}),\n }\n })\n}\n","import { styleText } from 'node:util'\nimport { getCommandSchema } from './schema.ts'\nimport type { CommandDefinition, OptionSchema } from './types.ts'\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const schema = getCommandSchema([def])[0]!\n\n const programName = parentName ? `${parentName} ${schema.name}` : schema.name\n\n const argsPart = schema.arguments?.length ? ` ${schema.arguments.join(' ')}` : ''\n const subCmdPart = schema.subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (schema.description) {\n console.log(` ${schema.description}\\n`)\n }\n\n if (schema.subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of schema.subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: OptionSchema[] = [\n ...schema.options,\n {\n name: 'help',\n flags: '-h, --help',\n type: 'boolean' as const,\n description: 'Show help',\n },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (schema.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of schema.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport { defineCLIAdapter } from '../define.ts'\nimport { renderHelp } from '../help.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs, RunOptions } from '../types.ts'\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: string[], parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: CommandDefinition[]): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter = defineCLIAdapter({\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(defs: CommandDefinition[], argv: string[], opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: string[]\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n },\n})\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CLIAdapter, CommandDefinition, RunOptions } from './types.ts'\n\n/**\n * Creates a CLI runner bound to a specific adapter.\n *\n * @default nodeAdapter (Node.js `node:util parseArgs`)\n *\n * @example\n * ```ts\n * await createCLI().run(commands, process.argv.slice(2), {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport function createCLI(options?: { adapter?: CLIAdapter }): {\n run(commands: CommandDefinition[], argv: string[], opts: RunOptions): Promise<void>\n} {\n const adapter = options?.adapter ?? nodeAdapter\n\n return {\n run(commands, argv, opts) {\n return adapter.run(commands, argv, opts)\n },\n }\n}\n","/**\n * Type guard that confirms `value` is a member of `set`. Avoids type assertions with `Set<T extends string>`.\n */\nexport function isFlag<T extends string>(set: ReadonlySet<T>, value: string): value is T {\n for (const flag of set) {\n if (flag === value) return true\n }\n return false\n}\n","import { styleText } from 'node:util'\nimport { createCLI, isFlag } from '@internals/utils'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\nimport { isTelemetryDisabled } from './telemetry.ts'\n\nconst cli = createCLI()\n\nfunction shouldShowTelemetryNotice(argv: Array<string>): boolean {\n if (isTelemetryDisabled()) {\n return false\n }\n\n // Skip when the user is just asking for help or version info\n if (argv.some((arg) => isFlag(QUIET_FLAGS, arg))) {\n return false\n }\n\n // Skip in non-interactive / scripting contexts\n if (!process.stdout.isTTY) {\n return false\n }\n\n return true\n}\n\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n if (shouldShowTelemetryNotice(argv)) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: agentCommand } = await import('./commands/agent.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli.run([generateCommand, validateCommand, mcpCommand, agentCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAgB,iBAAiB,MAA4C;CAC3E,OAAO,KAAK,IAAI,iBAAiB;;AAGnC,SAAS,iBAAiB,KAAuC;CAC/D,OAAO;EACL,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,IAAI,UAAU,SAAS,EAAE,UAAU,IAAI,UAAU,GAAG,EAAE;EAC1D,SAAS,iBAAiB,IAAI,WAAW,EAAE,CAAC;EAC5C,aAAa,IAAI,cAAc,IAAI,YAAY,IAAI,iBAAiB,GAAG,EAAE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CAC/C,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAE9C,MAAM,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;EAAc;EAAY,EAAE,MAAM;EAC7F,aAAa;EACb,oBAAoB;EACpB;EACD,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/cli/renderHelp.ts","../../../internals/utils/src/cli/runCLI.ts","../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport type { CommandDefinition, OptionDefinition } from './defineCommand.ts'\n\nfunction formatFlags(name: string, opt: OptionDefinition): string {\n const short = opt.short ? `-${opt.short}, ` : ''\n const value = opt.type === 'string' ? ` <${opt.hint ?? name}>` : ''\n return `${short}--${name}${value}`\n}\n\n/** Prints formatted help output for `def` using its `CommandDefinition`.\n *\n * @example\n * ```ts\n * renderHelp({ name: 'generate', description: 'Generate client code' })\n * // prints Usage: generate [options] ...\n * ```\n */\nexport function renderHelp(def: CommandDefinition, parentName?: string): void {\n const programName = parentName ? `${parentName} ${def.name}` : def.name\n const subCommands = def.subCommands ?? []\n\n const argsPart = def.arguments?.length ? ` ${def.arguments.join(' ')}` : ''\n const subCmdPart = subCommands.length ? ' <command>' : ''\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName}${argsPart}${subCmdPart} [options]\\n`)\n\n if (def.description) {\n console.log(` ${def.description}\\n`)\n }\n\n if (subCommands.length) {\n console.log(styleText('bold', 'Commands:'))\n for (const sub of subCommands) {\n console.log(` ${styleText('cyan', sub.name.padEnd(16))}${sub.description}`)\n }\n console.log()\n }\n\n const options: Array<{ flags: string; description: string; default?: string | boolean }> = [\n ...Object.entries(def.options ?? {}).map(([name, opt]) => ({ flags: formatFlags(name, opt), description: opt.description, default: opt.default })),\n { flags: '-h, --help', description: 'Show help' },\n ]\n\n console.log(styleText('bold', 'Options:'))\n for (const opt of options) {\n const flags = styleText('cyan', opt.flags.padEnd(30))\n const defaultPart = opt.default !== undefined ? styleText('dim', ` (default: ${opt.default})`) : ''\n console.log(` ${flags}${opt.description}${defaultPart}`)\n }\n console.log()\n\n if (def.examples?.length) {\n console.log(styleText('bold', 'Examples:'))\n for (const ex of def.examples) {\n console.log(` ${styleText('dim', ex)}`)\n }\n console.log()\n }\n}\n","import { parseArgs, styleText } from 'node:util'\nimport type { CommandDefinition, OptionType, ParsedArgs } from './defineCommand.ts'\nimport { renderHelp } from './renderHelp.ts'\n\n/**\n * Options passed to every `runCLI` invocation.\n */\nexport type RunOptions = {\n programName: string\n defaultCommandName: string\n version: string\n}\n\ntype ParseOption = {\n type: OptionType\n short?: string\n default?: string | boolean\n}\ntype ParseOptions = Record<string, ParseOption>\n\nfunction buildParseOptions(def: CommandDefinition): ParseOptions {\n const result: ParseOptions = {\n help: { type: 'boolean', short: 'h' },\n }\n\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n result[name] = {\n type: opt.type,\n ...(opt.short ? { short: opt.short } : {}),\n ...(opt.default !== undefined ? { default: opt.default } : {}),\n }\n }\n\n return result\n}\n\nasync function runCommand(def: CommandDefinition, argv: Array<string>, parentName?: string): Promise<void> {\n const parseOptions = buildParseOptions(def)\n\n let parsed: ParsedArgs\n try {\n const result = parseArgs({\n args: argv,\n options: parseOptions,\n allowPositionals: true,\n strict: false,\n })\n parsed = {\n values: result.values as ParsedArgs['values'],\n positionals: result.positionals,\n }\n } catch {\n renderHelp(def, parentName)\n process.exit(1)\n }\n\n if (parsed.values['help']) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n // Validate required options before running the command\n for (const [name, opt] of Object.entries(def.options ?? {})) {\n if (opt.required && parsed.values[name] === undefined) {\n console.error(styleText('red', `Error: --${name} is required`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n }\n\n if (!def.run) {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n try {\n await def.run(parsed)\n } catch (err) {\n console.error(styleText('red', `Error: ${err instanceof Error ? err.message : String(err)}`))\n renderHelp(def, parentName)\n process.exit(1)\n }\n}\n\nfunction printRootHelp(programName: string, version: string, defs: Array<CommandDefinition>): void {\n console.log(`\\n${styleText('bold', 'Usage:')} ${programName} <command> [options]\\n`)\n console.log(` Kubb v${version} — Generate TypeScript types, API clients, React Query hooks,`)\n console.log(` Zod schemas, and more from an OpenAPI specification.\\n`)\n console.log(` Quick start: ${styleText('cyan', `${programName} init`)} to scaffold a config, then ${styleText('cyan', `${programName} generate`)} to run.\\n`)\n console.log(styleText('bold', 'Commands:'))\n for (const def of defs) {\n console.log(` ${styleText('cyan', def.name.padEnd(16))}${def.description}`)\n }\n console.log()\n console.log(styleText('bold', 'Options:'))\n console.log(` ${styleText('cyan', '-v, --version'.padEnd(30))}Show version number`)\n console.log(` ${styleText('cyan', '-h, --help'.padEnd(30))}Show help`)\n console.log()\n console.log(`Run ${styleText('cyan', `${programName} <command> --help`)} for command-specific help.\\n`)\n}\n\n/**\n * Parses `argv` and runs the matching command using `node:util parseArgs`. No external dependencies.\n * Falls back to `defaultCommandName` when no command is given.\n *\n * @example\n * ```ts\n * await runCLI(commands, process.argv, {\n * programName: 'kubb',\n * defaultCommandName: 'generate',\n * version: '5.0.0',\n * })\n * ```\n */\nexport async function runCLI(defs: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void> {\n const { programName, defaultCommandName, version } = opts\n\n // Strip the leading executable + script entries when process.argv is passed directly.\n // Handles Node.js (/usr/bin/node), Bun (/usr/local/bin/bun), Deno, tsx, etc.\n // All runtime executable paths contain a path separator; bare command names do not.\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n\n if (args[0] === '--version' || args[0] === '-v') {\n console.log(version)\n process.exit(0)\n }\n\n if (args[0] === '--help' || args[0] === '-h') {\n printRootHelp(programName, version, defs)\n process.exit(0)\n }\n\n if (args.length === 0) {\n const defaultDef = defs.find((d) => d.name === defaultCommandName)\n if (defaultDef?.run) {\n await runCommand(defaultDef, [], programName)\n } else {\n printRootHelp(programName, version, defs)\n }\n return\n }\n\n const [first, ...rest] = args\n const isKnownSubcommand = defs.some((d) => d.name === first)\n\n let def: CommandDefinition | undefined\n let commandArgv: Array<string>\n let parentName: string | undefined\n\n if (isKnownSubcommand) {\n def = defs.find((d) => d.name === first)\n commandArgv = rest\n parentName = programName\n } else {\n def = defs.find((d) => d.name === defaultCommandName)\n commandArgv = args\n parentName = programName\n }\n\n if (!def) {\n console.error(`Unknown command: ${first}`)\n printRootHelp(programName, version, defs)\n process.exit(1)\n }\n\n if (def.subCommands?.length) {\n const [subName, ...subRest] = commandArgv\n const subDef = def.subCommands.find((s) => s.name === subName)\n\n if (subName === '--help' || subName === '-h') {\n renderHelp(def, parentName)\n process.exit(0)\n }\n\n if (!subDef) {\n renderHelp(def, parentName)\n process.exit(subName ? 1 : 0)\n }\n\n await runCommand(subDef, subRest, `${parentName} ${def.name}`)\n return\n }\n\n await runCommand(def, commandArgv, parentName)\n}\n","import { styleText } from 'node:util'\nimport { runCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!Telemetry.isDisabled && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await runCLI([generate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AAQ,KAAK,CAAC;EAChB;EAEA,IAAI,CAAC,QAAQ;GACX,WAAW,KAAK,UAAU;GAC1B,QAAQ,KAAK,UAAU,IAAI,CAAC;EAC9B;EAEA,MAAM,WAAW,QAAQ,SAAS,GAAG,WAAW,GAAG,IAAI,MAAM;EAC7D;CACF;CAEA,MAAM,WAAW,KAAK,aAAa,UAAU;AAC/C;;;;;;;;AC9KA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAAC,UAAU,cAAc,CAAC,aAC5B,QAAQ,IACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,eAAe,MAAM,OAAO;CAC7C,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAE9C,MAAM,OAAO;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC9E,aAAa;EACb,oBAAoB;EACpB;CACF,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { n as defineCommand } from "./define-m_fp-Aqm.js";
3
- import { t as version } from "./package-s8PvCnk-.js";
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
3
+ import { t as version } from "./package-CWDzRwvR.js";
4
4
  //#region src/commands/init.ts
5
5
  const command = defineCommand({
6
6
  name: "init",
@@ -9,7 +9,7 @@ const command = defineCommand({
9
9
  "kubb init",
10
10
  "kubb init --yes",
11
11
  "kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
12
- "kubb init --plugins plugin-ts,plugin-client,plugin-react-query"
12
+ "kubb init --plugins plugin-ts,plugin-axios,plugin-react-query"
13
13
  ],
14
14
  options: {
15
15
  yes: {
@@ -32,12 +32,12 @@ const command = defineCommand({
32
32
  },
33
33
  plugins: {
34
34
  type: "string",
35
- description: "Comma-separated list of plugins to use (plugin-ts, plugin-client, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)",
35
+ description: "Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)",
36
36
  hint: "plugin-ts,plugin-zod,..."
37
37
  }
38
38
  },
39
39
  async run({ values }) {
40
- const { run } = await import("./run-CF97BWVa.js");
40
+ const { run } = await import("./run-44Zxh8Ec.js");
41
41
  await run({
42
42
  yes: values.yes,
43
43
  version,
@@ -50,4 +50,4 @@ const command = defineCommand({
50
50
  //#endregion
51
51
  export { command };
52
52
 
53
- //# sourceMappingURL=init-BYlb-ua0.js.map
53
+ //# sourceMappingURL=init-B-vyaxN4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-B-vyaxN4.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
@@ -1,15 +1,15 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-Bdn8j5VM.cjs");
3
- const require_package = require("./package-BvBzYG6c.cjs");
1
+ require("./rolldown-runtime-Bx3C2hgW.cjs");
2
+ const require_defineCommand = require("./defineCommand-Bo3yZTWI.cjs");
3
+ const require_package = require("./package-CuDwndsr.cjs");
4
4
  //#region src/commands/init.ts
5
- const command = require_define.defineCommand({
5
+ const command = require_defineCommand.defineCommand({
6
6
  name: "init",
7
7
  description: "Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.",
8
8
  examples: [
9
9
  "kubb init",
10
10
  "kubb init --yes",
11
11
  "kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
12
- "kubb init --plugins plugin-ts,plugin-client,plugin-react-query"
12
+ "kubb init --plugins plugin-ts,plugin-axios,plugin-react-query"
13
13
  ],
14
14
  options: {
15
15
  yes: {
@@ -32,12 +32,12 @@ const command = require_define.defineCommand({
32
32
  },
33
33
  plugins: {
34
34
  type: "string",
35
- description: "Comma-separated list of plugins to use (plugin-ts, plugin-client, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)",
35
+ description: "Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)",
36
36
  hint: "plugin-ts,plugin-zod,..."
37
37
  }
38
38
  },
39
39
  async run({ values }) {
40
- const { run } = await Promise.resolve().then(() => require("./run-YsoCk5we.cjs"));
40
+ const { run } = await Promise.resolve().then(() => require("./run-DXEMoDFa.cjs"));
41
41
  await run({
42
42
  yes: values.yes,
43
43
  version: require_package.version,
@@ -50,4 +50,4 @@ const command = require_define.defineCommand({
50
50
  //#endregion
51
51
  exports.command = command;
52
52
 
53
- //# sourceMappingURL=init-BVYkUQ-b.cjs.map
53
+ //# sourceMappingURL=init-jpDYabNs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-jpDYabNs.cjs","names":["defineCommand"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,sBAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;CACF;CACA,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;EACR;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;EACR;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;EAClB,CAAC;CACH;AACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import "./rolldown-runtime-C0LytTxp.js";
2
+ import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
3
+ import { t as version } from "./package-CWDzRwvR.js";
4
+ //#region src/commands/mcp.ts
5
+ const command = defineCommand({
6
+ name: "mcp",
7
+ description: "Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.",
8
+ examples: [
9
+ "kubb mcp",
10
+ "# Then add to your MCP client config:",
11
+ "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
12
+ ],
13
+ async run() {
14
+ const { run } = await import("./run-BBLhhWZu.js");
15
+ await run({ version });
16
+ }
17
+ });
18
+ //#endregion
19
+ export { command };
20
+
21
+ //# sourceMappingURL=mcp-CEKfNLNk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-CEKfNLNk.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'],\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E;CAC/I,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI,EAAE,QAAQ,CAAC;CACvB;AACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ require("./rolldown-runtime-Bx3C2hgW.cjs");
2
+ const require_defineCommand = require("./defineCommand-Bo3yZTWI.cjs");
3
+ const require_package = require("./package-CuDwndsr.cjs");
4
+ //#region src/commands/mcp.ts
5
+ const command = require_defineCommand.defineCommand({
6
+ name: "mcp",
7
+ description: "Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.",
8
+ examples: [
9
+ "kubb mcp",
10
+ "# Then add to your MCP client config:",
11
+ "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
12
+ ],
13
+ async run() {
14
+ const { run } = await Promise.resolve().then(() => require("./run-Bz6ZUrhp.cjs"));
15
+ await run({ version: require_package.version });
16
+ }
17
+ });
18
+ //#endregion
19
+ exports.command = command;
20
+
21
+ //# sourceMappingURL=mcp-FhVeNd9X.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-FhVeNd9X.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'],\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,sBAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E;CAC/I,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI,EAAE,SAAA,gBAAA,QAAQ,CAAC;CACvB;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "5.0.0-beta.81";
3
+ //#endregion
4
+ export { version as t };
5
+
6
+ //# sourceMappingURL=package-CWDzRwvR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-CWDzRwvR.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "5.0.0-beta.8";
2
+ var version = "5.0.0-beta.81";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "version", {
8
8
  }
9
9
  });
10
10
 
11
- //# sourceMappingURL=package-BvBzYG6c.cjs.map
11
+ //# sourceMappingURL=package-CuDwndsr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-CuDwndsr.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,4 +1,3 @@
1
- import "node:module";
2
1
  //#region \0rolldown/runtime.js
3
2
  var __defProp = Object.defineProperty;
4
3
  var __name = (target, value) => __defProp(target, "name", {