Skip to content

pull-reprint: pick a WP.com site interactively when no --url is given - #3239

Closed
adamziel wants to merge 4 commits into
trunkfrom
adamziel/pull-reprint-wpcom-picker
Closed

pull-reprint: pick a WP.com site interactively when no --url is given#3239
adamziel wants to merge 4 commits into
trunkfrom
adamziel/pull-reprint-wpcom-picker

Conversation

@adamziel

@adamziel adamziel commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

Adds an interactive site picker when pull-reprint is ran without any --url.

site-picker.mp4

studio pull lets you run the command without a remote URL: it fetches your WP.com sites and drops you into a searchable picker. This PR gives studio pull-reprint the same nicety.

Testing Instructions

  • npm test -- apps/cli/commands/tests/pull-reprint.test.ts → all tests pass, including the 5 new resolveSourceSite cases.
  • Manually: STUDIO_ENABLE_PULL_REPRINT=1 ALL_PROXY=socks5h://127.0.0.1:8080 node apps/cli/dist/cli/main.mjs pull-reprint (no flags) → picker appears; typing filters; Esc cancels with a clean "No WordPress.com site selected" error.
  • With exactly one connected WP.com site → no picker, single-line "Using your only connected WordPress.com site: …" log.
  • With --url + --secret → no picker, no WP.com API calls.

Related issues

Follow-up UX polish on #2939.

How AI was used in this PR

Claude Code drafted the interactive picker port of the `resolveSourceSite` flow, ran the new tests locally, and wrote this description. A human reviewed every line.

Pre-merge Checklist

  • TypeScript + lint clean (verified locally).
  • Tests added for the new flow.
  • Draft until a reviewer signs off on the UX.
Replaces the multi-site abort path in resolveSourceSite() with a
searchable inquirer picker, and prints a one-line note after any
WP.com site is chosen that pull-reprint currently requires a WP
Cloud-hosted site. Addresses UX feedback on #2939.
Exports resolveSourceSite so the no-URL interactive flow can be
exercised end-to-end, and adds tests that assert the picker is
invoked only when we actually need the user to choose — one active
WP.com site auto-picks, --url skips the picker, --url+--secret never
loads the site list at all.
@adamziel
adamziel requested review from wojtekn and youknowriad April 25, 2026 00:32
@adamziel
adamziel marked this pull request as ready for review April 25, 2026 00:33
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 97ee9a1 vs trunk

app-size

Metric trunk 97ee9a1 Diff Change
App Size (Mac) 1442.33 MB 1442.33 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 97ee9a1 Diff Change
load 1751 ms 1783 ms +32 ms ⚪ 0.0%

site-startup

Metric trunk 97ee9a1 Diff Change
siteCreation 8083 ms 8087 ms +4 ms ⚪ 0.0%
siteStartup 4955 ms 4940 ms 15 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@fredrikekelund

Copy link
Copy Markdown
Contributor

Closing this in favor of #3729

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants