@kubb/cli
The Kubb CLI allows you to generate files based on the kubb.config.ts
configuration file. Upon startup, Kubb displays the progress of the plugin execution, the file writing, and the results of each hook once the generation process is complete.
Installation
bun add -d @kubb/cli
pnpm add -D @kubb/cli
npm install --save-dev @kubb/cli
yarn add -D @kubb/cli
Usage
kubb --config kubb.config.js
USAGE kubb generate
COMMANDS
generate [input] Generate files based on a 'kubb.config.ts' file
validate Validate a Swagger/OpenAPI file
mcp Start the server to enable the MCP client to interact with the LLM.
Use kubb <command> --help for more information about a command.
generate
Generate files based on a kubb.config.ts
file
TIP
kubb generate
and kubb
will call the same generate functionality.
USAGE kubb generate [OPTIONS]
OPTIONS
-c, --config Path to the Kubb config
-l, --logLevel=<silent|info|debug> Info, silent or debug
-w, --watch Watch mode based on the input file
-d, --debug Override logLevel to debug
-u, --ui Open ui
-h, --help Show help
Path of the input file(overrides the one in kubb.config.js
)
kubb petStore.yaml
Options
--config (-c)
Path to the Kubb config.
kubb --config kubb.config.ts
--log-level (-l)
silent
will suppresses all log messages, warnings, and errors, minimizing console output.info
will log all warnings, errors and info messages.debug
will show all message frominfo
and all details about what is being executed.
kubb --log-level info
--debug
TIP
Debug mode will create 2 log files:
.kubb/kubb-DATE_STRING.log
.kubb/kubb-files.log
Alias for kubb generate --log-level debug
kubb --debug
--watch (-w)
Watch mode based on the input file.
kubb --watch
--ui (-u)
beta
Open Kubb's ui in the default browser
kubb --watch
--version (-v)
Output the version number.
kubb --version
--help (-h)
Display the help.
kubb --help
validate
The command will check for syntax and structural errors in your Swagger/OpenAPI file, and provide clear feedback (errors/warnings).
Useful for CI pipelines, pre-commit hooks, and early feedback in development
IMPORTANT
@kubb/oas
should be installed
TIP
Behind the scenes we are using oas-normalize
to validate your Swagger/OpenAPI file.
USAGE kubb validate [OPTIONS]
OPTIONS
-i, --input Path to Swagger/OpenAPI file
-h, --help Show help
Options
--input (-i)
Path to your Swagger/OpenAPI file
kubb generate --input
mcp
Start a MCP server to make Kubb work together with a LLM like Claude.
IMPORTANT
@kubb/mcp
should be installed