Skip to content

refactor: extract content templates from SDK core#6

Merged
soulevilx merged 2 commits into
developfrom
refactor/extract-content-templates
May 16, 2026
Merged

refactor: extract content templates from SDK core#6
soulevilx merged 2 commits into
developfrom
refactor/extract-content-templates

Conversation

@soulevilx
Copy link
Copy Markdown
Contributor

@soulevilx soulevilx commented May 16, 2026

What

  • Removes non-native content template classes, data objects, examples, docs, and tests from wordpress-sdk core.
  • Removes PostsService::createFromTemplate().
  • Keeps PostBuilder and ContentBuilder because they are generic SDK-safe payload/Gutenberg helpers.
  • Adds 1.2.0 changelog migration notes pointing to jooservices/wordpress-content-templates.

Why

Content templates are not native WordPress REST API SDK features. SDK core remains focused on endpoints, auth, HTTP, DTO/data, pagination, services, request/response handling, errors, and generic helpers.

Validation

Passed:

  • composer validate --strict
  • composer lint
  • composer test
  • composer security
  • composer quality
  • composer test:coverage (97.0% statements, coverage gate passed)
  • composer test:coverage-map
  • find examples -name "*.php" -print -exec php -l {} ; (no SDK examples remain)

Blocked/not fully verified:

  • composer test:wordpress fails with: docker/wordpress/scripts/run-integration-tests.sh: No such file or directory
  • composer test:wordpress:extended fails with: docker/wordpress/scripts/run-extended-integration-tests.sh: No such file or directory

Migration

Use jooservices/wordpress-content-templates for story/product-review/article/custom content templates and pass generated payloads to posts()->create().

Release impact

Prepares wordpress-sdk 1.2.0. Release remains blocked until the configured Docker/WP scripts are restored or the repo scripts/docs are corrected.

Risk

Public BC break for template classes and PostsService::createFromTemplate(); native posts CRUD and generic builders remain covered.

Summary by CodeRabbit

  • Breaking Changes

    • Content template functionality has been migrated from the SDK core to a separate jooservices/wordpress-content-templates package; users relying on story, product review, or article templates must migrate to the new dedicated package.
  • Documentation

    • Updated all guides to direct template users to the separate content templates package with migration instructions.

Review Change Stack

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@soulevilx has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 28 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0874a4d-70ac-4f5e-803d-f8946e8a768f

📥 Commits

Reviewing files that changed from the base of the PR and between e73468a and 1380152.

📒 Files selected for processing (6)
  • AGENTS.md
  • CHANGELOG.md
  • README.md
  • composer.json
  • docs/04-development/ai-contributor-guide.md
  • docs/04-development/testing.md
📝 Walkthrough

Walkthrough

This pull request removes content-template functionality from the SDK core and directs users to a separate jooservices/wordpress-content-templates package. PostsService::createFromTemplate() is deleted, all template classes and registry are removed, documentation is updated to redirect users, and test infrastructure is refactored to reflect the feature separation.

Changes

Content Template Removal and Separation

Layer / File(s) Summary
Remove PostsService API
src/Services/PostsService.php, tests/Unit/Services/PostsServiceTest.php
PostsService::createFromTemplate() method is removed, along with the PostTemplate import and corresponding unit test, eliminating the public SDK interface for template-based post creation.
Redirect documentation to separate package
AGENTS.md, CHANGELOG.md, README.md, docs/02-user-guide/*, docs/03-examples/README.md, docs/04-development/testing.md, docs/guides/features.md, docs/services/posts.md
Documentation across repository guidance, changelog, user guides, feature guides, examples, testing, and service docs are updated to direct users to jooservices/wordpress-content-templates for story, product-review, article, and custom content templates. Template-related features are clarified as external to SDK core.
Update test coverage infrastructure
tools/test-coverage-map.php
Test coverage mapping removes explicit unit-coverage aliases for removed template classes, adds integration-coverage reasons for service classes, refactors integration test path logic with a new helper function, and removes template-specific path rewriting from unitTestPathFor().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

A feature once core, now takes its bow,
Templates depart to pastures new,
Documentation gently shows the way—
Follow the path to jooservices' bright array! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: extract content templates from SDK core' directly and clearly summarizes the primary change in the changeset, which involves removing content template classes, examples, documentation, and tests from the SDK core to separate concerns.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/extract-content-templates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 21: The changelog currently marks the release heading "## [1.2.0] -
2026-05-17" as released; move that section under the existing "## [Unreleased]"
heading (or rename it to "## [Unreleased] — pending 1.2.0") so 1.2.0 remains
marked as unreleased until the tag is created; locate the heading string "##
[1.2.0] - 2026-05-17" in CHANGELOG.md and either relocate its notes beneath "##
[Unreleased]" or change the heading to indicate pending status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73b032a4-4a8c-4f36-befc-c774d983b708

📥 Commits

Reviewing files that changed from the base of the PR and between e101130 and e73468a.

📒 Files selected for processing (34)
  • AGENTS.md
  • CHANGELOG.md
  • README.md
  • docs/02-user-guide/01-services-and-queries.md
  • docs/02-user-guide/posts.md
  • docs/03-examples/README.md
  • docs/04-development/testing.md
  • docs/guides/features.md
  • docs/guides/templates.md
  • docs/services/posts.md
  • examples/custom-template.php
  • examples/template-usage.php
  • src/Services/PostsService.php
  • src/Support/Templates/Contracts/TemplateDataInterface.php
  • src/Support/Templates/Data/AbstractTemplateData.php
  • src/Support/Templates/Data/ProductReviewTemplateData.php
  • src/Support/Templates/Data/StoryChapterTemplateData.php
  • src/Support/Templates/Data/StoryTemplateData.php
  • src/Support/Templates/PostTemplate.php
  • src/Support/Templates/ProductReviewTemplate.php
  • src/Support/Templates/StoryTemplate.php
  • src/Support/Templates/TemplateRegistry.php
  • tests/ExtendedIntegration/Support/Templates/StoryTemplateExtendedIntegrationTest.php
  • tests/Integration/Support/Templates/TemplateWorkflowIntegrationTest.php
  • tests/Unit/Services/PostsServiceTest.php
  • tests/Unit/Templates/AbstractTemplateDataTest.php
  • tests/Unit/Templates/PostTemplateTest.php
  • tests/Unit/Templates/ProductReviewTemplateDataTest.php
  • tests/Unit/Templates/ProductReviewTemplateTest.php
  • tests/Unit/Templates/StoryChapterTemplateDataTest.php
  • tests/Unit/Templates/StoryTemplateDataTest.php
  • tests/Unit/Templates/StoryTemplateTest.php
  • tests/Unit/Templates/TemplateRegistryTest.php
  • tools/test-coverage-map.php
💤 Files with no reviewable changes (24)
  • src/Support/Templates/Contracts/TemplateDataInterface.php
  • src/Support/Templates/Data/ProductReviewTemplateData.php
  • examples/custom-template.php
  • src/Support/Templates/Data/StoryChapterTemplateData.php
  • docs/guides/templates.md
  • src/Support/Templates/ProductReviewTemplate.php
  • tests/Unit/Templates/StoryChapterTemplateDataTest.php
  • src/Support/Templates/Data/StoryTemplateData.php
  • tests/Unit/Templates/TemplateRegistryTest.php
  • tests/Unit/Templates/ProductReviewTemplateTest.php
  • tests/ExtendedIntegration/Support/Templates/StoryTemplateExtendedIntegrationTest.php
  • tests/Unit/Templates/AbstractTemplateDataTest.php
  • tests/Unit/Templates/ProductReviewTemplateDataTest.php
  • src/Services/PostsService.php
  • src/Support/Templates/TemplateRegistry.php
  • tests/Unit/Templates/StoryTemplateDataTest.php
  • src/Support/Templates/Data/AbstractTemplateData.php
  • src/Support/Templates/PostTemplate.php
  • examples/template-usage.php
  • tests/Integration/Support/Templates/TemplateWorkflowIntegrationTest.php
  • src/Support/Templates/StoryTemplate.php
  • tests/Unit/Templates/PostTemplateTest.php
  • tests/Unit/Templates/StoryTemplateTest.php
  • tests/Unit/Services/PostsServiceTest.php

Comment thread CHANGELOG.md Outdated

- Updated testing docs, README development commands, and AI contributor guidance to require Docker-only WordPress integration tests.

## [1.2.0] - 2026-05-17
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep 1.2.0 notes under Unreleased until the tag exists.

Line 21 marks 1.2.0 as released on 2026-05-17, while this PR was opened on 2026-05-16. That can misstate release state and confuse release automation/changelog consumers. Consider moving this block under ## [Unreleased] (or clearly marking as pending) until the actual tag is cut.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` at line 21, The changelog currently marks the release heading
"## [1.2.0] - 2026-05-17" as released; move that section under the existing "##
[Unreleased]" heading (or rename it to "## [Unreleased] — pending 1.2.0") so
1.2.0 remains marked as unreleased until the tag is created; locate the heading
string "## [1.2.0] - 2026-05-17" in CHANGELOG.md and either relocate its notes
beneath "## [Unreleased]" or change the heading to indicate pending status.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the SDK core by removing non-native “content template” functionality (template DTOs/classes, template-specific docs/examples/tests, and PostsService::createFromTemplate()), keeping only generic payload/Gutenberg helpers (PostBuilder, ContentBuilder) and pointing template users to jooservices/wordpress-content-templates.

Changes:

  • Removed template framework (template contracts/data objects/templates/registry) and all related unit + (extended) integration tests/examples/docs.
  • Removed PostsService::createFromTemplate() and updated SDK docs to recommend passing template-generated payloads to posts()->create().
  • Updated coverage-map tooling to reflect the new integration test layout and added explicit integration-coverage alias reasons for services.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/test-coverage-map.php Removes template-specific mappings; improves integration test path resolution; expands integration coverage alias reasons.
tests/Unit/Templates/TemplateRegistryTest.php Removes template registry unit tests (template system extracted).
tests/Unit/Templates/StoryTemplateTest.php Removes story template unit tests (template system extracted).
tests/Unit/Templates/StoryTemplateDataTest.php Removes story template DTO unit tests (template system extracted).
tests/Unit/Templates/StoryChapterTemplateDataTest.php Removes chapter DTO unit tests (template system extracted).
tests/Unit/Templates/ProductReviewTemplateTest.php Removes product review template unit tests (template system extracted).
tests/Unit/Templates/ProductReviewTemplateDataTest.php Removes product review template DTO unit tests (template system extracted).
tests/Unit/Templates/PostTemplateTest.php Removes abstract post template unit tests (template system extracted).
tests/Unit/Templates/AbstractTemplateDataTest.php Removes shared template DTO validation unit tests (template system extracted).
tests/Unit/Services/PostsServiceTest.php Removes unit test coverage for createFromTemplate() (method removed).
tests/Integration/Support/Templates/TemplateWorkflowIntegrationTest.php Removes template workflow integration coverage (moved out of SDK core).
tests/ExtendedIntegration/Support/Templates/StoryTemplateExtendedIntegrationTest.php Removes extended integration coverage for story template workflow (moved out of SDK core).
src/Support/Templates/TemplateRegistry.php Removes template registry from SDK core.
src/Support/Templates/StoryTemplate.php Removes story template implementation from SDK core.
src/Support/Templates/ProductReviewTemplate.php Removes product review template implementation from SDK core.
src/Support/Templates/PostTemplate.php Removes abstract post template contract from SDK core.
src/Support/Templates/Data/StoryTemplateData.php Removes story template DTO from SDK core.
src/Support/Templates/Data/StoryChapterTemplateData.php Removes chapter DTO from SDK core.
src/Support/Templates/Data/ProductReviewTemplateData.php Removes product review DTO from SDK core.
src/Support/Templates/Data/AbstractTemplateData.php Removes shared template DTO base class from SDK core.
src/Support/Templates/Contracts/TemplateDataInterface.php Removes template DTO interface from SDK core.
src/Services/PostsService.php Removes PostsService::createFromTemplate() API.
README.md Updates SDK helper positioning; points template users to jooservices/wordpress-content-templates.
examples/template-usage.php Removes template usage example (no longer in SDK core).
examples/custom-template.php Removes custom template example (no longer in SDK core).
docs/services/posts.md Removes/updates template references; clarifies external template packages generate payloads for posts()->create().
docs/guides/templates.md Removes templates guide (no longer applicable to SDK core).
docs/guides/features.md Updates features guide to point content templates to external package.
docs/04-development/testing.md Updates testing docs to remove template-specific integration coverage claims.
docs/03-examples/README.md Updates examples index to point to external content-template examples.
docs/02-user-guide/posts.md Updates user guide to remove SDK-core template helper references; points to external package.
docs/02-user-guide/01-services-and-queries.md Updates user guide to remove template helper bullet; points to external package.
CHANGELOG.md Adds 1.2.0 migration notes for template extraction and createFromTemplate() removal.
AGENTS.md Adds explicit repository guidance: do not add content template features to SDK core.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@soulevilx soulevilx merged commit 1b230cf into develop May 16, 2026
3 checks passed
@soulevilx soulevilx deleted the refactor/extract-content-templates branch May 16, 2026 23:45
@soulevilx soulevilx mentioned this pull request May 16, 2026
soulevilx added a commit that referenced this pull request May 16, 2026
* feat: add chapter-based story templates

* chore: add coverage gates and refresh docs

* test: remove logger mock notice

* fix: align service pagination and endpoint behavior

* refactor: extract content templates from SDK core (#6)

* refactor: extract content templates from SDK core

* fix: clear release validation blockers

* chore: prepare release 1.2.0
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.

2 participants