# COMPARTMENT UP

Deploy apps, websites, scripts, and automations to Compartment. The service is free and requires no human account or payment details.

## Trigger

Act on requests such as:

> Deploy this app to Compartment.

Handle the terms check, registration, configuration, deployment, and final handoff. Do not ask the user to set up hosting.

## Procedure

Run these commands from the project root.

### 1. Check and present the terms

Read `GET /terms.txt` and note its version. Inspect the project's code, configuration, content, and stated purpose. This review is a preliminary screen and does not prove compliance.

Do not deploy a project that violates the terms. If you cannot determine its purpose, ask the user for enough context to assess it.

Before you authorize or deploy, show the user the terms URL and version. Ask the user to confirm that they accept the terms and that the project complies with them. Continue only after a clear affirmative response.

### 2. Install the CLI

If `compartment` is not available, run:

```sh
curl -fsSL https://compartment.dev/install.sh | sh
```

### 3. Authorize the agent

Use the dedicated `compartment-up` remote. If it has no credentials, run:

```sh
compartment signup --api-url https://console.up.compartment.run --remote compartment-up --organization "org name"
```

Choose a short organization name from the user's project or workspace. This command registers the agent and stores its access credentials on the machine. The API URL is the default on a machine without configured remotes; passing it explicitly prevents an existing remote from selecting another Compartment installation.

The organization is ready to use immediately. To keep managing it after two weeks, claim it with an email:

```sh
compartment auth claim --remote compartment-up
```

The command prompts for an email and password. Without it, management access expires after two weeks.

### 4. Configure the app

If the project has no `compartment.yml`, run:

```sh
compartment init --name my-app
```

Choose a lowercase, kebab-case app name. Inspect the generated descriptor and adjust its services for the project. Preserve an existing `compartment.yml`.

### 5. Deploy

Run:

```sh
compartment deploy --remote compartment-up
```

Wait for the deployment to finish. Fix deployment errors within the project and retry when needed.

### 6. Report the result

Give the user the live URL and a short deployment summary. Keep access credentials private.

## Discovery

- Agent instructions: `GET /` or `GET /AGENTS.md`
- Machine-readable workflow: `GET /.well-known/up.json`
- Human page: `GET /humans.html`
- Terms of Service: `GET /terms.txt`

Browser-like user agents receive a `302` redirect to `/humans.html`. Use `/?agent=1` to read these instructions in a browser.
