Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions fern/products/sdks/generators/cli/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: CLI generator
description: Generate a production CLI from your API definition — for AI agents and human developers alike.
---

<Note title="In Development">
The CLI generator is in active development. [Contact us](https://buildwithfern.com/contact) to learn more or request early access.
</Note>

Fern's CLI generator produces a fully functional command-line tool from the same API spec you already use for SDKs. It ships as a single binary with no runtime dependencies — built for both AI agents that need deterministic, introspectable interfaces and human developers who want to script, debug, and explore.

## Why a CLI and why now
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [vale] reported by reviewdog 🐶
[FernStyles.Current] Avoid time-relative terms like 'now' that become outdated


CLIs are how AI agents reach APIs in production. Agents invoke the command line because it gives them deterministic output, schemas they can introspect at runtime, and no interpreter or dependency tree to install.

Human developers want CLIs too — for scripting, CI, debugging, and exploring an API before committing to an SDK integration. Both audiences are well-served by a single binary.

Most API companies don't ship one because building a good CLI 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 CLI generator handles all of that automatically.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[Microsoft.Wordiness] Consider using 'all' instead of 'all of'.


## How it works

The CLI generator plugs into the same Fern workflow as your SDK generators. On every spec change, Fern regenerates the CLI source and opens a PR against your repo. You merge, tag a release, and your build pipeline ships binaries to npm, Homebrew, and GitHub Releases.

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

## Designed for agents

**Self-describing at runtime.** Agents can ask what a command accepts instead of carrying that context in their window. Schema introspection and structured JSON help output let agents discover capabilities on the fly.

**Hardened against agent failure modes.** The CLI validates inputs — checking for path traversal, URL encoding issues, and malformed resource names — before any byte hits the network. It's the last enforcement point between an agent's output and your production API.

**CLI and MCP server in one.** Run the binary with `serve` and the same engine exposes MCP over stdio. The CLI and MCP server are generated from the same spec, so the two interfaces never drift apart.

## Built for humans too

The same binary produces colored help, tabular output, shell completions, and `--dry-run` previews when a person runs it interactively. It works offline, starts instantly, and each version maps to a specific API version for deterministic behavior.
7 changes: 7 additions & 0 deletions fern/products/sdks/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ navigation:
- page: Publishing to Postman
path: ./generators/postman/publishing-to-postman.mdx
slug: publishing
- section: CLI
slug: cli
availability: pre-release
contents:
- page: Overview
path: ./generators/cli/overview.mdx
slug: overview
- section: SDK design
slug: deep-dives
collapsed: true
Expand Down
Loading