feat(entries): add revision-aware behavior to EntriesRouter#30
Merged
Conversation
When a collection has revisions enabled, the MCP server now respects Statamic's editorial workflow instead of bypassing it with direct saves. Changes: - Update on published entry creates a working copy (published content unchanged) - Create uses store() which saves as draft + initial revision - Publish/unpublish delegate to Statamic's built-in revision-aware methods - New actions: list_revisions, get_revision, restore_revision, publish_working_copy - New version param on get: published, working_copy, latest - Graceful fallback when Pro not licensed or revisions disabled Includes HandlesRevisions trait, updated resource policy and token scope mappings, and 31 new tests covering the full revision lifecycle.
…uality - Fix multi-site response in publishWorkingCopyAction (re-fetch with site context) - Fix stale revision_status/restored_as_working_copy after restoreRevisionAction - Add confirmation gate defaults for restore_revision and publish_working_copy - Fix normalizeTableCell unbounded recursion (unwrap one level only) - Fix filterOutputFields to strip denied fields from list and nested responses - Fix generateBlueprint field array shape (indexed handle/field format) - Add revision_message type check in publishWorkingCopyAction - Add missing PHPDoc annotations and return types for PHPStan L8
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
revisions: true, the MCP server now respects Statamic's editorial workflow instead of calling$entry->save()directly on published contentlist_revisions,get_revision,restore_revision,publish_working_copy) give agents full control over the revision lifecycleDetails
Revision-aware CRUD:
updateon a published entry with revisions enabled creates a working copyupdateon an unpublished entry saves directly (matches CP behavior)createusesstore()which saves as draft + creates an initial revisionpublish/unpublishdelegate to Statamic's built-in methods that handle the revision path automaticallyNew actions:
list_revisions- revision history for an entry (metadata only, no full snapshots)get_revision- full data snapshot for a specific revision by timestamp IDrestore_revision- creates working copy (published) or updates directly (unpublished)publish_working_copy- promotes the current working copy to publishedNew
versionparam onget:published(default) - live published dataworking_copy- current working copy data (errors if none exists)latest- working copy if present, else publishedSecurity:
restore_revisionandpublish_working_copymapped as write actions in resource policy and token scopeslist_revisions/get_revisionrequire view,restore_revision/publish_working_copyrequire publishTest plan
EntriesRevisionTest.php(86 assertions)composer qualitygreen