# ee-cdn-cli for AI agents

> Instructions for AI coding agents that deploy static sites to Evolving Edge with ee-cdn-cli: credentials, the deploy steps, checking the result, exit codes, block-aware redeploys, custom domains and what never to do.

Source: https://docs.evolvingedge.ai/cli-for-agents/

This page is written for AI coding agents (Claude Code, Codex, Cursor and others) asked to deploy a site to Evolving Edge, or to set up deploys for one. Give your agent this address:

```
https://docs.evolvingedge.ai/cli-for-agents.md
```

It's the same page as Markdown. People should read [Command line (ee-cdn-cli)](https://docs.evolvingedge.ai/cli/), which this page follows and links to.

## Instructions for the agent

You're deploying a static site with `@evolving-edge/ee-cdn-cli`, an npm package with three commands: `ee-deploy` publishes a folder of built files, `ee-domain` claims a custom domain, and `ee-migrate` converts a Netlify site's settings. None of them prompt for input, so they're safe to run without a terminal.

Work in this order:

1. [Check what you need](#1-check-what-you-need) before running anything.
2. [Build the site](#2-build-the-site) with the project's own build command.
3. [Package without publishing](#3-package-without-publishing) (`--dry-run`), and fix what it reports.
4. [Confirm with the person](#4-confirm-with-the-person) before the first deploy to a domain.
5. [Deploy](#5-deploy).
6. [Check the deploy is live](#6-check-the-deploy-is-live).

### Rules

- **The deploy token is a secret.** Read it from the `EE_CDN_TOKEN` environment variable. Never print it, echo it, write it to a file, commit it, or put it on a command line (`--token` ends up in shell history and logs). If `EE_CDN_TOKEN` isn't set, stop and ask the person to set it. Don't look for a token in files, keychains or other projects.
- **Deploying publishes to a live domain.** Visitors see the result within about 90 seconds. Don't deploy to a domain the person hasn't named, and confirm before the first deploy to it.
- **A Level 1 key is a secret too.** Read it from `EE_CDN_LEVEL1_KEY`; never print, log or commit it.
- **Don't get past a checksum mismatch by deleting `.ee-builder-lock.json`.** The lockfile pins the packaging tool `ee-deploy` downloads and runs with the token. Tell the person a new version was published and let them accept it (see [The packaging tool](#the-packaging-tool)).
- **Never weaken a project's deploy setup** to make a deploy pass: don't remove a pinned version, a `_redirects` rule, or a CI secret.

### 1. Check what you need

| What | How to check | If it's missing |
|---|---|---|
| Node.js 22.12 or later | `node --version` | Ask the person to install it. |
| Windows (x64), macOS, or Linux (x64 or arm64) | The platform you're on | `ee-deploy` doesn't run elsewhere. |
| A deploy token | `EE_CDN_TOKEN` is set: test with `[ -n "$EE_CDN_TOKEN" ]`, never by printing it | Ask the person. It's created in the portal under **Workload → Deploy Tokens**, scoped to one project, with `workload:write`. |
| The project ID (`proj_…`) | `EE_CDN_PROJECT_ID`, or the person tells you | Ask. A project-scoped token is refused without it. |
| The domain | The person tells you, or the project's existing deploy script or workflow | Ask. Don't guess it from the site's content. |
| The domain is claimed and active | `ee-domain status <domain>` (see [Custom domains](#custom-domains)) | Claim it first, or the deploy is refused. |

Which version to run:

- **If the project already has the package** (it's in `package.json`, usually as `devDependencies`), use that: `npx ee-deploy` or the project's `deploy` script.
- **Otherwise** run it with `npx --yes @evolving-edge/ee-cdn-cli@latest`. `--yes` stops `npx` from asking before it installs. Version 0.7.0 or later is needed for [block-aware redeploys](#redeploys-only-send-what-changed).

### 2. Build the site

Use the project's own build command (`npm run build`, `hugo --minify`, `bundle exec jekyll build`, and so on). `ee-deploy` publishes files; it doesn't build them.

For Astro, check `astro.config.mjs` has `trailingSlash: 'always'` and `build: { format: 'directory' }`. Without them pages are linked in a way the network doesn't serve. If the project uses the package's Astro integration (`@evolving-edge/ee-cdn-cli/astro`), the build itself deploys: don't also run `ee-deploy`.

### 3. Package without publishing

```sh
npx --yes @evolving-edge/ee-cdn-cli@latest ./dist --domain www.example.com --dry-run
```

- **Name the output folder** (`./dist`, `./public`, `./_site`, `./build`). Without it, `ee-deploy` detects the folder from the project and prints `Deploying ./<folder> (detected: <generator>)`. If detection is unsure it stops with exit code 2 and says what it found: name the folder then, don't guess.
- **A dry run needs no token,** uploads nothing, and leaves the packaged `.ee` file on disk.
- **Fix what it reports:**
  - a `_redirects` rule that can't work: the message names the line;
  - a warning for each `_headers` rule it drops;
  - a package over the size limit (1 GiB after compression).

### 4. Confirm with the person

Before the first deploy to a domain, tell the person the domain, the project ID, the folder and the [encryption level](https://docs.evolvingedge.ai/workloads/#encryption-levels-in-depth) (Level 0, public, unless they asked for another), and wait for them to agree. Later redeploys of the same site to the same domain don't need asking again unless the person said otherwise.

### 5. Deploy

```sh
npx --yes @evolving-edge/ee-cdn-cli@latest ./dist --domain www.example.com --project proj_abc123
```

With `EE_CDN_PROJECT_ID` set, `--project` can be left out. Add `--quiet` to print only errors and, on success, the content hash alone on stdout, which is the easiest output to read.

Other options you may need are on the [CLI page](https://docs.evolvingedge.ai/cli/#options). The common ones:

| Option | When |
|---|---|
| `--trailing-slash` | Pages are folders (`about/index.html`) and `/about` should redirect to `/about/`. |
| `--clean-urls` | Pages are files (`about.html`) and `/about` should serve them. |
| `--images webp` | The person asked to convert JPEG and PNG images. |
| `--level 2` | The person asked for a Level 2 site. Level 1 also needs a key: see [Redeploys](#redeploys-only-send-what-changed). |
| `--builder-version <v>` | Pin the packaging tool, as CI should. |

#### Exit codes

| Code | Meaning | What to do |
|---|---|---|
| `0` | Deployed (or packaged, with `--dry-run`). | [Check it's live](#6-check-the-deploy-is-live). |
| `1` | The deploy failed: packaging, upload, or a refusal from the control plane. The reason is on stderr, after `ee-deploy:`. | Read the message and see [When it fails](#when-it-fails). |
| `2` | A usage error: a missing `--domain`, a bad option value, no token, or no output folder detected. Nothing was uploaded. | Fix the command. |

`ee-domain` and `ee-migrate` use the same codes: 0 success, 1 failed, 2 usage error.

#### What it prints

- `Deploying ./dist (detected: Astro)`: the folder it chose, when you didn't name one.
- `Content hash <64 hex characters>`: the content's address. Keep it for [checking](#6-check-the-deploy-is-live).
- One of these for the upload:
  - `Uploaded <n> MB — <hash>…`: the whole package was uploaded.
  - `Uploaded <n> MB of <m> MB (the rest is already in the domain's current package)`: a block-aware redeploy (see below).
  - `Already stored at Level <n>: nothing uploaded`: this exact content is already stored; the domain is pointed at it.
- `Requested domain binding <domain> → <hash>…`: the domain now points at this content.

### 6. Check the deploy is live

A new deploy takes up to about 90 seconds to reach every node. Then compare the content hash the site serves with the one `ee-deploy` printed:

```sh
curl -sI https://www.example.com/ | grep -i '^x-ee-content-hash'
```

The value is the full content hash. If it still shows the previous hash after two minutes, try again with a cache-busting query (`/?check=1`), then report it to the person rather than redeploying in a loop.

Then open a page or two, including one below the root, and check they return `200`. A page that works only with or without a trailing slash needs `--trailing-slash` or `--clean-urls`.

## Redeploys only send what changed

Since 0.7.0, a **Level 0** redeploy uploads only the parts of the package the domain's current content doesn't already have. The packaging tool gives every file of 64 KiB or more blocks of its own, so a redeploy that changes a few files sends a few blocks. There's nothing to turn on:

- **It's automatic** when the deploy is Level 0, has a `--domain`, and the domain already serves an earlier deploy. You'll see `Uploaded <n> MB of <m> MB (the rest is already in the domain's current package)`.
- **It falls back to a whole upload by itself** when it can't be used, and says so (`Block-aware upload not accepted …; uploading the whole package.`). The deploy still succeeds; don't treat that line as an error.
- **The first deploy after upgrading** uploads the whole package once, because the package layout changed. Later ones send only changes.
- **It needs a packaging tool published on or after 2026-11-19.** A project that pins an older one with `--builder-version` or `EE_BUILDER_VERSION` keeps uploading whole packages. Mention it to the person rather than changing the pin yourself.
- **Levels 1 and 2** always upload the whole package, or nothing when it's already stored.

**Unchanged content uploads nothing** at any level: `Already stored at Level <n>: nothing uploaded`. That's also how a rollback works: deploy the earlier build again. For **Level 1**, a redeploy or rollback of stored content needs the key from that content's first deploy in `EE_CDN_LEVEL1_KEY`. Without it `ee-deploy` stops and says so: ask the person for it. Content already stored at one level can't be deployed at another.

## Custom domains

A deploy to a domain is refused until the domain is claimed for the project and active. Use `ee-domain`, with `EE_CDN_TOKEN` and `EE_CDN_PROJECT_ID` set as for `ee-deploy`, and a token scoped to the project:

```sh
npx --yes -p @evolving-edge/ee-cdn-cli@latest ee-domain status www.example.com --json
npx --yes -p @evolving-edge/ee-cdn-cli@latest ee-domain claim www.example.com --project proj_abc123 --json
```

- `claim` returns the TXT and CNAME records to add at the DNS provider. **Give them to the person;** don't change DNS yourself unless they asked you to and you have access.
- `--wait` keeps checking until the claim is active, or fails (exit 1), or `--timeout` minutes pass (default 120, exit 1). For a long wait, prefer running `status` again later.
- `verify` checks for the TXT record now.
- `--json` prints the control plane's response as JSON, which is easier to read than the text output.

See [Custom domains](https://docs.evolvingedge.ai/custom-domains/) for the statuses and what to do when a claim fails.

## Moving a site from Netlify

`ee-migrate` reads `netlify.toml` and writes `_redirects`, `_headers`, a report (`ee-migrate-report.json`), and a GitHub Actions workflow (`.github/workflows/ee-deploy.yml`) that builds and deploys the site:

```sh
npx --yes -p @evolving-edge/ee-cdn-cli@latest ee-migrate . --domain www.example.com --project proj_abc123
```

- Read the report and tell the person what was dropped and why. `--strict` makes it exit 1 when anything was.
- It never writes credential values into the workflow: values that look like credentials are read from repository secrets. Tell the person which secrets to create.
- Running it again replaces only what it added before.

See [Moving from Netlify](https://docs.evolvingedge.ai/migrate-from-netlify/).

## Setting up deploys from CI

When asked to deploy on every push, write a workflow rather than deploying from your own session each time. The [CLI page](https://docs.evolvingedge.ai/cli/#deploying-from-github-actions) has a complete GitHub Actions example. In it:

- the token comes from a repository secret (`EE_CDN_TOKEN`) and the project ID from a variable (`EE_CDN_PROJECT_ID`). Tell the person to create them; you can't and shouldn't.
- `concurrency` with `cancel-in-progress: false` stops two deploys racing for the same domain.
- the CLI and the packaging tool are pinned (`--builder-version` or `EE_BUILDER_VERSION`), and `.ee-builder-lock.json` is committed.

For sites not built with Node.js, use the GitHub Action [`evolving-edge/deploy-action`](https://github.com/marketplace/actions/deploy-to-evolving-edge-cdn), pinned to a commit SHA or an exact tag, never `@main`.

## The packaging tool

`ee-deploy` downloads a packaging tool (ee-builder) on first use, caches it, and records its checksum in `.ee-builder-lock.json`. If a later download doesn't match, the deploy stops with a checksum mismatch. That means a new version was published, or the download isn't the one recorded. Tell the person and point them to the [changelog](https://changelog.evolvingedge.ai/). Only they should accept the new version, by updating or deleting the lockfile and committing the change.

## When it fails

| Message or symptom | What to do |
|---|---|
| `No deploy token. Set EE_CDN_TOKEN …` (exit 2) | Ask the person to set `EE_CDN_TOKEN`. |
| A warning about no `--project`, then a `403` | Pass `--project` or set `EE_CDN_PROJECT_ID`. |
| An authorisation error (`401` or `403`) | The token is missing, revoked, or scoped to another project. Ask the person; don't try other tokens. |
| The deploy is refused for the domain | The domain isn't claimed for this project, or not active yet. Check with `ee-domain status`. |
| It stops and asks for a directory (exit 2) | Name the output folder. |
| It stops on a `_redirects` line | Fix that line. See [Redirects](https://docs.evolvingedge.ai/redirects/#checking-your-file). |
| Over the size limit | See [Size limit](https://docs.evolvingedge.ai/cli/#size-limit). Converting or scaling images often helps: `--images webp`, `--image-max-width 2560`, with the person's agreement. |
| A Level 1 redeploy asks for the key | Ask the person for the key from the first deploy; pass it in `EE_CDN_LEVEL1_KEY`. |
| A checksum mismatch for the packaging tool | See [The packaging tool](#the-packaging-tool). Don't delete the lockfile yourself. |
| `Block-aware upload not accepted …` | Not an error: it uploaded the whole package instead. |
| The site still serves the old hash after two minutes | Check again with a cache-busting query, then report it. Don't redeploy in a loop. |
| Anything else | Report the full `ee-deploy:` message to the person. Point them to [Customer Support](https://docs.evolvingedge.ai/customer-support/) if it's on our side. |

## More

- Every page of these docs is available as Markdown: add `.md` to its address without the trailing slash. An index for agents is at [/llms.txt](https://docs.evolvingedge.ai/llms.txt), and the whole site in one file at [/llms-full.txt](https://docs.evolvingedge.ai/llms-full.txt).
- `ee-deploy --help`, `ee-domain --help` and `ee-migrate --help` list every option of the version you're running.
