# PixelDirector CLI Remote Setup

You are connecting an AI Agent to PixelDirector's hosted production workspace. After installation, the CLI and Agent MCP servers call `https://pixeldirector.dev`; projects and generated media stay in the authenticated user's cloud workspace.

## Requirements

- Install Node.js 20 or newer with npm.
- Run this setup in an Agent with terminal, filesystem, network, and browser-launch access.
- Never commit the API key or print it in public logs.

## Install

1. Start the installer from npm:

   ```bash
   npx -y pixeldirector@latest install
   ```

2. When this machine is not authorized, the installer opens PixelDirector. Let the user finish sign-in in the browser. The CLI exchanges a one-time device authorization for an Agent key. Do not start a second login or guess the key.
3. If the environment cannot open a browser, print the authorization URL:

   ```bash
   npx -y pixeldirector@latest auth login --no-browser
   ```

   The user can also manually generate a key on the [PixelDirector CLI page](https://pixeldirector.dev/cli), then run:

   ```bash
   npx -y pixeldirector@latest auth login --token "<PixelDirector Agent API key>"
   ```

4. The CLI writes the key to `~/.config/pixeldirector/config.json` with mode `0600`. Each Agent MCP registration stores only that config path.
5. The installer downloads the Skill from PixelDirector's versioned remote manifest and verifies each file's byte size and SHA-256 digest before activation. Run `npx -y pixeldirector@latest update` to fetch and synchronize the latest Skill.
6. The default installer detects Codex, Claude Code, and Qoder CLI and installs into every client found on the machine. To select clients explicitly, repeat `--agent`:

   ```bash
   npx -y pixeldirector@latest install --agent codex --agent claude --agent qoder
   ```

7. The doctor check must pass:

   ```bash
   npx -y pixeldirector@latest doctor
   ```

The doctor command must return remote health, the authenticated account, and every detected Agent integration. Stop and report the real error when any check fails.

## Create

Create a remote project and run an image or video Skill:

```bash
npx -y pixeldirector@latest create --title "<project title>"
npx -y pixeldirector@latest run --project "<project ID>" --skill "product-key-visual" --prompt "<complete image brief>"
```

For complete video delivery:

```bash
npx -y pixeldirector@latest make --title "<project title>" --skill "<video workflow>" --prompt "<complete video brief>"
```

`make` succeeds only after the remote project returns `projectId`, `canvasUrl`, and one playable `videoUrl`. Use `npx -y pixeldirector@latest status --project <project ID>` or the MCP project tools before reporting progress.

Upload local source media and inspect persisted project state:

```bash
npx -y pixeldirector@latest upload --project "<project ID>" --file "/absolute/path/product.png"
npx -y pixeldirector@latest project state --project "<project ID>"
npx -y pixeldirector@latest chat history --project "<project ID>"
npx -y pixeldirector@latest result --project "<project ID>"
```

Use `project state` or `pixeldirector_project_state` before reporting progress. Use `result` or `pixeldirector_project_result` immediately before delivery to verify the persisted final-video URL.
