@@ -162,9 +162,147 @@ JSON configuration files (`package.json`, `composer.json`, `block.json`) use pla
162162}
163163```
164164
165+ ## Operational Modes
166+
167+ ### Template Mode vs Generator Mode
168+
169+ The scaffold supports two operational modes:
170+
171+ #### Template Mode (` --in-place ` )
172+
173+ ** Use when** : You want to use the scaffold as a starting point for your plugin.
174+
175+ - Processes files directly in the scaffold directory
176+ - Replaces all mustache variables in-place
177+ - Renames files and directories to match your slug
178+ - ** ⚠️ Destructive** : Modifies the scaffold permanently
179+ - Includes confirmation prompt to prevent accidents
180+ - Best for GitHub template repositories
181+
182+ ** Command:**
183+
184+ ``` bash
185+ node scripts/generate-plugin.js --in-place
186+ ```
187+
188+ ** Workflow:**
189+
190+ 1 . Clone/fork the scaffold repository
191+ 2 . Run generator with ` --in-place ` flag
192+ 3 . Confirm the operation (y/N prompt)
193+ 4 . Scaffold is processed in-place
194+ 5 . Install dependencies and build
195+ 6 . Commit your customized plugin
196+
197+ #### Generator Mode (Default)
198+
199+ ** Use when** : You want to create multiple plugins or keep the scaffold clean.
200+
201+ - Creates new plugin in ` generated-plugins/<slug>/ `
202+ - Leaves scaffold directory unchanged
203+ - Can generate multiple plugins
204+ - Safe for repeated use
205+ - Best for maintaining the scaffold as a tool
206+
207+ ** Command:**
208+
209+ ``` bash
210+ node scripts/generate-plugin.js
211+ ```
212+
213+ ** Workflow:**
214+
215+ 1 . Clone the scaffold repository once
216+ 2 . Run generator (no ` --in-place ` flag)
217+ 3 . Generated plugin appears in ` generated-plugins/<slug>/ `
218+ 4 . Move to WordPress plugins directory
219+ 5 . Install dependencies and build
220+ 6 . Generate another plugin anytime
221+
165222## Generation Methods
166223
167- ### Method 1: AI-Assisted Generation (Recommended)
224+ ### Method 1: Template Mode (In-Place Processing)
225+
226+ Use the scaffold as a GitHub template and process it directly:
227+
228+ ``` bash
229+ # Interactive mode with confirmation
230+ node scripts/generate-plugin.js --in-place
231+
232+ # With configuration file
233+ node scripts/generate-plugin.js --in-place --config plugin-config.json
234+
235+ # Skip confirmation (automation only - use with caution)
236+ node scripts/generate-plugin.js --in-place --yes
237+ ```
238+
239+ ** Process:**
240+
241+ 1 . Prompts for plugin configuration (or reads from config file)
242+ 2 . ** Displays confirmation warning** about in-place modification
243+ 3 . Waits for user confirmation (y/N)
244+ 4 . Processes all files in the scaffold directory
245+ 5 . Replaces mustache variables throughout
246+ 6 . Renames files/directories to match your slug
247+ 7 . Reports completion with next steps
248+
249+ ** ⚠️ Important Notes:**
250+
251+ - Always use on a fresh clone or template repository
252+ - Cannot be undone without version control
253+ - Confirmation prompt defaults to "No" for safety
254+ - Use ` --yes ` flag only in automated workflows you trust
255+
256+ ### Method 2: Generator Mode (Default)
257+
258+ Create a new plugin in a separate output directory:
259+
260+ ``` bash
261+ # Interactive mode - prompts for all configuration
262+ node scripts/generate-plugin.js
263+
264+ # With configuration file
265+ node scripts/generate-plugin.js --config plugin-config.json
266+
267+ # With inline arguments
268+ node scripts/generate-plugin.js \
269+ --slug tour-operator \
270+ --name " Tour Operator" \
271+ --description " Tour booking and display plugin" \
272+ --author " LightSpeed" \
273+ --author-uri " https://developer.lsdev.biz"
274+ ```
275+
276+ ** Process:**
277+
278+ 1 . Reads configuration from prompts, file, or arguments
279+ 2 . Validates configuration against schema
280+ 3 . Creates ` generated-plugins/<slug>/ ` directory
281+ 4 . Copies and processes all scaffold files
282+ 5 . Replaces mustache variables
283+ 6 . Renames files/directories
284+ 7 . Leaves scaffold directory unchanged
285+
286+ ** Output Location:**
287+
288+ ``` bash
289+ generated-plugins/
290+ └── tour-operator/ # Your generated plugin
291+ ├── tour-operator.php
292+ ├── package.json
293+ ├── composer.json
294+ └── ... (complete plugin structure)
295+ ```
296+
297+ ** Best for:**
298+
299+ - Creating multiple plugins from the same scaffold
300+ - Keeping scaffold repository clean
301+ - Testing different configurations
302+ - CI/CD pipelines
303+ - Advanced users comfortable with CLI tools
304+
305+ ### Method 3: AI-Assisted Generation (Recommended)
168306
169307Use the workspace prompt for an interactive, guided experience:
170308
@@ -179,7 +317,7 @@ Use the workspace prompt for an interactive, guided experience:
1793173 . Collects all required information interactively
1803184 . Validates input at each stage
1813195 . Confirms configuration before generation
182- 6 . Generates the complete plugin structure
320+ 6 . Generates the complete plugin structure (uses generator mode by default)
1833217 . Provides post-generation setup instructions
184322
185323** Benefits:**
@@ -189,6 +327,7 @@ Use the workspace prompt for an interactive, guided experience:
189327- Validation at each step
190328- Smart defaults for common configurations
191329- Best for first-time users
330+ - Can use either template or generator mode
192331
193332** Stages:**
194333
@@ -200,7 +339,7 @@ Use the workspace prompt for an interactive, guided experience:
2003396 . ** Templates & Patterns** - Template and pattern selection
2013407 . ** Version & Compatibility** - WordPress/PHP requirements
202341
203- ### Method 2 : Agent-Based Generation
342+ ### Method 4 : Agent-Based Generation
204343
205344Request the scaffold generator agent directly:
206345
@@ -214,60 +353,28 @@ Or be more specific:
214353Create a tour operator plugin with tours CPT, destination taxonomy, and booking fields
215354```
216355
217- ** Features:**
218-
219- - Conversational interface
220- - Can infer requirements from description
221- - Validates configuration automatically
222- - Follows agent specification in ` .github/agents/scaffold-generator.agent.md `
223- - Best for experienced users who know their requirements
224-
225- ### Method 3: CLI Script
226-
227- Run the generator script directly from the command line:
228-
229- ``` bash
230- node bin/generate-plugin.js
231- ```
232-
233- ** Interactive Mode:**
234-
235- ``` bash
236- # Prompts for all required information
237- node bin/generate-plugin.js
238- ```
356+ ### Method 4: Agent-Based Generation
239357
240- ** Direct Mode: **
358+ Request the scaffold generator agent directly:
241359
242- ``` bash
243- # Provide all values via arguments
244- node bin/generate-plugin.js \
245- --slug tour-operator \
246- --name " Tour Operator" \
247- --description " Tour booking and display plugin" \
248- --author " LightSpeed" \
249- --author-uri " https://developer.lsdev.biz"
360+ ``` text
361+ Generate a new multi-block plugin from scaffold
250362```
251363
252- ** Configuration File Mode: **
364+ Or be more specific:
253365
254- ``` bash
255- # Use a JSON configuration file
256- echo ' {
257- "slug": "tour-operator",
258- "name": "Tour Operator",
259- "description": "Tour booking plugin",
260- "author": "LightSpeed"
261- }' > plugin-config.json
262-
263- node bin/generate-plugin.js --config plugin-config.json
366+ ``` text
367+ Create a tour operator plugin with tours CPT, destination taxonomy, and booking fields
264368```
265369
266- ** Best for :**
370+ ** Features :**
267371
268- - Automation and CI/CD pipelines
269- - Batch plugin generation
270- - Advanced users comfortable with CLI tools
372+ - Conversational interface
373+ - Can infer requirements from description
374+ - Validates configuration automatically
375+ - Follows agent specification in ` .github/agents/generate-plugin.agent.md `
376+ - Best for experienced users who know their requirements
377+ - Can use either template or generator mode
271378
272379## Post-Generation Workflow
273380
@@ -280,7 +387,7 @@ tree -L 2
280387
281388Expected structure:
282389
283- ```
390+ ``` text
284391tour-operator/
285392├── tour-operator.php # Main plugin file (slug-based name)
286393├── package.json # Node dependencies
@@ -293,7 +400,7 @@ tour-operator/
293400│ └── scss/ # Stylesheets
294401├── templates/ # Block templates
295402├── patterns/ # Block patterns
296- ├── parts/ # Template parts
403+ ├── template- parts/ # Template parts
297404└── scf-json/ # SCF field groups
298405```
299406
@@ -485,7 +592,7 @@ Updates: `package.json`, `composer.json`, main plugin file, all `block.json` fil
485592## Related Documentation
486593
487594- [ Generator Instructions] ( .github/instructions/generate-plugin.instructions.md ) - Rules for using mustache values
488- - [ Scaffold Generator Agent] ( .github/agents/scaffold-generator .agent.md ) - Agent specification
595+ - [ Plugin Generator Agent] ( .github/agents/generate-plugin .agent.md ) - Agent specification
489596- [ Generation Prompt] ( .github/prompts/generate-plugin.prompt.md ) - Interactive prompt template
490597- [ SCF Fields Reference] ( .github/instructions/scf-fields.instructions.md ) - Field types and usage
491598- [ Build Process] ( BUILD-PROCESS.md ) - Detailed build documentation
0 commit comments