# CLI reference

> Every npx lefine command and option, read from the CLI itself.

Generated from the CLI's own help (`packages/cli/src/lefine.ts`) by `bun scripts/build-docs-reference.ts`. Run any command with `--help` to see the same text.

```bash
npx lefine --help
```

Lefine from the terminal: sign in, then push, check, publish and pull your strings

| Command | What it does |
|---|---|
| `lefine login` | Sign in through the browser (device code, works over SSH) |
| `lefine init` | Sign in, pick the app, install lefine, and write lefine.ts plus a first translated page for Next or TanStack Start |
| `lefine logout` | Remove the saved key from this machine |
| `lefine whoami` | Show who you are signed in as |
| `lefine strings pull` | Download translations from the CDN to local JSON files |
| `lefine strings push` | Show what would change, then push the source file to Lefine |
| `lefine strings check` | Server checks (ICU, placeholders, markup) plus a scan of your code |
| `lefine strings unused` | Keys in Lefine your code never uses (a scan of the code, compared on the server) |
| `lefine strings missing` | Names in your code with no key in Lefine (users would see the raw name) |
| `lefine strings publish` | Publish to the CDN after a person approves it in Lefine, and wait until every locale is verified |
| `lefine strings status` | Live revision, pending changes and the last CDN check |
| `lefine strings types` | Write a .d.ts with every key of the app, so the editor knows keys added in Lefine |
| `lefine strings snapshot` | Write the published texts to a file for createLefine({ snapshot }): the first request after a deploy is served from it |
| `lefine strings keys list` | Keys with their source text (or --locale), page by page |
| `lefine strings keys create` | Add a key (live with the next publish) |
| `lefine strings keys delete` | Delete keys by namespace.key or id (a person approves it in Lefine) |
| `lefine strings runs` | Recent syncs, imports and publishes, or one with its steps |
| `lefine strings languages add` | Add a language (a person approves it in Lefine) |
| `lefine doctor` | One report and a 0-100 score: hard-coded text in the code, texts that break, missing and unused keys |
| `lefine apps` | Your workspace's apps, with their ids |
| `lefine content types` | Write a TypeScript file with one type per content type of a Content project |
| `lefine migrate` | Move next-intl / @better-i18n code to lefine: rewrites what maps one to one, lists the rest (dry run unless --write) |
| `lefine mcp` | Lefine as a local MCP server (stdio) for Claude Desktop and IDEs; remote clients can use https://dash.lefine.ai/v1/mcp |

## lefine login

Sign in through the browser (device code, works over SSH)

```bash
npx lefine login [options]
```

| Option | What it does |
|---|---|
| `--token <key>` | Use an access key (lfn_...) instead of the browser |
| `--no-browser` | Do not try to open the browser |
| `--api-url <url>` | API origin (default: LEFINE_API_URL or https://dash.lefine.ai) |
| `--json` | Machine-readable output |

## lefine init

Sign in, pick the app, install lefine, and write lefine.ts plus a first translated page for Next or TanStack Start

```bash
npx lefine init [options]
```

| Option | What it does |
|---|---|
| `--app <id\|slug>` | The app, without the question (CI) |
| `-d, --dir <path>` | The app's directory |
| `-o, --output <path>` | Where lefine.ts goes (default: the framework's place) |
| `--force` | Replace an existing lefine.ts (never your pages) |
| `--no-install` | Do not add lefine to package.json |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |

## lefine logout

Remove the saved key from this machine

```bash
npx lefine logout [options]
```

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

## lefine whoami

Show who you are signed in as

```bash
npx lefine whoami [options]
```

| Option | What it does |
|---|---|
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |

## lefine strings pull

Download translations from the CDN to local JSON files

```bash
npx lefine strings pull [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from i18n.config.ts). workspace/app also works, as an alias |
| `-o, --output <path>` | Output directory (default: ./locales) |
| `-l, --locales <codes>` | Comma-separated locale codes (default: all) |
| `-d, --dir <path>` | Directory with the config |
| `--cdn-url <url>` | CDN origin (default: LEFINE_CDN_URL or https://cdn.lefine.ai) |
| `--since <revision>` | List what changed since this revision first |
| `--force` | Download every locale even when it is unchanged since the last pull |
| `--verbose` | Show detail per locale |
| `--json` | Machine-readable output |

## lefine strings push

Show what would change, then push the source file to Lefine

```bash
npx lefine strings push [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--file <path>` | Source locale file: JSON, YAML, XLIFF, Android XML or .properties (default: <output>/<default locale>.json) |
| `--namespace <name>` | For a YAML, XLIFF, XML or .properties file: its namespace (default: the file's name) |
| `--locale <code>` | Source locale (default: from i18n.config.ts) |
| `-y, --yes` | Apply without asking (required in CI) |

## lefine strings check

Server checks (ICU, placeholders, markup) plus a scan of your code

```bash
npx lefine strings check [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--file <path>` | Source locale file |
| `--locale <code>` | Source locale |

## lefine strings unused

Keys in Lefine your code never uses (a scan of the code, compared on the server)

```bash
npx lefine strings unused [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--namespace <name>` | Only this namespace |
| `--ci` | Exit 1 when a key is unused |
| `--delete` | Delete them (a person approves it in Lefine; the CLI opens the page and waits) |
| `--approval <id>` | Run a delete a person already approved |
| `-y, --yes` | Skip the question here; the person still approves in Lefine |

## lefine strings missing

Names in your code with no key in Lefine (users would see the raw name)

```bash
npx lefine strings missing [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--namespace <name>` | Only this namespace |

## lefine strings publish

Publish to the CDN after a person approves it in Lefine, and wait until every locale is verified

```bash
npx lefine strings publish [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `-y, --yes` | Skip the question here; a person still approves the publish in Lefine (the CLI opens the page and waits) |

## lefine strings status

Live revision, pending changes and the last CDN check

```bash
npx lefine strings status [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |

## lefine strings types

Write a .d.ts with every key of the app, so the editor knows keys added in Lefine

```bash
npx lefine strings types [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `-o, --output <path>` | File to write (default: lefine-strings.d.ts) |
| `--binding <name>` | Register the types with next-intl, use-intl, lefine/strings or none (default: from package.json) |

## lefine strings snapshot

Write the published texts to a file for createLefine({ snapshot }): the first request after a deploy is served from it

```bash
npx lefine strings snapshot [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `-o, --output <path>` | File to write (default: lefine-snapshot.json) |
| `--cdn-url <url>` | CDN origin (default: LEFINE_CDN_URL or https://cdn.lefine.ai) |

## lefine strings keys list

Keys with their source text (or --locale), page by page

```bash
npx lefine strings keys list [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--namespace <name>` | Only this namespace |
| `--search <text>` | Part of the key or of any of its texts |
| `--locale <code>` | Which text to show (default: the source locale) |
| `--limit <n>` | Keys per page, 1-200 (default 50) |
| `--all` | Every page |

## lefine strings keys create

Add a key (live with the next publish)

```bash
npx lefine strings keys create [options] <namespace.key>
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--text <source>` | Its source text |
| `--description <text>` | A note for translators |

## lefine strings keys delete

Delete keys by namespace.key or id (a person approves it in Lefine)

```bash
npx lefine strings keys delete [options] <keys...>
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--approval <id>` | Run a delete a person already approved |
| `-y, --yes` | Skip the question here; the person still approves in Lefine |

## lefine strings runs

Recent syncs, imports and publishes, or one with its steps

```bash
npx lefine strings runs [options] [id]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--kind <kind>` | Only this kind of run |
| `--limit <n>` | How many, 1-50 (default 10) |

## lefine strings languages add

Add a language (a person approves it in Lefine)

```bash
npx lefine strings languages add [options] <locale>
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--approval <id>` | Run an add a person already approved |

## lefine doctor

One report and a 0-100 score: hard-coded text in the code, texts that break, missing and unused keys

```bash
npx lefine doctor [options]
```

| Option | What it does |
|---|---|
| `-p, --project <app-id>` | The app's id, app_... (default: from lefine.ts or i18n.config.ts). workspace/app also works, as an alias |
| `-d, --dir <path>` | Directory with the config and code |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |
| `--threshold <score>` | Fail under this score (default 70) |
| `--verbose` | Show every finding |

## lefine apps

Your workspace's apps, with their ids

```bash
npx lefine apps [options]
```

| Option | What it does |
|---|---|
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |

## lefine content types

Write a TypeScript file with one type per content type of a Content project

```bash
npx lefine content types [options]
```

| Option | What it does |
|---|---|
| `-p, --project <id\|slug>` | Content project (default: the only one in the workspace) |
| `-o, --output <path>` | File to write (default: lefine-content.ts) |
| `-d, --dir <path>` | Directory to write in |
| `--api-url <url>` | API origin |
| `--json` | Machine-readable output |

## lefine migrate

Move next-intl / @better-i18n code to lefine: rewrites what maps one to one, lists the rest (dry run unless --write)

```bash
npx lefine migrate [options] [dir]
```

| Option | What it does |
|---|---|
| `--write` | Change the files |
| `--lefine-import <path>` | Where your lefine.ts is imported from (default: @/lefine) |

## lefine mcp

Lefine as a local MCP server (stdio) for Claude Desktop and IDEs; remote clients can use https://dash.lefine.ai/v1/mcp

```bash
npx lefine mcp [options]
```

Source: https://lefine.ai/en/docs/reference/cli/
