CLI generator

Beta
View as Markdown
Early access

The CLI generator is in early access. Reach out to get started.

Fern’s CLI generator produces a fully functional command-line tool from the same API spec you already use for SDKs. It ships alongside your Docs and SDKs as a single binary with no runtime dependencies, serving AI agents that need deterministic output and runtime-introspectable schemas as well as human developers who script, debug, and explore.

Building a CLI by hand is a multi-quarter project — commands, auth, pagination, retries, output formatting, cross-platform builds, shell completions, and keeping it all in sync as the API evolves. The generator handles that automatically.

How it works

Supported API definitions

Generate a CLI from an OpenAPI spec or a GraphQL introspection schema.

The CLI generator plugs into the same Fern workflow as your Docs and SDKs. When your spec changes, Fern opens a PR against your CLI repo with the generated source. On release, Fern automatically publishes the CLI to npm, Homebrew, and GitHub Releases so your users can install it with their package manager of choice. The CLI stays in sync with your Docs and SDKs, and you never need to write CLI code by hand.

The output is a single statically linked Rust binary. Users drop it onto their PATH and run it. There’s no language runtime and no dependencies.

Built for agents and humans

Runtime introspection

Schema and help available as structured JSON.

Input validation

Double-encoded URLs and other malformed inputs are caught before any request is sent.

MCP server built in

The same binary serves MCP over stdio or streamable HTTP.

Interactive output

Colored help, tabular output, and shell completions.

Dry-run mode

Preview a request without sending it.

Version-pinned

Each release maps to a specific API version.