Skip to content

Use search component in sync site picker and add i18n to CLI strings - #3014

Merged
bcotrim merged 2 commits into
add_cli_sync_and_import_operationsfrom
use-search-component-in-sync-site-picker
Apr 8, 2026
Merged

Use search component in sync site picker and add i18n to CLI strings#3014
bcotrim merged 2 commits into
add_cli_sync_and_import_operationsfrom
use-search-component-in-sync-site-picker

Conversation

@bcotrim

@bcotrim bcotrim commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Related issues

Related to #2878 (comment)

How AI was used in this PR

Claude Code was used to implement the changes. All changes were reviewed and validated by the author.

Proposed Changes

  • Replace select with search component from @inquirer/prompts in the sync site picker, allowing users to type to filter sites
  • Break down help tip strings into individually translated segments across sync-site-picker, tree-checkbox, and ai/sessions/helpers
  • Wrap untranslated user-facing strings in __() / sprintf() across import/export and sync CLI files

Testing Instructions

  1. Build the CLI: npm run cli:build
  2. Run studio sync pull (or studio sync push) and verify:
    • The site picker now shows a search input where you can type to filter sites by name or hostname
    • The help tip at the bottom shows translated, separated hints (e.g. "↑↓ navigate · type to filter · ⏎ select · esc cancel")
  3. Run studio ai and start a new session — verify the session picker also shows separated help tip hints
  4. Run studio site export / studio site import with invalid inputs and verify error messages are displayed correctly

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@bcotrim bcotrim self-assigned this Apr 8, 2026
@bcotrim bcotrim changed the title Add push/pull and import/export commands to the CLI Apr 8, 2026
@bcotrim
bcotrim changed the base branch from trunk to add_cli_sync_and_import_operations April 8, 2026 14:11
@bcotrim
bcotrim requested review from a team and fredrikekelund April 8, 2026 14:13

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works beautifully 👍 Nice improvement.

@bcotrim
bcotrim merged commit 2976cd2 into add_cli_sync_and_import_operations Apr 8, 2026
5 checks passed
@bcotrim
bcotrim deleted the use-search-component-in-sync-site-picker branch April 8, 2026 15:04
fredrikekelund added a commit that referenced this pull request Apr 9, 2026
* CLI: Add sync push/pull commands (#2878)

* 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>

* Implement import/export in CLI (#2963)

* 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>

* glob dev dependency for the CLI

* Fix Vite config

* Move new commands to topmost scope

Also, sort all CLI commands alphabetically

* Use search component in sync site picker and add i18n to CLI strings (#3014)

---------

Co-authored-by: Bernardo Cotrim <bmmcotrim@gmail.com>
Co-authored-by: bcotrim <bernardo.cotrim@a8c.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants