# CLI — tested.dev docs

One binary. Same coverage math as the app and MCP. `td` is the same CLI after install.

Need Node 24+. `tested diff` and `tested check` work with no account. Full path on [Install](https://tested.dev/docs/install). App: [tested-dev-app](https://github.com/apps/tested-dev-app).

## Install

`pnpm add -D @tested/cli`. After install, `td` is an alias for `tested`. One-off: `npx @tested/cli`.

```
pnpm add -D @tested/cli
# then:
tested --version
td --version
```

CI uses `tested-hq/cli/action@main` with `version: 0.1.10`. Pin `uses:` to a SHA in production. See [GitHub Action](https://tested.dev/docs/github-action).

## Commands

| Command | What it does |
|---------|--------------|
| `tested setup` | Init config + doctor + CI/token hints |
| `tested doctor` | Environment checklist. Exits 1 on Node < 24. JSON with `--json` |
| `tested init` | Write `.tested.yaml` only |
| `tested run` | Run configured test runner with coverage. Writes coverage even if tests fail |
| `tested diff` | Report only. Exit 0. No account. `--json` for agents |
| `tested check` | The gate. Exit 1 under thresholds. No account |
| `tested push` | Upload. Needs token. `--pr N` or `--mainline` |

## Token env

Mint at `https://app.tested.dev/repos/{owner}/{name}/settings` after installing [tested-dev-app](https://github.com/apps/tested-dev-app). Settings shows the 64-character hex once.

```
export TESTED_TOKEN=…              # paste from Settings (shown once)
# or TESTED_TOKEN_FILE=/path (chmod 600)
# optional: TESTED_API_URL=https://app.tested.dev
```

## Diff vs check

`tested diff` prints the scorecard and exits 0. `tested check` is the gate. Wire CI and required checks to `tested check`, not `tested diff`.

## Empty patch

If the PR has no new executable lines, the patch gate is **skipped**. Project threshold still applies.

## Path floors

Optional `thresholds.paths` globs in `.tested.yaml`. Independent floors per path. Omitted `patch` / `project` inherit the global floors. A glob with no files this run is skipped (not 0%). Not flags. `tested check` fails when any matched path is under its floor. `--json` adds a `paths` array. No per-path GitHub check slugs. Coverage stays the only PR gate. Fields: [Config](https://tested.dev/docs/config).

```yaml
thresholds:
  patch: 80
  project: 90
  paths:
    - glob: src/api/**
      patch: 90
      project: 90
    - glob: src/cli/**
      patch: 70
      project: 70
```
