# CLI

Every command and flag of the prongs CLI. Generated from the same data as prongs --help.

Run it with `npx prongs`, or through your package manager’s scripts. It needs Node 22.18 or newer: it loads your TypeScript registry with Node’s built-in type stripping.

## Commands

### `prongs add`

Copy the UI components and starter intents into your repo, and write prongs.json.

| Prop | Type | What it does |
|---|---|---|
| `--dir` | `<path>` | Where the components go. Defaults to components/prongs. |
| `--force` | `flag` | Overwrite files that already exist. |

```bash
npx prongs add
```

### `prongs add gallery`

Add a page that renders every intent in your registry live (development only by default).

| Prop | Type | What it does |
|---|---|---|
| `--route` | `<file>` | Where to put the page in a Next.js app. Defaults to app/prongs/page.tsx. |
| `--public` | `flag` | Serve the page in production too. |

### `prongs add logs`

Add the logs profile: audit, security, incident, job and debug intents, plus log().

### `prongs add errors`

Add the errors profile: request, auth, permission, record, conflict, limit and failure intents, plus fail(). Adds the logs profile too, which errors write to.

### `prongs add analytics`

Add trackIntents(), which reports presses, submits, toggles and opens as events named by intent. You decide where they go.

### `prongs find <what it is for>`

Look up the intents for a job: each match with what it renders, its "not for" lines and how code writes it.

| Prop | Type | What it does |
|---|---|---|
| `--limit` | `<n>` | How many matches to show (default 3). |
| `--json` | `flag` | Print the matches as JSON, for tools. |

```bash
npx prongs find "wrong email or password"
```

### `prongs check [paths...]`

Check how intents are used. Existing violations in the baseline pass; new ones fail.

| Prop | Type | What it does |
|---|---|---|
| `--json` | `flag` | Print the findings as JSON, for tools. |
| `--suggest` | `flag` | Group repeated overrides and styled raw elements into proposed intents. |
| `--update-baseline` | `flag` | Record today’s findings in .prongs/baseline.json, so only new ones fail. |
| `--no-baseline` | `flag` | Ignore the baseline and report everything. |
| `--max-unsafe` | `<n>` | Fail when unsafeClassName is used more than n times. |
| `--hook` | `claude \| cursor` | Run as an agent hook: read the edited file from the hook payload and answer in that tool’s format. |

```bash
npx prongs check --suggest
```

### `prongs add-intent <id>`

Add an intent to the registry, validate it, and regenerate PRONGS.md. Rolls back if the registry would be invalid.

| Prop | Type | What it does |
|---|---|---|
| `--description` | `"<what it is for>"` | Required: what the intent is for, in a sentence. |
| `--refs` | `a,b` | Intents to build it from. |
| `--classes` | `"..."` | UI intents: its own classes. |
| `--element` | `<tag>` | UI intents: the element it renders. |
| `--not-for` | `"<context>"` | When not to use it. |
| `--instead` | `<id>` | What to use in that case. |

```bash
npx prongs add-intent action.follow --refs control.primary --description "Follows a person"
```

### `prongs spec`

Write PRONGS.md from the registry.

| Prop | Type | What it does |
|---|---|---|
| `--out` | `<file>` | Where to write it. Defaults to PRONGS.md. |
| `--agents` | `flag` | Also add a short block to AGENTS.md, and make sure CLAUDE.md reaches it. |
| `--check` | `flag` | Write nothing; fail if PRONGS.md is out of date. For CI. |

```bash
npx prongs spec --agents
```

### `prongs export`

Print the registry as JSON, in the shape the spec defines, for tools that do not run TypeScript.

| Prop | Type | What it does |
|---|---|---|
| `--out` | `<file>` | Write it to a file instead of printing it. |

```bash
npx prongs export --out prongs.registry.json
```

### `prongs install-hooks`

Run prongs check on every file an agent edits.

| Prop | Type | What it does |
|---|---|---|
| `--claude` | `flag` | Only the Claude Code PostToolUse hook. |
| `--cursor` | `flag` | Only the Cursor postToolUse hook. |

## Common options

| Prop | Type | What it does |
|---|---|---|
| `--config` | `<prongs.json>` | Use a config file other than ./prongs.json. |
| `--cli` | `"<how to run prongs>"` | How printed commands should call the CLI, e.g. "yarn prongs". |
