> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# CLI

The `@blotch/dolan` CLI copies UI components into your app. Later, it tells you when they change and merges the updates for you.

```bash
npx @blotch/dolan <command> [options]
```

- **Run every command from your project folder.**
- **`npx` runs your installed copy** once `@blotch/dolan` is a dependency (see [installation](/dolan/index.md#installation)). The shorter `npx dolan <command>` works too.
- **`npx @blotch/dolan --help`** lists the commands, and `<command> --help` lists a command's options. `--version` prints the version.
- **Every command except `init` and `info` needs a `dolan.config.json`.** Run [`init`](#init) first: it writes the file.
- **In CI, a script or an AI agent, the commands ask nothing.** See [Without a terminal](#without-a-terminal).

| Command                                      | What it does                                            |
| -------------------------------------------- | ------------------------------------------------------- |
| [`init`](#init)                              | Set up dolan and copy the theme files                   |
| [`add`](/dolan/cli/components.md#add)        | Copy components into your app                           |
| [`list`](/dolan/cli/updates.md#list)         | Show installed components and their status              |
| [`info`](/dolan/cli/components.md#info)      | Show a component's files and dependencies               |
| [`diff`](/dolan/cli/updates.md#diff)         | Show how your copy differs from the bundled source      |
| [`outdated`](/dolan/cli/updates.md#outdated) | List components that aren't up to date (exits 1 if any) |
| [`update`](/dolan/cli/updates.md#update)     | Merge the bundled source into your copies               |
| [`remove`](/dolan/cli/components.md#remove)  | Delete a component                                      |
| [`eject`](/dolan/cli/components.md#eject)    | Stop recording a component's file hashes                |
| [`theme`](#theme)                            | List theme files, or start a new one                    |
| [`doctor`](#doctor)                          | Check your setup                                        |

## Where updates come from

**The CLI package contains the component source.** It doesn't download anything. So "upstream" in every command means the source bundled with the `@blotch/dolan` version you have installed.

To get newer components, upgrade the CLI and then update:

```bash
npm install @blotch/dolan@latest
npx @blotch/dolan update
```

The CLI keeps two files at the project root. Commit both.

- **`dolan.config.json`:** where components and theme files go. Paths are relative to the project folder.
- **`dolan.lock.json`:** a hash of every copied file, as it was when dolan wrote it. dolan compares it with your file and the bundled source to tell who changed what.

```json title="dolan.config.json"
{
  "aliases": {
    "components": "src/components/ui",
    "theme": "src/styles"
  }
}
```

If your project has an `.oxfmtrc.json` and oxfmt installed, dolan formats the `.ts` files it writes with your settings.

## Without a terminal

In CI, a script or an AI agent, a command's input isn't a terminal, so nobody can answer its questions.

- **The commands ask nothing.** Each question takes its default answer.
- **Some stop instead.** Where a question has no default, or its default would cancel the run, the command exits with code 1. It does so before changing anything, and says what to pass instead.

| Command                                     | Question                                    | Without a terminal                                                                                      |
| ------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [`init`](#init)                             | Where should components and theme files go? | Uses `--components` and `--theme`, or the defaults.                                                     |
|                                             | Overwrite `dolan.config.json`?              | Exits 1. Add `--force` to overwrite it.                                                                 |
|                                             | Overwrite theme files that differ?          | Keeps yours.                                                                                            |
| [`add`](/dolan/cli/components.md#add)       | Which components? (no names given)          | Exits 1. Name them: `add button card`.                                                                  |
|                                             | Overwrite installed components?             | Skips them. Add `--force` to overwrite them.                                                            |
| [`update`](/dolan/cli/updates.md#update)    | Apply the auto-updates?                     | Applies them.                                                                                           |
|                                             | How should each conflict be resolved?       | Applies the rest, leaves the conflicts alone and exits 1. See [`update`](/dolan/cli/updates.md#update). |
|                                             | Every file, with `--selective`              | Exits 1.                                                                                                |
| [`diff`](/dolan/cli/updates.md#diff)        | Which component? (no name given)            | Shows every changed component.                                                                          |
| [`remove`](/dolan/cli/components.md#remove) | Remove it, though others depend on it?      | Exits 1. Add `--force` to remove it anyway.                                                             |
|                                             | Also remove orphaned dependencies?          | Removes them.                                                                                           |
| [`eject`](/dolan/cli/components.md#eject)   | Stop tracking it?                           | Exits 1. Add `--force` to eject it.                                                                     |

To get the same in a terminal, redirect the input, as in `npx @blotch/dolan update < /dev/null`. `init` also takes `--yes`.

## init

Sets up dolan in your project and copies the theme files.

```bash
npx @blotch/dolan init
```

| Argument or option    | Description                                                                                         |
| --------------------- | --------------------------------------------------------------------------------------------------- |
| `--components <path>` | Install components here instead of asking. Default: `src/components/ui`.                            |
| `--theme <path>`      | Install the theme files here instead of asking. Default: `src/styles`.                              |
| `-y, --yes`           | Ask nothing: use the default folders, keep theme files that differ, and stop on an existing config. |
| `-f, --force`         | Overwrite an existing `dolan.config.json` and theme files without asking.                           |

It asks where to install components and theme files, then sets up the project:

- **Writes `dolan.config.json`.** If one exists, it asks before overwriting (default No).
- **Copies the theme files** into the theme folder: `default.css`, `dark.css` and `tailwind.css`.
  - **On Tailwind 3**, it copies `tailwind-plugin.ts` in place of `tailwind.css`. That's an app with a `tailwind.config.*`, or without Tailwind 4 installed.
  - **With the testing library**, it also copies the plugin's test, `tailwind-plugin.test.ts`. That's when your `package.json` lists `@blotch/angular-lynx-testing-library` (see [add](/dolan/cli/components.md#add)).
  - **If a theme file is already there and differs**, it asks before overwriting (default No), and keeps yours otherwise.
- **Records the theme files' hashes** in `dolan.lock.json`, so [`update`](/dolan/cli/updates.md#update) can tell whether you've edited them.
- **Installs `@blotch/dolan` as a dependency** if `package.json` doesn't list it, with your package manager. The copied components import its utilities. If the install fails, the next steps say how to run it.
- **Creates the components folder and prints the next steps.**
  - The `@import` lines for the theme files, and on Tailwind 3, the Tailwind plugin for your config.
  - They're written relative to your global stylesheet: the first `styles` entry in `angular.json`, `src/styles.css` by default.

**Without a terminal**, or with `--yes`, `init` asks nothing:

```bash
npx @blotch/dolan init --yes --components src/app/ui --theme src/app/theme
```

- The folders come from `--components` and `--theme`, or are the defaults.
- Theme files that differ are kept, and `init` lists them. Add `--force` to replace them.
- An existing `dolan.config.json` stops `init` with exit code 1, before it changes anything. Add `--force` to overwrite it.

## theme

Lists your theme files, or starts a new theme.

```bash
npx @blotch/dolan theme [name]
```

| Argument or option | Description                         |
| ------------------ | ----------------------------------- |
| `[name]`           | Create a theme file with this name. |

- **Without a name**, it lists the `.css` files in your theme folder.
- **With a name**, it copies `default.css` to `<theme folder>/<name>.css` for you to edit. It stops if that file exists.

Import the new file in place of `default.css`. See [Theming](/dolan/theming.md#start-a-new-theme).

## doctor

Checks your setup, and exits with code 1 if any check fails.

```bash
npx @blotch/dolan doctor
```

Options: none. It runs these checks in order:

| Check                                                                                                          | If it doesn't pass |
| -------------------------------------------------------------------------------------------------------------- | ------------------ |
| `dolan.config.json` exists, is valid JSON and has `components` and `theme` paths                               | Fails and stops    |
| The components and theme folders exist                                                                         | Fails              |
| The theme folder has `tailwind.css` (`tailwind-plugin.ts` on Tailwind 3), and `default.css` or `dark.css`      | Warns              |
| `default.css` sets a font size on `page` (see below)                                                           | Warns              |
| Each color the plugin maps with `themeColor()` has a matching `-rgb` twin in every theme file                  | Warns              |
| The theme sets and maps the colors the installed components read, such as Glass's `glass-*` colors             | Warns              |
| `tailwindcss` is installed, and the app is set up for its version (see below)                                  | Warns              |
| No theme files for the other Tailwind version (see below)                                                      | Warns              |
| On Tailwind 4, the global stylesheet imports `tailwind.css`; on Tailwind 3, the config mentions `blotchPlugin` | Warns              |
| `package.json` lists `@angular/core`, `@blotch/angular-lynx` and `@blotch/dolan`                               | Fails              |
| Every component folder is a known component, has all its files and has its dependencies                        | Warns              |
| No component has tests without `@blotch/angular-lynx-testing-library` to run them                              | Warns              |
| `package.json` lists the npm packages the components import, such as `class-variance-authority`                | Fails              |

:::details What the checks look for

- **Font size:** the components are sized in `rem` for a 16px root, where Lynx's own is 14px.
- **Tailwind set up for its version:** no `tailwind.config.*` on Tailwind 4, and a `tailwind.config.*` on Tailwind 3.
- **The other version's theme files:** `tailwind-plugin.ts` and its test on Tailwind 4, or `tailwind.css` on Tailwind 3.
- **`-rgb` twins** are what [opacity modifiers](/dolan/theming.md#opacity-modifiers) such as `bg-primary/50` read. The check suggests the line to add for a missing one.
- **Components' colors** are missing from a theme copied before the component existed. The check quotes dolan's lines for them.
- **Ejected components:** their files aren't checked.
- **A `utils` path** in an older config is allowed but not needed.

:::

### Finding Tailwind

`doctor` looks for `tailwindcss` the way the build does, from your app's folder, and reports its version:

```text
◆  tailwindcss 4.3.3 found, set up for Tailwind 4
```

- **It finds Tailwind that your workspace root installs.** It also finds the one `@tailwindcss/postcss` brings, when your `package.json` lists only that.
- **A `tailwind.config.*` with Tailwind 4 installed gets a warning.** dolan sets the theme up for Tailwind 3 while the config is there (see [Move to Tailwind 4](/guide/tailwindcss.md#move-to-tailwind-4)).
- **So does Tailwind 3 without a config**, which the build needs to run it.

## Related

- [Add and remove components](/dolan/cli/components.md): `add`, `info`, `remove` and `eject`
- [Check and update components](/dolan/cli/updates.md): `list`, `diff`, `outdated` and `update`
- [UI Components](/dolan/index.md): install dolan and add your first component
- [Theming](/dolan/theming.md): the theme files `init` copies
- [Tailwind CSS](/guide/tailwindcss.md): required by every component
