Open Studio
Commands

kubb generate

The generate command runs the Kubb code-generation pipeline based on your kubb.config.ts.

Run kubb generate to read your kubb.config.ts and run the code-generation pipeline. It's the default command, so running kubb with no arguments does the same.

kubb generate

Usage ​

Generate from the input set in your config:

Terminal
shell
kubb generate

Pass an input file to override the config:

Terminal
shell
kubb generate ./petStore.yaml

Arguments ​

ArgumentDescription
[input]Optional path or URL to a Swagger/OpenAPI document. Overrides the input set in the config.

Options ​

OptionDefaultDescription
--config=<path>, -c <path>Path to a config file, such as ./kubb.staging.ts.
--log-level=<silent|info|verbose>, -linfoSet the verbosity. Use verbose to see plugin timings.
--silent, -sfalseForce the log level to silent. Suppresses output.
--verbosefalseForce the log level to verbose. Shows slow plugins.
--reporter=<cli|json|file|html>Pick which reporters to trigger, comma-separated. Defaults to cli.
--watch, -wfalseRe-run the pipeline whenever the input spec changes.
--dry-runfalsePreview a run without writing files, formatting, linting, or running post-generate commands.

--reporter takes no short flag.

Reporters ​

A reporter decides how a run is rendered. The config registers available reporters with reporters. --reporter picks which ones to trigger by name, comma-separated (--reporter cli,file). Four reporters are registered by default.

ReporterOutput
cliThe end-of-run summary in the terminal. This runs when you pass no flag. Renders as plain text, without spinners or progress bars, when there is no interactive terminal or when an AI coding agent runs the command.
jsonA machine-readable report on stdout for CI. See Diagnostics for the full JSON shape.
fileThe run's diagnostics, written to .kubb/kubb[-<name>]-<timestamp>.log. The <name> segment is dropped when the config has no name.
htmlA browsable report directory with generated files and diagnostics, written to .kubb/kubb[-<name>]-<timestamp>/index.html.

Write a log file:

Terminal
shell
kubb generate --reporter file

Print a JSON report for CI. The exit code is non-zero on any error:

Terminal
shell
kubb generate --reporter json

Examples ​

Run with a custom config:

Terminal
shell
kubb generate --config ./kubb.staging.ts

Watch the spec and regenerate on every change:

Terminal
shell
kubb generate --watch

Run with verbose plugin timings:

Terminal
shell
kubb generate --verbose

Preview a run without touching disk:

Terminal
shell
kubb generate --dry-run

See also ​