@kubb/cli 5.0.0-beta.72 → 5.0.0-beta.74

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 (57) hide show
  1. package/README.md +4 -3
  2. package/dist/{Telemetry-uAr3lK_-.js → Telemetry-CxzkLSdD.js} +2 -2
  3. package/dist/{Telemetry-uAr3lK_-.js.map → Telemetry-CxzkLSdD.js.map} +1 -1
  4. package/dist/{Telemetry-CfPP7MYq.cjs → Telemetry-D8jhC5Bc.cjs} +1 -7
  5. package/dist/{Telemetry-CfPP7MYq.cjs.map → Telemetry-D8jhC5Bc.cjs.map} +1 -1
  6. package/dist/{generate-FRVvwG45.js → generate-CiL6ZDvQ.js} +2 -2
  7. package/dist/{generate-FRVvwG45.js.map → generate-CiL6ZDvQ.js.map} +1 -1
  8. package/dist/{generate-BveUz6Vg.cjs → generate-DsYuZKep.cjs} +2 -2
  9. package/dist/{generate-BveUz6Vg.cjs.map → generate-DsYuZKep.cjs.map} +1 -1
  10. package/dist/index.cjs +63 -81
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +63 -81
  13. package/dist/index.js.map +1 -1
  14. package/dist/{init-SPfikrcb.cjs → init-C_XrK9iu.cjs} +5 -5
  15. package/dist/init-C_XrK9iu.cjs.map +1 -0
  16. package/dist/{init-CXsu_xzX.js → init-yda89Wb-.js} +5 -5
  17. package/dist/init-yda89Wb-.js.map +1 -0
  18. package/dist/{mcp-nTCEwXRZ.cjs → mcp-bQcjXZVn.cjs} +3 -3
  19. package/dist/{mcp-nTCEwXRZ.cjs.map → mcp-bQcjXZVn.cjs.map} +1 -1
  20. package/dist/{mcp-X_bUXZSt.js → mcp-smxWEGCy.js} +3 -3
  21. package/dist/{mcp-X_bUXZSt.js.map → mcp-smxWEGCy.js.map} +1 -1
  22. package/dist/package-BQ8Q4wIC.js +6 -0
  23. package/dist/package-BQ8Q4wIC.js.map +1 -0
  24. package/dist/{package-BHgq_42J.cjs → package-DWzrRisS.cjs} +2 -2
  25. package/dist/package-DWzrRisS.cjs.map +1 -0
  26. package/dist/{run-CMRA1tNF.js → run-1UJGpleM.js} +8 -24
  27. package/dist/run-1UJGpleM.js.map +1 -0
  28. package/dist/{run-D9mQoQHA.js → run-44Zxh8Ec.js} +12 -5
  29. package/dist/run-44Zxh8Ec.js.map +1 -0
  30. package/dist/{run-CBc896in.cjs → run-BPLW8mrc.cjs} +2 -2
  31. package/dist/{run-CBc896in.cjs.map → run-BPLW8mrc.cjs.map} +1 -1
  32. package/dist/{run-AYlRjIX5.cjs → run-DXEMoDFa.cjs} +12 -5
  33. package/dist/run-DXEMoDFa.cjs.map +1 -0
  34. package/dist/{run-3PgeOZOa.cjs → run-DfpL-1Zz.cjs} +8 -24
  35. package/dist/run-DfpL-1Zz.cjs.map +1 -0
  36. package/dist/{run-BlFVmIJl.js → run-Dv-1NGl-.js} +2 -2
  37. package/dist/{run-BlFVmIJl.js.map → run-Dv-1NGl-.js.map} +1 -1
  38. package/dist/{run-BM1t8CSM.cjs → run-GFI-E4ua.cjs} +2 -2
  39. package/dist/{run-BM1t8CSM.cjs.map → run-GFI-E4ua.cjs.map} +1 -1
  40. package/dist/{run-D_dWNFhX.js → run-WfvBLKQY.js} +2 -2
  41. package/dist/{run-D_dWNFhX.js.map → run-WfvBLKQY.js.map} +1 -1
  42. package/dist/tools-CZT9wSA6.cjs.map +1 -1
  43. package/dist/tools-D0UogMU3.js.map +1 -1
  44. package/dist/{validate-CCX30ZlG.js → validate-CChh84BL.js} +3 -3
  45. package/dist/{validate-CCX30ZlG.js.map → validate-CChh84BL.js.map} +1 -1
  46. package/dist/{validate-B9huRms8.cjs → validate-DmSTe1u3.cjs} +3 -3
  47. package/dist/{validate-B9huRms8.cjs.map → validate-DmSTe1u3.cjs.map} +1 -1
  48. package/package.json +6 -6
  49. package/dist/init-CXsu_xzX.js.map +0 -1
  50. package/dist/init-SPfikrcb.cjs.map +0 -1
  51. package/dist/package-BHgq_42J.cjs.map +0 -1
  52. package/dist/package-D78MBODi.js +0 -6
  53. package/dist/package-D78MBODi.js.map +0 -1
  54. package/dist/run-3PgeOZOa.cjs.map +0 -1
  55. package/dist/run-AYlRjIX5.cjs.map +0 -1
  56. package/dist/run-CMRA1tNF.js.map +0 -1
  57. package/dist/run-D9mQoQHA.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./rolldown-runtime-C0LytTxp.js";
2
- import { r as QUIET_FLAGS, t as Telemetry } from "./Telemetry-uAr3lK_-.js";
3
- import { t as version } from "./package-D78MBODi.js";
2
+ import { r as QUIET_FLAGS, t as Telemetry } from "./Telemetry-CxzkLSdD.js";
3
+ import { t as version } from "./package-BQ8Q4wIC.js";
4
4
  import { parseArgs, styleText } from "node:util";
5
5
  //#region ../../internals/utils/src/cli/renderHelp.ts
6
6
  function formatFlags(name, opt) {
@@ -48,7 +48,7 @@ function renderHelp(def, parentName) {
48
48
  }
49
49
  }
50
50
  //#endregion
51
- //#region ../../internals/utils/src/cli/adapters/nodeAdapter.ts
51
+ //#region ../../internals/utils/src/cli/runCLI.ts
52
52
  function buildParseOptions(def) {
53
53
  const result = { help: {
54
54
  type: "boolean",
@@ -115,91 +115,73 @@ function printRootHelp(programName, version, defs) {
115
115
  console.log(`Run ${styleText("cyan", `${programName} <command> --help`)} for command-specific help.\n`);
116
116
  }
117
117
  /**
118
- * CLI adapter using `node:util parseArgs`. No external dependencies.
119
- */
120
- const nodeAdapter = {
121
- renderHelp(def, parentName) {
122
- renderHelp(def, parentName);
123
- },
124
- async run(defs, argv, opts) {
125
- const { programName, defaultCommandName, version } = opts;
126
- const firstArgIsExecutablePath = (argv[0]?.includes("/") || argv[0]?.includes("\\")) ?? false;
127
- const args = argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv;
128
- if (args[0] === "--version" || args[0] === "-v") {
129
- console.log(version);
130
- process.exit(0);
131
- }
132
- if (args[0] === "--help" || args[0] === "-h") {
133
- printRootHelp(programName, version, defs);
134
- process.exit(0);
135
- }
136
- if (args.length === 0) {
137
- const defaultDef = defs.find((d) => d.name === defaultCommandName);
138
- if (defaultDef?.run) await runCommand(defaultDef, [], programName);
139
- else printRootHelp(programName, version, defs);
140
- return;
141
- }
142
- const [first, ...rest] = args;
143
- const isKnownSubcommand = defs.some((d) => d.name === first);
144
- let def;
145
- let commandArgv;
146
- let parentName;
147
- if (isKnownSubcommand) {
148
- def = defs.find((d) => d.name === first);
149
- commandArgv = rest;
150
- parentName = programName;
151
- } else {
152
- def = defs.find((d) => d.name === defaultCommandName);
153
- commandArgv = args;
154
- parentName = programName;
155
- }
156
- if (!def) {
157
- console.error(`Unknown command: ${first}`);
158
- printRootHelp(programName, version, defs);
159
- process.exit(1);
160
- }
161
- if (def.subCommands?.length) {
162
- const [subName, ...subRest] = commandArgv;
163
- const subDef = def.subCommands.find((s) => s.name === subName);
164
- if (subName === "--help" || subName === "-h") {
165
- renderHelp(def, parentName);
166
- process.exit(0);
167
- }
168
- if (!subDef) {
169
- renderHelp(def, parentName);
170
- process.exit(subName ? 1 : 0);
171
- }
172
- await runCommand(subDef, subRest, `${parentName} ${def.name}`);
173
- return;
174
- }
175
- await runCommand(def, commandArgv, parentName);
176
- }
177
- };
178
- //#endregion
179
- //#region ../../internals/utils/src/cli/createCLI.ts
180
- /**
181
- * Creates a CLI runner bound to a specific adapter.
182
- *
183
- * @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.
184
120
  *
185
121
  * @example
186
122
  * ```ts
187
- * await createCLI().run(commands, process.argv.slice(2), {
123
+ * await runCLI(commands, process.argv, {
188
124
  * programName: 'kubb',
189
125
  * defaultCommandName: 'generate',
190
126
  * version: '5.0.0',
191
127
  * })
192
128
  * ```
193
129
  */
194
- function createCLI(options) {
195
- const adapter = options?.adapter ?? nodeAdapter;
196
- return { run(commands, argv, opts) {
197
- return adapter.run(commands, argv, opts);
198
- } };
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);
199
182
  }
200
183
  //#endregion
201
184
  //#region src/index.ts
202
- const cli = createCLI();
203
185
  /**
204
186
  * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
205
187
  * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
@@ -208,11 +190,11 @@ const cli = createCLI();
208
190
  async function run(argv = process.argv) {
209
191
  const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg));
210
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`);
211
- const { command: generateCommand } = await import("./generate-FRVvwG45.js");
212
- const { command: validateCommand } = await import("./validate-CCX30ZlG.js");
213
- const { command: mcpCommand } = await import("./mcp-X_bUXZSt.js");
214
- const { command: initCommand } = await import("./init-CXsu_xzX.js");
215
- await cli.run([
193
+ const { command: generateCommand } = await import("./generate-CiL6ZDvQ.js");
194
+ const { command: validateCommand } = await import("./validate-CChh84BL.js");
195
+ const { command: mcpCommand } = await import("./mcp-smxWEGCy.js");
196
+ const { command: initCommand } = await import("./init-yda89Wb-.js");
197
+ await runCLI([
216
198
  generateCommand,
217
199
  validateCommand,
218
200
  mcpCommand,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/cli/renderHelp.ts","../../../internals/utils/src/cli/adapters/nodeAdapter.ts","../../../internals/utils/src/cli/createCLI.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 { CLIAdapter, RunOptions } from '../createCLI.ts'\nimport type { CommandDefinition, OptionType, ParsedArgs } from '../defineCommand.ts'\nimport { renderHelp } from '../renderHelp.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: 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 * CLI adapter using `node:util parseArgs`. No external dependencies.\n */\nexport const nodeAdapter: CLIAdapter = {\n renderHelp(def: CommandDefinition, parentName?: string): void {\n renderHelp(def, parentName)\n },\n\n async run(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}\n","import { nodeAdapter } from './adapters/nodeAdapter.ts'\nimport type { CommandDefinition } from './defineCommand.ts'\n\n/**\n * Options passed to every `CLIAdapter.run` invocation.\n */\nexport type RunOptions = {\n programName: string\n defaultCommandName: string\n version: string\n}\n\n/**\n * Interface a CLI adapter must implement to plug into `createCLI`.\n */\nexport type CLIAdapter = {\n run(commands: Array<CommandDefinition>, argv: Array<string>, opts: RunOptions): Promise<void>\n renderHelp(def: CommandDefinition, parentName?: string): void\n}\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: Array<CommandDefinition>, argv: Array<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","import { styleText } from 'node:util'\nimport { createCLI } from '@internals/utils'\nimport { Telemetry } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\nconst cli = createCLI()\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 cli.run([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: '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AC1B,QAAQ,KAAK,CAAC;GAChB;GAEA,IAAI,CAAC,QAAQ;IACX,WAAW,KAAK,UAAU;IAC1B,QAAQ,KAAK,UAAU,IAAI,CAAC;GAC9B;GAEA,MAAM,WAAW,QAAQ,SAAS,GAAG,WAAW,GAAG,IAAI,MAAM;GAC7D;EACF;EAEA,MAAM,WAAW,KAAK,aAAa,UAAU;CAC/C;AACF;;;;;;;;;;;;;;;;;AC3IA,SAAgB,UAAU,SAExB;CACA,MAAM,UAAU,SAAS,WAAW;CAEpC,OAAO,EACL,IAAI,UAAU,MAAM,MAAM;EACxB,OAAO,QAAQ,IAAI,UAAU,MAAM,IAAI;CACzC,EACF;AACF;;;ACtCA,MAAM,MAAM,UAAU;;;;;;AAMtB,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,IAAI,IAAI;EAAC;EAAiB;EAAiB;EAAY;CAAW,GAAG,MAAM;EAC/E,aAAa;EACb,oBAAoB;EACpB;CACF,CAAC;AACH"}
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([generateCommand, validateCommand, mcpCommand, initCommand], argv, {\n programName: 'kubb',\n defaultCommandName: 'generate',\n version,\n })\n}\n"],"mappings":";;;;;AAGA,SAAS,YAAY,MAAc,KAA+B;CAGhE,OAAO,GAFO,IAAI,QAAQ,IAAI,IAAI,MAAM,MAAM,GAE9B,IAAI,OADN,IAAI,SAAS,WAAW,KAAK,IAAI,QAAQ,KAAK,KAAK;AAEnE;;;;;;;;;AAUA,SAAgB,WAAW,KAAwB,YAA2B;CAC5E,MAAM,cAAc,aAAa,GAAG,WAAW,GAAG,IAAI,SAAS,IAAI;CACnE,MAAM,cAAc,IAAI,eAAe,CAAC;CAExC,MAAM,WAAW,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AU,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
1
  require("./rolldown-runtime-Bx3C2hgW.cjs");
2
2
  const require_defineCommand = require("./defineCommand-Bo3yZTWI.cjs");
3
- const require_package = require("./package-BHgq_42J.cjs");
3
+ const require_package = require("./package-DWzrRisS.cjs");
4
4
  //#region src/commands/init.ts
5
5
  const command = require_defineCommand.defineCommand({
6
6
  name: "init",
@@ -9,7 +9,7 @@ const command = require_defineCommand.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 = require_defineCommand.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-AYlRjIX5.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_defineCommand.defineCommand({
50
50
  //#endregion
51
51
  exports.command = command;
52
52
 
53
- //# sourceMappingURL=init-SPfikrcb.cjs.map
53
+ //# sourceMappingURL=init-C_XrK9iu.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-C_XrK9iu.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"}
@@ -1,6 +1,6 @@
1
1
  import "./rolldown-runtime-C0LytTxp.js";
2
2
  import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
3
- import { t as version } from "./package-D78MBODi.js";
3
+ import { t as version } from "./package-BQ8Q4wIC.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-D9mQoQHA.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-CXsu_xzX.js.map
53
+ //# sourceMappingURL=init-yda89Wb-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-yda89Wb-.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,6 +1,6 @@
1
1
  require("./rolldown-runtime-Bx3C2hgW.cjs");
2
2
  const require_defineCommand = require("./defineCommand-Bo3yZTWI.cjs");
3
- const require_package = require("./package-BHgq_42J.cjs");
3
+ const require_package = require("./package-DWzrRisS.cjs");
4
4
  //#region src/commands/mcp.ts
5
5
  const command = require_defineCommand.defineCommand({
6
6
  name: "mcp",
@@ -11,11 +11,11 @@ const command = require_defineCommand.defineCommand({
11
11
  "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
12
12
  ],
13
13
  async run() {
14
- const { run } = await Promise.resolve().then(() => require("./run-BM1t8CSM.cjs"));
14
+ const { run } = await Promise.resolve().then(() => require("./run-GFI-E4ua.cjs"));
15
15
  await run({ version: require_package.version });
16
16
  }
17
17
  });
18
18
  //#endregion
19
19
  exports.command = command;
20
20
 
21
- //# sourceMappingURL=mcp-nTCEwXRZ.cjs.map
21
+ //# sourceMappingURL=mcp-bQcjXZVn.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-nTCEwXRZ.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"}
1
+ {"version":3,"file":"mcp-bQcjXZVn.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"}
@@ -1,6 +1,6 @@
1
1
  import "./rolldown-runtime-C0LytTxp.js";
2
2
  import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
3
- import { t as version } from "./package-D78MBODi.js";
3
+ import { t as version } from "./package-BQ8Q4wIC.js";
4
4
  //#region src/commands/mcp.ts
5
5
  const command = defineCommand({
6
6
  name: "mcp",
@@ -11,11 +11,11 @@ const command = defineCommand({
11
11
  "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
12
12
  ],
13
13
  async run() {
14
- const { run } = await import("./run-BlFVmIJl.js");
14
+ const { run } = await import("./run-Dv-1NGl-.js");
15
15
  await run({ version });
16
16
  }
17
17
  });
18
18
  //#endregion
19
19
  export { command };
20
20
 
21
- //# sourceMappingURL=mcp-X_bUXZSt.js.map
21
+ //# sourceMappingURL=mcp-smxWEGCy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-X_bUXZSt.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"}
1
+ {"version":3,"file":"mcp-smxWEGCy.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,6 @@
1
+ //#region package.json
2
+ var version = "5.0.0-beta.74";
3
+ //#endregion
4
+ export { version as t };
5
+
6
+ //# sourceMappingURL=package-BQ8Q4wIC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-BQ8Q4wIC.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "5.0.0-beta.72";
2
+ var version = "5.0.0-beta.74";
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-BHgq_42J.cjs.map
11
+ //# sourceMappingURL=package-DWzrRisS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-DWzrRisS.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import "./rolldown-runtime-C0LytTxp.js";
2
2
  import { n as toCause, r as toError } from "./errors-Dc_d7BfX.js";
3
- import { a as runtime, i as WATCHER_IGNORED_PATHS, n as KUBB_NPM_PACKAGE_URL, o as canUseTTY, t as Telemetry } from "./Telemetry-uAr3lK_-.js";
3
+ import { a as canUseTTY, i as WATCHER_IGNORED_PATHS, n as KUBB_NPM_PACKAGE_URL, t as Telemetry } from "./Telemetry-CxzkLSdD.js";
4
4
  import { i as linters, n as detectTool, r as formatters } from "./tools-D0UogMU3.js";
5
- import { t as version } from "./package-D78MBODi.js";
5
+ import { t as version } from "./package-BQ8Q4wIC.js";
6
6
  import { styleText } from "node:util";
7
7
  import { EventEmitter } from "node:events";
8
8
  import { hash } from "node:crypto";
@@ -11,7 +11,6 @@ import path, { basename, dirname, relative, resolve } from "node:path";
11
11
  import process$1 from "node:process";
12
12
  import * as clack from "@clack/prompts";
13
13
  import { Diagnostics, cliReporter, createKubb, logLevel } from "@kubb/core";
14
- import { pathToFileURL } from "node:url";
15
14
  import { createJiti } from "jiti";
16
15
  import { NonZeroExitError, x } from "tinyexec";
17
16
  import { loadConfig } from "unconfig";
@@ -876,12 +875,9 @@ const JITI_OPTIONS = {
876
875
  moduleCache: false
877
876
  };
878
877
  /**
879
- * Creates a runtime-aware loader for Kubb's TypeScript and JavaScript config modules.
878
+ * Creates a jiti-based loader for Kubb's TypeScript and JavaScript config modules.
880
879
  *
881
- * On Bun and Deno it imports the file natively, skipping jiti's transform step, and falls back to
882
- * jiti only when the native import throws. On Node it always uses jiti, which transpiles TypeScript
883
- * and the `@kubb/renderer-jsx` JSX runtime on the fly. The jiti instance is created lazily, so the
884
- * Bun/Deno happy path never pays for it.
880
+ * jiti transpiles TypeScript and the `@kubb/renderer-jsx` JSX runtime on the fly.
885
881
  *
886
882
  * @example
887
883
  * ```ts
@@ -889,21 +885,9 @@ const JITI_OPTIONS = {
889
885
  * ```
890
886
  */
891
887
  function createModuleLoader() {
892
- let jiti;
893
- const getJiti = () => jiti ??= createJiti(import.meta.url, JITI_OPTIONS);
894
- const viaJiti = (filePath, options) => options?.default ? getJiti().import(filePath, { default: true }) : getJiti().import(filePath);
895
- const viaNative = async (filePath, options) => {
896
- const href = pathToFileURL(filePath).href;
897
- const mod = await (options?.bust != null ? import(`${href}?t=${options.bust}`) : import(href));
898
- return options?.default ? mod.default ?? mod : mod;
899
- };
900
- return { async load(filePath, options) {
901
- if (runtime.isBun || runtime.isDeno) try {
902
- return await viaNative(filePath, options);
903
- } catch {
904
- return viaJiti(filePath, options);
905
- }
906
- return viaJiti(filePath, options);
888
+ const jiti = createJiti(import.meta.url, JITI_OPTIONS);
889
+ return { load(filePath, options) {
890
+ return options?.default ? jiti.import(filePath, { default: true }) : jiti.import(filePath);
907
891
  } };
908
892
  }
909
893
  //#endregion
@@ -1374,4 +1358,4 @@ async function run({ input, configPath, logLevel: logLevelKey, watch, reporters:
1374
1358
  //#endregion
1375
1359
  export { run };
1376
1360
 
1377
- //# sourceMappingURL=run-CMRA1tNF.js.map
1361
+ //# sourceMappingURL=run-1UJGpleM.js.map