Skip to content

Add new publish command - #3052

Draft
zaerl wants to merge 6 commits into
trunkfrom
publish-command
Draft

Add new publish command#3052
zaerl wants to merge 6 commits into
trunkfrom
publish-command

Conversation

@zaerl

@zaerl zaerl commented Apr 10, 2026

Copy link
Copy Markdown

This PR adds a new code publish command that starts a Calypso flow from the CLI.

The command does not remain there waiting for the site to be created; it exits immediately. The browser automatically opens the app at the end of the flow.

How AI was used in this PR

Helped with the unit tests, which I didn't know.

Proposed Changes

  • Add a new publish CLI command that starts the cart flow
  • Check if the user has already published the site
  • Start a push to the new site if the transfer ended

Testing Instructions

  • node apps/cli/dist/cli/main.mjs publish --path=~/Studio/__SITE__
  • Follow Calypso flow
  • Check if Calypso polls every five seconds https://wordpress.com/setup/transferring-hosted-site/processing&...
  • Be sure the browser opens at the end wp-studio://sync-connect-site?studioSiteId=_STUDIO_ID_&remoteSiteId=_BLOG_ID_&autoOpenPush=true and Studio opens the sync modal

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@zaerl
zaerl force-pushed the publish-command branch from b162189 to 1b58d33 Compare April 13, 2026 08:43
@zaerl
zaerl requested a review from wojtekn April 13, 2026 10:37
@zaerl
zaerl marked this pull request as ready for review April 13, 2026 10:37
@zaerl zaerl changed the title Initial support for new publish command Apr 13, 2026
@@ -1,11 +1,11 @@
import { generateCheckoutUrl } from '@studio/common/lib/generate-checkout-url';

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I moved this declaration to the common library, so it can be used on the app and CLI.

const site = await getSiteByFolder( siteFolder );
logger.reportSuccess( __( 'Site loaded' ) );

if ( await isSiteAlreadyConnected( site.id, token.id ) ) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've added this check here, but I'm not 100% sure. I know various sites can be synced, but this is the first one, so probably it's better to check if it's a human error.

@wojtekn

wojtekn commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Marking as draft until conflicts are solved.

@wojtekn
wojtekn marked this pull request as draft July 14, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants