@@ -253,9 +253,147 @@ JSON configuration files (`package.json`, `composer.json`, `block.json`) use pla
253253}
254254```
255255
256+ ## Operational Modes
257+
258+ ### Template Mode vs Generator Mode
259+
260+ The scaffold supports two operational modes:
261+
262+ #### Template Mode (` --in-place ` )
263+
264+ ** Use when** : You want to use the scaffold as a starting point for your plugin.
265+
266+ - Processes files directly in the scaffold directory
267+ - Replaces all mustache variables in-place
268+ - Renames files and directories to match your slug
269+ - ** ⚠️ Destructive** : Modifies the scaffold permanently
270+ - Includes confirmation prompt to prevent accidents
271+ - Best for GitHub template repositories
272+
273+ ** Command:**
274+
275+ ``` bash
276+ node scripts/generate-plugin.js --in-place
277+ ```
278+
279+ ** Workflow:**
280+
281+ 1 . Clone/fork the scaffold repository
282+ 2 . Run generator with ` --in-place ` flag
283+ 3 . Confirm the operation (y/N prompt)
284+ 4 . Scaffold is processed in-place
285+ 5 . Install dependencies and build
286+ 6 . Commit your customized plugin
287+
288+ #### Generator Mode (Default)
289+
290+ ** Use when** : You want to create multiple plugins or keep the scaffold clean.
291+
292+ - Creates new plugin in ` generated-plugins/<slug>/ `
293+ - Leaves scaffold directory unchanged
294+ - Can generate multiple plugins
295+ - Safe for repeated use
296+ - Best for maintaining the scaffold as a tool
297+
298+ ** Command:**
299+
300+ ``` bash
301+ node scripts/generate-plugin.js
302+ ```
303+
304+ ** Workflow:**
305+
306+ 1 . Clone the scaffold repository once
307+ 2 . Run generator (no ` --in-place ` flag)
308+ 3 . Generated plugin appears in ` generated-plugins/<slug>/ `
309+ 4 . Move to WordPress plugins directory
310+ 5 . Install dependencies and build
311+ 6 . Generate another plugin anytime
312+
256313## Generation Methods
257314
258- ### Method 1: AI-Assisted Generation (Recommended)
315+ ### Method 1: Template Mode (In-Place Processing)
316+
317+ Use the scaffold as a GitHub template and process it directly:
318+
319+ ``` bash
320+ # Interactive mode with confirmation
321+ node scripts/generate-plugin.js --in-place
322+
323+ # With configuration file
324+ node scripts/generate-plugin.js --in-place --config plugin-config.json
325+
326+ # Skip confirmation (automation only - use with caution)
327+ node scripts/generate-plugin.js --in-place --yes
328+ ```
329+
330+ ** Process:**
331+
332+ 1 . Prompts for plugin configuration (or reads from config file)
333+ 2 . ** Displays confirmation warning** about in-place modification
334+ 3 . Waits for user confirmation (y/N)
335+ 4 . Processes all files in the scaffold directory
336+ 5 . Replaces mustache variables throughout
337+ 6 . Renames files/directories to match your slug
338+ 7 . Reports completion with next steps
339+
340+ ** ⚠️ Important Notes:**
341+
342+ - Always use on a fresh clone or template repository
343+ - Cannot be undone without version control
344+ - Confirmation prompt defaults to "No" for safety
345+ - Use ` --yes ` flag only in automated workflows you trust
346+
347+ ### Method 2: Generator Mode (Default)
348+
349+ Create a new plugin in a separate output directory:
350+
351+ ``` bash
352+ # Interactive mode - prompts for all configuration
353+ node scripts/generate-plugin.js
354+
355+ # With configuration file
356+ node scripts/generate-plugin.js --config plugin-config.json
357+
358+ # With inline arguments
359+ node scripts/generate-plugin.js \
360+ --slug tour-operator \
361+ --name " Tour Operator" \
362+ --description " Tour booking and display plugin" \
363+ --author " LightSpeed" \
364+ --author-uri " https://developer.lsdev.biz"
365+ ```
366+
367+ ** Process:**
368+
369+ 1 . Reads configuration from prompts, file, or arguments
370+ 2 . Validates configuration against schema
371+ 3 . Creates ` generated-plugins/<slug>/ ` directory
372+ 4 . Copies and processes all scaffold files
373+ 5 . Replaces mustache variables
374+ 6 . Renames files/directories
375+ 7 . Leaves scaffold directory unchanged
376+
377+ ** Output Location:**
378+
379+ ``` bash
380+ generated-plugins/
381+ └── tour-operator/ # Your generated plugin
382+ ├── tour-operator.php
383+ ├── package.json
384+ ├── composer.json
385+ └── ... (complete plugin structure)
386+ ```
387+
388+ ** Best for:**
389+
390+ - Creating multiple plugins from the same scaffold
391+ - Keeping scaffold repository clean
392+ - Testing different configurations
393+ - CI/CD pipelines
394+ - Advanced users comfortable with CLI tools
395+
396+ ### Method 3: AI-Assisted Generation (Recommended)
259397
260398Use the workspace prompt for an interactive, guided experience:
261399
@@ -270,7 +408,7 @@ Use the workspace prompt for an interactive, guided experience:
2704083 . Collects all required information interactively
2714094 . Validates input at each stage
2724105 . Confirms configuration before generation
273- 6 . Generates the complete plugin structure
411+ 6 . Generates the complete plugin structure (uses generator mode by default)
2744127 . Provides post-generation setup instructions
275413
276414** Benefits:**
@@ -280,6 +418,7 @@ Use the workspace prompt for an interactive, guided experience:
280418- Validation at each step
281419- Smart defaults for common configurations
282420- Best for first-time users
421+ - Can use either template or generator mode
283422
284423** Stages:**
285424
@@ -291,7 +430,7 @@ Use the workspace prompt for an interactive, guided experience:
2914306 . ** Templates & Patterns** - Template and pattern selection
2924317 . ** Version & Compatibility** - WordPress/PHP requirements
293432
294- ### Method 2 : Agent-Based Generation
433+ ### Method 4 : Agent-Based Generation
295434
296435Request the scaffold generator agent directly:
297436
@@ -327,8 +466,9 @@ node scripts/generate-plugin.js
327466# Prompts for all required information
328467node scripts/generate-plugin.js
329468```
469+ ### Method 4: Agent-Based Generation
330470
331- ** Direct Mode: **
471+ Request the scaffold generator agent directly:
332472
333473``` bash
334474# Provide all values via arguments
@@ -354,13 +494,24 @@ node scripts/validate-plugin-config.js my-plugin.json
354494
355495# Generate plugin
356496node scripts/generate-plugin.js --config my-plugin.json
497+ ```text
498+ Generate a new multi-block plugin from scaffold
357499```
358500
359- ** Best for: **
501+ Or be more specific:
360502
361- - Automation and CI/CD pipelines
362- - Batch plugin generation
363- - Advanced users comfortable with CLI tools
503+ ``` text
504+ Create a tour operator plugin with tours CPT, destination taxonomy, and booking fields
505+ ```
506+
507+ ** Features:**
508+
509+ - Conversational interface
510+ - Can infer requirements from description
511+ - Validates configuration automatically
512+ - Follows agent specification in ` .github/agents/generate-plugin.agent.md `
513+ - Best for experienced users who know their requirements
514+ - Can use either template or generator mode
364515
365516## Post-Generation Workflow
366517
@@ -373,7 +524,7 @@ tree -L 2
373524
374525Expected structure:
375526
376- ```
527+ ``` text
377528tour-operator/
378529├── tour-operator.php # Main plugin file (slug-based name)
379530├── package.json # Node dependencies
@@ -386,7 +537,7 @@ tour-operator/
386537│ └── scss/ # Stylesheets
387538├── templates/ # Block templates
388539├── patterns/ # Block patterns
389- ├── parts/ # Template parts
540+ ├── template- parts/ # Template parts
390541└── scf-json/ # SCF field groups
391542```
392543
@@ -856,6 +1007,12 @@ For complete schema details, see:
8561007- ** [ ../.github/instructions/generate-plugin.instructions.md] ( ../.github/instructions/generate-plugin.instructions.md ) ** - Mustache template rules
8571008- ** [ ../.github/instructions/schema-files.instructions.md] ( ../.github/instructions/schema-files.instructions.md ) ** - Schema file standards
8581009- ** [ ../.github/instructions/scf-fields.instructions.md] ( ../.github/instructions/scf-fields.instructions.md ) ** - SCF field types
1010+ - [ Generator Instructions] ( .github/instructions/generate-plugin.instructions.md ) - Rules for using mustache values
1011+ - [ Plugin Generator Agent] ( .github/agents/generate-plugin.agent.md ) - Agent specification
1012+ - [ Generation Prompt] ( .github/prompts/generate-plugin.prompt.md ) - Interactive prompt template
1013+ - [ SCF Fields Reference] ( .github/instructions/scf-fields.instructions.md ) - Field types and usage
1014+ - [ Build Process] ( BUILD-PROCESS.md ) - Detailed build documentation
1015+ - [ API Reference] ( API-REFERENCE.md ) - PHP and JavaScript APIs
8591016
8601017## Support
8611018
0 commit comments