Skip to content

Conversation

@fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Jan 9, 2026

Related issues

Proposed Changes

  • Use a single runCommand function instead of runCommand and runCommandAll
  • Call site stop --all command from Studio codebase instead of site stop-all
  • Update tests

Testing Instructions

  1. npm run cli:build
  2. Run node dist/cli/main.js site create to create at least two sites
  3. Run node dist/cli/main.js site stop --all
  4. Ensure that the command runs successfully
  5. Run node dist/cli/main.js site stop --all
  6. Ensure that the message No sites are currently running is displayed
  7. Start 1 site
  8. node dist/cli/main.js site stop --path PATH_TO_SITE
  9. Ensure that the one site stops successfully
  10. Run node dist/cli/main.js site list
  11. Ensure that no sites are running

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund changed the base branch from moveCliStopAllToStopCommandWithAllFlag to dev/studio-cli-i2 January 9, 2026 13:56
@fredrikekelund fredrikekelund requested a review from a team January 9, 2026 14:00
Copy link
Contributor

@bcotrim bcotrim left a comment

Choose a reason for hiding this comment

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

LGTM and works as described 👍

Added a couple of smaller comments, but no blockers

if ( ! runningProcess ) {
logger.reportSuccess( __( 'WordPress site is not running' ) );
return;
const SITES_TO_TARGET: SiteData[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should we rename it to sitesToTarget?

);
} else {
throw new LoggerError(
sprintf( __( 'Stopped %d sites out of %d' ), stoppedSiteIds.length, SITES_TO_TARGET.length )
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should we handle single site error message differently?
Stopped 0 sites out of 1 seems strange.

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

The changes LGTM, and everything worked well while testing. 👍

I added the two sites:

gcsecsey@Mac-Studio studio % node dist/cli/main.js site list                        
✔ Found 2 sites
✔ Connected to process daemon
┌─────────────┬──────────────────────────┬────────────────────────────────────────┬─────────────────────────────────────────────────────┐
│ Status      │ Name                     │ Path                                   │ URL                                                 │
├─────────────┼──────────────────────────┼────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 🟢 Online   │ site-1                   │ ~/Studio/site-1                        │ http://localhost:8881                               │
├─────────────┼──────────────────────────┼────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 🟢 Online   │ site-2                   │ ~/Studio/site-2                        │ http://localhost:8882                               │
└─────────────┴──────────────────────────┴────────────────────────────────────────┴─────────────────────────────────────────────────────┘

Stopping all:

gcsecsey@Mac-Studio studio % node dist/cli/main.js site stop --all
✔ Successfully stopped 2 sites

Running the stop --all command again:

gcsecsey@Mac-Studio studio % node dist/cli/main.js site stop --all
✔ No sites are currently running

Stopping a single site:

gcsecsey@Mac-Studio studio % node dist/cli/main.js site stop --path ~/Studio/site-2
✔ Successfully stopped 1 site

Checking the list:

gcsecsey@Mac-Studio studio % node dist/cli/main.js site list
✔ Found 2 sites
✔ Connected to process daemon
┌─────────────┬──────────────────────────┬────────────────────────────────────────┬─────────────────────────────────────────────────────┐
│ Status      │ Name                     │ Path                                   │ URL                                                 │
├─────────────┼──────────────────────────┼────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 🔴 Offline  │ site-1                   │ ~/Studio/site-1                        │ http://localhost:8881                               │
├─────────────┼──────────────────────────┼────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 🔴 Offline  │ site-2                   │ ~/Studio/site-2                        │ http://localhost:8882                               │
└─────────────┴──────────────────────────┴────────────────────────────────────────┴─────────────────────────────────────────────────────┘

@fredrikekelund fredrikekelund merged commit 9710988 into dev/studio-cli-i2 Jan 12, 2026
3 of 4 checks passed
@fredrikekelund fredrikekelund deleted the f26d/site-stop-all-refactor-refinements branch January 12, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants