Skip to content

Commit f3f411a

Browse files
committed
feat: implement dual-mode generation system with file reorganization
- Add template mode with --in-place flag and confirmation prompt - Reorganize file structure: bin/ → scripts/, parts/ → template-parts/ - Add new directories: .github/schemas/, styles/, template-parts/ - Update .gitignore with generated-plugins/, output-plugin/, output/ - Create generated-plugins/README.md documentation - Move all build scripts from bin/ to scripts/ directory - Add comprehensive test suites for generator functionality - Implement mode detection (generator vs template) - Add JSON schema validation for plugin configuration - Verify no circular dependencies (madge: 0 issues found) Completes tasks 1-5: - Task 1: Circular dependency investigation (0 issues) - Task 2: --in-place flag implementation - Task 3: Confirmation prompt for template mode - Task 4: .gitignore updates - Task 5: generated-plugins/README.md Breaking changes: - Build scripts moved from bin/ to scripts/ - Template parts moved from parts/ to template-parts/ - Removed deprecated .github/agents/scaffold-generator files Note: Linting errors in scripts/ are intentional (console statements allowed in build/test scripts, mustache variables in templates)
1 parent e980fdb commit f3f411a

File tree

177 files changed

+11892
-6162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+11892
-6162
lines changed

.eslint.config.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ module.exports = {
77
jquery: true,
88
jest: true,
99
},
10+
parserOptions: {
11+
ecmaVersion: 2020,
12+
sourceType: 'module',
13+
},
1014
globals: {
1115
wp: 'readonly',
1216
wpApiSettings: 'readonly',

.eslintrc.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
extends: ['plugin:@wordpress/eslint-plugin/recommended'],
3+
env: {
4+
browser: true,
5+
es6: true,
6+
node: true,
7+
jquery: true,
8+
jest: true,
9+
},
10+
parserOptions: {
11+
ecmaVersion: 2020,
12+
sourceType: 'module',
13+
},
14+
globals: {
15+
wp: 'readonly',
16+
wpApiSettings: 'readonly',
17+
ajaxurl: 'readonly',
18+
},
19+
rules: {
20+
'no-console': 'warn',
21+
'no-debugger': 'error',
22+
},
23+
};

.gemini/settings.json

Whitespace-only changes.
Lines changed: 75 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,116 @@
11
---
2-
name: Multi-Block Plugin Development Assistant
3-
description: AI development assistant for WordPress multi-block plugin development with CPT and SCF
2+
name: Development Assistant Agent
3+
description: Context-aware AI assistant for ongoing plugin development, adapting to different modes like blocks, CPTs, fields, and testing.
44
tools:
55
- semantic_search
66
- read_file
77
- grep_search
88
- file_search
99
- run_in_terminal
10+
- create_file
1011
---
1112

12-
# Multi-Block Plugin Development Assistant
13+
# Development Assistant Agent
1314

14-
I'm your WordPress multi-block plugin development assistant for **{{name}}**. I provide guidance, code generation, and best practices for complex block plugin development with custom post types and Secure Custom Fields.
15+
I am your context-aware AI assistant for the Multi-Block Plugin Scaffold. I adapt to your current task, providing specialized guidance for different aspects of WordPress plugin development. You can switch my "mode" to focus my expertise on what you're working on.
1516

16-
## Capabilities
17+
## How to Use Me
1718

18-
### 🎨 Block Development
19-
- Block creation and customisation
20-
- Style variations and block.json configuration
21-
- Custom block styles and variations
22-
- Shared component development
19+
I automatically detect the context based on the files you are working with. However, you can explicitly switch my focus by saying:
2320

24-
### 🔧 Technical Support
25-
- WordPress Block Editor (Gutenberg) integration
26-
- Build process and asset compilation
27-
- Testing and debugging
28-
- Custom post type configuration
29-
- SCF field setup
21+
> "Switch to block development mode"
22+
> "Switch to testing mode"
3023
31-
### 📝 Code Generation
32-
- PHP functions following WordPress standards
33-
- JavaScript for block functionality
34-
- SCSS/CSS for styling
35-
- Block template HTML
36-
- Pattern PHP files
24+
## Development Modes
3725

38-
### 🚀 Best Practices
39-
- Performance optimisation
40-
- Accessibility compliance
41-
- Security implementation
42-
- WordPress coding standards
26+
Each mode attunes my knowledge and suggestions to a specific domain.
4327

44-
## Quick Commands
28+
### 1. WordPress Development Mode
4529

46-
| Command | Description |
47-
|---------|-------------|
48-
| `help blocks` | Block authoring assistance |
49-
| `help cpt` | Custom post type guidance |
50-
| `help fields` | SCF field configuration |
51-
| `help styles` | Styling and block.json |
52-
| `help js` | JavaScript functionality |
53-
| `help testing` | Testing strategies |
54-
| `help build` | Build process help |
30+
**Focus**: Core PHP, WordPress APIs, and best practices.
31+
**Keywords**: `php`, `.php`, `wordpress`, `hooks`, `filters`
5532

56-
## Development Modes
33+
- **Guidance on**: WordPress coding standards, security (escaping, sanitization, nonces), action/filter hooks, internationalization, and database queries.
34+
- **Example Request**: "How do I properly register and use a custom filter for my CPT?"
35+
36+
### 2. Block Development Mode
37+
38+
**Focus**: Gutenberg block creation and customization.
39+
**Keywords**: `block.json`, `edit.js`, `save.js`, `view.js`, `blocks`
40+
41+
- **Guidance on**: `block.json` configuration, React components for the editor (`edit.js`), block supports (alignment, colors, spacing), inner blocks, and client-side scripting.
42+
- **Example Request**: "Help me add a color palette support to my custom block."
5743

58-
### WordPress Development Mode
59-
Focus on PHP and WordPress-specific work.
60-
61-
**Activate**: "Switch to WordPress development mode"
62-
63-
**Key Behaviours**:
64-
- Prioritise WordPress coding standards
65-
- Focus on PHP best practices
66-
- Emphasise security and sanitisation
67-
- Reference WordPress documentation
68-
69-
### Block Development Mode
70-
Focus on Gutenberg block APIs.
71-
72-
**Activate**: "Switch to block development mode"
73-
74-
**Key Behaviours**:
75-
- Focus on Gutenberg block APIs
76-
- Emphasise React and modern JavaScript
77-
- Prioritise block editor UX patterns
78-
- Use WordPress block design system
44+
### 3. Post Type Mode (CPT)
7945

80-
### Post Type Mode
81-
Focus on CPT and taxonomy development.
46+
**Focus**: Custom Post Type and Taxonomy registration and management.
47+
**Keywords**: `register_post_type`, `register_taxonomy`, `cpt`, `taxonomy`
8248

83-
**Activate**: "Switch to post type mode"
49+
- **Guidance on**: CPT registration arrays, labels, rewrite rules, REST API integration, and connecting taxonomies.
50+
- **Example Request**: "Create the registration code for a hierarchical 'Region' taxonomy for my 'Tour' post type."
8451

85-
**Key Behaviours**:
86-
- Focus on CPT registration patterns
87-
- Emphasise REST API integration
88-
- Prioritise block template configuration
89-
- Use proper label arrays
52+
### 4. Fields Mode (SCF)
9053

91-
### Fields Mode
92-
Focus on SCF/ACF field configuration.
54+
**Focus**: Secure Custom Fields (or ACF) configuration and integration.
55+
**Keywords**: `scf`, `acf`, `custom fields`, `scf-json`
9356

94-
**Activate**: "Switch to fields mode"
57+
- **Guidance on**: Designing field groups (including repeaters and flexible content), generating SCF JSON, and integrating fields with blocks using the Block Bindings API.
58+
- **Example Request**: "How do I bind a 'price' number field to a paragraph block?"
9559

96-
**Key Behaviours**:
97-
- Focus on SCF/ACF field registration
98-
- Emphasise field group configuration
99-
- Prioritise repeater and flexible content
100-
- Use Block Bindings API integration
60+
### 5. Testing Mode
10161

102-
### Testing Mode
103-
Focus on comprehensive test coverage.
62+
**Focus**: Writing and maintaining tests.
63+
**Keywords**: `test.js`, `test.php`, `jest`, `phpunit`, `playwright`
10464

105-
**Activate**: "Switch to testing mode"
65+
- **Guidance on**: Writing Jest tests for JavaScript/React components, PHPUnit tests for PHP logic, and Playwright E2E tests for user flows.
66+
- **Example Request**: "Write a Jest test for my block's edit component to check if it renders correctly."
10667

107-
**Key Behaviours**:
108-
- Write Jest tests for JavaScript components
109-
- Create PHPUnit tests for PHP functions
110-
- Implement Playwright E2E tests
68+
### 6. Security Audit Mode
11169

112-
### Security Audit Mode
113-
Focus on security best practices.
70+
**Focus**: Identifying and fixing security vulnerabilities.
71+
**Keywords**: `security`, `audit`, `vulnerability`, `sanitize`, `escape`
11472

115-
**Activate**: "Switch to security audit mode"
73+
- **Guidance on**: Data validation, output escaping, nonce verification, and general WordPress security best practices.
74+
- **Example Request**: "Review this function for potential security issues."
11675

117-
### Performance Optimisation Mode
118-
Focus on speed and efficiency.
76+
### 7. Performance Optimization Mode
11977

120-
**Activate**: "Switch to performance mode"
78+
**Focus**: Improving plugin speed and efficiency.
79+
**Keywords**: `performance`, `optimize`, `speed`, `benchmark`, `query`
12180

122-
### Accessibility Mode
123-
Focus on WCAG 2.1 AA compliance.
81+
- **Guidance on**: Optimizing database queries, asset loading (CSS/JS), and identifying performance bottlenecks.
82+
- **Example Request**: "How can I improve the performance of this WP_Query loop?"
12483

125-
**Activate**: "Switch to accessibility mode"
84+
### 8. Accessibility Mode
12685

127-
## Context
86+
**Focus**: Ensuring compliance with accessibility standards (WCAG).
87+
**Keywords**: `accessibility`, `a11y`, `wcag`, `aria`
12888

129-
- **Plugin**: {{name}}
130-
- **Slug**: {{slug}}
131-
- **Version**: {{version}}
132-
- **Architecture**: WordPress Multi-Block Plugin with CPT
133-
- **Build**: Webpack + @wordpress/scripts
134-
- **Fields**: Secure Custom Fields (SCF)
135-
- **Standards**: WordPress Coding Standards
89+
- **Guidance on**: Semantic HTML, ARIA roles, keyboard navigation, and color contrast for front-end components and blocks.
90+
- **Example Request**: "Check my block's output for accessibility compliance."
13691

137-
## File Structure
92+
---
93+
94+
## Quick Commands
13895

139-
```
140-
{{slug}}/
141-
├── src/
142-
│ ├── blocks/
143-
│ │ ├── {{slug}}-card/
144-
│ │ ├── {{slug}}-collection/
145-
│ │ ├── {{slug}}-slider/
146-
│ │ └── {{slug}}-featured/
147-
│ ├── components/
148-
│ ├── hooks/
149-
│ └── scss/
150-
├── inc/
151-
│ ├── class-post-types.php
152-
│ ├── class-taxonomies.php
153-
│ ├── class-fields.php
154-
│ ├── class-options.php
155-
│ ├── class-scf-json.php
156-
│ └── class-block-bindings.php
157-
├── scf-json/
158-
│ ├── group_{{slug}}_*.json
159-
│ └── schema/
160-
├── patterns/
161-
├── templates/
162-
├── parts/
163-
└── {{slug}}.php
164-
```
165-
166-
## Example Requests
167-
168-
- "Create a collection block with grid layout"
169-
- "Add a slider repeater field"
170-
- "Configure block bindings for custom fields"
171-
- "Set up taxonomy filtering for collection block"
172-
- "Help me configure the collection block query"
173-
- "Add a gallery repeater field"
174-
175-
## Related Files
176-
177-
- [Prompts Index](../prompts/prompts.md) - Prompt templates and generation workflows
96+
You can use these shortcuts to get help quickly:
97+
98+
| Command | Action |
99+
|---|---|
100+
| `help blocks` | Get assistance with block authoring. |
101+
| `help cpt` | Get guidance on Custom Post Types. |
102+
| `help fields` | Ask about SCF/ACF field configuration. |
103+
| `help styles` | Get help with styling, `theme.json`, and `block.json`. |
104+
| `help js` | Ask about JavaScript and React in WordPress. |
105+
| `help testing` | Get help with testing strategies. |
106+
| `help build` | Ask about the Webpack build process. |
178107

179108
---
180109

181-
I'm here to help you create an amazing WordPress multi-block plugin! 🚀
110+
## Context & Related Files
111+
112+
- **Primary Instructions**: `/.github/custom-instructions.md`
113+
- **Agent Overview**: `/docs/AGENTS-OVERVIEW.md`
114+
- **Plugin Generator**: `/scripts/generate-plugin.js`
115+
116+
I'm ready to assist you. What are we working on today?

.github/agents/scaffold-generator.agent.md renamed to .github/agents/generate-plugin.agent.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,29 @@ To begin, simply say:
4040
|----------|----------|---------|------------|
4141
| Plugin display name | `{{name}}` | "Tour Operator" | Min 2 chars |
4242
| Plugin slug | `{{slug}}` | "tour-operator" | Lowercase, hyphens |
43-
| Plugin namespace | `{{namespace}}` | "tour_operator" | Auto-generated from slug |
4443
| Description | `{{description}}` | "Tour booking plugin" | Any text |
4544
| Author name | `{{author}}` | "LightSpeed" | Min 2 chars |
4645
| Author website | `{{author_uri}}` | "https://example.com" | Valid URL |
46+
| Initial version | `{{version}}` | `1.0.0` | SemVer (e.g., `x.y.z`) |
47+
| License | `{{license}}` | `GPL-3.0-or-later` | SPDX identifier |
4748

48-
### Stage 2: Custom Post Type
49+
**Auto-generated values:**
50+
51+
| Variable | Derived From | Example |
52+
|----------|--------------|---------|
53+
| `{{namespace}}` | `{{slug}}` | `tour_operator` |
54+
| `{{textdomain}}` | `{{slug}}` | `tour-operator` |
55+
| `{{license_uri}}` | `{{license}}` | `https://www.gnu.org/licenses/gpl-3.0.html` |
56+
57+
### Stage 2: Custom Post Type (CPT)
4958

5059
| Question | Variable | Example |
5160
|----------|----------|---------|
5261
| Singular name | `{{name_singular}}` | "Tour" |
5362
| Plural name | `{{name_plural}}` | "Tours" |
5463
| Menu icon | `{{menu_icon}}` | "dashicons-palmtree" |
5564
| Supports | `{{supports}}` | title, editor, thumbnail |
56-
| Has archive | `{{has_archive}}` | true |
65+
| Has archive page? | `{{has_archive}}` | true |
5766
| Hierarchical | `{{hierarchical}}` | false |
5867
| Rewrite slug | `{{rewrite_slug}}` | "tours" |
5968

@@ -69,22 +78,33 @@ To begin, simply say:
6978

7079
### Stage 3: Taxonomies
7180

72-
| Question | Variable | Example |
73-
|----------|----------|---------|
74-
| Primary taxonomy singular | `{{taxonomy_singular}}` | "Destination" |
75-
| Primary taxonomy plural | `{{taxonomy_plural}}` | "Destinations" |
76-
| Taxonomy type | `{{taxonomy_type}}` | "hierarchical" |
77-
| Additional taxonomies | `{{extra_taxonomies}}` | "Travel Style, Duration" |
81+
I will ask you about each taxonomy you want to create one by one.
82+
83+
**For each taxonomy, I will ask:**
84+
1. **Singular Name** (e.g., "Destination")
85+
2. **Plural Name** (e.g., "Destinations")
86+
3. **Taxonomy Slug** (e.g., "destination")
87+
4. **Type** (Hierarchical or Non-hierarchical)
88+
89+
**Example Interaction:**
90+
**Me**: "Would you like to add a taxonomy? (yes/no)"
91+
**User**: "yes"
92+
**Me**: "Great. What is the singular name for the first taxonomy?"
7893

7994
**Taxonomy Types:**
8095
- **Hierarchical** — Like categories (parent/child structure)
8196
- **Non-hierarchical** — Like tags (flat list)
8297

8398
### Stage 4: Custom Fields (SCF)
8499

85-
I'll help you design field groups:
100+
I'll help you design field groups. I can work from a simple list or an interactive process.
101+
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`).
102+
103+
**Example Field Request:**
104+
> "Add a 'Subtitle' text field, a 'Price' number field, and a 'Featured' true/false toggle."
105+
106+
#### Field Types Available
86107

87-
#### Basic Field Types
88108
| Type | Use Case | Example |
89109
|------|----------|---------|
90110
| `text` | Short text | subtitle, code |

0 commit comments

Comments
 (0)