Skip to content

Scope AI to page sections and verticals, add wp waygate build, fix stripped backslashes (1.1.0) - #13

Merged
jasperf merged 5 commits into
mainfrom
feature/sections-verticals-build-command
Oct 26, 2026
Merged

jasperf merged 5 commits into
mainfrom
feature/sections-verticals-build-command

Conversation

@jasperf

@jasperf jasperf commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes Waygate useful for building Elayne verticals and child themes (e.g. Elayne Legal).

AI page generation scoping

  • Only page sections are offered to the AI. Inserter-hidden, template and template-part patterns, and header/footer/full-page categories are excluded, so it can no longer place a header or a whole page composite inside a page.
  • New Vertical select in Tools → Waygate. It defaults to the active child theme's vertical (elayne-legal → legal) and falls back to all sections when the vertical has fewer than three.
  • The prompt now includes pattern description and keywords. Slugs the AI returns that weren't offered are dropped.
  • Filters: waygate_verticals, waygate_structural_categories.

WP-CLI (no AI)

  • wp waygate build <map.json> [--dry-run] [--references] builds pages from a JSON map. Pages are matched by id or slug, and an unknown slug creates a draft. Pattern content is inlined with nested wp:pattern references expanded, the same way a block-editor insert stores it.
  • wp waygate list [--vertical=] [--sections] [--format=].

Fix

  • create_page() / create_page_from_content() passed unslashed content to wp_insert_post(), which unslashes it, so backslashes in block JSON (-, \") were stripped. Now wrapped in wp_slash(), and the new CLI writes use it too.

Version bumped to 1.1.0 (waygate.php, readme.txt, CHANGELOG.md).

Testing

  • vendor/bin/phpunit: 72 tests pass (was 47). The new backslash test fails without the fix.
  • vendor/bin/phpcs: clean. Each commit was checked on its own.
  • On the local demo /legal/ subsite (Elayne Legal active):
    • wp waygate list --sections --vertical=legal returns 14 patterns. The header, footer and 4 page composites are excluded. Across all patterns, 134 drop to 89 sections.
    • build --dry-run reports create/update per page. An unknown slug warns and the command exits non-zero.
    • A real build of the home section list and of page-legal-about produced content identical to demo pages 5 and 7. The only differences are the media-library band photo and portraits that rebuild-demo-subsite.php adds. Nested references were fully expanded and new pages were created as drafts. The test pages were deleted afterwards and the demo's Composer copy restored.

Not covered

  • The AI path (vertical scoping in generate_page()) is unit-tested only. It hasn't been run against a live provider.
  • The admin Vertical select hasn't been checked in a browser.
  • The demo's composer.json pins imagewize/waygate to <1.0.0, so the demo needs a constraint bump to use 1.1.0.

@imagewize imagewize deleted a comment from github-actions Bot Oct 26, 2026
@jasperf
jasperf merged commit 16f516b into main Oct 26, 2026
4 checks passed
@jasperf
jasperf deleted the feature/sections-verticals-build-command branch October 26, 2026 04: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