> ## Documentation Index
> Fetch the complete documentation index at: https://novita.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate

The CLI's `migrate` command converts a legacy template — a `novita.Dockerfile` plus a `novita.toml` config — into the new **Template SDK** format, generating template and build scripts in the language you choose (TypeScript, sync Python, or async Python).

<Note>
  **Note:** After a successful migration, the original `novita.Dockerfile` and `novita.toml` are renamed with a `.old` suffix — they are no longer needed by the new SDK-based build.
</Note>

***

## Usage

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template migrate [options]
```

If you don't pass `--language`, the command prompts you to pick a target language interactively (default: TypeScript).

### Options

| Option                      | Description                                                     |
| --------------------------- | --------------------------------------------------------------- |
| `-d, --dockerfile <file>`   | Path to the Dockerfile. Defaults to `novita.Dockerfile`         |
| `--config <novita-toml>`    | Path to the config toml. Defaults to `./novita.toml`            |
| `-l, --language <language>` | Target language: `typescript`, `python-sync`, or `python-async` |
| `-p, --path <path>`         | Change the root directory where the command runs                |

***

## What it does

* Reads the Dockerfile and `novita.toml`, then parses the Dockerfile with the SDK (`fromDockerfile`) to build the equivalent template definition.
* Carries over config values — start / ready commands, CPU count, and memory — into the generated template.
* Writes the template and build scripts for the chosen language.
* Renames the old `novita.Dockerfile` and `novita.toml` to `.old`.

<Warning>
  **Note:** If the Dockerfile cannot be fully converted, the command falls back to a placeholder image (`my-custom-image`) and prints instructions to build and push the Docker image manually, then update the generated files with the real image tag.
</Warning>

***

## Examples

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template migrate --language typescript
```

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template migrate \
  --dockerfile custom.Dockerfile \
  --language python-async
```

After migrating, get started with the generated files:

```bash CLI icon="terminal" theme={"system"}
npm install novita-sandbox
npx tsx build.dev.ts   # development build
npx tsx build.prod.ts  # production build
```

```bash CLI icon="terminal" theme={"system"}
pip install novita-sandbox
python build_dev.py    # development build
python build_prod.py   # production build
```
