# Finished commands and deploys

> POST /command brings Waddle's newspaper for a command that finished. POST /deploy is the deploy duck.

## A command finished

What `waddle wait` and the shell hook send. Waddle brings it as a newspaper: happy if it worked, with the last line it printed if not.

```sh
curl localhost:4404/command -H 'content-type: application/json' \
  -d '{"command":["npm","test"],"code":0,"seconds":42.5,"cwd":"/Users/you/code/limen"}'
```

```json
{ "ok": true }
```

| Field | Type | What it is |
|---|---|---|
| `command` | list of strings | The command, as words. Up to 8 words of 200 characters. Required. |
| `code` | number | Its exit code, 0 to 255. 0 is a pass. Required. |
| `seconds` | number | How long it took, up to 7 days. Required. |
| `last` | string | The last line it printed. Waddle fits it in its bubble. |
| `cwd` | string | Where it ran, from `/`. |
| `term` | object | Where to jump back to on a click, as in [Sessions](https://docs.waddle.sh/sessions.md). |
| `agent` | boolean | An agent ran it: Waddle only notes it down. |

In the coop, the reply adds `"mailed": true` and the paper waits in the mailbox.

## A deploy went live

For a deploy Waddle doesn't see on GitHub. (Waddle watches GitHub itself for deploys from Vercel, Render, Railway, GitHub Pages, Actions and Netlify: Preferences → News → Deploys.)

```sh
curl localhost:4404/deploy -H 'content-type: application/json' \
  -d '{"name":"limen-fm","outcome":"live"}'
```

```sh
waddle deploy limen-fm live
```

```json
{ "ok": true }
```

| Field | Type | What it is |
|---|---|---|
| `name` | string | What went live, up to 60 characters. Required. |
| `outcome` | string | `live` or `failed`. Live if you leave it out. |

```sh
curl localhost:4404/deploy -H 'content-type: application/json' -d '{"outcome":"live"}'
```

```json
{ "ok": false, "error": "Send {\"name\":\"limen-fm\",\"outcome\":\"live\"}: what went live" }
```
