Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to Waygate will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.0] - 2026-05-25

### Added
- Client-side ability `waygate/insert-pattern` registered via `@wordpress/abilities`: inserts a `core/pattern` block at the current cursor position in the block editor, accepting a `slug` parameter
- Ability category `waygate-editor` groups all Waygate block editor abilities
- `Admin::enqueue_editor_abilities()` enqueues `@wordpress/core-abilities` (auto-loads server abilities into the editor store) and the `waygate-editor-abilities` ES module on `enqueue_block_editor_assets`; gracefully skips when `wp_enqueue_script_module()` is unavailable

## [0.7.0] - 2026-05-25

### Added
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Waygate lets you assemble WordPress pages from block patterns — manually or via a natural-language AI prompt powered by the WordPress AI Client (WordPress 7.0+). Works with any block theme; [Elayne](https://github.com/imagewize/elayne) is the primary supported theme.

> **Beta** — v0.7.0. Use on staging/development sites; not yet recommended for production.
> **Beta** — v0.8.0. Use on staging/development sites; not yet recommended for production.

---

Expand All @@ -16,7 +16,7 @@ Waygate lets you assemble WordPress pages from block patterns — manually or vi
- **Developer debug info** — When `WP_ENV=development`, the page editor sidebar and the generation notice also show the ordered pattern slugs and generation timestamp
- **Prompt templates** — Six built-in page templates (Homepage, About, Services, Contact, Landing Page, Portfolio) pre-fill the AI prompt; extend via the `waygate_prompt_templates` filter
- **Feature detection** — AI form is hidden automatically when no provider supports text generation
- **Abilities API** — Exposes `elayne/list-patterns` and `elayne/create-page` abilities for WP 7.0+
- **Abilities API** — Exposes `elayne/list-patterns` and `elayne/create-page` server abilities plus a `waygate/insert-pattern` client-side ability for the block editor (WP 7.0+)
- **REST API** — `GET /wp-json/waygate/v1/patterns` and `POST /wp-json/waygate/v1/pages` for headless and external tool integration
- **Multi-provider** — Works with Mistral, Claude, OpenAI, or Gemini via WP AI Client
- **Any block theme** — Default prefix is `elayne/`; extend via the `waygate_pattern_prefixes` filter
Expand Down Expand Up @@ -95,12 +95,15 @@ Waygate registers this provider manually since the library distribution excludes

## Abilities API (WordPress 7.0+)

When WordPress 7.0's Abilities API is available, Waygate registers two abilities:
When WordPress 7.0's Abilities API is available, Waygate registers three abilities:

| Ability | Description |
|---|---|
| `elayne/list-patterns` | Returns patterns, optionally filtered by category |
| `elayne/create-page` | Creates a draft page from an ordered list of pattern slugs |
| Ability | Type | Description |
|---|---|---|
| `elayne/list-patterns` | Server | Returns patterns, optionally filtered by category |
| `elayne/create-page` | Server | Creates a draft page from an ordered list of pattern slugs |
| `waygate/insert-pattern` | Client (editor) | Inserts a pattern block at the current cursor position in the block editor |

The client-side ability is registered via `@wordpress/abilities` and is available whenever the block editor is open. Pass a `slug` parameter (e.g. `"elayne/hero-centered"`) to insert any registered pattern.

---

Expand Down
32 changes: 32 additions & 0 deletions assets/js/abilities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { registerAbility, registerAbilityCategory } from '@wordpress/abilities';

registerAbilityCategory( 'waygate-editor', {
label: 'Waygate Editor',
description: 'Pattern insertion and management in the block editor',
} );

registerAbility( {
name: 'waygate/insert-pattern',
label: 'Insert Pattern',
description: 'Insert a block pattern at the current cursor position in the editor',
category: 'waygate-editor',
input_schema: {
type: 'object',
properties: {
slug: { type: 'string', description: 'Pattern slug to insert, e.g. "elayne/hero-centered"' },
},
required: [ 'slug' ],
},
output_schema: {
type: 'object',
properties: {
success: { type: 'boolean' },
},
required: [ 'success' ],
},
callback: async ( { slug } ) => {
const block = wp.blocks.createBlock( 'core/pattern', { slug } );
await wp.data.dispatch( 'core/block-editor' ).insertBlock( block );
return { success: true };
},
} );
7 changes: 4 additions & 3 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class RestApi {

**Benefit**: Headless WordPress support, external tool integration.

#### 7. Add Client-Side Abilities for Editor Integration
#### 7. Add Client-Side Abilities for Editor Integration
**New file**: `assets/js/abilities.js`

```javascript
Expand Down Expand Up @@ -457,8 +457,8 @@ public static function track_pattern_usage( string $pattern_slug ): void {
1. ~~Feature detection, ability annotations, generic prefixes — *Phase 1*~~ ✅ Done
2. ~~Prompt templates — *Phase 2* (1–2 days)~~ ✅ Done
3. ~~REST API endpoints — *Phase 2* (2–3 days)~~ ✅ Done
4. Client-side abilities for editor integration — *Phase 2* (2–3 days) ← **Start here**
5. Image generation for previews — *Phase 2* (2–3 days)
4. ~~Client-side abilities for editor integration — *Phase 2* (2–3 days)~~ ✅ Done
5. Image generation for previews — *Phase 2* (2–3 days) ← **Start here**
6. Batch page creation — *Phase 2* (1–2 days)
7. Cost tracking, pattern popularity — *Phase 3* (2–3 days)
8. Advanced features based on user feedback — *Phase 3, speculative*
Expand Down Expand Up @@ -586,3 +586,4 @@ const abilities = getAbilities();
| 2026-05-22 | Initial draft | Created roadmap document |
| 2026-05-24 | Jasper Frumau | Marked Phase 1 complete; Phase 2 is next |
| 2026-05-25 | Jasper Frumau | Marked Prompt Templates (#8) complete; REST API is next |
| 2026-05-25 | Jasper Frumau | Marked Client-side abilities (#7) complete; Image generation is next |
21 changes: 21 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ class Admin {
public static function init(): void {
add_action( 'admin_menu', array( self::class, 'register_menu' ) );
add_action( 'add_meta_boxes', array( self::class, 'register_meta_box' ) );
add_action( 'enqueue_block_editor_assets', array( self::class, 'enqueue_editor_abilities' ) );
}

/**
* Enqueues the Waygate client-side abilities script module for the block editor.
*/
public static function enqueue_editor_abilities(): void {
if ( ! function_exists( 'wp_enqueue_script_module' ) ) {
return;
}

wp_enqueue_script_module( '@wordpress/core-abilities' );

wp_register_script_module(
'waygate-editor-abilities',
WAYGATE_PLUGIN_URL . 'assets/js/abilities.js',
array( '@wordpress/abilities' ),
WAYGATE_VERSION
);

wp_enqueue_script_module( 'waygate-editor-abilities' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions waygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Waygate
* Plugin URI: https://github.com/imagewize/waygate
* Description: AI-powered pattern page builder for the Elayne block theme. Lists registered patterns, creates pages from pattern slugs, and integrates with WordPress AI Client for natural-language page generation.
* Version: 0.7.0
* Version: 0.8.0
* Author: Jasper Frumau
* Author URI: https://imagewize.com
* License: GPL-2.0-or-later
Expand All @@ -18,7 +18,7 @@

defined( 'ABSPATH' ) || exit;

define( 'WAYGATE_VERSION', '0.7.0' );
define( 'WAYGATE_VERSION', '0.8.0' );
define( 'WAYGATE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'WAYGATE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

Expand Down
Loading