# website

> The command Agents use to keep a Project's website list, the one the Website tab in the AirBuild app shows.

Source: https://air.build/docs/cli/website/

`website` keeps the list of websites that belong to a Project: the sites people see in the Project's **Website** tab in the AirBuild app. An Agent adds a site with a title and an address, and AirBuild then reads the page for its icon and theme color. The list lives with the Project in AirBuild; nothing in the Project's files describes it.

## Where it runs

The same command is available to Agents on a cloud Team and on a Mac Team. Sign-in comes from the Agent's environment, so there is nothing to set up. The command needs `curl` and `jq`, which the environment provides. See [Choose where your Agents run](https://air.build/docs/get-started/where-agents-run/) for the two kinds of Team.

## Synopsis

```text
website [--project <project-id>] list
website [--project <project-id>] add --title T --url U [--source PATH] [--worker NAME] [--color #RRGGBB]
website [--project <project-id>] edit <id|url> [--title T] [--url U] [--source PATH] [--worker NAME] [--color #RRGGBB]
website [--project <project-id>] move <id|url> --to N
website [--project <project-id>] refresh <id|url>
website [--project <project-id>] remove <id|url> --confirm
website --help
```

`--project` can go anywhere on the line. Every option also accepts the `--option=value` form.

## Which Project

Run from inside a Project's folder and `website` works out the Project by itself. Anywhere else, pass `--project` with the Project's id (a UUID). Without either, it stops with:

```text
Error: cannot tell which Project this is. Run website from inside a Project directory, or pass --project <project-id> (the uuid from list_projects).
```

## Naming a site

`edit`, `move`, `refresh` and `remove` take a site by its id (from `website list`) or by its address. An address matches with or without a trailing slash.

## Commands

| Command | What it does | Prints |
| --- | --- | --- |
| `list` | Shows the Project's websites in order. Takes no arguments. | One line per site (see [Output](https://air.build/docs/cli/website/#output)), or `No websites listed for this Project yet. Add one with website add --title … --url ….` |
| `add` | Adds a site at the end of the list. `--title` and `--url` are required. The page's icon and theme color are read after adding. | `Added <title> — <url> (id <id>). The page is being read for its icon and colour.` |
| `edit` | Changes only the fields you pass; needs at least one. Pass an empty value (`""`) to clear `--source`, `--worker` or `--color`. A new address reads the page again. | `Updated <title> — <url>.` |
| `move` | Puts the site at position N; `0` is first. A position past the end puts it last. | The whole list in its new order. |
| `refresh` | Reads the page again for its icon and color. | `Reading the page again; website list shows the result in a moment.` |
| `remove` | Removes the site from the list. Needs `--confirm`. | `Removed.` |

## Fields

| Option | Value | Meaning |
| --- | --- | --- |
| `--title` | 1–80 characters | The site's name in the list. |
| `--url` | An absolute `http://` or `https://` address | The site's address. Each address appears once in a Project's list. |
| `--source` | A path from the Project's root, up to 512 characters | Where the site's code lives in the Project. |
| `--worker` | A worker name | The AirHost worker that serves the site. Leave it out for a site hosted elsewhere. |
| `--color` | `#RRGGBB` | The site's theme color. A color set this way is kept when the page is read again; clearing it with `""` lets the color read from the page's `theme-color` take over. |
| `--to` | A whole number, `0` or more | `move` only: the new position. |
| `--confirm` | — | `remove` only: confirms the removal. |
| `--project` | A Project id (UUID) | The Project to act for. Optional inside a Project's folder. |

A Project lists at most 50 websites.

## Output

`list` and `move` print one line per site, in order:

```text
<id>  <title> — <url>  worker=<name>  source=<path>  color=<#RRGGBB>  icon
```

`worker=`, `source=` and `color=` appear only when they are known. The line ends in `icon` when AirBuild has the page's icon, or `no-icon` when it does not.

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | Success. |
| `2` | Any error. The message on stderr starts with `Error:`. |

## Errors

| Message | What to do |
| --- | --- |
| `Error: cannot tell which Project this is. …` | Run it from the Project's folder, or pass `--project`. |
| `Error: --project expects a Project id (uuid), got: …` | Pass the Project's UUID, not its name. |
| `Error: no website with the address '…' in this Project. Run website list.` | Check the address against `website list`, or use the site's id. |
| `Error: website add needs --url.` | Add `--url`. A missing `--title` prints the `add` usage line. |
| `Error: website edit needs at least one of --title, --url, --source, --worker, --color.` | Pass the field you want to change. |
| `Error: usage: website move … --to N` | `--to` needs a whole number. |
| `Error: removing a site from the list needs --confirm.` | Add `--confirm`. |
| `Error: unknown option '…' for website <command>. Run website --help.` | Check the option against the table above. |
| `Error: unknown command '…'. Run website --help.` / `Error: unexpected argument '…' …` / ``Error: `website list` takes no arguments.`` | Check the line against the synopsis. |
| `Error: could not reach the Airbuild service.` | Try again. |
| `Error: <reason>` | AirBuild refused the request: for example a title outside 1–80 characters, an address that is not absolute `http(s)`, an address the Project already lists, a color that is not `#RRGGBB`, or a list that already has 50 sites. The reason says which; fix it and run the command again. |

## Examples

Add the app's support page and give it a color:

```bash
website add --title "Support" --url https://example.com/support --color "#1E88E5"
```

Record that a site is served by a worker and built from a folder in the Project:

```bash
website edit https://example.com --worker example-site --source web/
```

Put a site first and check the list:

```bash
website move https://example.com/privacy --to 0
website list
```

Remove a site:

```bash
website remove 6f1c2d3e-0000-4000-8000-000000000000 --confirm
```
