Improve site status check for json format - #3485
Conversation
📊 Performance Test ResultsComparing 260fef0 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
fredrikekelund
left a comment
There was a problem hiding this comment.
This is fine, but I could also see us adding an optional jsonValue property to siteData entries to avoid outputting emoji in the JSON objects. I'll leave it up to you, @nightnei
|
There's already an optional {
key: __( 'Status' ),
jsonKey: 'status',
jsonValue: isOnline ? 'online' : 'offline',
value: status,
}Totally up to you! |
Got it, thanks for the explanation. Let's go with |
f2c3f3c to
260fef0
Compare
How AI was used in this PR
AI helped to write the code and we had a few iterations to adjust teh approach
Proposed Changes
site status --format=jsonwe receive emoji which doesn't make sense for machine-readable output and it forces to use.includes('Online')instead of direct check via=== 'Online'autoLoginUrl, but it's jsut workaround.So I propose to introduce
isOnline: booleanfor json.Testing Instructions
npm run cli:buildnode apps/cli/dist/cli/main.mjs site status --path=~/Studio/my-wordpress-website --format=jsonisOnline: booleannode apps/cli/dist/cli/main.mjs site status --path=~/Studio/my-wordpress-websiteisOnline: boolean