# CLI reference

The `dryv` CLI is the client that owns your filesystem. It compiles your authored source, talks to the engine, shows diffs and writes generated files only after you approve. Install it with [Installation](/docs/usage/installation). For every option of every command, see [All CLI commands](/docs/cli/commands).

## Global options

| Option          | Meaning                                                                  |
| --------------- | ------------------------------------------------------------------------ |
| `--api <url>`   | Engine URL. Defaults to `DRYV_API_URL`, then the Engine of the [local daemon](/docs/guides/local-daemon), which the CLI starts when needed. |
| `--root <path>` | Project root. Defaults to the current directory.                         |
| `-y, --yes`     | Approve a known change without prompting. It never picks missing values. |
| `--json`        | Print one machine-readable JSON result.                                  |
| `--no-input`    | Never prompt. Fail with a clear code when input is required.             |
| `-q, --quiet`   | Print only errors and the final result.                                  |

Use `--json --no-input` in CI and from agents. Results share one envelope (`dryv.cli.result/v1alpha1`) with stable codes such as `DRYV_INPUT_REQUIRED`, `DRYV_TRUST_REQUIRED`, `DRYV_PLAN_STALE` and `DRYV_NOT_FOUND`.

## Set up a project

| Command                           | What it does                                                                                                                                                    | Writes? |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `dryv init`                       | Previews and creates `dryv.yaml`, plus `dryv/README.md` and an `AGENTS.md` block for agents (`--no-docs` skips them). Refuses to overwrite one.                 | yes     |
| `dryv configure`                  | Previews structured edits to `dryv.yaml`, such as build settings.                                                                                               | yes     |
| `dryv pack search`                | Searches the official pack catalogue.                                                                                                                           | no      |
| `dryv pack list / info`           | Lists packs, or shows one. Read from the Dryv registry.                                                                                                         | no      |
| `dryv pack describe <id>`         | Prints a pack's README, what it needs and what it provides.                                                                                                     | no      |
| `dryv pack explain <id>`          | Explains how to bind and activate it in `dryv.yaml`.                                                                                                            | no      |
| `dryv pack add <id>`              | Adds a pack as an explicit activation in `dryv.yaml`.                                                                                                           | yes     |
| `dryv pack remove`                | Removes an activation.                                                                                                                                          | yes     |
| `dryv pack update`                | Moves a pack source to a new ref.                                                                                                                               | yes     |
| `dryv action list / add <preset>` | Adds a ready-made action such as removing unused imports and attaches it to your destinations. See [Clean up generated code](/docs/usage/clean-generated-code). | yes     |
| `dryv pack catalog`               | Inspects the official pack catalogue.                                                                                                                            | no      |
| `dryv server setup`               | Writes a `dryv.server.yaml` that wires the API and template servers.                                                                                            | yes     |

The catalogue is for discovery only. `pack add` writes the exact source and ref into `dryv.yaml`, so what you generate with is always visible in your repository.

## Generate

| Command                   | What it does                                                      | Writes?             |
| ------------------------- | ----------------------------------------------------------------- | ------------------- |
| `dryv build`              | Compiles authored source to Runtime IR files (YAML, JSON, JSONL). | yes                 |
| `dryv validate`           | Compiles and validates against the engine.                        | no                  |
| `dryv plan`               | Shows every planned file, its template and its path.              | no                  |
| `dryv generate --dry-run` | Renders and shows the diff.                                       | no                  |
| `dryv generate`           | Renders, shows the diff and asks before writing.                  | yes, after approval |
| `dryv generate --check`   | Exits with status 2 when generated files are out of date (CI).    | no                  |
| `dryv apply <plan-id>`    | Applies a saved plan without re-rendering.                        | yes                 |
| `dryv undo`               | Reverts the most recent apply while its journal is still valid.   | yes                 |

`--diff stat|names|full` controls how much of the diff is printed. `--no-actions` skips pack actions such as dependency installs.

### Edited generated files

If you changed a managed file and your definition changed it too, Dryv reports a conflict instead of overwriting. Choose with `--conflicts block|overwrite|keep` on `generate` or `apply`. `--yes` alone never resolves a conflict.

## Database schema changes

| Command                 | What it does                                                                     | Writes?             |
| ----------------------- | -------------------------------------------------------------------------------- | ------------------- |
| `dryv migrate plan / generate / apply <release> / status / verify / adopt` | Plans, renders and applies reviewed PostgreSQL schema changes for your project.  | yes, after approval |
| `dryv checkpoint approve / status` | Approves or inspects the durable generation baselines that migrations compare to. | yes                 |

## Tasks and agent

| Command          | What it does                                                                   |
| ---------------- | ------------------------------------------------------------------------------ |
| `dryv task`      | Manages the project's tasks: create, list, update, check, comment, validate, sync. See [Tasks](/docs/guides/tasks). `dryv tasks` is an alias. |
| `dryv code`      | Opens the Dryv coding agent, or runs one of its commands. See [Dryv agent](/docs/guides/agent). `dryv agent` and `dryvcode` are aliases. |

## Understand

| Command               | What it does                                                                                                                                        |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dryv status`         | Shows generated output drift and freshness.                                                                                                         |
| `dryv why <path>`     | Explains why one generated path exists, from persisted evidence.                                                                                    |
| `dryv explain change` | Explains what caused the current or a past generated change.                                                                                        |
| `dryv context list / show <path>` | Lists the template context vocabulary the engine serves, or explains one path.                                                          |
| `dryv watch`          | Follows project activity produced by any connected client.                                                                                          |
| `dryv ui`             | Opens the optional full-screen terminal interface.                                                                                                  |
| `dryv docs [topic]`   | Prints built-in guides (workflow, dryv-yaml, pack-yaml, authoring, errors, agents). `--write` refreshes `dryv/README.md` and the `AGENTS.md` block. |

## Environment and trust

| Command                     | What it does                                                              |
| --------------------------- | ------------------------------------------------------------------------- |
| `dryv doctor`               | Checks project, engine, pack catalogue and execution readiness.           |
| `dryv info`                 | Shows the engine, its version and its template servers.                   |
| `dryv capabilities`         | Shows which workflows this machine and engine support.                    |
| `dryv trust / trust revoke` | Grants or removes trust for running project-controlled code.              |
| `dryv local <action>`       | Manages the local daemon that runs your Engine: `connect`, `start`, `status`, `restart`, `stop`, `logs`, `link`. See [Local daemon](/docs/guides/local-daemon). |
| `dryv update`               | Installs the latest Dryv release next to this one, verifies it and switches to it. See [Update the CLI](#update-the-cli). |
| `dryv login / logout`       | Signs in to or out of the Dryv Platform. Only needed to sync, publish, use private packs, use the Playground or export your data. See [Sign in and sync](/docs/guides/sync). |
| `dryv whoami`               | Shows the signed-in Dryv Platform identity. |
| `dryv clean`                | Removes Dryv plans, journals, logs and caches stored outside the project. |

Trust lets Dryv run your author compiler, install dependencies and run pack actions. It never approves file changes. In CI, grant it explicitly: Dryv never trusts a workspace on its own without a prompt.

The engine needs no key or token, whether it runs on your machine or you host it yourself. Everything on this page except `login`, `logout`, `whoami` and Platform sync works without signing in.

## Build your own plugins

| Command                                                  | For                                     |
| -------------------------------------------------------- | --------------------------------------- |
| `dryv pack init/inspect/validate/doctor/test`            | Developing a pack.                      |
| `dryv author init/inspect/validate/doctor/test`          | Developing an author and compiler pair. |
| `dryv template-server init/inspect/validate/doctor/test` | Developing a template server.           |
| `dryv check [path]`                                      | Validating any `dryv.*.yaml` artifact.  |
| `dryv ir build`                                          | Writing portable Runtime IR on its own. |
| `dryv server info/plugins/setup/inspect/validate/doctor` | Inspecting and configuring the API and template server wiring. |
| `dryv pack catalog validate`                             | Validating a pack catalogue.            |

See [Extensibility](/docs/ecosystem/extensibility).

## Update the CLI

```bash
dryv update
```

`dryv update` downloads the latest release next to the one you run, verifies it, and switches to it.

| Option | Meaning |
| --- | --- |
| `--channel <name>` | Release channel. Defaults to `stable`, or `DRYV_CHANNEL`. |
| `--to <version>` | Install this exact version. |
| `--force` | Reinstall even when you already have the latest version. |

## Environment variables

| Variable | Used for |
| --- | --- |
| `DRYV_API_URL` | The Engine to use instead of the local daemon's Engine. |
| `DRYV_PLATFORM_URL` | The Dryv Platform API for `login`, `logout`, `whoami`, private packs and the pack catalogue, instead of `https://api.dryvcode.com`. Leave it unset to use Dryv. |
| `DRYV_LOCAL_HOME` | The local daemon's home. Defaults to `~/.dryv/local`. |
| `DRYV_LOCAL_COMMAND` | The command that runs the local daemon, when the CLI cannot find it. |
| `DRYV_CONFIG_HOME` | Where the Platform session file is stored when no keychain is available. |
| `DRYV_CHANNEL` | The release channel for `dryv update`. |
