miles-import

A bash script that imports Miles AI WordPress export ZIPs into any local WordPress environment — not just Local by WP Engine or Studio. Handles database import, URL replacement, plugins, themes, and uploads.

miles-import is a bash script that unpacks a Miles AI WordPress export ZIP and loads it into an existing local WordPress installation. Miles exports target Local by WP Engine and Studio — this tool makes those exports work anywhere.

Miles — AI for WordPress Beta

Miles is the AI assistant that generates these WordPress exports. It’s currently in private beta — if you’re a WordPress developer curious about AI-assisted site building, it’s worth a look.

Join the Miles beta

The problem

Miles AI exports WordPress sites as ZIP archives designed for Local by WP Engine or WordPress Studio. If you run a custom local environment — a manual stack, a .test TLD setup, a VM, or anything else — those exports are not directly usable. The ZIP lands on your machine with no obvious path to get it running.

How it works

miles-import takes the ZIP file and a path to an existing WordPress installation, extracts the archive to a temp directory, and then imports each component in sequence: database, plugins, themes, and uploads.

The key step is the URL replacement. Before importing the database, the script reads your existing site URL. After the import it runs wp search-replace to swap Miles's placeholder (http://miles-exported.invalid) with your real local URL — so everything resolves correctly the moment the import finishes.

It also handles the SQLite case: if Miles exports a .ht.sqlite file instead of a SQL dump, the script detects that and copies the SQLite database into place.

Usage

# Basic import
miles-import backup.zip ~/Sites/mysite.test

# Specify your local URL explicitly
miles-import backup.zip ~/Sites/mysite.test --site-url=http://mysite.test

# Back up existing database before replacing it
miles-import backup.zip ~/Sites/mysite.test --backup-db

# Skip interactive prompts
miles-import backup.zip ~/Sites/mysite.test --force

# Import only the database, skip files
miles-import backup.zip ~/Sites/mysite.test --skip-plugins --skip-themes --skip-uploads

Options

FlagDescription
--forceSkip all confirmation prompts
--backup-dbExport existing database before overwriting
--skip-dbSkip database import
--skip-pluginsSkip plugin copy
--skip-themesSkip theme copy
--skip-uploadsSkip uploads copy
--site-url URLOverride the auto-detected local URL for search-replace

What it imports

  • Database — imports database.sql via wp db import, then search-replaces the Miles placeholder with your local URL. Falls back to SQLite (.ht.sqlite) if no SQL dump is present.
  • Plugins — copies each plugin directory, prompting before overwriting any that already exist.
  • Themes — copies theme directories with the same overwrite handling.
  • Uploads — syncs the uploads directory using rsync if available, falling back to cp.

Dependencies

Requires WP-CLI and unzip. Both are standard on most development machines. rsync is used for uploads if present but is not required.

Why we built it

Miles is a useful AI assistant for WordPress work, but its export format assumes you are using Local or Studio. A custom local environment is just a directory with a WordPress install and a database — there is no special tooling to receive these exports. miles-import fills that gap: it does what you would do manually, without the tedium of running WP-CLI commands one at a time and remembering to search-replace the URL.