You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/agents/generate-plugin.agent.md
+88-33Lines changed: 88 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,10 @@
1
+
# SCF-Driven Content Model
2
+
3
+
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.
1
4
---
2
5
name: "Plugin Generator Agent"
3
6
description: Interactive agent that collects comprehensive requirements and generates a WordPress multi-block plugin with CPT, taxonomies, and SCF fields
@@ -202,9 +205,35 @@ I will ask you about each taxonomy you want to create one by one.
202
205
203
206
### Stage 4: Custom Fields (SCF)
204
207
205
-
I'll help you design field groups. I can work from a simple list or an interactive process.
208
+
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.
209
+
206
210
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`).
207
211
212
+
**How It Works:**
213
+
- Fields from `plugin-config.json` are converted to SCF JSON format
214
+
- Generated files are saved to `scf-json/group_{slug}_fields.json`
215
+
- SCF automatically loads and registers these field groups from JSON files
216
+
- No PHP code required - pure JSON configuration
217
+
218
+
**Configuration Options:**
219
+
All fields support these common properties:
220
+
-`name` — Field slug (lowercase with underscores)
221
+
-`label` — Display label in admin
222
+
-`type` — Field type (see below)
223
+
-`instructions` — Help text shown below the field
224
+
-`required` — Whether the field is required (true/false)
225
+
-`default_value` — Default value for the field
226
+
-`placeholder` — Placeholder text for text-based fields
227
+
-`choices` — Options for select/radio/checkbox fields (object with key:value pairs)
228
+
-`return_format` — Return format for certain field types (value, label, array, url, id, object)
| Featured pattern |`patterns/{{slug}}-featured.php`| ✓ Default |
303
316
304
317
### Stage 8: Additional Features
305
318
@@ -460,9 +473,9 @@ Which blocks do you want?
460
473
461
474
### Final Configuration
462
475
463
-
**User**: "All defaults plus the search block"
476
+
**User**: "All defaults"
464
477
465
-
**Me**: "Adding search block.
478
+
**Me**: "Using all defaults.
466
479
467
480
**Final Configuration Summary:**
468
481
@@ -491,21 +504,14 @@ Fields:
491
504
Repeater: features (feature_name, feature_icon)
492
505
493
506
Blocks:
494
-
- real-estate-pro-card
495
-
- real-estate-pro-collection
496
-
- real-estate-pro-slider
497
-
- real-estate-pro-single
498
-
- real-estate-pro-featured
499
-
- real-estate-pro-search
507
+
- None (block templates removed - implement as patterns or custom code)
500
508
501
509
Templates:
502
510
- single-real-estate-pro.html
503
511
- archive-real-estate-pro.html
504
512
505
513
Patterns:
506
-
- real-estate-pro-card.php
507
514
- real-estate-pro-grid.php
508
-
- real-estate-pro-featured.php
509
515
```
510
516
511
517
**Ready to generate?** (yes/no/modify)"
@@ -517,25 +523,74 @@ Patterns:
517
523
After generation, I can help with:
518
524
519
525
### 1. SCF Field Configuration
526
+
527
+
Field groups are automatically generated as JSON files:
528
+
520
529
```bash
521
-
# Field groups will be in:
530
+
# Field group JSON files:
522
531
scf-json/group_{{slug}}_fields.json
532
+
533
+
# Schema for validation:
534
+
.github/schemas/scf-field-group.schema.json
535
+
```
536
+
537
+
**SCF Local JSON Benefits:**
538
+
- Version control friendly
539
+
- No database queries for field definitions
540
+
- Easy to backup and sync across environments
541
+
- Can be edited directly or via WordPress admin
542
+
543
+
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.
544
+
545
+
### 2. Post Types & Taxonomies via SCF Local JSON
546
+
547
+
Post types and taxonomies are defined using Secure Custom Fields' Local JSON format in the `scf-json/` directory:
548
+
549
+
```bash
550
+
# Post type JSON configuration:
551
+
scf-json/post-type-{{slug}}.json
552
+
553
+
# Taxonomy JSON configuration:
554
+
scf-json/taxonomy-{{slug}}.json
555
+
```
556
+
557
+
**SCF Post Type JSON Example:**
558
+
```json
559
+
{
560
+
"key": "post_type_product",
561
+
"title": "Product",
562
+
"post_type": "product",
563
+
"active": true,
564
+
"labels": {
565
+
"name": "Products",
566
+
"singular_name": "Product"
567
+
}
568
+
}
523
569
```
524
570
525
-
### 2. Block Customisation
571
+
**SCF Local JSON Benefits:**
572
+
- Native SCF format for post types, taxonomies, and fields
573
+
- Automatic loading via SCF's Local JSON system
574
+
- Version control friendly
575
+
- No separate Content_Model_Manager needed
576
+
- Edit in WordPress admin, saved automatically to JSON
577
+
578
+
The SCF_JSON class configures SCF to load post types, taxonomies, and field groups from `scf-json/` directory.
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}}`).
3
+
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}}`).
4
4
5
5
**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`.
6
6
@@ -179,7 +179,7 @@ When generating taxonomy functionality:
0 commit comments