> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI0YzRjYTY2Zi0zMjA5LTQ3YTctYjUyOC02ODNkOGJhNDg5YWIiLCJleHAiOjE3ODQzNTkxODksImlhdCI6MTc4NDM1ODg4OX0.SSGUsWRGAtF3io3EPLVnZENZy-kXozSxfMGhaCqXOos
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# Configuration reference

> Configure CLI generation in generators.yml with generator-specific options, output targets, GitHub integration, and shared settings.

The CLI generator is in early access. [Reach out](https://buildwithfern.com/book-demo?type=cli) to get started.

Configure the CLI generator in `generators.yml`. Options nested under `config` are specific to the CLI generator. The rest (`output`, `github`, `audiences`, `smart-casing`, `metadata`, `api`) behave the same way as for [SDK generators](/learn/sdks/reference/generators-yml).

```yaml title="generators.yml" {6-8}
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        config:
          binaryName: my-cli
          customCommands: true
        github:
          repository: my-org/my-cli
          mode: pull-request
```

## `config` options

Name of the compiled binary. Determines the executable filename, the Cargo `[[bin]]` target name, and the environment-variable prefix used for [TLS, proxy, and logging settings](/learn/cli-generator/get-started/features#tls-proxies-and-ca-bundles).

When omitted, the generator derives the name from the API definition's display name (kebab-cased). Multi-spec workspaces must set this field explicitly — there is no sensible auto-derivation when multiple specs are present.

```yaml title="generators.yml"
config:
  binaryName: contoso
```

The binary name `contoso` produces:

* Executable: `contoso`
* Env-var prefix: `CONTOSO` (e.g. `CONTOSO_CA_BUNDLE`, `CONTOSO_LOG`)

Controls whether the generator produces the custom command infrastructure alongside the CLI binary. When enabled, the output includes:

* A `<binaryName>-types` library crate (typed serde structs)
* A `<binaryName>-sdk` library crate (HTTP client accessible via `ctx.client()`)
* Scaffolding files for user-authored command handlers

Set to `false` to produce a spec-only CLI with no custom command support.

```yaml title="generators.yml"
config:
  customCommands: false
```

## Publishing & delivery

### `output`

Configures where to publish the generated CLI. The CLI generator supports `npm` and `local-file-system` output locations. For the full publishing workflow (OIDC auth, CI builds, Homebrew tap), see [Publishing](/learn/cli-generator/get-started/publishing). For Docker-based generation on your own machine, see [Self-hosted generation](/learn/cli-generator/get-started/local-generation).

Publish the CLI as an npm package. Users install with `npm install -g @myorg/my-cli` or `npx @myorg/my-cli`.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        output:
          location: npm
          package-name: "@myorg/my-cli"
          token: "${NPM_TOKEN}"
        config:
          binaryName: my-cli
```

Write the generated Rust project to a local directory for manual building and distribution.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        output:
          location: local-file-system
          path: ../my-cli
        config:
          binaryName: my-cli
```

### `github`

Specifies how generated CLI code is delivered to your repository. Supports the same [modes as SDKs](/learn/sdks/reference/generators-yml#github): `release`, `pull-request`, and `push`.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        config:
          binaryName: my-cli
        github:
          repository: my-org/my-cli
          mode: release
```

| Mode           | Behavior                                                                                                       |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| `release`      | Commits to the default branch and tags a new release. Triggers CI workflows that build and publish the binary. |
| `pull-request` | Opens a PR with the generated source for review before merging.                                                |
| `push`         | Pushes directly to the specified branch. Requires `branch` field.                                              |

## Command generation

### `audiences`

Filter which API endpoints are included in the generated CLI based on audience tags. Only endpoints tagged with the specified audiences in your API spec (via [`x-fern-audiences`](/learn/api-definitions/openapi/extensions/audiences)) produce commands. Without this filter, all endpoints generate commands.

```yaml title="generators.yml"
groups:
  cli:
    audiences: ["external"]
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        config:
          binaryName: my-cli
```

### `smart-casing`

Enables intelligent case conversion that preserves numbers and common programming patterns in generated command and flag names.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        smart-casing: true
        config:
          binaryName: my-cli
```

### `api`

Override authentication settings at the generator level. This uses the same schema as the [SDK generator-level `api.auth`](/learn/sdks/reference/generators-yml#override-api-authentication-settings) to control which auth schemes the CLI uses.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        api:
          auth: BearerAuth
        config:
          binaryName: my-cli
```

### `metadata`

Attach package metadata to the generated CLI for use in published artifacts.

```yaml title="generators.yml"
groups:
  cli:
    generators:
      - name: fern-cli-generator
        version: 0.23.4
        metadata:
          package-description: "CLI for the Contoso API"
          author: "Contoso Inc."
          reference-url: "https://docs.contoso.com/cli"
        config:
          binaryName: contoso
```