# The CLI

> Everything the console does, from your terminal. One binary, macOS, Linux and Windows.

## Install

macOS and Linux:

```
curl -fsSL https://00b5e2.com/install.sh | bash
```

Windows, PowerShell:

```
irm https://00b5e2.com/install.ps1 | iex
```

The script puts the 00b5e2 binary in your path and nothing else. It updates itself with 00b5e2 update.

## Login

```sh
$ 00b5e2 login
→ opening login.00b5e2.com in your browser
■ logged in as aaangelmartin (aaangelmartin)
```

The browser asks for your passkey or code, like the console. On a machine without a browser, use a token instead.

## Deploy

```sh
$ cd my-site
$ 00b5e2 link
$ 00b5e2 deploy
▲ building 3f9c2a1 ......... 41s
▪ web  https://my-site.00b5e2.dev
▪ api  https://api.my-site.00b5e2.dev
$ 00b5e2 deploy --prod
▪ web  https://my-site.00b5e2.app
▪ api  https://api.my-site.00b5e2.app
```

> Deploys go to development by default. Production is always an explicit step, so an agent can't reach it by mistake.

## Agents and JSON

Every command has a JSON mode that returns plain data with no colours or spinners. Exit codes are stable: 0 done, 1 failed, 2 not allowed.

```sh
$ 00b5e2 ls --json
[{"name":"my-site","env":"production","status":"live"}]
```

## Commands

### account

| name | what it does |  |
| --- | --- | --- |
| `login` | Login through the browser, or with a token | --token |
| `logout` | End the session on this machine |  |
| `whoami` | Who, or which token, is logged in |  |
| `update` | Update the CLI to the latest version |  |
| `help` | List every command, or explain one |  |

### projects

| name | what it does |  |
| --- | --- | --- |
| `init` | Create a project from the current folder | --name |
| `link` | Connect this folder to an existing project | --project |
| `ls` | List projects and services |  |
| `git connect` | Deploy a GitHub repo on every push | <owner/repo> |

### services

| name | what it does |  |
| --- | --- | --- |
| `services add` | Add a site, API, worker, database, cron job or container; its address is reserved | --name --dir --engine --address |
| `services ls` | List the services of a project |  |
| `services rm` | Remove a service and its development data | --prod |
| `services open` | Open a service at its address; a database gets its own port | <service> --allow --prod |
| `services close` | Close a service; only its project reaches it | <service> --prod |
| `services link` | Give a service the variables of a database or another service | <service> <to> |

### deploys

| name | what it does |  |
| --- | --- | --- |
| `deploy` | Deploy to development, production or a preview | --prod --preview |
| `promote` | Move a development deploy to production | <deploy id> |
| `rollback` | Go back to a previous deploy | --prod --to |
| `previews ls` | List the previews of a project |  |
| `previews rm` | Remove a preview | <branch> |

### variables

| name | what it does |  |
| --- | --- | --- |
| `env set` | Set or rotate a variable, value asked for | --prod --redeploy |
| `env ls` | List variables, never secret values | --prod |
| `env rm` | Remove a variable | --prod |
| `env import` | Import variables from a .env file | --prod |

### databases

| name | what it does |  |
| --- | --- | --- |
| `db create` | Create a Postgres database. MySQL and Valkey coming next | --engine --name --prod |
| `db connect` | Open a tunnel from your machine | --port --prod |
| `db shell` | Open a database shell | --prod |
| `db backups ls` | List the nightly backups by date | --prod |
| `db backups create` | Take a backup now | --prod |
| `db restore` | Restore a database to a date | --date --into --prod |

### cron jobs

| name | what it does |  |
| --- | --- | --- |
| `cron add` | Add or change a cron job | --schedule --command --prod |
| `cron ls` | List cron jobs and their last run | --prod |
| `cron run` | Start a run now | <name> |
| `cron rm` | Remove a cron job | --prod |

### domains

| name | what it does |  |
| --- | --- | --- |
| `domains add` | Add a domain to an open service (main site by default) and get its records | <domain> --service |
| `domains verify` | Check the records and issue HTTPS | <domain> |
| `domains ls` | List domains and their state |  |
| `domains rm` | Remove a domain | <domain> |

### network

| name | what it does |  |
| --- | --- | --- |
| `network allow` | Let one project reach another of the organisation | --to |
| `network ls` | List the allowed paths |  |

### logs and metrics

| name | what it does |  |
| --- | --- | --- |
| `logs` | Read or follow logs | --prod --since --follow --level --grep --run |
| `metrics` | Requests, latency, cpu, memory and disk | --prod --since |
| `alerts add` | Alert when a metric crosses a value | --metric --above --for |
| `alerts ls` | List alerts |  |
| `alerts rm` | Remove an alert | <id> |

### agents

| name | what it does |  |
| --- | --- | --- |
| `tokens create` | Create a scoped token, shown once | --scope --project --expires |
| `tokens ls` | List tokens and their scopes |  |
| `tokens revoke` | Revoke a token at once | <name> |
| `audit` | What each token and person did | --token --since |
| `mcp` | Run the MCP server locally |  |

### organisation

| name | what it does |  |
| --- | --- | --- |
| `members ls` | List members and their roles |  |
| `members invite` | Invite someone to the organisation or a project | --role --project |
| `members rm` | Remove a member and free the seat | <name> |
| `usage` | Seats and cubes of the organisation |  |

Previous: [Backups](https://docs.00b5e2.com/backups.md)
Next: [MCP](https://docs.00b5e2.com/mcp.md)
