# aerostack migrate

> Migrate an existing Cloudflare Worker project to Aerostack. Detects wrangler.toml and uses AI to suggest code changes for compatibility.

Migrate an existing Cloudflare Worker project to Aerostack. The command detects your `wrangler.toml`, generates an `aerostack.toml`, and uses AI to suggest code changes for compatibility.

## Usage

```bash
aerostack migrate
```

Run this from the root of your existing Cloudflare Worker project.

## What it does

1. Detects and reads your existing `wrangler.toml`
2. Generates a compatible `aerostack.toml`
3. Maps your existing D1, KV, R2, and Queue bindings
4. Uses AI to analyze your Worker code and suggest Aerostack SDK integrations
5. Lists any incompatible patterns that need manual review

## Typical migration

```bash
# From your existing Worker project directory
aerostack migrate

# Review the generated aerostack.toml
cat aerostack.toml

# Start the dev server to test
aerostack dev
```

## After migration

- Your original `wrangler.toml` is preserved (not deleted)
- `aerostack.toml` references the same D1/KV/R2 IDs
- The AI suggestions are comments in your code — review and apply manually

The migration command is non-destructive. Your existing `wrangler.toml` and Worker code are untouched. Aerostack adds its configuration alongside your existing setup.

## Keeping both deploy paths

After migration, you can deploy via Aerostack or continue using Wrangler directly — the two configs coexist. When you're confident in the Aerostack setup, you can remove `wrangler.toml`.
