# Kuup CLI

Ask Kuup to check a change on your local dev server, from your terminal or from a coding agent.

You describe what a user can now do. Kuup writes a plan, you approve it in your browser, Kuup's browser does it against your dev server, and the result comes back in the terminal with an exit code an agent can act on.

## Requirements

- Node 22 or newer
- macOS or Linux (Windows through WSL is untested)
- A Kuup account and a project

## Install

```
npm install -g @kuup/cli
```

The command is called `kuup`. To run it without installing, use `npx @kuup/cli` in place of `kuup` everywhere below.

## Set up, once per repository

```
kuup init
```

This opens a page where you check a code against your terminal, pick the project and authorize this computer. It then writes:

- `.kuup/config.yaml`: settings for this repository. Safe to commit.
- `.claude/skills/kuup/SKILL.md`: tells Claude Code when and how to run a check.
- `~/.kuup/credentials.json`: this computer's key. It is never written into the repository.
- `~/.kuup/sessions/`: your saved login to the local app, if you use `--login`. See below.

## Run a check

```
kuup check "Create an invoice, apply a 10% discount, the total shows 90.00"
```

One quoted sentence per behavior. The command finds your dev server, prints a link to the plan and waits while you review and approve it.

| Command | What it does |
| --- | --- |
| `kuup check "<what to check>" ...` | Plan and run a check |
| `kuup check --plan <id>` | Pick up a plan that was approved after the command stopped waiting |
| `kuup check --rerun <run-id>` | Run the failed checks of an earlier run again |
| `--port <port>` | Use this dev server port instead of finding it |
| `--url <address>` | Use this local address, such as `http://acme.localhost:3000` |
| `--login` | Log in to your app in a browser window first, and run the check as you |
| `kuup login` | Log in and save the session, without running a check |
| `kuup logout` | Delete the saved session from this computer |

## Run a check as yourself

A check can run with your own login to your local app, so you do not have to set up a login in Kuup first.

```
kuup check "Create an invoice and see it in the list" --login
```

1. A Chrome or Edge window opens on your dev server, in a profile of its own. Your everyday browser is not touched.
2. The window opens on a short page that says what it is for. Click "Open your app" and log in as you normally do. When you see the app logged in, press Enter in the terminal, or quit that browser.
3. Kuup saves the session on your computer and runs the check. The plan shows "Your local session" where it asks how to log in, and you approve it as usual.

Later checks reuse the saved session without `--login`. When it stops working, the check says so; run it again with `--login`.

What is saved, and where:

- The cookies and local storage of your local addresses (the dev server and the ports in `.kuup/config.yaml`). Nothing from other sites you signed in to in that window.
- One session per repository, in `~/.kuup/sessions/`, readable only by you. It is never written into the repository.
- It is handed to Kuup's browser when a check you approved starts, and Kuup does not keep it afterwards. Kuup is only told that a session exists, never what is in it.
- Kuup does not judge whether you are logged in. If the window holds nothing at all, nothing is saved.

The window is an ordinary browser while you log in: Kuup has no connection into it, because sign-in providers such as Google refuse to sign in inside a browser that is open to outside control. Kuup reads the session from the window's temporary profile after the window has ended, then deletes the profile.

The login window needs Chrome or Edge. It is tested on macOS; Windows and Linux are written but not tested yet.

A test you save from such a check needs one of the project's saved logins, because it later runs without your computer.

## Exit codes

| Code | Meaning | What a coding agent should do |
| --- | --- | --- |
| 0 | Every check passed | Report the result |
| 1 | At least one check failed | Fix the failed checks, then `kuup check --rerun <run-id>` |
| 2 | The check could not run | Follow the printed message |
| 3 | Kuup could not tell, and nothing failed | Stop and report. Change no code |

## What Kuup can reach on your computer

During a check, Kuup's browser can reach your dev server's port and the ports you list in `.kuup/config.yaml`, and nothing else:

```yaml
# Other ports the app needs while it is checked, such as an API it calls.
ports:
  - 8080
```

- The ports are shown on the plan and approved with it. A rerun gets exactly the ports you approved.
- The command only connects to `localhost`, only while an approved check is running.
- Source maps and files outside the repository are never sent.
- Every request is written to `.kuup/runs/<run>/requests.jsonl`, which is kept out of git.

If your app reaches for a port that is not listed, the check stops with exit code 2 and prints the lines to add.

## What the key can and cannot do

The key on your computer can ask for a plan, read the results of its own checks and rerun the failed checks of a plan you approved. It cannot approve a plan, save a test, read saved logins or change settings. You can see and revoke linked computers under Settings in Kuup.

## Settings

`.kuup/config.yaml`:

| Setting | Use it when |
| --- | --- |
| `app: apps/web` | The repository holds several apps and Kuup picks the wrong dev server |
| `port: 3000` | You want a fixed dev server port |
| `ports:` | The app needs other local ports while it is checked |

Environment variables: `KUUP_API_URL` points `kuup init` at another Kuup address, and `KUUP_NO_BROWSER=1` stops the command from opening a browser.
