Skip to content

Add push/pull and import/export commands to the CLI - #3010

Merged
fredrikekelund merged 9 commits into
trunkfrom
add_cli_sync_and_import_operations
Apr 9, 2026
Merged

Add push/pull and import/export commands to the CLI#3010
fredrikekelund merged 9 commits into
trunkfrom
add_cli_sync_and_import_operations

Conversation

@fredrikekelund

@fredrikekelund fredrikekelund commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Related issues

N/A

How AI was used in this PR

N/A

Proposed Changes

This branch contains the changes from #2963 and #2878. This PR is simply meant for landing the branch to trunk.

TO-DO:

  • Move the newly introduced commands to the topmost scope (i.e. studio pull instead of studio sync pull, etc)

Testing Instructions

CI should pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
bcotrim and others added 2 commits April 7, 2026 15:22
* Add sync push/pull CLI commands with shared Zod schemas and event pipeline

* Fix CLI build by replacing stream/promises with stream import

* Fix lint errors in sync store files

* Add progress tracking, --archive flag, and better error handling to sync commands

* Add interactive selective sync to CLI push and pull commands

* Extract shared sync logic to common and fix selective pull bugs

* Fix pre-existing TS error in process.emit override

* Fix lint error in process.emit override

* Remove unused sync constants re-export

* Remove unnecessary comment in sync-operations-slice

* Add esc cancel support and unify help tip layout across prompts

* Fix return types for sync selector cancel support

* Use Zod schema for SyncOption validation instead of manual VALID_OPTIONS

* Fix sync event lifecycle bugs and extract shared constants

- Move process.emit restore into finally block in push command
- Emit SYNC_EVENTS.FAILED in catch blocks for both pull and push
- Extract poll constants and parseSyncOptions to shared locations

* Add sync size validation to CLI push and pull commands

* Simplify type annotations in sync push and pull commands

* Remove unused sync CLI events

* Add --site arg, stale-progress polling, and fix push archive flow

* Rename --site arg to --remote-site in sync commands

* Address PR feedback: move try/catch to handlers, parse options in yargs, double-cancel, reorder validation, remove re-exports

* Move logger to module scope in sync pull/push commands

* Remove type re-exports, import directly from common

* Fix import order in sync test

* Remove dead tusUpload and use raw progress for stall detection

* Address PR feedback: use normalizeHostname, chalk, camelCase schema, remove type assertion

* Address PR feedback: camelCase schemas, static tus import, sort by name, remove re-exports

---------

Co-authored-by: Fredrik Rombach Ekelund <fredrik@f26d.dev>
* Add sync push/pull CLI commands with shared Zod schemas and event pipeline

* Fix CLI build by replacing stream/promises with stream import

* Fix lint errors in sync store files

* Add progress tracking, --archive flag, and better error handling to sync commands

* Add interactive selective sync to CLI push and pull commands

* Extract shared sync logic to common and fix selective pull bugs

* Fix pre-existing TS error in process.emit override

* Fix lint error in process.emit override

* Remove unused sync constants re-export

* Remove unnecessary comment in sync-operations-slice

* Add esc cancel support and unify help tip layout across prompts

* Fix return types for sync selector cancel support

* Use Zod schema for SyncOption validation instead of manual VALID_OPTIONS

* Fix sync event lifecycle bugs and extract shared constants

- Move process.emit restore into finally block in push command
- Emit SYNC_EVENTS.FAILED in catch blocks for both pull and push
- Extract poll constants and parseSyncOptions to shared locations

* Add sync size validation to CLI push and pull commands

* Simplify type annotations in sync push and pull commands

* Remove unused sync CLI events

* Add --site arg, stale-progress polling, and fix push archive flow

* Rename --site arg to --remote-site in sync commands

* Address PR feedback: move try/catch to handlers, parse options in yargs, double-cancel, reorder validation, remove re-exports

* Move logger to module scope in sync pull/push commands

* Remove type re-exports, import directly from common

* Fix import order in sync test

* First iteration of the `import` CLI command

* Initial version of export command

* Polishing

* Fix and refine

* Import command: restart site on error, too

* Allow .sql exports without `--only` flag

* Improved error handling

* More error handling

* Move files

* Wire up import/export logic to sync commands

* Install missing dependency

* Cleanup and test fixes

* Windows-friendly paths in test

* Fix issues identified in review

* Address review comments

* Stray console.log

* Revert Playground downgrades and implement WP-CLI fix

* Disallow database-only exports for .zip and .tar.gz files

* Numerous changes

- Default values for export files.
- Replace `--only` with `--mode` for export command. Users can choose between "full" and "db". The `--mode` option is required and defaults to `full`.

* Address review comments

---------

Co-authored-by: bcotrim <bernardo.cotrim@a8c.com>
Co-authored-by: Bernardo Cotrim <bmmcotrim@gmail.com>
@wpmobilebot

wpmobilebot commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing f3180ad vs trunk

app-size

Metric trunk f3180ad Diff Change
App Size (Mac) 1252.12 MB 1260.85 MB +8.73 MB 🔴 0.7%

site-editor

Metric trunk f3180ad Diff Change
load 1906 ms 1855 ms 51 ms 🟢 -2.7%

site-startup

Metric trunk f3180ad Diff Change
siteCreation 9138 ms 9164 ms +26 ms ⚪ 0.0%
siteStartup 4941 ms 4956 ms +15 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Also, sort all CLI commands alphabetically
@fredrikekelund
fredrikekelund merged commit ad3f8aa into trunk Apr 9, 2026
10 checks passed
@fredrikekelund
fredrikekelund deleted the add_cli_sync_and_import_operations branch April 9, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants