> ## Documentation Index
> Fetch the complete documentation index at: https://docs.frontic.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Frontic CLI

The Frontic CLI is a command-line interface for interacting with your [Frontic Account](https://app.frontic.com) and generating project-specific files such as the [Client SDK](https://docs.frontic.com/reference/client-sdk.md).

![Frontic CLI Hero](https://mintcdn.com/frontic/34vlQbUxJTTktEkF/images/hero-cli.png?fit=max\&auto=format\&n=34vlQbUxJTTktEkF\&q=85\&s=8e37f99a07185ac75ec5a9ce9a08b01c)

## Setup

You can use the Frontic CLI in two ways:

1. Install the CLI globally (enables the `frontic` command).
2. Run it ad-hoc through your package manager's runner (`pnpm dlx`, `npx`, `yarn dlx`, `bunx`).

```bash frontic theme={"theme":"css-variables"}
# Install once globally
npm install -g @frontic/cli

# Then use the `frontic` command
frontic <command>
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest <command>
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest <command>
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest <command>
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest <command>
```

> [accordion] Which option should I choose?
>
> * **Global install** - pin to a specific version, run frequently. You manage upgrades manually.
> * **One-off runner** (`pnpm dlx`, `npx`, etc.) - always uses the latest version (or your package manager's cache). No global state.

> [accordion] Video tutorial 🎬
>
> [https://www.loom.com/embed/80e900735a6f4502a04eb02866525735?sid=c37fdabb-be58-4ab9-b6dd-113d657bc5e2](https://www.loom.com/embed/80e900735a6f4502a04eb02866525735?sid=c37fdabb-be58-4ab9-b6dd-113d657bc5e2)

## Commands

### Global options

These go before or after any command, for example `frontic generate --non-interactive`.

`--non-interactive` is for scripts, CI, and any machine without a person at the keyboard. The CLI then never opens a browser or a picker. Where it would have asked, it stops with an `[ERROR]` line and a non-zero exit code instead:

* `frontic login` without `--token` fails with "Browser login needs a terminal". Log in with `frontic login --token <token>` instead.
* `frontic project` with more than one project to pick from fails and asks for `-p <project-id>`. With exactly one project, it selects that one.
* `frontic generate` fails when no project is selected, or when the existing client was generated for a different project, instead of asking whether to switch or overwrite. Without a version, it generates against the public version, or the develop version before anything is published, instead of asking which API version. `frontic generate draft` without a name fails and lists the drafts.

The `--json` option of the `release` and `draft` commands turns on the same behaviour for that command.

Whether or not the flag is set, a Frontic backend the CLI can't reach ends the command with `Cannot reach <url>`, or `<url> answered <status>`, and exit code `1`. Logging in again can't fix that, so the CLI doesn't offer it.

| Option | What it does |
| - | - |
| `-V, --version` | output the version number |
| `--non-interactive` | Never prompt or open a browser; fail instead (scripts, CI, agent VMs) |

### `frontic context`

Sync your project's [Context Base](https://docs.frontic.com/context-base/overview.md) (Skills and Rules) into your repository so your editor's AI agent reads them on every session. Two subcommands.

#### `frontic context init`

Sync Skills, Context Rules and brand tokens in one shot. Skills go to `.claude/skills/` (`.cursor/skills/` with `--agent cursor`), Context Rules to `.claude/rules/`. Project Rules go to `.claude/CLAUDE.md` only with `--profile studio` or `--profile designer`; the default profile, `custom`, has none. See [Choosing a profile](https://docs.frontic.com/ide/frontic-cli.md#choosing-a-profile).

Re-running without `--force` leaves rule files alone when nothing changed in Frontic - safe to run repeatedly.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic context init
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest context init
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest context init
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest context init
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest context init
```

| Option | What it does |
| - | - |
| `--agent \<agent>` | Target agent: claude-code, cursor Default `claude-code`. |
| `-o, --output \<path>` | Output base directory Default `.`. |
| `--profile \<profile>` | Which workspace to sync for: studio, designer, custom Default `custom`. |
| `--force` | Overwrite all files (without --force, unchanged files are skipped) |

#### `frontic context skills`

Sync only Skills.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic context skills
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest context skills
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest context skills
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest context skills
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest context skills
```

| Option | What it does |
| - | - |
| `--agent \<agent>` | Target agent: claude-code, cursor Default `claude-code`. |
| `-o, --output \<path>` | Output base directory Default `.`. |

### `frontic credentials`

Manage project credentials

#### `frontic credentials load`

Pull the project's [Studio credentials](https://docs.frontic.com/studio/settings.md#credentials) into a local `.env` file so the same secrets your Studio workspace uses are available when you run the code on your own machine. The command merges credentials into the file under a delimited block so re-running the command updates only that block - anything else in the file stays put. If a `.gitignore` exists, the env file is added to it automatically.

For Studio workspaces, credentials are injected automatically - `frontic credentials load` is for local development.

The default is `.env.studio` rather than `.env` so the command never overwrites an existing `.env` or `.env.local`. Pass `--env-file` to write to a different filename instead.

Pass `--export` to print `export VAR=value` statements to stdout instead of writing a file, which is useful for sourcing into the current shell:

```bash theme={"theme":"css-variables"}
eval "$(frontic credentials load --export)"
```

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic credentials load
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest credentials load
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest credentials load
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest credentials load
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest credentials load
```

| Option | What it does |
| - | - |
| `--env-file \<path>` | Target .env file path Default `.env.studio`. |
| `--export` | Print export statements to stdout instead of writing a file |

### `frontic draft`

> [!NOTE]
>
> Preview - drafts are in active development. Specifics may change before general availability. Unlike the rest of [Release Control](https://docs.frontic.com/releases/overview.md), drafts are currently planned to be **exclusive to the Scale plan**.

Split a short-lived snapshot off the [workspace](https://docs.frontic.com/releases/overview.md#the-workspace), prepare work in it, and merge it back, choosing a side for each conflict. Each draft has its own version key and a random sample of up to 100 records from each feed, so you can iterate end to end without changing the workspace for the rest of the team. Multiple drafts can exist in parallel, and a draft is removed only when it merges. Use `frontic generate draft <name>` to generate an SDK against one without changing your active project.

#### `frontic draft create`

Split a new draft from develop (prompts for name if omitted)

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic draft create [name]
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest draft create [name]
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest draft create [name]
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest draft create [name]
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest draft create [name]
```

**name** `string`

name

| Option | What it does |
| - | - |
| `--json` | Machine-readable output |

#### `frontic draft list`

List drafts of the current develop project

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic draft list
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest draft list
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest draft list
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest draft list
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest draft list
```

| Option | What it does |
| - | - |
| `--json` | Machine-readable output |

#### `frontic draft diff`

Show what the draft has changed vs develop (interactive picker if no name given)

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic draft diff [name]
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest draft diff [name]
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest draft diff [name]
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest draft diff [name]
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest draft diff [name]
```

**name** `string`

name

| Option | What it does |
| - | - |
| `--json` | Machine-readable output |

#### `frontic draft check`

Check whether a draft will merge cleanly into develop (interactive picker if no name given)

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic draft check [name]
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest draft check [name]
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest draft check [name]
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest draft check [name]
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest draft check [name]
```

**name** `string`

name

| Option | What it does |
| - | - |
| `--json` | Machine-readable output |

#### `frontic draft merge`

Merge a draft back into develop (interactive picker if no name given). The draft is removed after merge.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic draft merge [name]
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest draft merge [name]
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest draft merge [name]
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest draft merge [name]
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest draft merge [name]
```

**name** `string`

name

| Option | What it does |
| - | - |
| `--resolutions \<uuids>` | Comma-separated UUIDs to resolve conflicts (one per pair) |
| `-y, --yes` | Skip the no-conflict confirmation prompt |
| `--json` | Machine-readable output |

### `frontic generate`

Generate the typed [Client SDK](https://docs.frontic.com/reference/client-sdk.md) for the current project.

Pass the [API version](https://docs.frontic.com/releases/overview.md#api-versions) to generate against: `develop`, `preview` or `public`. Without one, the CLI uses the public version, or the develop version before anything is published, and prints which. In an interactive terminal it also opens a picker with that version preselected.

```bash frontic theme={"theme":"css-variables"}
frontic generate develop
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest generate develop
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest generate develop
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest generate develop
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest generate develop
```

To generate against a [draft](https://docs.frontic.com/releases/overview.md#drafts), run `frontic generate draft <name>`. Without a name, the CLI opens a picker; in CI it fails and lists the drafts.

Rerun `frontic generate` after upgrading the CLI or the [Nuxt module](https://docs.frontic.com/reference/nuxt-module.md#typescript). The module reads a newer layout of the generated types and warns at build time when your `.frontic/` folder was generated by an older CLI.

If generation fails with `Invalid API specification. The API specification must be a valid YAML file.`, rerun with `--debug` - it writes the raw spec response to `fetch-api.debug.yaml` so you can inspect exactly what the backend returned.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic generate [version] [name]
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest generate [version] [name]
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest generate [version] [name]
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest generate [version] [name]
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest generate [version] [name]
```

**version** `string`

API version to generate against: develop, preview or public (default: public when it exists, else develop); or draft \<name> for a draft

**name** `string`

With draft: the draft to generate against

| Option | What it does |
| - | - |
| `-o, --output \<path>` | Output path Default `.frontic`. |
| `-v, --verbose` | Enable verbose logging |
| `-s --persist-oas` | Persist OpenAPI specification file |
| `--debug` | Write the raw YAML response of the fetch-API spec to fetch-api.debug.yaml for debugging |

### `frontic info`

Display the current team (printed as `Organization`), project, and authenticated user.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic info
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest info
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest info
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest info
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest info
```

### `frontic library`

Sync the brand tokens [Context Setup](https://docs.frontic.com/context-base/setup.md) wrote into your repository, so the colors, fonts, and radii your agent uses come from the project rather than from memory.

#### `frontic library tokens`

Sync the brand tokens Context Setup wrote, and any you've published since in the [Design Library](https://docs.frontic.com/context-base/design-library.md).

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic library tokens
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest library tokens
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest library tokens
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest library tokens
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest library tokens
```

| Option | What it does |
| - | - |
| `-o, --output \<path>` | Output base directory Default `.`. |

### `frontic login`

Login to your Frontic account.

In most cases, run this from your project directory (where your `package.json` lives) so the CLI can place generated files correctly.

> [!NOTE]
>
> Opens a browser window to complete the login flow. Creates a token in `.frontic-local/`. Add this directory to `.gitignore` to keep credentials out of the repo.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic login
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest login
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest login
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest login
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest login
```

| Option | What it does |
| - | - |
| `--token \<token>` | A current token of your Frontic login, for non-interactive use |
| `--token-stdin` | Read the token from stdin instead of argv |

### `frontic logout`

Log out of your Frontic account.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic logout
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest logout
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest logout
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest logout
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest logout
```

### `frontic mcp`

Configure Frontic MCP servers for your AI coding client

#### `frontic mcp init`

Initialize Frontic MCP configuration for an AI coding client (`claude` resolves to Claude Code). Writes the Frontic MCP server entries directly into your client's MCP config file. The command merges with any existing MCP config rather than overwriting it.

When run, the CLI prompts you to choose what to install:

* **Tools & Docs** - both project tools and documentation MCP servers (default).
* **Tools only** - `frontic-tools` (authenticated project access).
* **Docs only** - `frontic-docs` (read-only documentation).

#### Config file paths

| Client | Path |
| - | - |
| `cursor` | `.cursor/mcp.json` (project-local) |
| `claude` | `.mcp.json` (project root, for Claude Code) |
| `windsurf` | `~/.codeium/windsurf/mcp_config.json` (global) |
| `vscode` | `.vscode/mcp.json` (project-local) |
| `codex` | `~/.codex/config.toml` (global, TOML format) |

See [MCP Tools](https://docs.frontic.com/ide/mcp-tools.md) for a guided walkthrough of the editor setup flow.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic mcp init
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest mcp init
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest mcp init
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest mcp init
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest mcp init
```

| Option | What it does |
| - | - |
| `--client \<client>` | Target client (cursor, claude, windsurf, vscode, codex) |

### `frontic project`

Select the active project for SDK generation and Context Base sync. The selection is stored in `.frontic-local/`. If you omit `--project`, the CLI prompts you to pick.

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic project
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest project
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest project
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest project
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest project
```

| Option | What it does |
| - | - |
| `-p --project \<project-id>` | Set current project ID |

### `frontic release`

Preview and publish versions of a project: the develop, preview and public versions

#### `frontic release status`

Show develop, preview, public, and any in-flight drafts

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic release status
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest release status
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest release status
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest release status
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest release status
```

| Option | What it does |
| - | - |
| `--json` | Machine-readable output |
| `-v, --verbose` | Verbose error output |

#### `frontic release preview`

Preview a version: generate a fresh preview version from the current workspace configuration and your data, replacing the old one

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic release preview
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest release preview
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest release preview
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest release preview
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest release preview
```

| Option | What it does |
| - | - |
| `--wait` | Block until the preview build is ready (polls preview-status) |
| `--poll-interval \<ms>` | Poll interval while --wait is set Default `2000`. |
| `--poll-timeout \<ms>` | Maximum time to wait for the build Default `600000`. |
| `--force` | Skip the typed-phrase confirm when overwriting an existing preview (must be combined with --yes) |
| `-y, --yes` | Skip the final yes/no confirm |
| `--json` | Machine-readable output |

#### `frontic release publish`

Publish the preview version as the public version (irreversible)

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic release publish
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest release publish
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest release publish
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest release publish
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest release publish
```

| Option | What it does |
| - | - |
| `--confirm \<projectName>` | Skip the typed project-name prompt (must be combined with --yes) |
| `-y, --yes` | Skip the final yes/no confirm |
| `--json` | Machine-readable output |

#### `frontic release diff`

Show what publishing will change (develop → public by default)

#### Usage

```bash frontic theme={"theme":"css-variables"}
frontic release diff
```

```bash pnpm theme={"theme":"css-variables"}
pnpm dlx @frontic/cli@latest release diff
```

```bash npm theme={"theme":"css-variables"}
npx @frontic/cli@latest release diff
```

```bash yarn theme={"theme":"css-variables"}
yarn dlx @frontic/cli@latest release diff
```

```bash bun theme={"theme":"css-variables"}
bunx @frontic/cli@latest release diff
```

| Option | What it does |
| - | - |
| `--from \<version>` | `develop`, `preview`, or `public` (default: develop) |
| `--to \<version>` | `develop`, `preview`, or `public` (default: public) |
| `--json` | Machine-readable output |

### Getting help

Pass `--help` to any command to see its options:

```bash theme={"theme":"css-variables"}
frontic --help
frontic generate --help
frontic context init --help
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.