# Install and use the Diakrin CLI

> The local engine your AI tool uses to get an app onto your computer, run it and save it.

Source: https://diakrin.com/docs/cli

The `diakrin` command is Diakrin's local engine. The Diakrin plugin for Claude Code, Cursor and Codex installs it and keeps it up to date, so you never run it yourself: your AI tool uses it to get your app onto this computer, run it with sample data, check it and save it back. It never signs in. Your AI tool connects to Diakrin with its own sign-in, and the engine uses only one-use, five-minute hand-offs that your AI tool gets from Diakrin for one app.

## Before you start

- macOS or Linux (Intel/AMD or ARM). Windows is not supported yet; there your AI tool uses the Preview in Diakrin instead.
- Nothing else. The engine brings its own Node.js, package manager and database. It needs no GitHub account, token, Docker or administrator rights.

## Install

With the Diakrin plugin there is nothing to install: the plugin sets the engine up in `~/.diakrin` the first time your AI tool starts. To install it by hand, open Terminal and run:

```sh
curl -fsSL https://diakrin.com/cli/install.sh | sh
```

The installer checks the download against the release's SHA-256 checksums before it unpacks anything. Updates within the same major version install automatically, at most once a day, from an update list signed by Diakrin; a new major version comes with a new plugin version. `diakrin upgrade` updates now; `diakrin upgrade --check` only looks. Set `DIAKRIN_NO_AUTO_UPDATE=1` to turn automatic updates off, or `DIAKRIN_INSTALL_BASE` to use your company's mirror. To remove it, delete `~/.diakrin`.

IT and security teams can verify each release's Sigstore signature. See [diakrin.com/cli](https://diakrin.com/cli).

## What your AI tool does with it

| Step | What happens |
|---|---|
| Get the app | Your AI tool asks Diakrin for a one-use hand-off, then the engine downloads the app into a folder named after it (`pull`). |
| Try it | The engine runs the app on this computer with sample data and gives you a link such as `http://127.0.0.1:8080` (`dev start`). Your data stays on this computer. |
| Check it | The engine runs the same checks as Diakrin's build: the app's rules, its tests and the page check (`check`). |
| Save it | When you say it is ready, your AI tool gets another hand-off and the engine sends only the changed files as one new version (`save`). |

Each hand-off works once, for 5 minutes, for one app, and is sent only to your company's Diakrin address that the plugin set up. The engine never writes it to disk or prints it.

## What happens after you save

Saving is the last step you start. When your agent saves a version (with Diakrin's local engine or the Diakrin tools), Diakrin does the rest in order:

1. **Check.** The version is built and started with a test database. You see `Checked ✓ (version N)` or the findings to fix.
2. **Image.** After a passed check, Diakrin publishes the version's image to your company cloud. Nothing to do; it is never shown as "ready".
3. **Preview.** Diakrin takes the version to your private Preview.

The console shows each version's Preview state in these words:

- **Preview queued**, **Checking**, **Building the preview**, **Starting the preview**: still on its way; the page looks again every few seconds.
- **Preview ready**: the link appears, labelled **Private link · no sign-in** or **Needs Diakrin sign-in**.
- **Preview didn't start**: something to fix, with the reason after **To fix:**. Your version is saved.
- **Preview status unknown**: Diakrin cannot confirm the Preview right now. No link is shown.
- **Preview shows an earlier version**: the Preview is out of date. No link is shown.

Read the status in either place:

- Your AI tool reports it as it follows the version (the Diakrin tool `app.status`).
- The app's page in the console, under **Saved versions**, shows the check, image and Preview state per version.

A link appears only when the state is **Preview ready** and that exact version passed its health and audience checks. A saved or published image alone never shows ready. If a newer version fails, the page keeps the link to the last version that is ready, for example "Version 7 is still your live Preview". If the state says IT must act (for example, prepare the app's private Preview), your app is saved and nothing is lost; ask IT. A saved version that changes `package.json` or `pnpm-lock.yaml` is not previewed: the starter pins its dependencies, so revert that change and save again.

> [!SELF-HOSTED]
> Your Preview is a private address on your company network and opens without a sign-in. Whether Preview runs automatically depends on your installation; the version's Preview state in the console tells you.

## Use the engine yourself

Your AI tool calls the engine as `~/.diakrin/bin/diakrin` with `--json` and reads `diakrin --json schema` for each command. If you work with it in a terminal: `diakrin dev status`, `diakrin dev logs` and `diakrin dev stop` show and stop the app running on this computer, and `diakrin doctor` shows whether the engine is set up.

## Shell completion

```sh
diakrin completion zsh > _diakrin
diakrin completion bash > diakrin.bash
diakrin completion fish > diakrin.fish
```

Put the file in your shell's completion directory and restart the shell.

## Troubleshooting

| Problem | What to do |
|---|---|
| `checksum mismatch` or `signature verification failed` | The download was changed or damaged and was not installed. Start your AI tool again (or run the install line again); if it repeats, tell IT. |
| `unsupported operating system` or `unsupported processor` | The engine runs on macOS and Linux (x64, arm64). Your AI tool uses the Preview in Diakrin instead. |
| "This hand-off from Diakrin is not valid any more" | Each hand-off works once, for 5 minutes. Your AI tool gets a new one. |
| "This app is too old to run on this computer" | Apps from templates before web-app 1.1.0 run only in Preview. Save and use the Preview link. |
| "This computer cannot reach the package registry" | The first run of an app downloads its packages. Check your internet or proxy; the Preview in Diakrin still works. |
| Access denied | Your role or app access does not allow this action. Ask the app owner or IT. See [Troubleshooting and help](/docs/troubleshooting). |

To share details with support, run `diakrin support bundle --destination /absolute/path/support.json`. It writes a local file without credentials, source or business data and sends nothing.
