# Sync to Cloud

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Optionally sync your local YAML tests, templates, and functions to [Shiplight Cloud](https://app.shiplight.ai) for scheduled runs, team collaboration, and automatic locator self-updates. This requires a Shiplight Cloud subscription.

## Setup

You need a `SHIPLIGHT_API_TOKEN` to use cloud features. Get your token from [app.shiplight.ai/settings/api-tokens](https://app.shiplight.ai/settings/api-tokens) and add it to your `.env` file:

```
SHIPLIGHT_API_TOKEN=your-token-here
```

Reconnect the MCP server (`/mcp` in Claude Code) to activate cloud tools.

## Using `/cloud`

The `/cloud` slash command guides your AI agent through cloud operations. Just describe what you want:

```
/cloud sync all my local tests to the cloud
```

```
/cloud run login.test.yaml on staging environment
```

```
/cloud show me the latest test results
```

Your agent uses the Shiplight MCP tools (`save_test_case`, `get_test_case`, `save_template`, `save_function`, etc.) to handle the sync automatically.

## What Gets Synced

| Local artifact         | Cloud equivalent  | ID tracking                  |
| ---------------------- | ----------------- | ---------------------------- |
| `*.test.yaml`          | Test case         | `test_case_id` field in YAML |
| `templates/*.yaml`     | Reusable template | `template_id` field in YAML  |
| `helpers/*.ts` exports | Test function     | `@function_id` JSDoc tag     |

After syncing, the agent adds the cloud ID to your local file so future syncs update the existing cloud resource instead of creating duplicates.

## Cloud Benefits

- **Scheduled runs** — run tests on a schedule without local infrastructure
- **Locator self-updates** — when an AI self-heal succeeds, the cloud automatically updates the cached locator for future runs
- **Team collaboration** — share tests, results, and environments across your team
- **Test accounts** — manage login credentials and browser sessions centrally
- **Environments** — configure different base URLs and variables per environment (staging, production, etc.)
