Fern CLI
How the Fern CLI stays clear for people and predictable for scripts and agents.
- Adding a command, flag, prompt or message to the
fernCLI or@fern-api/wizard. - Printing anything a person reads in a terminal: status, progress, errors and next steps.
The short version
If you read nothing else on this page, read these.
✓ Created fern/ from openapi.yaml⚠ No logo found. Using the starter logo.✗ fern check found 2 errors in fern/docs.yml
Created fern/ from openapi.yamlNo logo foundfern check found 2 errors
✗ Couldn't create the Fern project. pnpm exited with code 1. To see the full error, run: $ pnpm exec fern init --log-level debug
Error: ENOENT: no such file or directory, open 'generators.yml' at Object.openSync (node:fs:573:18) at readFileSync (node:fs:452:35) at loadGenerators (cli.cjs:88231:19)
$ npx @fern-api/wizard < /dev/nullInteractive mode needs a terminal.Re-run with --yes to accept the defaults.
? Fern organization name (used for fern.config.json) Error: The job timed out after 360 minutes.
Fern CLI splash
Plays once as it scrolls into view. Switch to a light terminal to see why the summary beside the logo uses the terminal's own colors.
$ npx @fern-api/wizard
Primitives
What every Fern command does, distilled from clig.dev, GitHub's CLI guidelines, Heroku's CLI style guide and Atlassian's principles for delightful CLIs. Download them for an agent working in fern-api/fern.
01Status is a glyph and words, never color alone
Start the line with✓,✗,⚠or◆, then say what happened. Color backs it up in chalk's named colors, so the person's theme picks the shade, and turns off underNO_COLORor when stdout isn't a terminal.02Errors say what happened, then how to fix it
Name the failure in words, not an internal id, and put the command that fixes it on the next line. Stack traces and raw tool output appear only with--log-level debug.03Every prompt has a flag
Prompt only when stdin is a terminal, and show the default. Every answer is also a flag and--yestakes every default, so a script, a CI job or a coding agent never waits on a question. Without a terminal, stop at once and name the flag.04Streams and exit codes are the API
Results go to stdout; progress, warnings and errors go to stderr. Data has a--jsonform with no color or prose. Exit0when it worked and anything else when it didn't: a failed step fails the run, even if later steps pass.05Respond at once, and show the shape of the work
Print something within 100 ms. Count work of known length (3 of 8) and narrate the rest in a present-tense line (Scanning ~/acme…). Animate only in an interactive terminal; in CI, print one line when a step starts and one when it ends.06End with the next step
Finish on the commands to run next, exactly as they'll run ($ pnpm exec fern check), then a prompt to hand to a coding agent.✓is only for what already happened.07Help leads with examples
Every command takes--help: one line on what it's for, the common examples, then every flag with its default. Flags are long and kebab-case, and a mistyped command suggests the closest one.08Writes are safe by default
Anything that writes takes--dry-run. Never overwrite a file someone wrote; skip it and say so. Changes outside the repo, like signing in or editing~/.cursor/mcp.json, are opt-in, and--yesnever widens them.09Ctrl-C always works
Stop at once, give back the cursor and exit with130. A terminal left without a cursor is the most visible bug a CLI can ship.10Speak like Fern
Use the dashboard's voice and names: sentence case, outcome first, no exclamation marks or em dashes. One name per thing (docs site, SDK, API definition) and one meaning per flag, on every command.
In a terminal and in CI
Every command reads top to bottom in the same order: what it found, what you chose, what it did, what to run next. The wizard's first run, at a keyboard and then in CI.
At a keyboard: each step shows the command it runs, and the run ends on what to do next.
What Fern can do for this repo ✓ SDK generation: found openapi.yaml (OpenAPI 3.0.3) https://buildwithfern.com/learn/sdks/overview/introduction ✓ API documentation: build docs from openapi.yaml https://buildwithfern.com/learn/docs/getting-started/overview ✓ Fern MCP for coding agents: found a claude-code configuration https://buildwithfern.com/learn/docs/ai-features/fern-mcp-servers ? Choose what to set up Fern CLI, Fern project, Docs site, Agent handoff? Site title Acme? Docs URL (acme.docs.buildwithfern.com) acme? Landing page layout Stacked? Features API Reference, Ask Fern, Changelog ◆ Install the Fern CLI $ pnpm add -D fern-api✓ Installed fern-api◆ Create a Fern project from your OpenAPI spec $ pnpm exec fern init --openapi openapi.yaml --org acme✓ Created fern/ with fern.config.json and generators.yml◆ Create a docs site from a template Stacked layout · acme.docs.buildwithfern.com · API Reference, Ask Fern, Changelog✓ Wrote fern/docs.yml, fern/docs/ and fern/styles.css◆ Teach your coding agent about Fern✓ Wrote .claude/skills/fern/SKILL.md⚠ Skipped AGENTS.md: already exists Next steps $ pnpm exec fern check $ pnpm exec fern docs dev $ pnpm exec fern generate --docs https://acme.docs.buildwithfern.com Hand this to your coding agent Help me get started with Fern. Read https://buildwithfern.com/learn/home/get-started.md and follow it step by step.
In CI: flags answer every question, and the exit code fails the job even though a later step passed.
$ npx @fern-api/wizard --yes --org acme✓ Scanned ~/work/acme: openapi.yaml, fastapi, pnpm◆ Install the Fern CLI✓ Installed fern-api◆ Create a Fern project from your OpenAPI spec✗ Couldn't create the Fern project. pnpm exited with code 1. Run it yourself to see the full error: $ pnpm exec fern init --openapi openapi.yaml --org acme --log-level debug◆ Create a docs site from a template✓ Wrote fern/docs.yml, fern/docs/ and fern/styles.css$ echo $?1
Glyphs
Five status glyphs and two markers, each with its ASCII fallback and chalk style. Dim is for detail lines, bold for headings and names.