Skip to content

Add scaffold:winter.pages demo-data command - #58

Merged
LukeTowers merged 2 commits into
mainfrom
wip/scaffold-command
Aug 27, 2026
Merged

Add scaffold:winter.pages demo-data command#58
LukeTowers merged 2 commits into
mainfrom
wip/scaffold-command

Conversation

@LukeTowers

@LukeTowers LukeTowers commented Aug 27, 2026

Copy link
Copy Markdown
Member

What

Adds a dev-only scaffold:winter.pages console command. Winter.Pages stores its content as files in the active theme (not DB rows); this command creates theme content objects in the edit theme so the Pages side-panel tree and every editor surface can be exercised locally.

Conventions

  • Env-guarded — refuses to run in production (checked first).
  • Idempotent + --fresh (deletes/recreates scaffold content only).
  • Marker-scoped cleanup — theme-file name prefix scaffold-.
  • Registered in Plugin.php via a new register() + registerConsoleCommand().

Seeds (verified on a local install)

6 static pages (a nested three-level hierarchy, plus a long-title and a nav-hidden page) · 1 menu with nested items (URL / header / static-page references) · 2 content blocks (HTML + plain-text) · 1 snippet. Also creates a staticPage-wired layout so the pages resolve a usable layout in the editor.

Tests

PHPUnit test covering command registration + the production guard. The full seed writes to the active theme's files on disk (not rolled back like DB rows), so it is cross-checked against a real install rather than mutating the demo theme in an isolated test.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a console command that generates sample Winter Pages content, including layouts, pages, menus, content blocks, and snippets.
    • Supports refreshing existing scaffold content with a --fresh option.
    • Prevents scaffold generation in production environments.
  • Bug Fixes
    • Added safeguards to avoid duplicate scaffold content and clean up related files during refreshes.
  • Tests
    • Added coverage for command registration and production-environment protection.

Adds a dev-only, env-guarded, idempotent console command that creates
theme content objects in the edit theme — a nested three-level static
page hierarchy (plus a long-title and a nav-hidden page), a menu with
nested items, two content blocks and a snippet — so the Pages side-panel
tree and every editor surface can be exercised locally. Supports --fresh.

Includes a PHPUnit test covering command registration and the production
guard. (The full theme-file seeding is verified against a real install,
so the isolated test does not mutate the on-disk demo theme.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 24 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 23cfdc52-206b-4206-b311-f621fb697e20

📥 Commits

Reviewing files that changed from the base of the PR and between d2f8001 and 83e3dda.

📒 Files selected for processing (4)
  • .github/workflows/code-quality.yaml
  • .github/workflows/utilities/phpcs-pr
  • .github/workflows/utilities/phpcs-push
  • phpcs.xml

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 08326009-1cb0-41a8-85a1-830f88c3adeb

📥 Commits

Reviewing files that changed from the base of the PR and between db35509 and d2f8001.

📒 Files selected for processing (3)
  • Plugin.php
  • console/ScaffoldCommand.php
  • tests/console/ScaffoldCommandTest.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The plugin registers the scaffold:winter.pages command. The command blocks production execution, requires an active edit theme, skips existing scaffold pages, and supports --fresh cleanup. It creates a static layout, pages, menu items, content blocks, and a snippet partial. It clears the plugin cache and prints backend capture targets. Tests cover command registration and production refusal.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to d2f80

This adds a production-guarded, dev-only scaffold command with localized registration and test coverage; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. 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 clearly and concisely describes the main change: adding the scaffold:winter.pages demo-data command.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wip/scaffold-command

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.

Bring the plugin to full CI parity with its siblings/EasyForms: add the
phpcs Code Quality workflow (+ the phpcs-pr / phpcs-push diff-scoped
utilities and the Winter CMS Plugins phpcs.xml ruleset). Verified locally
with the phpcs-pr utility against the base branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LukeTowers
LukeTowers merged commit 4cd732d into main Aug 27, 2026
6 checks passed
@LukeTowers
LukeTowers deleted the wip/scaffold-command branch August 27, 2026 01:54
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.

1 participant