@kubb/cli 5.8.0 → 5.8.2
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.
- package/dist/{Telemetry-C2052gYB.cjs → Telemetry-D6v6WUtX.cjs} +2 -2
- package/dist/{Telemetry-C2052gYB.cjs.map → Telemetry-D6v6WUtX.cjs.map} +1 -1
- package/dist/{Telemetry-A_TdzcbF.js → Telemetry-DMMnTu4n.js} +2 -2
- package/dist/{Telemetry-A_TdzcbF.js.map → Telemetry-DMMnTu4n.js.map} +1 -1
- package/dist/{background-DFGFUYGe.cjs → background-B-5uPpUT.cjs} +2 -2
- package/dist/{background-DFGFUYGe.cjs.map → background-B-5uPpUT.cjs.map} +1 -1
- package/dist/{background-BHIwU4gp.js → background-CV1vB9ys.js} +2 -2
- package/dist/{background-BHIwU4gp.js.map → background-CV1vB9ys.js.map} +1 -1
- package/dist/background-CuIy_K8c.js +1 -0
- package/dist/{commands-Uc-5l9O0.cjs → commands-CBibFu1T.cjs} +3 -3
- package/dist/{commands-Uc-5l9O0.cjs.map → commands-CBibFu1T.cjs.map} +1 -1
- package/dist/{commands-Hx6XpJx7.js → commands-DZgyEg0r.js} +3 -3
- package/dist/{commands-Hx6XpJx7.js.map → commands-DZgyEg0r.js.map} +1 -1
- package/dist/{config-DX176_YM.cjs → config-CRBZcWwg.cjs} +16 -61
- package/dist/config-CRBZcWwg.cjs.map +1 -0
- package/dist/{config-Czvfdmb6.js → config-DAdYwK_D.js} +14 -53
- package/dist/config-DAdYwK_D.js.map +1 -0
- package/dist/{errors-CMbMAwyW.cjs → errors-BdA8M78q.cjs} +19 -1
- package/dist/{errors-CMbMAwyW.cjs.map → errors-BdA8M78q.cjs.map} +1 -1
- package/dist/{errors-BQJzaUwP.js → errors-DmC83ALX.js} +14 -2
- package/dist/{errors-BQJzaUwP.js.map → errors-DmC83ALX.js.map} +1 -1
- package/dist/index.cjs +128 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +128 -40
- package/dist/index.js.map +1 -1
- package/dist/{output-DekB5lg3.cjs → output-CWupdozw.cjs} +31 -31
- package/dist/output-CWupdozw.cjs.map +1 -0
- package/dist/registry-CCKUL3ps.cjs +113 -0
- package/dist/registry-CCKUL3ps.cjs.map +1 -0
- package/dist/registry-DjGepXb0.js +77 -0
- package/dist/registry-DjGepXb0.js.map +1 -0
- package/dist/reporters-C5HAypFq.cjs +67 -0
- package/dist/reporters-C5HAypFq.cjs.map +1 -0
- package/dist/reporters-CNZQUlXY.js +55 -0
- package/dist/reporters-CNZQUlXY.js.map +1 -0
- package/dist/run-B9wWJSSx.js +65 -0
- package/dist/run-B9wWJSSx.js.map +1 -0
- package/dist/{run-BaErHa3l.cjs → run-BNfemif8.cjs} +3 -3
- package/dist/{run-BaErHa3l.cjs.map → run-BNfemif8.cjs.map} +1 -1
- package/dist/run-BURZ4hDs.js +106 -0
- package/dist/run-BURZ4hDs.js.map +1 -0
- package/dist/run-BaFyksnF.cjs +72 -0
- package/dist/run-BaFyksnF.cjs.map +1 -0
- package/dist/{run-BSPA8JKH.cjs → run-BbSYIW7v.cjs} +9 -8
- package/dist/{run-BSPA8JKH.cjs.map → run-BbSYIW7v.cjs.map} +1 -1
- package/dist/run-C4IHvWT_.cjs +109 -0
- package/dist/run-C4IHvWT_.cjs.map +1 -0
- package/dist/run-CDS3EWEN.js +71 -0
- package/dist/run-CDS3EWEN.js.map +1 -0
- package/dist/{run-CN5DJ5XC.js → run-CGqjX3nk.js} +3 -3
- package/dist/{run-CN5DJ5XC.js.map → run-CGqjX3nk.js.map} +1 -1
- package/dist/{run-BWjtN8Gs.cjs → run-D87cI2Vc.cjs} +3 -3
- package/dist/{run-BWjtN8Gs.cjs.map → run-D87cI2Vc.cjs.map} +1 -1
- package/dist/{run-BeptvKTj.js → run-D9QTeOsm.js} +3 -3
- package/dist/{run-BeptvKTj.js.map → run-D9QTeOsm.js.map} +1 -1
- package/dist/{run-DuD68jDf.cjs → run-DSpOqqKI.cjs} +9 -8
- package/dist/{run-DuD68jDf.cjs.map → run-DSpOqqKI.cjs.map} +1 -1
- package/dist/run-DVIqUt1x.cjs +67 -0
- package/dist/run-DVIqUt1x.cjs.map +1 -0
- package/dist/{run-s3XYpkCe.cjs → run-E11sqsk0.cjs} +9 -81
- package/dist/run-E11sqsk0.cjs.map +1 -0
- package/dist/{run-BNEll0r7.js → run-Myj1dJrW.js} +5 -4
- package/dist/{run-BNEll0r7.js.map → run-Myj1dJrW.js.map} +1 -1
- package/dist/{run-BTU318R1.js → run-USNnlQcA.js} +2 -74
- package/dist/run-USNnlQcA.js.map +1 -0
- package/dist/{run-CIVIeuAh.js → run-W-tLF6Qs.js} +6 -5
- package/dist/{run-CIVIeuAh.js.map → run-W-tLF6Qs.js.map} +1 -1
- package/dist/{snapshot-GiKqhTTe.cjs → snapshot-9BhLfZLz.cjs} +7 -7
- package/dist/{snapshot-GiKqhTTe.cjs.map → snapshot-9BhLfZLz.cjs.map} +1 -1
- package/dist/{snapshot-B0piE_yD.js → snapshot-BdP6LpUP.js} +4 -4
- package/dist/{snapshot-B0piE_yD.js.map → snapshot-BdP6LpUP.js.map} +1 -1
- package/dist/studioWorker.js +2 -2
- package/dist/utils-Dhx5PMpD.js +80 -0
- package/dist/utils-Dhx5PMpD.js.map +1 -0
- package/dist/utils-ZcCFqERz.cjs +106 -0
- package/dist/utils-ZcCFqERz.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/background-BpMcA026.js +0 -1
- package/dist/config-Czvfdmb6.js.map +0 -1
- package/dist/config-DX176_YM.cjs.map +0 -1
- package/dist/output-DekB5lg3.cjs.map +0 -1
- package/dist/run-BTU318R1.js.map +0 -1
- package/dist/run-s3XYpkCe.cjs.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -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 } 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 },\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AE,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","define","command","defineWithTypes","dryRunId","command","defineWithTypes","dryRunId","command","define","command","define","command","define","command","define","connectCommand","command","define","command","define","command","define","connectCommand","command","define","command","define","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","snapshotCommand","command","define","define","styleText","isTelemetryDisabled","styleText","cli","generateCommand","initCommand","validateCommand","mcpCommand","studioCommand","addCommand","updateCommand","listCommand","dryrun"],"sources":["../src/commands/shared.ts","../src/commands/add.ts","../src/commands/generate.ts","../src/commands/init.ts","../src/commands/list.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/update.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 yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\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 { define } from 'gunshi'\nimport { configArg, yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'add',\n description:\n 'Install a plugin, adapter, or parser from the Kubb registry at its reviewed version. A plugin is added to kubb.config.ts, an adapter or parser prints the code to add. Reads KUBB_REGISTRY to use another registry.',\n examples: ['kubb add plugin-zod', 'kubb add kubb-labs/plugin-react-query', 'kubb add acme/plugin-x --yes', 'kubb add plugin-zod --no-install'].join('\\n'),\n toKebab: true,\n args: {\n id: {\n type: 'positional',\n description: 'Registry id: owner/slug, or a slug for an official extension',\n required: true,\n },\n ...configArg,\n ...yesArg,\n install: {\n type: 'boolean',\n description: 'Install the package. Pass --no-install to only edit the config',\n negatable: true,\n default: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/add/run.ts')\n await run({ id: values.id, configPath: values.config, yes: values.yes, install: values.install })\n },\n})\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\nexport const command = define({\n name: 'list',\n description:\n 'List the installed Kubb extensions: their registry id, package, installed version, the version the Kubb registry pins, and whether an update exists.',\n examples: 'kubb list',\n async run() {\n const { run } = await import('../runners/list/run.ts')\n await run()\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'\nimport { yesArg } from './shared.ts'\n\nexport const command = define({\n name: 'update',\n description:\n 'Update installed extensions to the version the Kubb registry pins. Pass ids to update only those, or --check to list the updates without installing.',\n examples: ['kubb update', 'kubb update --check', 'kubb update plugin-zod plugin-ts --yes'].join('\\n'),\n args: {\n ids: {\n type: 'positional',\n description: 'Registry ids to update, all installed extensions when omitted',\n multiple: true,\n },\n check: {\n type: 'boolean',\n description: 'List the available updates without installing them',\n default: false,\n },\n ...yesArg,\n },\n async run({ values }) {\n const { run } = await import('../runners/update/run.ts')\n await run({ ids: values.ids ?? [], check: values.check, yes: values.yes })\n },\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 addCommand } from './commands/add.ts'\nimport { command as generateCommand } from './commands/generate.ts'\nimport { command as initCommand } from './commands/init.ts'\nimport { command as listCommand } from './commands/list.ts'\nimport { command as mcpCommand } from './commands/mcp.ts'\nimport { command as studioCommand, routeStudioFlags } from './commands/studio/index.ts'\nimport { command as updateCommand } from './commands/update.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 given command, or `generate` when none 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, manage Kubb extensions, 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 add: addCommand,\n update: updateCommand,\n list: listCommand,\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,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,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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
4
|
* Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
|
|
5
|
-
* quiet flag is passed, then runs the
|
|
6
|
-
* `generate` when no command is given.
|
|
5
|
+
* quiet flag is passed, then runs the given command, or `generate` when none is given.
|
|
7
6
|
*/
|
|
8
7
|
export declare function run(argv?: Array<string>): Promise<void>;
|
|
9
8
|
//#endregion
|
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-
|
|
2
|
+
import { r as version, t as isDisabled } from "./Telemetry-DMMnTu4n.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";
|
|
@@ -9,6 +9,12 @@ const configArg = { config: {
|
|
|
9
9
|
description: "Path to the Kubb config",
|
|
10
10
|
short: "c"
|
|
11
11
|
} };
|
|
12
|
+
const yesArg = { yes: {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
description: "Skip the confirmation",
|
|
15
|
+
short: "y",
|
|
16
|
+
default: false
|
|
17
|
+
} };
|
|
12
18
|
const logLevelArg = { logLevel: {
|
|
13
19
|
type: "enum",
|
|
14
20
|
choices: [
|
|
@@ -58,6 +64,43 @@ const studioPermissionArgs = {
|
|
|
58
64
|
}
|
|
59
65
|
};
|
|
60
66
|
//#endregion
|
|
67
|
+
//#region src/commands/add.ts
|
|
68
|
+
const command$13 = define({
|
|
69
|
+
name: "add",
|
|
70
|
+
description: "Install a plugin, adapter, or parser from the Kubb registry at its reviewed version. A plugin is added to kubb.config.ts, an adapter or parser prints the code to add. Reads KUBB_REGISTRY to use another registry.",
|
|
71
|
+
examples: [
|
|
72
|
+
"kubb add plugin-zod",
|
|
73
|
+
"kubb add kubb-labs/plugin-react-query",
|
|
74
|
+
"kubb add acme/plugin-x --yes",
|
|
75
|
+
"kubb add plugin-zod --no-install"
|
|
76
|
+
].join("\n"),
|
|
77
|
+
toKebab: true,
|
|
78
|
+
args: {
|
|
79
|
+
id: {
|
|
80
|
+
type: "positional",
|
|
81
|
+
description: "Registry id: owner/slug, or a slug for an official extension",
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
...configArg,
|
|
85
|
+
...yesArg,
|
|
86
|
+
install: {
|
|
87
|
+
type: "boolean",
|
|
88
|
+
description: "Install the package. Pass --no-install to only edit the config",
|
|
89
|
+
negatable: true,
|
|
90
|
+
default: true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
async run({ values }) {
|
|
94
|
+
const { run } = await import("./run-BURZ4hDs.js");
|
|
95
|
+
await run({
|
|
96
|
+
id: values.id,
|
|
97
|
+
configPath: values.config,
|
|
98
|
+
yes: values.yes,
|
|
99
|
+
install: values.install
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
//#endregion
|
|
61
104
|
//#region src/commands/generate.ts
|
|
62
105
|
const REPORTER_NAMES = [
|
|
63
106
|
"cli",
|
|
@@ -81,7 +124,7 @@ function resolveLogLevel({ verbose, silent, logLevel }) {
|
|
|
81
124
|
if (silent) return "silent";
|
|
82
125
|
return logLevel;
|
|
83
126
|
}
|
|
84
|
-
const command$
|
|
127
|
+
const command$12 = defineWithTypes()({
|
|
85
128
|
name: "generate",
|
|
86
129
|
description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
|
|
87
130
|
examples: [
|
|
@@ -131,7 +174,7 @@ const command$10 = defineWithTypes()({
|
|
|
131
174
|
async run(ctx) {
|
|
132
175
|
const { values } = ctx;
|
|
133
176
|
const logLevel = resolveLogLevel(values);
|
|
134
|
-
const { run } = await import("./run-
|
|
177
|
+
const { run } = await import("./run-Myj1dJrW.js");
|
|
135
178
|
await run({
|
|
136
179
|
input: values.input,
|
|
137
180
|
configPath: values.config,
|
|
@@ -144,7 +187,7 @@ const command$10 = defineWithTypes()({
|
|
|
144
187
|
});
|
|
145
188
|
//#endregion
|
|
146
189
|
//#region src/commands/init.ts
|
|
147
|
-
const command$
|
|
190
|
+
const command$11 = defineWithTypes()({
|
|
148
191
|
name: "init",
|
|
149
192
|
description: "Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.",
|
|
150
193
|
examples: [
|
|
@@ -182,7 +225,7 @@ const command$9 = defineWithTypes()({
|
|
|
182
225
|
},
|
|
183
226
|
async run(ctx) {
|
|
184
227
|
const { values } = ctx;
|
|
185
|
-
const { run } = await import("./run-
|
|
228
|
+
const { run } = await import("./run-USNnlQcA.js");
|
|
186
229
|
await run({
|
|
187
230
|
yes: values.yes,
|
|
188
231
|
version,
|
|
@@ -194,9 +237,20 @@ const command$9 = defineWithTypes()({
|
|
|
194
237
|
}
|
|
195
238
|
});
|
|
196
239
|
//#endregion
|
|
240
|
+
//#region src/commands/list.ts
|
|
241
|
+
const command$10 = define({
|
|
242
|
+
name: "list",
|
|
243
|
+
description: "List the installed Kubb extensions: their registry id, package, installed version, the version the Kubb registry pins, and whether an update exists.",
|
|
244
|
+
examples: "kubb list",
|
|
245
|
+
async run() {
|
|
246
|
+
const { run } = await import("./run-CDS3EWEN.js");
|
|
247
|
+
await run();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
//#endregion
|
|
197
251
|
//#region src/commands/mcp.ts
|
|
198
252
|
/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/mcp`. */
|
|
199
|
-
const command$
|
|
253
|
+
const command$9 = define({
|
|
200
254
|
name: "mcp",
|
|
201
255
|
description: "Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.",
|
|
202
256
|
examples: [
|
|
@@ -205,13 +259,13 @@ const command$8 = define({
|
|
|
205
259
|
"# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
|
|
206
260
|
].join("\n"),
|
|
207
261
|
async run() {
|
|
208
|
-
const { run } = await import("./run-
|
|
262
|
+
const { run } = await import("./run-CGqjX3nk.js");
|
|
209
263
|
await run();
|
|
210
264
|
}
|
|
211
265
|
});
|
|
212
266
|
//#endregion
|
|
213
267
|
//#region src/commands/studio/connect.ts
|
|
214
|
-
const command$
|
|
268
|
+
const command$8 = define({
|
|
215
269
|
name: "connect",
|
|
216
270
|
description: "Connect this project to Kubb Studio and generate from the browser.",
|
|
217
271
|
examples: [
|
|
@@ -234,26 +288,26 @@ const command$7 = define({
|
|
|
234
288
|
...logLevelArg
|
|
235
289
|
},
|
|
236
290
|
async run(ctx) {
|
|
237
|
-
const { connectRunner } = await import("./commands-
|
|
291
|
+
const { connectRunner } = await import("./commands-DZgyEg0r.js");
|
|
238
292
|
await connectRunner(ctx);
|
|
239
293
|
}
|
|
240
294
|
});
|
|
241
295
|
//#endregion
|
|
242
296
|
//#region src/commands/studio/login.ts
|
|
243
|
-
const command$
|
|
297
|
+
const command$7 = define({
|
|
244
298
|
name: "login",
|
|
245
299
|
description: "Pair this machine with Kubb Studio without connecting.",
|
|
246
300
|
examples: ["kubb studio login", "kubb studio login --url http://localhost:3000"].join("\n"),
|
|
247
301
|
toKebab: true,
|
|
248
|
-
args: command$
|
|
302
|
+
args: command$8.args,
|
|
249
303
|
async run(ctx) {
|
|
250
|
-
const { loginRunner } = await import("./commands-
|
|
304
|
+
const { loginRunner } = await import("./commands-DZgyEg0r.js");
|
|
251
305
|
await loginRunner(ctx);
|
|
252
306
|
}
|
|
253
307
|
});
|
|
254
308
|
//#endregion
|
|
255
309
|
//#region src/commands/studio/logout.ts
|
|
256
|
-
const command$
|
|
310
|
+
const command$6 = define({
|
|
257
311
|
name: "logout",
|
|
258
312
|
description: "Forget the stored Kubb Studio token.",
|
|
259
313
|
examples: ["kubb studio logout"].join("\n"),
|
|
@@ -265,13 +319,13 @@ const command$5 = define({
|
|
|
265
319
|
...logLevelArg
|
|
266
320
|
},
|
|
267
321
|
async run(ctx) {
|
|
268
|
-
const { logoutRunner } = await import("./commands-
|
|
322
|
+
const { logoutRunner } = await import("./commands-DZgyEg0r.js");
|
|
269
323
|
await logoutRunner(ctx);
|
|
270
324
|
}
|
|
271
325
|
});
|
|
272
326
|
//#endregion
|
|
273
327
|
//#region src/commands/studio/snapshot.ts
|
|
274
|
-
const command$
|
|
328
|
+
const command$5 = define({
|
|
275
329
|
name: "snapshot",
|
|
276
330
|
description: "Generate and publish a Kubb Studio snapshot from CI.",
|
|
277
331
|
examples: ["kubb studio snapshot", "kubb studio snapshot --json"].join("\n"),
|
|
@@ -305,19 +359,19 @@ const command$4 = define({
|
|
|
305
359
|
...logLevelArg
|
|
306
360
|
},
|
|
307
361
|
async run(ctx) {
|
|
308
|
-
const { runner } = await import("./snapshot-
|
|
362
|
+
const { runner } = await import("./snapshot-BdP6LpUP.js");
|
|
309
363
|
await runner(ctx);
|
|
310
364
|
}
|
|
311
365
|
});
|
|
312
366
|
//#endregion
|
|
313
367
|
//#region src/commands/studio/background.ts
|
|
314
|
-
const command$
|
|
368
|
+
const command$4 = define({
|
|
315
369
|
name: "start",
|
|
316
370
|
description: "Keep this project connected to Kubb Studio in the background.",
|
|
317
371
|
toKebab: true,
|
|
318
|
-
args: command$
|
|
372
|
+
args: command$8.args,
|
|
319
373
|
async run(ctx) {
|
|
320
|
-
const { startRunner } = await import("./commands-
|
|
374
|
+
const { startRunner } = await import("./commands-DZgyEg0r.js");
|
|
321
375
|
await startRunner(ctx);
|
|
322
376
|
}
|
|
323
377
|
});
|
|
@@ -325,13 +379,13 @@ const stopCommand = define({
|
|
|
325
379
|
name: "stop",
|
|
326
380
|
description: "Stop this project's background connection and keep its pairing.",
|
|
327
381
|
async run() {
|
|
328
|
-
const { stopRunner } = await import("./commands-
|
|
382
|
+
const { stopRunner } = await import("./commands-DZgyEg0r.js");
|
|
329
383
|
await stopRunner();
|
|
330
384
|
}
|
|
331
385
|
});
|
|
332
386
|
//#endregion
|
|
333
387
|
//#region src/commands/studio/status.ts
|
|
334
|
-
const command$
|
|
388
|
+
const command$3 = define({
|
|
335
389
|
name: "status",
|
|
336
390
|
description: "Show the project worker, Kubb Studio pairing, and saved permissions.",
|
|
337
391
|
examples: ["kubb studio status"].join("\n"),
|
|
@@ -343,13 +397,13 @@ const command$2 = define({
|
|
|
343
397
|
...logLevelArg
|
|
344
398
|
},
|
|
345
399
|
async run(ctx) {
|
|
346
|
-
const { statusRunner } = await import("./commands-
|
|
400
|
+
const { statusRunner } = await import("./commands-DZgyEg0r.js");
|
|
347
401
|
await statusRunner(ctx);
|
|
348
402
|
}
|
|
349
403
|
});
|
|
350
404
|
//#endregion
|
|
351
405
|
//#region src/commands/studio/index.ts
|
|
352
|
-
const command$
|
|
406
|
+
const command$2 = define({
|
|
353
407
|
name: "studio",
|
|
354
408
|
description: "Connect this project to Kubb Studio, or manage its pairing and snapshots.",
|
|
355
409
|
examples: [
|
|
@@ -361,19 +415,19 @@ const command$1 = define({
|
|
|
361
415
|
"kubb studio snapshot"
|
|
362
416
|
].join("\n"),
|
|
363
417
|
toKebab: true,
|
|
364
|
-
args: command$
|
|
418
|
+
args: command$8.args,
|
|
365
419
|
async run(ctx) {
|
|
366
|
-
const { connectRunner } = await import("./commands-
|
|
420
|
+
const { connectRunner } = await import("./commands-DZgyEg0r.js");
|
|
367
421
|
await connectRunner(ctx);
|
|
368
422
|
},
|
|
369
423
|
subCommands: {
|
|
370
|
-
start: command$
|
|
424
|
+
start: command$4,
|
|
371
425
|
stop: stopCommand,
|
|
372
|
-
connect: command$
|
|
373
|
-
login: command$
|
|
374
|
-
logout: command$
|
|
375
|
-
status: command$
|
|
376
|
-
snapshot: command$
|
|
426
|
+
connect: command$8,
|
|
427
|
+
login: command$7,
|
|
428
|
+
logout: command$6,
|
|
429
|
+
status: command$3,
|
|
430
|
+
snapshot: command$5
|
|
377
431
|
}
|
|
378
432
|
});
|
|
379
433
|
/**
|
|
@@ -390,6 +444,38 @@ function routeStudioFlags(args) {
|
|
|
390
444
|
];
|
|
391
445
|
}
|
|
392
446
|
//#endregion
|
|
447
|
+
//#region src/commands/update.ts
|
|
448
|
+
const command$1 = define({
|
|
449
|
+
name: "update",
|
|
450
|
+
description: "Update installed extensions to the version the Kubb registry pins. Pass ids to update only those, or --check to list the updates without installing.",
|
|
451
|
+
examples: [
|
|
452
|
+
"kubb update",
|
|
453
|
+
"kubb update --check",
|
|
454
|
+
"kubb update plugin-zod plugin-ts --yes"
|
|
455
|
+
].join("\n"),
|
|
456
|
+
args: {
|
|
457
|
+
ids: {
|
|
458
|
+
type: "positional",
|
|
459
|
+
description: "Registry ids to update, all installed extensions when omitted",
|
|
460
|
+
multiple: true
|
|
461
|
+
},
|
|
462
|
+
check: {
|
|
463
|
+
type: "boolean",
|
|
464
|
+
description: "List the available updates without installing them",
|
|
465
|
+
default: false
|
|
466
|
+
},
|
|
467
|
+
...yesArg
|
|
468
|
+
},
|
|
469
|
+
async run({ values }) {
|
|
470
|
+
const { run } = await import("./run-B9wWJSSx.js");
|
|
471
|
+
await run({
|
|
472
|
+
ids: values.ids ?? [],
|
|
473
|
+
check: values.check,
|
|
474
|
+
yes: values.yes
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
//#endregion
|
|
393
479
|
//#region src/commands/validate.ts
|
|
394
480
|
/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */
|
|
395
481
|
const command = define({
|
|
@@ -402,7 +488,7 @@ const command = define({
|
|
|
402
488
|
required: true
|
|
403
489
|
} },
|
|
404
490
|
async run({ values }) {
|
|
405
|
-
const { run } = await import("./run-
|
|
491
|
+
const { run } = await import("./run-D9QTeOsm.js");
|
|
406
492
|
await run({ input: values.input });
|
|
407
493
|
}
|
|
408
494
|
});
|
|
@@ -457,23 +543,25 @@ function stripExecArgs(argv) {
|
|
|
457
543
|
}
|
|
458
544
|
/**
|
|
459
545
|
* Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
|
|
460
|
-
* quiet flag is passed, then runs the
|
|
461
|
-
* `generate` when no command is given.
|
|
546
|
+
* quiet flag is passed, then runs the given command, or `generate` when none is given.
|
|
462
547
|
*/
|
|
463
548
|
async function run(argv = process.argv) {
|
|
464
549
|
const args = routeStudioFlags(resolveDeprecatedFlags(stripExecArgs(argv)));
|
|
465
550
|
const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg));
|
|
466
551
|
if (!isDisabled() && !isQuietFlag) console.error(`${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`);
|
|
467
|
-
await cli(args, command$
|
|
552
|
+
await cli(args, command$12, {
|
|
468
553
|
name: "kubb",
|
|
469
554
|
version,
|
|
470
|
-
description: "Generate code from an OpenAPI specification, or connect the project to Kubb Studio.",
|
|
555
|
+
description: "Generate code from an OpenAPI specification, manage Kubb extensions, or connect the project to Kubb Studio.",
|
|
471
556
|
subCommands: {
|
|
472
|
-
generate: command$
|
|
473
|
-
init: command$
|
|
557
|
+
generate: command$12,
|
|
558
|
+
init: command$11,
|
|
474
559
|
validate: command,
|
|
475
|
-
mcp: command$
|
|
476
|
-
studio: command$
|
|
560
|
+
mcp: command$9,
|
|
561
|
+
studio: command$2,
|
|
562
|
+
add: command$13,
|
|
563
|
+
update: command$1,
|
|
564
|
+
list: command$10
|
|
477
565
|
},
|
|
478
566
|
fallbackToEntry: true,
|
|
479
567
|
strict: true,
|