@kubb/cli 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{Telemetry-bGdFBaGt.cjs → Telemetry-CDyZhMHb.cjs} +2 -2
  2. package/dist/{Telemetry-bGdFBaGt.cjs.map → Telemetry-CDyZhMHb.cjs.map} +1 -1
  3. package/dist/{Telemetry-RBcAjNxj.js → Telemetry-WZD1Le7A.js} +2 -2
  4. package/dist/{Telemetry-RBcAjNxj.js.map → Telemetry-WZD1Le7A.js.map} +1 -1
  5. package/dist/{background-0PMj56FJ.js → background-CQmrmXMz.js} +3 -7
  6. package/dist/background-CQmrmXMz.js.map +1 -0
  7. package/dist/{background-R0T_7Szu.cjs → background-Ch3napsn.cjs} +2 -2
  8. package/dist/background-Ch3napsn.cjs.map +1 -0
  9. package/dist/background-D7IE4acj.js +2 -0
  10. package/dist/{commands-Si-RFAS6.cjs → commands-CCMgXgwc.cjs} +31 -15
  11. package/dist/commands-CCMgXgwc.cjs.map +1 -0
  12. package/dist/{commands-BAgGrcvc.js → commands-ECaVqjMu.js} +31 -15
  13. package/dist/commands-ECaVqjMu.js.map +1 -0
  14. package/dist/{config-ByfJSj3q.cjs → config-B2BlaYOU.cjs} +2 -2
  15. package/dist/{config-ByfJSj3q.cjs.map → config-B2BlaYOU.cjs.map} +1 -1
  16. package/dist/{config-8Xl4yZmw.js → config-CCxOcwWu.js} +3 -3
  17. package/dist/{config-8Xl4yZmw.js.map → config-CCxOcwWu.js.map} +1 -1
  18. package/dist/index.cjs +13 -19
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +13 -19
  21. package/dist/index.js.map +1 -1
  22. package/dist/{output-B6Ondw0g.js → output-CnSY0tCG.js} +12 -22
  23. package/dist/output-CnSY0tCG.js.map +1 -0
  24. package/dist/{output-i3s5c4Xu.cjs → output-gox62nKo.cjs} +11 -21
  25. package/dist/output-gox62nKo.cjs.map +1 -0
  26. package/dist/{run-yvuot2N9.cjs → run-3xcH2h63.cjs} +2 -2
  27. package/dist/{run-yvuot2N9.cjs.map → run-3xcH2h63.cjs.map} +1 -1
  28. package/dist/{run-D8Wz_17X.cjs → run-BIK3c6u-.cjs} +68 -139
  29. package/dist/run-BIK3c6u-.cjs.map +1 -0
  30. package/dist/{run-3I2NPeXG.cjs → run-BKHV1Apt.cjs} +2 -2
  31. package/dist/{run-3I2NPeXG.cjs.map → run-BKHV1Apt.cjs.map} +1 -1
  32. package/dist/{run-DQoKTiGk.js → run-BP_Z7A4e.js} +2 -2
  33. package/dist/{run-DQoKTiGk.js.map → run-BP_Z7A4e.js.map} +1 -1
  34. package/dist/{run-BkLJ5mXn.cjs → run-BvKVx0qs.cjs} +2 -2
  35. package/dist/{run-BkLJ5mXn.cjs.map → run-BvKVx0qs.cjs.map} +1 -1
  36. package/dist/{run-CmNDNEjR.js → run-DAYWA84e.js} +9 -6
  37. package/dist/run-DAYWA84e.js.map +1 -0
  38. package/dist/{run-CZlkqkDc.js → run-J7ekQ_kc.js} +2 -2
  39. package/dist/{run-CZlkqkDc.js.map → run-J7ekQ_kc.js.map} +1 -1
  40. package/dist/{run-Dgph0WYk.js → run-TsXMXWSj.js} +73 -132
  41. package/dist/run-TsXMXWSj.js.map +1 -0
  42. package/dist/{run-t8nm7zcT.cjs → run-UY0fzPon.cjs} +9 -6
  43. package/dist/run-UY0fzPon.cjs.map +1 -0
  44. package/dist/{run-D5AeacqK.js → run-sM7YjAc9.js} +2 -2
  45. package/dist/{run-D5AeacqK.js.map → run-sM7YjAc9.js.map} +1 -1
  46. package/dist/{snapshot-CkHXR0Nl.js → snapshot-7yPYU6ol.js} +68 -136
  47. package/dist/snapshot-7yPYU6ol.js.map +1 -0
  48. package/dist/{snapshot-D4nKbwkw.cjs → snapshot-Bi1Jy0hs.cjs} +66 -134
  49. package/dist/snapshot-Bi1Jy0hs.cjs.map +1 -0
  50. package/dist/studioWorker.js +3 -9
  51. package/dist/studioWorker.js.map +1 -1
  52. package/package.json +8 -12
  53. package/dist/background-0PMj56FJ.js.map +0 -1
  54. package/dist/background-BqS01QDb.js +0 -2
  55. package/dist/background-R0T_7Szu.cjs.map +0 -1
  56. package/dist/commands-BAgGrcvc.js.map +0 -1
  57. package/dist/commands-Si-RFAS6.cjs.map +0 -1
  58. package/dist/output-B6Ondw0g.js.map +0 -1
  59. package/dist/output-i3s5c4Xu.cjs.map +0 -1
  60. package/dist/run-CmNDNEjR.js.map +0 -1
  61. package/dist/run-D8Wz_17X.cjs.map +0 -1
  62. package/dist/run-Dgph0WYk.js.map +0 -1
  63. package/dist/run-t8nm7zcT.cjs.map +0 -1
  64. package/dist/snapshot-CkHXR0Nl.js.map +0 -1
  65. package/dist/snapshot-D4nKbwkw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"config-8Xl4yZmw.js","names":[],"sources":["../../../internals/shared/src/loader.ts","../src/loggers/reporters.ts","../src/config.ts"],"sourcesContent":["import { createJiti } from 'jiti'\n\n/**\n * jiti options for loading Kubb config modules: the automatic JSX runtime pointed at\n * `@kubb/renderer-jsx`, and `moduleCache` off so a re-load re-evaluates the file.\n */\nconst JITI_OPTIONS = {\n jsx: { runtime: 'automatic', importSource: '@kubb/renderer-jsx' },\n moduleCache: false,\n} satisfies Parameters<typeof createJiti>[1]\n\n/**\n * Per-call options for {@link ModuleLoader.load}.\n */\ntype LoadModuleOptions = {\n /**\n * Return the module's default export instead of the full namespace.\n */\n default?: boolean\n}\n\n/**\n * Loads `.ts`/`.js` modules via jiti.\n */\ntype ModuleLoader = {\n load<T = unknown>(filePath: string, options?: LoadModuleOptions): Promise<T>\n}\n\n/**\n * Creates a jiti-based loader for Kubb's TypeScript and JavaScript config modules.\n *\n * jiti transpiles TypeScript and the `@kubb/renderer-jsx` JSX runtime on the fly.\n *\n * @example\n * ```ts\n * const config = await createModuleLoader().load('/abs/kubb.config.ts', { default: true })\n * ```\n */\nexport function createModuleLoader(): ModuleLoader {\n const jiti = createJiti(import.meta.url, JITI_OPTIONS)\n\n return {\n load<T>(filePath: string, options?: LoadModuleOptions) {\n return (options?.default ? jiti.import(filePath, { default: true }) : jiti.import(filePath)) as Promise<T>\n },\n }\n}\n","import process from 'node:process'\nimport type { Config, Hookable, KubbHooks, Reporter, ReporterContext, ReporterPluginFiles } from '@kubb/core'\nimport { createCliReporter } from '@kubb/core'\nimport { isRichOutput } from '../utils/env.ts'\nimport type { Logger, LoggerOptions } from './defineLogger.ts'\nimport { clackLogger } from './clackLogger.ts'\nimport { plainLogger } from './plainLogger.ts'\n\n/** Bridges a {@link Reporter} onto the hook emitter: calls `report` with each config's {@link GenerationResult} on `kubb:generation:end`. */\nfunction installReporter(context: Hookable<KubbHooks>, reporter: Reporter, ctx: ReporterContext): void {\n const pluginFiles = reporter.needsPluginFiles ? new Map<Config, Map<string, Set<string>>>() : undefined\n\n if (pluginFiles) {\n context.hook('kubb:plugin:end', ({ config, plugin, files }) => {\n const filesByPlugin = pluginFiles.get(config) ?? new Map<string, Set<string>>()\n const seen = new Set([...filesByPlugin.values()].flatMap((paths) => [...paths]))\n const added = files.filter((file) => !seen.has(file.path)).map((file) => file.path)\n\n if (added.length) filesByPlugin.set(plugin.name, new Set([...(filesByPlugin.get(plugin.name) ?? []), ...added]))\n\n pluginFiles.set(config, filesByPlugin)\n })\n }\n\n context.hook('kubb:generation:end', async ({ config, diagnostics = [], filesCreated = 0, status = 'success', hrStart = process.hrtime() }) => {\n const files = pluginFiles?.get(config)\n const grouped: ReporterPluginFiles | undefined = files && [...files].map(([plugin, paths]) => ({ plugin, files: [...paths] }))\n\n await reporter.report({ config, diagnostics, filesCreated, status, hrStart, pluginFiles: grouped }, ctx)\n\n pluginFiles?.delete(config)\n })\n\n if (reporter.drain) {\n context.hook('kubb:lifecycle:end', () => reporter.drain?.(ctx))\n }\n}\n\n/** Installs the live logger and wires the selected reporters. `cli` renders its summary through the logger, and is skipped when `json` owns stdout. */\nfunction setupReporters(\n context: Hookable<KubbHooks>,\n {\n logLevel,\n reporters,\n logger: forcedLogger,\n }: LoggerOptions & {\n reporters: ReadonlyArray<Reporter>\n /** Overrides the terminal-based pick, e.g. the plain logger for `kubb studio snapshot`. */\n logger?: Logger\n },\n): void {\n const hasJson = reporters.some((reporter) => reporter.name === 'json')\n const ctx: ReporterContext = { logLevel }\n\n for (const reporter of reporters) {\n if (reporter.name !== 'cli') {\n installReporter(context, reporter, ctx)\n continue\n }\n\n if (hasJson) {\n continue\n }\n\n const logger = forcedLogger ?? (isRichOutput() ? clackLogger : plainLogger)\n const handle = logger(context, { logLevel })\n\n // The summary belongs inside the group the logger opened for this config, so the logger writes it.\n installReporter(context, createCliReporter({ render: handle?.renderSummary }), ctx)\n }\n}\n\nexport default setupReporters\n\n/** Picks the reporters whose `name` is in `names`, in the given order (the CLI maps `--reporter` to this); duplicates and unknown names are skipped. */\nexport function selectReporters(reporters: ReadonlyArray<Reporter>, names: ReadonlyArray<string>): Array<Reporter> {\n return [...new Set(names)].flatMap((name) => reporters.find((reporter) => reporter.name === name) ?? [])\n}\n","import { basename, dirname, resolve } from 'node:path'\nimport process from 'node:process'\nimport { createModuleLoader } from '@internals/shared'\nimport type { CLIOptions, Config, PossibleConfig } from '@kubb/core'\nimport { type LoadConfigResult, type LoadConfigSource, loadConfig } from 'unconfig'\n\nconst loader = createModuleLoader()\n\n// Kubb configs are JS/TS modules (they call `defineConfig`/`pluginX()`), so YAML and JSON are not\n// supported. The jiti loader handles every module format and the JSX runtime, returning the default export.\nconst tsLoader = (configFile: string) => loader.load(configFile, { default: true })\n\nconst MODULE_NAME = 'kubb'\n\nconst SEARCH_FILES = ['', '.config/', 'configs/'].flatMap((prefix) => [`${prefix}.${MODULE_NAME}rc`, `${prefix}${MODULE_NAME}.config`])\nconst SEARCH_EXTENSIONS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs']\n\ntype GetConfigsOptions = {\n /** Explicit path to the Kubb config file. When omitted, the loader searches up from `process.cwd()`. */\n configPath?: string\n /** OpenAPI input path or URL that overrides `config.input` for this run. */\n input?: string\n /** Watch flag forwarded to the user's `defineConfig` function. */\n watch?: boolean\n /** Log level forwarded to the user's `defineConfig` function. */\n logLevel?: CLIOptions['logLevel']\n}\n\ntype GetConfigsResult = {\n /** Absolute path to the resolved config file. */\n configPath: string\n /** Resolved and normalized Kubb configs, each guaranteed to have a `plugins` array. */\n configs: Array<Config>\n}\n\n/** Discovers the Kubb config and resolves it into normalized configs, each guaranteed to have a `plugins` array. */\nexport async function getConfigs({ configPath, input, watch, logLevel }: GetConfigsOptions): Promise<GetConfigsResult> {\n const abs = configPath ? resolve(configPath) : undefined\n const sources: Array<LoadConfigSource<unknown>> = abs\n ? [{ files: [basename(abs)], extensions: [], parser: tsLoader }]\n : [{ files: SEARCH_FILES, extensions: SEARCH_EXTENSIONS, parser: tsLoader }]\n\n let result: LoadConfigResult<unknown>\n try {\n result = await loadConfig<unknown>({ cwd: abs ? dirname(abs) : process.cwd(), sources, merge: false })\n } catch (error) {\n throw new Error('Config failed loading', { cause: error })\n }\n\n const [filepath] = result.sources\n if (!result.config || !filepath) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n const config = result.config as PossibleConfig<CLIOptions>\n const cli: CLIOptions = { config: configPath, input, watch, logLevel }\n const resolved = await (typeof config === 'function' ? config(cli) : config)\n const userConfigs = Array.isArray(resolved) ? resolved : [resolved]\n\n return {\n configPath: filepath,\n configs: userConfigs.map((item) => {\n const config: Config = { ...item, plugins: item.plugins ?? [] }\n return config\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;;AAMA,MAAM,eAAe;CACnB,KAAK;EAAE,SAAS;EAAa,cAAc;CAAqB;CAChE,aAAa;AACf;;;;;;;;;;;AA6BA,SAAgB,qBAAmC;CACjD,MAAM,OAAO,WAAW,YAAY,KAAK,YAAY;CAErD,OAAO,EACL,KAAQ,UAAkB,SAA6B;EACrD,OAAQ,SAAS,UAAU,KAAK,OAAO,UAAU,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IAAI,QAAQ,IAAI;GAAG;GAAS,OAAO;EAAM,CAAC;CACvG,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,yBAAyB,EAAE,OAAO,MAAM,CAAC;CAC3D;CAEA,MAAM,CAAC,YAAY,OAAO;CAC1B,IAAI,CAAC,OAAO,UAAU,CAAC,UACrB,MAAM,IAAI,MAAM,kGAAkG;CAGpH,MAAM,SAAS,OAAO;CAEtB,MAAM,WAAW,OAAO,OAAO,WAAW,aAAa,OAAO;EADpC,QAAQ;EAAY;EAAO;EAAO;CACI,CAAC,IAAI;CAGrE,OAAO;EACL,YAAY;EACZ,UAJkB,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAAA,CAI3C,KAAK,SAAS;GAEjC,OAAO;IADkB,GAAG;IAAM,SAAS,KAAK,WAAW,CAAC;GAChD;EACd,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"config-CCxOcwWu.js","names":[],"sources":["../../../internals/shared/src/loader.ts","../src/loggers/reporters.ts","../src/config.ts"],"sourcesContent":["import { createJiti } from 'jiti'\n\n/**\n * jiti options for loading Kubb config modules: the automatic JSX runtime pointed at\n * `@kubb/renderer-jsx`, and `moduleCache` off so a re-load re-evaluates the file.\n */\nconst JITI_OPTIONS = {\n jsx: { runtime: 'automatic', importSource: '@kubb/renderer-jsx' },\n moduleCache: false,\n} satisfies Parameters<typeof createJiti>[1]\n\n/**\n * Per-call options for {@link ModuleLoader.load}.\n */\ntype LoadModuleOptions = {\n /**\n * Return the module's default export instead of the full namespace.\n */\n default?: boolean\n}\n\n/**\n * Loads `.ts`/`.js` modules via jiti.\n */\ntype ModuleLoader = {\n load<T = unknown>(filePath: string, options?: LoadModuleOptions): Promise<T>\n}\n\n/**\n * Creates a jiti-based loader for Kubb's TypeScript and JavaScript config modules.\n *\n * jiti transpiles TypeScript and the `@kubb/renderer-jsx` JSX runtime on the fly.\n *\n * @example\n * ```ts\n * const config = await createModuleLoader().load('/abs/kubb.config.ts', { default: true })\n * ```\n */\nexport function createModuleLoader(): ModuleLoader {\n const jiti = createJiti(import.meta.url, JITI_OPTIONS)\n\n return {\n load<T>(filePath: string, options?: LoadModuleOptions) {\n return (options?.default ? jiti.import(filePath, { default: true }) : jiti.import(filePath)) as Promise<T>\n },\n }\n}\n","import process from 'node:process'\nimport type { Config, Hookable, KubbHooks, Reporter, ReporterContext, ReporterPluginFiles } from '@kubb/core'\nimport { createCliReporter } from '@kubb/core'\nimport { isRichOutput } from '../utils/env.ts'\nimport type { Logger, LoggerOptions } from './defineLogger.ts'\nimport { clackLogger } from './clackLogger.ts'\nimport { plainLogger } from './plainLogger.ts'\n\n/** Bridges a {@link Reporter} onto the hook emitter: calls `report` with each config's {@link GenerationResult} on `kubb:generation:end`. */\nfunction installReporter(context: Hookable<KubbHooks>, reporter: Reporter, ctx: ReporterContext): void {\n const pluginFiles = reporter.needsPluginFiles ? new Map<Config, Map<string, Set<string>>>() : undefined\n\n if (pluginFiles) {\n context.hook('kubb:plugin:end', ({ config, plugin, files }) => {\n const filesByPlugin = pluginFiles.get(config) ?? new Map<string, Set<string>>()\n const seen = new Set([...filesByPlugin.values()].flatMap((paths) => [...paths]))\n const added = files.filter((file) => !seen.has(file.path)).map((file) => file.path)\n\n if (added.length) filesByPlugin.set(plugin.name, new Set([...(filesByPlugin.get(plugin.name) ?? []), ...added]))\n\n pluginFiles.set(config, filesByPlugin)\n })\n }\n\n context.hook('kubb:generation:end', async ({ config, diagnostics = [], filesCreated = 0, status = 'success', hrStart = process.hrtime() }) => {\n const files = pluginFiles?.get(config)\n const grouped: ReporterPluginFiles | undefined = files && [...files].map(([plugin, paths]) => ({ plugin, files: [...paths] }))\n\n await reporter.report({ config, diagnostics, filesCreated, status, hrStart, pluginFiles: grouped }, ctx)\n\n pluginFiles?.delete(config)\n })\n\n if (reporter.drain) {\n context.hook('kubb:lifecycle:end', () => reporter.drain?.(ctx))\n }\n}\n\n/** Installs the live logger and wires the selected reporters. `cli` renders its summary through the logger, and is skipped when `json` owns stdout. */\nfunction setupReporters(\n context: Hookable<KubbHooks>,\n {\n logLevel,\n reporters,\n logger: forcedLogger,\n }: LoggerOptions & {\n reporters: ReadonlyArray<Reporter>\n /** Overrides the terminal-based pick, e.g. the plain logger for `kubb studio snapshot`. */\n logger?: Logger\n },\n): void {\n const hasJson = reporters.some((reporter) => reporter.name === 'json')\n const ctx: ReporterContext = { logLevel }\n\n for (const reporter of reporters) {\n if (reporter.name !== 'cli') {\n installReporter(context, reporter, ctx)\n continue\n }\n\n if (hasJson) {\n continue\n }\n\n const logger = forcedLogger ?? (isRichOutput() ? clackLogger : plainLogger)\n const handle = logger(context, { logLevel })\n\n // The summary belongs inside the group the logger opened for this config, so the logger writes it.\n installReporter(context, createCliReporter({ render: handle?.renderSummary }), ctx)\n }\n}\n\nexport default setupReporters\n\n/** Picks the reporters whose `name` is in `names`, in the given order (the CLI maps `--reporter` to this); duplicates and unknown names are skipped. */\nexport function selectReporters(reporters: ReadonlyArray<Reporter>, names: ReadonlyArray<string>): Array<Reporter> {\n return [...new Set(names)].flatMap((name) => reporters.find((reporter) => reporter.name === name) ?? [])\n}\n","import { basename, dirname, resolve } from 'node:path'\nimport process from 'node:process'\nimport { createModuleLoader } from '@internals/shared'\nimport type { CLIOptions, Config, PossibleConfig } from '@kubb/core'\nimport { type LoadConfigResult, type LoadConfigSource, loadConfig } from 'unconfig'\n\nconst loader = createModuleLoader()\n\n// Kubb configs are JS/TS modules (they call `defineConfig`/`pluginX()`), so YAML and JSON are not\n// supported. The jiti loader handles every module format and the JSX runtime, returning the default export.\nconst tsLoader = (configFile: string) => loader.load(configFile, { default: true })\n\nconst MODULE_NAME = 'kubb'\n\nconst SEARCH_FILES = ['', '.config/', 'configs/'].flatMap((prefix) => [`${prefix}.${MODULE_NAME}rc`, `${prefix}${MODULE_NAME}.config`])\nconst SEARCH_EXTENSIONS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs']\n\ntype GetConfigsOptions = {\n /** Explicit path to the Kubb config file. When omitted, the loader searches up from `process.cwd()`. */\n configPath?: string\n /** OpenAPI input path or URL that overrides `config.input` for this run. */\n input?: string\n /** Watch flag forwarded to the user's `defineConfig` function. */\n watch?: boolean\n /** Log level forwarded to the user's `defineConfig` function. */\n logLevel?: CLIOptions['logLevel']\n}\n\ntype GetConfigsResult = {\n /** Absolute path to the resolved config file. */\n configPath: string\n /** Resolved and normalized Kubb configs, each guaranteed to have a `plugins` array. */\n configs: Array<Config>\n}\n\n/** Discovers the Kubb config and resolves it into normalized configs, each guaranteed to have a `plugins` array. */\nexport async function getConfigs({ configPath, input, watch, logLevel }: GetConfigsOptions): Promise<GetConfigsResult> {\n const abs = configPath ? resolve(configPath) : undefined\n const sources: Array<LoadConfigSource<unknown>> = abs\n ? [{ files: [basename(abs)], extensions: [], parser: tsLoader }]\n : [{ files: SEARCH_FILES, extensions: SEARCH_EXTENSIONS, parser: tsLoader }]\n\n let result: LoadConfigResult<unknown>\n try {\n result = await loadConfig<unknown>({ cwd: abs ? dirname(abs) : process.cwd(), sources, merge: false })\n } catch (error) {\n throw new Error('Config failed loading', { cause: error })\n }\n\n const [filepath] = result.sources\n if (!result.config || !filepath) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n const config = result.config as PossibleConfig<CLIOptions>\n const cli: CLIOptions = { config: configPath, input, watch, logLevel }\n const resolved = await (typeof config === 'function' ? config(cli) : config)\n const userConfigs = Array.isArray(resolved) ? resolved : [resolved]\n\n return {\n configPath: filepath,\n configs: userConfigs.map((item) => {\n const config: Config = { ...item, plugins: item.plugins ?? [] }\n return config\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;;AAMA,MAAM,eAAe;CACnB,KAAK;EAAE,SAAS;EAAa,cAAc;CAAqB;CAChE,aAAa;AACf;;;;;;;;;;;AA6BA,SAAgB,qBAAmC;CACjD,MAAM,OAAO,WAAW,YAAY,KAAK,YAAY;CAErD,OAAO,EACL,KAAQ,UAAkB,SAA6B;EACrD,OAAQ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;GAAE,KAAK,MAAM,QAAQ,GAAG,IAAI,QAAQ,IAAI;GAAG;GAAS,OAAO;EAAM,CAAC;CACvG,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,yBAAyB,EAAE,OAAO,MAAM,CAAC;CAC3D;CAEA,MAAM,CAAC,YAAY,OAAO;CAC1B,IAAI,CAAC,OAAO,UAAU,CAAC,UACrB,MAAM,IAAI,MAAM,kGAAkG;CAGpH,MAAM,SAAS,OAAO;CAEtB,MAAM,WAAW,OAAO,OAAO,WAAW,aAAa,OAAO;EADpC,QAAQ;EAAY;EAAO;EAAO;CACI,CAAC,IAAI;CAGrE,OAAO;EACL,YAAY;EACZ,UAJkB,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAAA,CAI3C,KAAK,SAAS;GAEjC,OAAO;IADkB,GAAG;IAAM,SAAS,KAAK,WAAW,CAAC;GAChD;EACd,CAAC;CACH;AACF"}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_agent = require("./agent-DElUuYuy.cjs");
3
- const require_Telemetry = require("./Telemetry-bGdFBaGt.cjs");
3
+ const require_Telemetry = require("./Telemetry-CDyZhMHb.cjs");
4
4
  let node_util = require("node:util");
5
5
  let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
6
6
  _gunshi_plugin_dryrun = require_agent.__toESM(_gunshi_plugin_dryrun, 1);
@@ -133,7 +133,7 @@ const command$10 = (0, gunshi.defineWithTypes)()({
133
133
  async run(ctx) {
134
134
  const { values } = ctx;
135
135
  const logLevel = resolveLogLevel(values);
136
- const { run } = await Promise.resolve().then(() => require("./run-t8nm7zcT.cjs"));
136
+ const { run } = await Promise.resolve().then(() => require("./run-UY0fzPon.cjs"));
137
137
  await run({
138
138
  input: values.input,
139
139
  configPath: values.config,
@@ -184,7 +184,7 @@ const command$9 = (0, gunshi.defineWithTypes)()({
184
184
  },
185
185
  async run(ctx) {
186
186
  const { values } = ctx;
187
- const { run } = await Promise.resolve().then(() => require("./run-BkLJ5mXn.cjs"));
187
+ const { run } = await Promise.resolve().then(() => require("./run-BvKVx0qs.cjs"));
188
188
  await run({
189
189
  yes: values.yes,
190
190
  version: require_Telemetry.version,
@@ -207,7 +207,7 @@ const command$8 = (0, gunshi.define)({
207
207
  "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
208
208
  ].join("\n"),
209
209
  async run() {
210
- const { run } = await Promise.resolve().then(() => require("./run-3I2NPeXG.cjs"));
210
+ const { run } = await Promise.resolve().then(() => require("./run-BKHV1Apt.cjs"));
211
211
  await run();
212
212
  }
213
213
  });
@@ -236,7 +236,7 @@ const command$7 = (0, gunshi.define)({
236
236
  ...logLevelArg
237
237
  },
238
238
  async run(ctx) {
239
- const { connectRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
239
+ const { connectRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
240
240
  await connectRunner(ctx);
241
241
  }
242
242
  });
@@ -249,7 +249,7 @@ const command$6 = (0, gunshi.define)({
249
249
  toKebab: true,
250
250
  args: command$7.args,
251
251
  async run(ctx) {
252
- const { loginRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
252
+ const { loginRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
253
253
  await loginRunner(ctx);
254
254
  }
255
255
  });
@@ -267,7 +267,7 @@ const command$5 = (0, gunshi.define)({
267
267
  ...logLevelArg
268
268
  },
269
269
  async run(ctx) {
270
- const { logoutRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
270
+ const { logoutRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
271
271
  await logoutRunner(ctx);
272
272
  }
273
273
  });
@@ -281,7 +281,6 @@ const command$4 = (0, gunshi.define)({
281
281
  args: {
282
282
  ...configArg,
283
283
  ...studioConnectionArgs,
284
- ...studioPermissionArgs,
285
284
  id: {
286
285
  type: "string",
287
286
  description: "Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI"
@@ -300,11 +299,6 @@ const command$4 = (0, gunshi.define)({
300
299
  description: "Package version for the generated tarball. Defaults to the version in package.json",
301
300
  toKebab: true
302
301
  },
303
- timeout: {
304
- type: "number",
305
- description: "Seconds to wait for the job to finish",
306
- default: 600
307
- },
308
302
  json: {
309
303
  type: "boolean",
310
304
  description: "Print the result as one JSON object instead of a summary",
@@ -313,7 +307,7 @@ const command$4 = (0, gunshi.define)({
313
307
  ...logLevelArg
314
308
  },
315
309
  async run(ctx) {
316
- const { runner } = await Promise.resolve().then(() => require("./snapshot-D4nKbwkw.cjs"));
310
+ const { runner } = await Promise.resolve().then(() => require("./snapshot-Bi1Jy0hs.cjs"));
317
311
  await runner(ctx);
318
312
  }
319
313
  });
@@ -325,7 +319,7 @@ const command$3 = (0, gunshi.define)({
325
319
  toKebab: true,
326
320
  args: command$7.args,
327
321
  async run(ctx) {
328
- const { startRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
322
+ const { startRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
329
323
  await startRunner(ctx);
330
324
  }
331
325
  });
@@ -333,7 +327,7 @@ const stopCommand = (0, gunshi.define)({
333
327
  name: "stop",
334
328
  description: "Stop this project's background connection and keep its pairing.",
335
329
  async run() {
336
- const { stopRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
330
+ const { stopRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
337
331
  await stopRunner();
338
332
  }
339
333
  });
@@ -351,7 +345,7 @@ const command$2 = (0, gunshi.define)({
351
345
  ...logLevelArg
352
346
  },
353
347
  async run(ctx) {
354
- const { statusRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
348
+ const { statusRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
355
349
  await statusRunner(ctx);
356
350
  }
357
351
  });
@@ -371,7 +365,7 @@ const command$1 = (0, gunshi.define)({
371
365
  toKebab: true,
372
366
  args: command$7.args,
373
367
  async run(ctx) {
374
- const { connectRunner } = await Promise.resolve().then(() => require("./commands-Si-RFAS6.cjs"));
368
+ const { connectRunner } = await Promise.resolve().then(() => require("./commands-CCMgXgwc.cjs"));
375
369
  await connectRunner(ctx);
376
370
  },
377
371
  subCommands: {
@@ -410,7 +404,7 @@ const command = (0, gunshi.define)({
410
404
  required: true
411
405
  } },
412
406
  async run({ values }) {
413
- const { run } = await Promise.resolve().then(() => require("./run-yvuot2N9.cjs"));
407
+ const { run } = await Promise.resolve().then(() => require("./run-3xcH2h63.cjs"));
414
408
  await run({ input: values.input });
415
409
  }
416
410
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["command","defineWithTypes","dryRunId","command","defineWithTypes","dryRunId","command","define","command","define","command","define","connectCommand","command","define","command","define","command","define","connectCommand","command","define","command","define","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","define","styleText","isTelemetryDisabled","styleText","cli","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand","dryrun"],"sources":["../src/commands/shared.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n timeout: {\n type: 'number',\n description: 'Seconds to wait for the job to finish',\n default: 600,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, 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 args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS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AA,GAAGC,UAAAA,UAAAA,CAAU,UAAU,UAAU,EAAE,KAAK,KAAK,wBAAwB,YAAY,cAAc,KAAK,4CACtG;EAEA,OAAO,KAAK,cAAc,QAAQ,MAAM;CAC1C,CAAC;AACH;;;;ACzBA,MAAM,8BAAc,IAAI,IAAY;CAAC;CAAU;CAAM;CAAa;CAAM;AAAQ,CAAC;;;;;;AAOjF,SAAS,cAAc,MAAoC;CACzD,MAAM,4BAA4B,KAAK,EAAE,EAAE,SAAS,GAAG,KAAK,KAAK,EAAE,EAAE,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;;AAOA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,OAAO,iBAAiB,uBAAuB,cAAc,IAAI,CAAC,CAAC;CACzE,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAG3D,IAAI,CAACC,kBAAAA,WAAoB,KAAK,CAAC,aAC7B,QAAQ,MACN,IAAA,GAAGC,UAAAA,UAAAA,CAAU,UAAU,SAAS,EAAE,wIAAA,GAAuIA,UAAAA,UAAAA,CAAU,QAAQ,0BAA0B,EAAE,IACzN;CAIF,OAAA,GAAMC,OAAAA,IAAAA,CAAI,MAAMC,YAAiB;EAC/B,MAAM;EACN,SAAA,kBAAA;EAGA,aAAa;EACb,aAAa;GACX,UAAUA;GACV,MAAMC;GACN,UAAUC;GACV,KAAKC;GACL,QAAQC;EACV;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,EAAA,GAACC,sBAAAA,QAAAA,CAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EACrC,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.cjs","names":["command","defineWithTypes","dryRunId","command","defineWithTypes","dryRunId","command","define","command","define","command","define","connectCommand","command","define","command","define","command","define","connectCommand","command","define","command","define","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","define","styleText","isTelemetryDisabled","styleText","cli","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand","dryrun"],"sources":["../src/commands/shared.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, 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 args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error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0B,EAAE,IACzN;CAIF,OAAA,GAAMC,OAAAA,IAAAA,CAAI,MAAMC,YAAiB;EAC/B,MAAM;EACN,SAAA,kBAAA;EAGA,aAAa;EACb,aAAa;GACX,UAAUA;GACV,MAAMC;GACN,UAAUC;GACV,KAAKC;GACL,QAAQC;EACV;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,EAAA,GAACC,sBAAAA,QAAAA,CAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EACrC,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-CRm0XQPb.js";
2
- import { r as version, t as isDisabled } from "./Telemetry-RBcAjNxj.js";
2
+ import { r as version, t as isDisabled } from "./Telemetry-WZD1Le7A.js";
3
3
  import { styleText } from "node:util";
4
4
  import dryrun, { pluginId as dryRunId } from "@gunshi/plugin-dryrun";
5
5
  import { cli, define, defineWithTypes } from "gunshi";
@@ -131,7 +131,7 @@ const command$10 = defineWithTypes()({
131
131
  async run(ctx) {
132
132
  const { values } = ctx;
133
133
  const logLevel = resolveLogLevel(values);
134
- const { run } = await import("./run-CmNDNEjR.js");
134
+ const { run } = await import("./run-DAYWA84e.js");
135
135
  await run({
136
136
  input: values.input,
137
137
  configPath: values.config,
@@ -182,7 +182,7 @@ const command$9 = defineWithTypes()({
182
182
  },
183
183
  async run(ctx) {
184
184
  const { values } = ctx;
185
- const { run } = await import("./run-DQoKTiGk.js");
185
+ const { run } = await import("./run-BP_Z7A4e.js");
186
186
  await run({
187
187
  yes: values.yes,
188
188
  version,
@@ -205,7 +205,7 @@ const command$8 = define({
205
205
  "# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
206
206
  ].join("\n"),
207
207
  async run() {
208
- const { run } = await import("./run-CZlkqkDc.js");
208
+ const { run } = await import("./run-J7ekQ_kc.js");
209
209
  await run();
210
210
  }
211
211
  });
@@ -234,7 +234,7 @@ const command$7 = define({
234
234
  ...logLevelArg
235
235
  },
236
236
  async run(ctx) {
237
- const { connectRunner } = await import("./commands-BAgGrcvc.js");
237
+ const { connectRunner } = await import("./commands-ECaVqjMu.js");
238
238
  await connectRunner(ctx);
239
239
  }
240
240
  });
@@ -247,7 +247,7 @@ const command$6 = define({
247
247
  toKebab: true,
248
248
  args: command$7.args,
249
249
  async run(ctx) {
250
- const { loginRunner } = await import("./commands-BAgGrcvc.js");
250
+ const { loginRunner } = await import("./commands-ECaVqjMu.js");
251
251
  await loginRunner(ctx);
252
252
  }
253
253
  });
@@ -265,7 +265,7 @@ const command$5 = define({
265
265
  ...logLevelArg
266
266
  },
267
267
  async run(ctx) {
268
- const { logoutRunner } = await import("./commands-BAgGrcvc.js");
268
+ const { logoutRunner } = await import("./commands-ECaVqjMu.js");
269
269
  await logoutRunner(ctx);
270
270
  }
271
271
  });
@@ -279,7 +279,6 @@ const command$4 = define({
279
279
  args: {
280
280
  ...configArg,
281
281
  ...studioConnectionArgs,
282
- ...studioPermissionArgs,
283
282
  id: {
284
283
  type: "string",
285
284
  description: "Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI"
@@ -298,11 +297,6 @@ const command$4 = define({
298
297
  description: "Package version for the generated tarball. Defaults to the version in package.json",
299
298
  toKebab: true
300
299
  },
301
- timeout: {
302
- type: "number",
303
- description: "Seconds to wait for the job to finish",
304
- default: 600
305
- },
306
300
  json: {
307
301
  type: "boolean",
308
302
  description: "Print the result as one JSON object instead of a summary",
@@ -311,7 +305,7 @@ const command$4 = define({
311
305
  ...logLevelArg
312
306
  },
313
307
  async run(ctx) {
314
- const { runner } = await import("./snapshot-CkHXR0Nl.js");
308
+ const { runner } = await import("./snapshot-7yPYU6ol.js");
315
309
  await runner(ctx);
316
310
  }
317
311
  });
@@ -323,7 +317,7 @@ const command$3 = define({
323
317
  toKebab: true,
324
318
  args: command$7.args,
325
319
  async run(ctx) {
326
- const { startRunner } = await import("./commands-BAgGrcvc.js");
320
+ const { startRunner } = await import("./commands-ECaVqjMu.js");
327
321
  await startRunner(ctx);
328
322
  }
329
323
  });
@@ -331,7 +325,7 @@ const stopCommand = define({
331
325
  name: "stop",
332
326
  description: "Stop this project's background connection and keep its pairing.",
333
327
  async run() {
334
- const { stopRunner } = await import("./commands-BAgGrcvc.js");
328
+ const { stopRunner } = await import("./commands-ECaVqjMu.js");
335
329
  await stopRunner();
336
330
  }
337
331
  });
@@ -349,7 +343,7 @@ const command$2 = define({
349
343
  ...logLevelArg
350
344
  },
351
345
  async run(ctx) {
352
- const { statusRunner } = await import("./commands-BAgGrcvc.js");
346
+ const { statusRunner } = await import("./commands-ECaVqjMu.js");
353
347
  await statusRunner(ctx);
354
348
  }
355
349
  });
@@ -369,7 +363,7 @@ const command$1 = define({
369
363
  toKebab: true,
370
364
  args: command$7.args,
371
365
  async run(ctx) {
372
- const { connectRunner } = await import("./commands-BAgGrcvc.js");
366
+ const { connectRunner } = await import("./commands-ECaVqjMu.js");
373
367
  await connectRunner(ctx);
374
368
  },
375
369
  subCommands: {
@@ -408,7 +402,7 @@ const command = define({
408
402
  required: true
409
403
  } },
410
404
  async run({ values }) {
411
- const { run } = await import("./run-D5AeacqK.js");
405
+ const { run } = await import("./run-sM7YjAc9.js");
412
406
  await run({ input: values.input });
413
407
  }
414
408
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["command","command","command","command","command","connectCommand","command","command","command","connectCommand","command","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","isTelemetryDisabled","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand"],"sources":["../src/commands/shared.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n timeout: {\n type: 'number',\n description: 'Seconds to wait for the job to finish',\n default: 600,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, 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 args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;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C,CAAC;CACzE,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAG3D,IAAI,CAACC,WAAoB,KAAK,CAAC,aAC7B,QAAQ,MACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAIF,MAAM,IAAI,MAAMC,YAAiB;EAC/B,MAAM;EACN;EAGA,aAAa;EACb,aAAa;GACX,UAAUA;GACV,MAAMC;GACN,UAAUC;GACV,KAAKC;GACL,QAAQC;EACV;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,CAAC,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EACrC,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["command","command","command","command","command","connectCommand","command","command","command","connectCommand","command","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","isTelemetryDisabled","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand"],"sources":["../src/commands/shared.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/mcp.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts","../src/commands/validate.ts","../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n","import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { configArg, dryRunId, type DryRunExtensions, logLevelArg } from './shared.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n ...configArg,\n ...logLevelArg,\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n","import { defineWithTypes } from 'gunshi'\nimport { dryRunId, type DryRunExtensions } from './shared.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n await run()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { loginRunner } = await import('../../runners/studio/commands.ts')\n await loginRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: ['kubb studio logout'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { logoutRunner } = await import('../../runners/studio/commands.ts')\n await logoutRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\n\nexport const command = define({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { startRunner } = await import('../../runners/studio/commands.ts')\n await startRunner(ctx)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopRunner } = await import('../../runners/studio/commands.ts')\n await stopRunner()\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: ['kubb studio status'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n ...logLevelArg,\n },\n async run(ctx) {\n const { statusRunner } = await import('../../runners/studio/commands.ts')\n await statusRunner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: ['kubb studio', 'kubb studio --allow-read', 'kubb studio login', 'kubb studio status', 'kubb studio logout', 'kubb studio snapshot'].join('\\n'),\n toKebab: true,\n args: connectCommand.args,\n async run(ctx) {\n const { connectRunner } = await import('../../runners/studio/commands.ts')\n await connectRunner(ctx)\n },\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n","import { define } from 'gunshi'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n input: {\n type: 'positional',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input })\n },\n})\n","import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as validateCommand } from './commands/validate.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/** Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these. */\nconst QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v', '--json'])\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, 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 args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg))\n\n // stderr, so the notice never lands in a stream a client parses, such as `kubb mcp` stdio.\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.error(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n // Each command's `run` imports its runner, so an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio) loads only when it runs.\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF;;;AC7DA,MAAM,iBAAsC;CAAC;CAAO;CAAQ;CAAQ;AAAM;;;;AAK1E,SAAS,eAAe,OAAoC;CAC1D,MAAM,QAAQ,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