Skip to content

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Dec 19, 2025

Related issues

Proposed Changes

  • Add logPrefix option to executeCliCommand to identify which site the logs belong to
  • Capture stdout from CLI child processes and log in real-time with [CLI - {siteId}] prefix
  • Add logging for site create operations via CLI (cli-site-creator.ts)
  • Add logging for site start operations via CLI (cli-server-process.ts)
  • Add logging for WP-CLI command execution (site-server.ts)

This restores the logging behavior that was available before switching to CLI for site create/start operations, making debugging easier.

Testing Instructions

  1. npm start
  2. Create a site
  3. Verify logs appear in Studio console with prefix [CLI - {siteId}]
  4. Start a stopped site
  5. Verify startup logs appear in Studio console with the same prefix format
  6. Run a WP-CLI from the AI Assistant command on a running site
  7. Verify the command output appears in Studio console with the site ID prefix

Pre-merge Checklist

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

@bcotrim bcotrim self-assigned this Dec 19, 2025
@bcotrim bcotrim requested review from a team and fredrikekelund December 19, 2025 09:11
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.

Thanks for improving the logging @bcotrim! 🙌

I confirm that I see the logs when adding or starting a site.

Image Image

However, I couldn't get the WP CLI output to get logged in the Studio console. In another tab, I tested listing the site plugins:

node dist/cli/main.js wp plugin list --path ~/Studio/my-wordpress-website-7

But I only see the output in the original tab.

@bcotrim
Copy link
Contributor Author

bcotrim commented Dec 22, 2025

@gcsecsey thanks for reviewing and testing.
Did you run those WP CLI from a terminal outside of Studio? If that's the case we don't capture those logs.
If you run the WP CLI from the Assistant tab for example, you should see the logs in Studio.
Sorry if the instructions weren't clear, I've updated them.

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.

@gcsecsey thanks for reviewing and testing. Did you run those WP CLI from a terminal outside of Studio? If that's the case we don't capture those logs. If you run the WP CLI from the Assistant tab for example, you should see the logs in Studio. Sorry if the instructions weren't clear, I've updated them.

Thanks @bcotrim for updating the steps. Yes indeed, earlier I tried running the CLI commands from another terminal tab. I now tested running it through the Assistant, and this works great, I can see the output in the console.

Image Image

@katinthehatsite
Copy link
Contributor

katinthehatsite commented Dec 23, 2025

Run a WP-CLI from the AI Assistant command on a running site

This testing step did not seem to work for me, I was getting errors on this branch when running commands in asisstant:

Screenshot 2025-12-23 at 10 26 43 AM

The rest worked as expected:

Screenshot 2025-12-23 at 10 22 30 AM

I approved the PR regardless as I don't think asisstant command failures are related to this.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants