Repository navigation
Conversation
Add status, publish, build, sync-settings and disconnect commands so hosts, agencies and deploy scripts can publish without wp-admin. The manual admin actions move into shared methods that the admin handlers and the CLI both call, so wp-admin behavior is unchanged. publish --wait and build --wait block until the version is live or the build succeeds and exit non-zero on failure or timeout. With --wait, Simply Static's export tasks run inline, so a publish finishes without WP-Cron. The inline worker yields between tasks but keeps Simply Static's own limits inside a task, since fetch_urls checks should_continue before every page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Publishing to Spacefast was only possible from wp-admin buttons. Now a shell or deploy script can do it with
wp spacefast:With
--wait, publish blocks until the version is live and exits non-zero on failure or timeout.Why this matters
Publishing to Spacefast from WordPress only works from wp-admin buttons, and the plugin registers no WP-CLI command. A host, an agency's deploy script, CI or a coding agent can't publish after a content import without driving a browser. With these commands it's one shell call whose exit code a script can trust.
Demo
Simulated demo (HyperFrames), built from a real run: Docker WordPress with Simply Static 3.8.25, connected to a Spacefast Space:
Changes
The manual admin actions move into shared methods with no nonce or redirect handling, and the
admin_post_*handlers become thin wrappers around them, so wp-admin behaves exactly as before. The commands live in a newincludes/class-spacefast-cli.php, registered only whenWP_CLIis defined.statusreads saved state and never prints credentials.publish --waitruns Simply Static's export tasks inline through a smallArchive_Creation_Jobsubclass, so a publish finishes without WP-Cron or loopback requests. On timeout, the remaining work goes back to the normal background worker, so nothing is lost.The inline worker yields between tasks but has to respect Simply Static's own limits inside a task. In 3.8.x,
fetch_urlsasksshould_continuebefore every page, and returning false there fetched nothing. My first live run sat at "Fetched 0 of 1356" until it timed out. The fix and a regression test are included.The README and readme.txt get a "Command line" section, and the version is 0.6.0 with a changelog entry.
Testing
bin/test.shbehavior tests pass, including the per-task yield.bin/test-wordpress.shpasses both container suites; the WP-CLI suite installs Simply Static 3.8.0 and runsstatus --format=jsonandpublish --waitagainst the injected transport.Live, I edited a page and ran
wp spacefast publish --wait. It took 39 seconds and exited 0.wp spacefast statusthen showedstate livewith the new version ID, and the public page had the edit.This touches files that open #13, #15 and #16 also change (the client, publisher and plugin bootstrap), so I'll rebase after whichever lands first. The 0.6.0 bump may need renumbering.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit