Skip to content
Open
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1afb350
fix: correct namespace escaping in plugin initialization comments and…
krugazul Jan 9, 2026
f737c7f
fix: remove unnecessary blank lines at the beginning of class files
krugazul Jan 9, 2026
6c262e4
refactor: standardize class names by removing namespace prefixes in m…
krugazul Jan 9, 2026
092b423
refactor: update constructor and class references to remove namespace…
krugazul Jan 9, 2026
5dc226b
fix: remove unnecessary namespace declaration and update schema path …
krugazul Jan 9, 2026
5951e75
fix: ensure supports property is an array in post type registration a…
krugazul Jan 9, 2026
18502c9
refactor: remove unused HTML markup and improve structure in multiple…
krugazul Jan 9, 2026
7ca7c1f
refactor: remove unnecessary comments from block.json files for card,…
krugazul Jan 19, 2026
226cce6
fix: update post type slug and template references to use correct pla…
krugazul Jan 19, 2026
6ec4c26
Refactor {{cpt1_slug}} Collection Block
krugazul Jan 19, 2026
06169f0
Initial plan
Copilot Jan 20, 2026
dda9c1e
feat: Implement JSON-based post type loading system (#8)
krugazul Jan 20, 2026
d939f30
refactor: Remove hardcoded registration methods for fields, post type…
krugazul Jan 20, 2026
8c27806
refactor: Consolidate JSON loading into Content_Model_Manager
krugazul Jan 20, 2026
e7ade1e
refactor: Remove hardcoded fallback registration
krugazul Jan 20, 2026
b466cd7
refactor: Migrate custom post types and taxonomies to JSON-based regi…
krugazul Jan 20, 2026
839ca0c
Refactor SCF JSON Schema and Generation Logic
krugazul Jan 21, 2026
f765a98
refactor: Enhance JSON loading system for post types and taxonomies
krugazul Jan 21, 2026
46dbbb4
refactor: Update JSON schema and post type configuration to include s…
krugazul Jan 21, 2026
fe4fbd3
refactor: Remove block templates and associated references from the p…
krugazul Jan 21, 2026
15d0295
refactor: Reorganize name_singular and name_plural properties in JSON…
krugazul Jan 21, 2026
3616d95
refactor: Update JSON schema and example configuration to support new…
krugazul Jan 21, 2026
15c90f4
refactor: Remove unused JSON style and configuration files for blocks…
krugazul Jan 21, 2026
507ca9d
refactor: Enhance plugin generator with post-type JSON file generatio…
krugazul Jan 21, 2026
4455eba
refactor: Update workspace configuration and remove defensive coding …
krugazul Jan 22, 2026
9e463da
refactor: Rename plugin initialization function for consistency and c…
krugazul Jan 23, 2026
1905b5b
refactor: Update plugin directory constant to improve consistency acr…
krugazul Jan 23, 2026
4de6911
refactor: Update plugin constant names for consistency and clarity
krugazul Jan 23, 2026
80c987a
Remove example field group JSON files and update test paths; add comp…
krugazul Jan 23, 2026
bd92251
feat: Implement taxonomy mapping for post types in Content_Model_Manager
krugazul Jan 23, 2026
4ccfd6f
feat: Add taxonomy fields example and documentation for SCF
krugazul Jan 26, 2026
8620262
feat: Implement JSON loading system for taxonomy fields and update do…
krugazul Jan 26, 2026
1148995
feat: Update SCF examples documentation to clarify default taxonomy f…
krugazul Jan 26, 2026
36e7e5b
feat: Enhance JSON schema and generator to support new three-array st…
krugazul Jan 26, 2026
ed31eab
Merge pull request #9 from lightspeedwp/copilot/implement-json-loadin…
krugazul Jan 26, 2026
1c9c2fb
Remove {{block_slug}}-card and {{block_slug}}-featured blocks
krugazul Jan 26, 2026
c8a63f3
Remove {{block_slug}} collection and slider blocks, including all rel…
krugazul Jan 26, 2026
50111b4
feat: Update plugin configuration schema to include default block typ…
krugazul Jan 26, 2026
f7e8274
feat: Update block.json files for slider and collection blocks to sta…
krugazul Jan 27, 2026
ed9a7bd
feat: Update block names to use dasherized slugs in block.json files …
krugazul Jan 27, 2026
2916c9d
feat: Update block slug references to use dasherized format for colle…
krugazul Jan 27, 2026
fd207fa
Refactor {{cpt_slug}}-collection block: Remove old implementation and…
krugazul Jan 27, 2026
8f1457d
feat: Add dynamic block imports generation in src/index.js for improv…
krugazul Jan 27, 2026
0d70ebc
feat: Ensure render functions for collection and slider blocks are de…
krugazul Jan 28, 2026
061a0cf
feat: Implement block bindings system for custom field display
krugazul Jan 28, 2026
d40de24
feat: Refactor plugin generation to output post types and taxonomies …
krugazul Feb 2, 2026
c57dfc5
feat: Update plugin to use SCF Local JSON for post type and taxonomy …
krugazul Feb 2, 2026
26e1e89
feat: Remove unused REST API route registration and simplify field se…
krugazul Feb 2, 2026
0f1dff2
feat: Update block rendering to use dynamic render functions and impr…
krugazul Feb 2, 2026
008a290
feat: Enhance block registration to support dynamic rendering via blo…
krugazul Feb 2, 2026
2e63cbb
feat: Migrate post type and taxonomy registration to SCF Local JSON f…
krugazul Feb 2, 2026
e5bb3ef
feat: Remove Content_Model_Manager and JSON_Loader classes to streaml…
krugazul Feb 2, 2026
4f5f48f
Merge pull request #12 from lightspeedwp/feature/post-type-registration
krugazul Feb 2, 2026
9a01a03
feat: Add icon selection and rendering functionality to field display…
krugazul Feb 2, 2026
cf8d542
feat: Enhance plugin generation to include snake_case function names …
krugazul Feb 2, 2026
9692aae
Add new solid icons for various features
krugazul Feb 2, 2026
42e0ae7
feat: Simplify field display block styles and adjust rendering for co…
krugazul Feb 2, 2026
5f845cb
feat: Add Field Display Pattern Generator skill to automate pattern f…
krugazul Feb 3, 2026
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
121 changes: 88 additions & 33 deletions .github/agents/generate-plugin.agent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# SCF-Driven Content Model

All post types, taxonomies, and field groups are now output as individual JSON files in `scf-json/` and registered by Secure Custom Fields (SCF). No PHP registration code is generated for post types or taxonomies.
---
name: "Plugin Generator Agent"
description: Interactive agent that collects comprehensive requirements and generates a WordPress multi-block plugin with CPT, taxonomies, and SCF fields
tools: ["semantic_search", "read_file", "grep_search", "file_search", "run_in_terminal", "create_file", "update_file", "delete_file", "move_file"]
tools: ['vscode', 'execute', 'read', 'edit', 'search', 'web', 'github/delete_file', 'agent', 'ms-vscode.vscode-websearchforcopilot/websearch', 'todo']
permissions: ["read", "write", "execute", "shell", "filesystem"]
---
Comment on lines +1 to 9
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Move the frontmatter to the very top of the spec.
The heading and paragraph before the frontmatter will break schema validation and the expected agent-spec template layout.

As per coding guidelines: "Start agent specification files from .github/agents/template.agent.md; replace all placeholders and keep metadata accurate (version, last_updated, status, owners)."

🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: The official name of this software platform is spelled with a capital “H”.
Context: ...ute', 'read', 'edit', 'search', 'web', 'github/delete_file', 'agent', 'ms-vscode.vscod...

(GITHUB)

🪛 markdownlint-cli2 (0.20.0)

[warning] 3-3: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)


[warning] 5-5: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

🤖 Prompt for AI Agents
In @.github/agents/generate-plugin.agent.md around lines 1 - 9, The YAML
frontmatter (starts with --- and contains name/description/tools/permissions)
must be moved to the very top of the file so it is the first content in the
agent spec; remove the heading "SCF-Driven Content Model" and the paragraph that
precede it, then ensure the frontmatter follows the template fields (include
accurate metadata keys such as version, last_updated, status, owners) and that
the file is based on the `.github/agents/template.agent.md` structure with
placeholders replaced and metadata updated; update the file's frontmatter block
(the existing name/description/tools/permissions) to match that template and
validate schema.

Comment on lines 5 to 9
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Frontmatter is missing required fields and tool-permission alignment.
Add version, last_updated, status, owners, and references, and ensure permissions cover every listed tool (e.g., network for web, github:repo/github:issues for GitHub tools).

As per coding guidelines: "Include references to AGENTS.md and .github/instructions/agent-spec.instructions.md in the references field" and "Ensure permissions field in agent specifications is present with appropriate values aligned with the tools array."

🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: The official name of this software platform is spelled with a capital “H”.
Context: ...ute', 'read', 'edit', 'search', 'web', 'github/delete_file', 'agent', 'ms-vscode.vscod...

(GITHUB)

🪛 markdownlint-cli2 (0.20.0)

[warning] 5-5: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

🤖 Prompt for AI Agents
In @.github/agents/generate-plugin.agent.md around lines 5 - 9, Update the agent
frontmatter to include the missing metadata keys (add version, last_updated,
status, owners, and references) and make the permissions array cover every tool
listed in the tools array (e.g., add network for 'web', github:repo and
github:issues for GitHub tools, and any other specific permission names required
by 'vscode', 'execute', 'read', 'edit', 'search', 'agent', 'todo'); ensure the
references field explicitly includes AGENTS.md and
.github/instructions/agent-spec.instructions.md as required, and keep the
existing name, description, tools, and permissions fields aligned and
syntactically valid in the frontmatter.


Expand Down Expand Up @@ -202,9 +205,35 @@ I will ask you about each taxonomy you want to create one by one.

### Stage 4: Custom Fields (SCF)

I'll help you design field groups. I can work from a simple list or an interactive process.
I'll help you design field groups. The generator will create SCF JSON files that Secure Custom Fields automatically loads from the `scf-json/` directory.

For each field, please provide the **field label** (e.g., "Start Date") and the **field type** (e.g., `date_picker`). I will generate the field name automatically (e.g., `start_date`).

**How It Works:**
- Fields from `plugin-config.json` are converted to SCF JSON format
- Generated files are saved to `scf-json/group_{slug}_fields.json`
- SCF automatically loads and registers these field groups from JSON files
- No PHP code required - pure JSON configuration

**Configuration Options:**
All fields support these common properties:
- `name` — Field slug (lowercase with underscores)
- `label` — Display label in admin
- `type` — Field type (see below)
- `instructions` — Help text shown below the field
- `required` — Whether the field is required (true/false)
- `default_value` — Default value for the field
- `placeholder` — Placeholder text for text-based fields
- `choices` — Options for select/radio/checkbox fields (object with key:value pairs)
- `return_format` — Return format for certain field types (value, label, array, url, id, object)
- `multiple` — Allow multiple selections (for select/post_object/user fields)
- `allow_null` — Allow null/empty value

**Number Field Options:**
- `min` — Minimum value
- `max` — Maximum value
- `step` — Step increment (default: 1)

**Example Field Request:**
> "Add a 'Subtitle' text field, a 'Price' number field, and a 'Featured' true/false toggle."

Expand Down Expand Up @@ -275,31 +304,15 @@ itinerary (repeater)

### Stage 6: Blocks Configuration

| Block | Purpose | Included |
|-------|---------|----------|
| `{{slug}}-card` | Single post card display | ✓ Default |
| `{{slug}}-collection` | Query-based post grid | ✓ Default |
| `{{slug}}-slider` | Carousel display | ✓ Default |
| `{{slug}}-single` | Full post display | ✓ Default |
| `{{slug}}-featured` | Featured posts section | ✓ Default |

**Block Configuration Options:**

For each block:
- Category (common, text, media, design, widgets)
- Icon (dashicon name)
- Supports (align, anchor, className, color, spacing)
- Variations (grid, list, slider layouts)
**Note**: Block templates have been removed from the scaffold. Blocks should be implemented as patterns or custom code.

### Stage 7: Templates & Patterns

| Item | File | Include? |
|------|------|----------|
| Single template | `templates/single-{{slug}}.html` | ✓ Default |
| Archive template | `templates/archive-{{slug}}.html` | ✓ Default |
| Card pattern | `patterns/{{slug}}-card.php` | ✓ Default |
| Grid pattern | `patterns/{{slug}}-grid.php` | ✓ Default |
| Featured pattern | `patterns/{{slug}}-featured.php` | ✓ Default |

### Stage 8: Additional Features

Expand Down Expand Up @@ -460,9 +473,9 @@ Which blocks do you want?

### Final Configuration

**User**: "All defaults plus the search block"
**User**: "All defaults"

**Me**: "Adding search block.
**Me**: "Using all defaults.

**Final Configuration Summary:**

Expand Down Expand Up @@ -491,21 +504,14 @@ Fields:
Repeater: features (feature_name, feature_icon)

Blocks:
- real-estate-pro-card
- real-estate-pro-collection
- real-estate-pro-slider
- real-estate-pro-single
- real-estate-pro-featured
- real-estate-pro-search
- None (block templates removed - implement as patterns or custom code)

Templates:
- single-real-estate-pro.html
- archive-real-estate-pro.html

Patterns:
- real-estate-pro-card.php
- real-estate-pro-grid.php
- real-estate-pro-featured.php
```

**Ready to generate?** (yes/no/modify)"
Expand All @@ -517,25 +523,74 @@ Patterns:
After generation, I can help with:

### 1. SCF Field Configuration

Field groups are automatically generated as JSON files:

```bash
# Field groups will be in:
# Field group JSON files:
scf-json/group_{{slug}}_fields.json

# Schema for validation:
.github/schemas/scf-field-group.schema.json
```

**SCF Local JSON Benefits:**
- Version control friendly
- No database queries for field definitions
- Easy to backup and sync across environments
- Can be edited directly or via WordPress admin

The SCF_JSON class automatically configures the save/load paths so any field groups created in WordPress admin are saved to `scf-json/` and version controlled.

### 2. Post Types & Taxonomies via SCF Local JSON

Post types and taxonomies are defined using Secure Custom Fields' Local JSON format in the `scf-json/` directory:

```bash
# Post type JSON configuration:
scf-json/post-type-{{slug}}.json

# Taxonomy JSON configuration:
scf-json/taxonomy-{{slug}}.json
```

**SCF Post Type JSON Example:**
```json
{
"key": "post_type_product",
"title": "Product",
"post_type": "product",
"active": true,
"labels": {
"name": "Products",
"singular_name": "Product"
}
}
```

### 2. Block Customisation
**SCF Local JSON Benefits:**
- Native SCF format for post types, taxonomies, and fields
- Automatic loading via SCF's Local JSON system
- Version control friendly
- No separate Content_Model_Manager needed
- Edit in WordPress admin, saved automatically to JSON

The SCF_JSON class configures SCF to load post types, taxonomies, and field groups from `scf-json/` directory.

### 3. Block Customisation
```bash
# Edit block attributes and supports:
src/blocks/{{slug}}-*/block.json
```

### 3. Template Setup
### 4. Template Setup
```bash
# Customise templates with block bindings:
templates/single-{{slug}}.html
templates/archive-{{slug}}.html
```

### 4. Development Start
### 5. Development Start
```bash
cd output-plugin
composer install
Expand Down
27 changes: 8 additions & 19 deletions .github/copilot-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ date: 2025-12-01
**Status**: ✅ COMPLETED

- [x] **Custom Post Types**
- Location: [inc/class-post-types.php](../inc/class-post-types.php)
- Location: JSON files in [/scf-json/](../scf-json/) (post-type-{slug}.json)
- Registers: {{slug}} post type with block editor support

- [x] **Custom Taxonomies**
- Location: [inc/class-taxonomies.php](../inc/class-taxonomies.php)
- Location: JSON files in [/scf-json/](../scf-json/) (taxonomy-{slug}.json)
- Registers: {{slug}}_category taxonomy

---
Expand All @@ -46,7 +46,7 @@ date: 2025-12-01
**Status**: ✅ COMPLETED

- [x] **SCF Field Registration**
- Location: [inc/class-fields.php](../inc/class-fields.php)
- Location: JSON files in [/scf-json/](../scf-json/) (group_{name}.json)
- Features: Subtitle, featured flag, gallery, related posts

- [x] **Repeater Fields**
Expand Down Expand Up @@ -75,23 +75,11 @@ date: 2025-12-01

## 5. Block Development

**Status**: 📋 TODO

- [ ] **Card Block** - Single post card display
- Location: `src/blocks/{{slug}}-card/`
- Features: Post preview with featured image, title, excerpt

- [ ] **Collection Block** - Post query/collection
- Location: `src/blocks/{{slug}}-collection/`
- Features: Grid/list/slider layouts, taxonomy filtering
**Status**: ❌ REMOVED

- [ ] **Slider Block** - Carousel/slider display
- Location: `src/blocks/{{slug}}-slider/`
- Features: ACF repeater integration, navigation, autoplay
**Note**: Block templates have been removed from the scaffold. Implement blocks as patterns or custom code as needed.

- [ ] **Featured Block** - Featured posts display
- Location: `src/blocks/{{slug}}-featured/`
- Features: Highlight featured {{name_plural_lower}}
**Note**: Card and Featured blocks are implemented as patterns using the Collection block.

---

Expand Down Expand Up @@ -127,7 +115,8 @@ date: 2025-12-01

- [ ] **Block Patterns**
- Location: `patterns/`
- Files: {{slug}}-archive.php, {{slug}}-card.php, {{slug}}-grid.php
- Files: {{slug}}-archive.php, {{slug}}-grid.php
- Note: Implement card and featured displays as patterns

---

Expand Down
15 changes: 4 additions & 11 deletions .github/custom-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ You are an expert WordPress multi-block plugin developer working on {{name}}, a
```
{{slug}}/
├── src/
│ ├── blocks/
│ │ ├── {{slug}}-card/
│ │ ├── {{slug}}-collection/
│ │ ├── {{slug}}-slider/
│ │ └── {{slug}}-featured/
│ ├── components/
│ │ ├── Slider/
│ │ ├── PostSelector/
Expand All @@ -114,9 +109,7 @@ You are an expert WordPress multi-block plugin developer working on {{name}}, a
│ ├── utils/
│ └── scss/
├── inc/
│ ├── class-post-types.php
│ ├── class-taxonomies.php
│ ├── class-fields.php
│ ├── class-content-model-manager.php
│ ├── class-repeater-fields.php
│ ├── class-block-templates.php
│ ├── class-block-bindings.php
Expand Down Expand Up @@ -181,14 +174,14 @@ You are an expert WordPress multi-block plugin developer working on {{name}}, a

### Custom Post Types

- Register in `inc/class-post-types.php`
- Register via JSON files in `/scf-json/` using SCF Local JSON format (handled by `inc/class-scf-json.php`)
- Enable block editor support (`show_in_rest`)
- Define block templates for consistent editing

### Custom Fields

- Use Secure Custom Fields (SCF) API
- Register fields in `inc/class-fields.php`
- Register fields via JSON files in `/scf-json/` using SCF field group format (handled by `inc/class-scf-json.php`)
- Implement repeater fields for complex data
- Use Block Bindings for field display

Expand Down Expand Up @@ -254,7 +247,7 @@ Use these variables in templates and configuration files:

**Adding Custom Fields**

1. Register field group in `inc/class-fields.php`
1. Register field group via JSON files in `/scf-json/` using SCF format (handled by `inc/class-scf-json.php`)
2. Use `acf_add_local_field_group()` API
3. Implement block binding if needed
4. Test field functionality
Expand Down
2 changes: 1 addition & 1 deletion .github/instructions/block-json.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ $alignment = $attributes['alignment'] ?? 'left';
$post_id = $block->context['postId'] ?? get_the_ID();

?>
<div class="wp-block-{{namespace}}-{{slug}}-card align<?php echo esc_attr( $alignment ); ?>">
<div class="wp-block-{{namespace}}-custom-block align<?php echo esc_attr( $alignment ); ?>">
<?php echo wp_kses_post( $content ); ?>
</div>
```
Expand Down
8 changes: 4 additions & 4 deletions .github/instructions/folder-structure.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ Use this guide when creating, moving, or auditing files. It covers where to plac

**Block**:

- **Location**: `src/blocks/{{slug}}-{block-name}/`
- **Location**: `src/blocks/{block-name}/` (custom blocks only, no templates provided)
- **Files**: `block.json`, `edit.js`, `save.js`, `render.php`, `style.scss`, `editor.scss`
- **Example**: `src/blocks/{{slug}}-card/`
- **Example**: `src/blocks/custom-block/`

**Test File**:

Expand Down Expand Up @@ -496,8 +496,8 @@ fs.rmSync(tmpDir, { recursive: true, force: true });
### 2. Mirror Test Structure

```text
src/blocks/{{slug}}-card/edit.js
tests/js/blocks/{{slug}}-card.test.js
src/blocks/custom-block/edit.js
tests/js/blocks/custom-block.test.js
```

### 3. Namespace Everything
Expand Down
4 changes: 2 additions & 2 deletions .github/instructions/generate-plugin.instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ⚠️ WARNING: Strict Mustache Placeholder Enforcement

All contributors must use the correct mustache placeholders in all template files, folders, and code. Do not use generic placeholders (like `{{slug}}`) where a more specific one is required (e.g., `{{cpt1_slug}}`, `{{taxonomy1_slug}}`).
All contributors must use the correct mustache placeholders in all template files, folders, and code. Do not use generic placeholders (like `{{slug}}`) where a more specific one is required (e.g., `{{cpt_slug}}`, `{{taxonomy1_slug}}`).

**Never hard-code plugin-specific values** in the scaffold. All identifiers, class names, translation domains, and meta keys must use the appropriate placeholder as defined in `scripts/mustache-variables-registry.json`.

Expand Down Expand Up @@ -179,7 +179,7 @@ When generating taxonomy functionality:
```php
// Use UPPERCASE namespace
define( '{{namespace|upper}}_VERSION', '{{version}}' );
define( '{{namespace|upper}}_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( '{{namespace|upper}}_DIR', plugin_dir_path( __FILE__ ) );
```

**Classes:**
Expand Down
Loading
Loading