# CLI

One small program that runs the same checks as our probes. A check behaves the same on your laptop, in CI and from our regions, because it is the same code.

## Open source

The probe and the CLI are one binary, written in Go, open source under the Apache 2.0 licence. You can read exactly what a check does, and run it yourself.

## Run it

```bash
npx openping init
```

`openping test` needs no account: it runs the monitors in `openping.yml` from your own machine and prints one line each.

```console
$ openping test
✓ Web app  200 in 182 ms
✗ Sign-in page  Expected status 200, got 503
```

## Commands

| Command | What it does |
| --- | --- |
| `openping login` | Signs in through the browser and stores a key |
| `openping init` | Reads the project and writes openping.yml with suggested monitors |
| `openping test [name]` | Runs monitors now, from this machine or --from mumbai,virginia |
| `openping deploy` | Shows the plan, then applies it |
| `openping status` | The state of every monitor, and open incidents |
| `openping run --heartbeat <name> -- <command>` | Wraps a job and reports its start, end and exit code |
| `openping mcp test -- <command>` | Checks a local MCP server over stdio |
| `openping agent test <suite>` | Runs an agent suite and prints each answer with its result |
| `openping import <tool>` | Brings monitors over from UptimeRobot, Better Stack, Pingdom or Checkly |

It exits non-zero when a check fails, so it drops straight into CI.

## Good to know

- **init** looks at `package.json`, health routes, an OpenAPI file, MCP server code, and schedules in `vercel.json` and GitHub Actions. It never overwrites an existing file without `--force`.
- **test** takes `--file` to point at another file. With `--from` it asks our regions to run the checks instead of your machine. Secrets come from the environment: `secret.NAME` is read from `$NAME`.
- **deploy** takes `--yes` to skip the question, for CI.
- **mcp test** also takes `--url` to check a remote server.
- **agent test** runs the rules locally. Judge rubrics are listed as “judged in the cloud”.

## Signing in

`openping login` opens the browser, you approve, and the key is stored in `~/.config/openping/credentials.json`, readable only by you. In CI, set an API key instead:

```bash
export OPENPING_API_KEY=opk_your_key_here
openping deploy --yes
```

Make a key in the app under API keys, or see [the API](https://openping.ai/docs/api#auth). `OPENPING_API_URL` points the CLI at another server.
