npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kubb/cli

v5.33.0

Published

Official CLI for Kubb. Run kubb generate, kubb init, kubb validate, and kubb studio to manage the full code generation lifecycle.

Readme

npm version npm downloads Stars License Node

@kubb/cli

The command-line interface for Kubb

Official CLI for Kubb. Run kubb generate to produce TypeScript types, API clients, hooks, validators, and mocks. Includes interactive project setup (kubb init), spec validation, watch mode, and plain-text output for CI and AI agents.

Installation

bun add -D @kubb/cli
# or
pnpm add -D @kubb/cli
# or
npm install -D @kubb/cli

Commands

The command reference on kubb.dev has every flag of every command.


kubb init

Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for an interactive setup wizard, or pass flags to skip the prompts.

npx kubb init

Options

| Flag | Short | Type | Default | Description | | ------------------ | ----- | ------- | ---------------- | ------------------------------------------ | | --yes | -y | boolean | false | Skip all prompts and use defaults | | --input <path> | -i | string | ./openapi.yaml | Path to the OpenAPI specification | | --output <path> | -o | string | ./src/gen | Output directory for generated files | | --plugins <list> | | string | | Comma-separated list of plugins to install |

Available plugin values for --plugins: plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc.

Examples

# Interactive wizard
npx kubb init

# Accept all defaults
npx kubb init --yes

# Fully non-interactive
npx kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod

# Select specific plugins only
npx kubb init --plugins plugin-ts,plugin-axios,plugin-react-query

The wizard will:

  1. Detect or create a package.json if one does not exist
  2. Prompt for your OpenAPI specification path (default: ./openapi.yaml)
  3. Ask for the output directory (default: ./src/gen)
  4. Let you choose which plugins to install
  5. Install the selected packages using your package manager (npm, pnpm, yarn, or bun)
  6. Generate a kubb.config.ts with your chosen configuration

kubb generate

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.

npx kubb generate

Options

| Flag | Short | Type | Default | Description | | --------------------- | ----- | ------- | ------- | ----------------------------------------------------------------------------------------------------------- | | [input] | | string | | OpenAPI file path or URL that overrides input in the config | | --config <path> | -c | string | | Path to the Kubb config file | | --log-level <level> | -l | string | info | Log level: silent, info, or verbose | | --watch | -w | boolean | false | Re-generate whenever the input file changes | | --dry-run | | boolean | false | Preview the run without writing files | | --check | | boolean | false | Compare the output with the files on disk and write nothing. Exits 1 when a file is out of date | | --diff | | boolean | false | Print a diff for each out-of-date file. Turns --check on | | --force | | boolean | false | Generate even when kubb-lock.json says the output is up to date | | --no-lockfile | | boolean | | Generate without reading or writing kubb-lock.json | | --verbose | | boolean | false | Override log level to verbose | | --silent | -s | boolean | false | Override log level to silent | | --reporter <names> | | string | cli | Reporters that render the run, comma-separated: cli, json, file, html. Overrides config.reporters |

Examples

# Use kubb.config.ts in the current directory
npx kubb generate

# Override the input spec without editing the config
npx kubb generate ./openapi.yaml

# Point to a custom config file
npx kubb generate --config ./configs/kubb.config.ts

# Watch for changes and regenerate automatically
npx kubb generate --watch

# Verbose output
npx kubb generate --verbose

# Fail when the generated files on disk are out of date, and print what would change
npx kubb generate --check --diff

# Write a JSON run report alongside the CLI output
npx kubb generate --reporter cli,json

# Write an HTML run report
npx kubb generate --reporter html

kubb studio

Connect this project to Kubb Studio and generate from the browser. Kubb runs on your machine, reads your config and spec from disk, and streams progress and files back to Studio over a WebSocket.

npx kubb studio

The first run pairs the project. The CLI prints a short code, and you approve it in Studio. The CLI then stores the token per project, under ~/.kubb/projects/. The project is the folder that holds kubb.config.ts, found by walking up from the current folder, or the current folder when there is none. Later runs reuse the token. The pairing key goes to the system keychain when one is available, and into the same file otherwise. Set KUBB_HOME to store the credential files somewhere other than ~/.kubb.

Each permission is off by default. On the first connect to a project, the CLI shows one checklist of the permissions that no flag grants. It saves your answers for that project. Each --allow-* flag grants its permission and skips it in the checklist. Outside an interactive terminal, such as in CI, the CLI shows no checklist, so pass the --allow-* flags the run needs. Run kubb studio permissions to change the saved answers.

Arguments

| Argument | Required | Description | | ---------- | -------- | ----------------------------------------------------------------------------------------------- | | [action] | No | connect (default), start, stop, login, logout, status, permissions, or snapshot |

Options

| Flag | Short | Type | Default | Description | | --------------------- | ----- | ------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | --config <path> | -c | string | | Path to the Kubb config file | | --url <url> | | string | https://kubb.studio | Base URL of the Kubb Studio instance. Defaults to the one this project paired with | | --allow-read | | boolean | false | Read the source of generated files. Asked for once per project when omitted | | --allow-read-ast | | boolean | false | Read the parsed spec (the Kubb AST). Asked for once per project when omitted | | --allow-write | | boolean | false | Write generated files to disk. Asked for once per project when omitted | | --allow-config-edit | | boolean | false | Edit plugin options in kubb.config.ts. Asked for once per project when omitted | | --allow-install | | boolean | false | Let Studio install extensions with kubb add. Needs --allow-config-edit too. Asked once | | --allow-update | | boolean | false | Let Studio update installed extensions with kubb update. Asked once | | --allow-remove | | boolean | false | Let Studio remove extensions with kubb remove. Needs --allow-config-edit too. Asked once | | --allow-save-input | | boolean | false | Let Studio save the spec it sends as input. Needs --allow-config-edit too. Asked once | | --allow-file-refs | | boolean | false | Let a $ref read a local file outside the project, or a URL on a host that is not public. Asked for once per project when omitted | | --allow-exec | | boolean | false | Run the formatter, the linter, and output.postGenerate. Asked once per project when omitted | | --no-open | | boolean | | Do not open the approval page in a browser while pairing | | --log-level <level> | -l | string | info | Log level: silent, info, or verbose |

The old camelCase spelling of a flag (--allowWrite, --logLevel, --dryRun) still works and prints a deprecation warning on stderr. Support for it will be removed in a future major version.

Examples

# Pair on first run, then connect read-only
npx kubb studio

# Let Studio write generated files to disk
npx kubb studio --allow-write

# Pair without connecting
npx kubb studio login

# Show which machine is paired, and with which Studio
npx kubb studio status

# Forget the stored token
npx kubb studio logout

# Point at a self-hosted Studio
npx kubb studio --url http://localhost:3000

kubb validate

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.

npx kubb validate <path-or-url>

Arguments

| Argument | Required | Description | | --------- | -------- | --------------------------------------------------- | | <input> | ✅ | Path or URL to the OpenAPI/Swagger file to validate |

Examples

# Validate a local file
npx kubb validate ./openapi.yaml

# Validate a remote spec
npx kubb validate https://petstore3.swagger.io/api/v3/openapi.json

Supporting Kubb

Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:

License

MIT