Fern CLI
$ fern Official Med RiskFern CLI (fern-api on npm) validates OpenAPI or Fern Definition workspaces (fern check) and generates idiomatic SDKs plus API docs (fern generate). Supports non-interactive FERN_TOKEN CI auth and --local Docker-backed local generation.
npm install -g fern-api fern check and fern generate --local run inside repo CI workflows to validate API specs and build SDKs without needing MCP.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Clear fern check, fern generate --local, and FERN_TOKEN env auth, though outputs are human text rather than JSON.
- Supports
fern check,fern generate --local, andFERN_TOKEN
fern check validates specs read-only and --local keeps builds on-machine instead of publishing remotely.
- Read-only
fern checkand--localgeneration guard
Cross-platform Node.js package (fern-api), though --local generator execution requires Docker.
- Distributed as
fern-apion npm;--localuses Docker
Combines OpenAPI/DSL validation, multi-language SDK generation, and API docs publishing.
- Unified validation, SDK generation, and docs CLI
Official fern-api/fern repository under Apache-2.0.
- Official
fern-api/fernrepository
Well-organized CLI reference at buildwithfern.com.
- Official docs at buildwithfern.com
Security, Auth & Guardrails
Auth token stored locally after fern login or supplied non-interactively via FERN_TOKEN env var.
CLI and core generators are Apache-2.0 open-source; hosted Fern Docs and enterprise tiers are commercially billed.
# Fern CLI Agent Rules - Always run `fern check` after editing OpenAPI or `fern/` definitions. - Prefer `fern generate --local` during development before cloud generation. - Supply `FERN_TOKEN` via env var in CI instead of interactive `fern login`.
Agent-Ready Command Recipes
Safe Read-Only Queries
fern check
Validates OpenAPI/Fern API schemas, examples, and generators.yml without generating or publishing artifacts.
Controlled Writes & Previews
fern generate --local
Executes configured SDK generators locally without pushing to remote registries.
Strengths for Agents
- +
fern checkcatches OpenAPI and example mismatches offline. - +
fern generate --localallows safe local SDK verification before CI publish. - + Apache-2.0 open-source CLI (
fern-api/fern).
Caveats & Pitfalls
- ! Note the npm package name is
fern-apiwhile the installed binary isfern. - ! Local generator runs require Docker, and remote cloud generation requires
FERN_TOKEN.