@@ -36,10 +36,10 @@ This command is for defining **toolkit implementation specifications**:
3636|------|-------|------|-----------------|
3737| 1. Setup & Verify | 103-159 | 56 lines | `read_file(target_file, offset=103, limit=56)` |
3838| 2. Gather Content | 160-239 | 79 lines | `read_file(target_file, offset=160, limit=79)` |
39- | 3. Generate Sections | 240-2583 | 2343 lines | See components below ⬇️ **LARGE** |
40- | 4. Write File | 2584-2632 | 48 lines | `read_file(target_file, offset=2584 , limit=48)` |
41- | 5. Impact Report | 2633-2730 | 97 lines | `read_file(target_file, offset=2633 , limit=97 )` |
42- | 6-9. Analysis & Report | 2731-3007 | 276 lines | `read_file(target_file, offset=2731 , limit=276 )` |
39+ | 3. Generate Sections | 240-2639 | 2399 lines | See components below ⬇️ **LARGE** |
40+ | 4. Write File | 2640-2688 | 48 lines | `read_file(target_file, offset=2640 , limit=48)` |
41+ | 5. Impact Report | 2689-2787 | 98 lines | `read_file(target_file, offset=2689 , limit=98 )` |
42+ | 6-9. Analysis & Report | 2788-3084 | 296 lines | `read_file(target_file, offset=2788 , limit=296 )` |
4343
4444**📋 Key Components in Step 3** (Jump to specific components):
4545
@@ -51,8 +51,8 @@ This command is for defining **toolkit implementation specifications**:
5151| Component 2: Validator | 447-491 | 44 lines | 🟢 Optional | `read_file(target_file, offset=447, limit=44)` |
5252| **Component 3: CLI Commands** ⭐ | 492-1015 | 523 lines | 🔴 **KEY** | See subsections below ⬇️ |
5353| **Component 4: Slash Commands** ⭐⭐ | 1016-2181 | 1165 lines | 🔴 **LARGE** | See subsections below ⬇️ |
54- | **Component 5: Generator** ⭐⭐⭐ | 2210-2717 | 508 lines | 🔴 **CRITICAL** | See subsections below ⬇️ |
55- | Architecture & Requirements | 2718-2845 | 128 lines | 🟡 Important | `read_file(target_file, offset=2718 , limit=128 )` |
54+ | **Component 5: Generator** ⭐⭐⭐ | 2214-2779 | 565 lines | 🔴 **CRITICAL** | See subsections below ⬇️ |
55+ | Architecture & Requirements | 2780-2850 | 70 lines | 🟡 Important | `read_file(target_file, offset=2780 , limit=70 )` |
5656
5757**🎨 Component 3: CLI Commands Subsections**:
5858
@@ -70,16 +70,16 @@ This command is for defining **toolkit implementation specifications**:
7070| **Custom Commands** ⭐ | 1123-1650 | 527 lines | `read_file(target_file, offset=1123, limit=527)` |
7171| **Library Commands** ⭐ | 1982-2181 | 199 lines | `read_file(target_file, offset=1982, limit=199)` |
7272
73- **🎨 Component 5: Generator Subsections** (508 lines total, ⭐⭐⭐ v0.9.2 ):
73+ **🎨 Component 5: Generator Subsections** (565 lines total, ⭐⭐⭐ v0.9.3 ):
7474
7575| Subsection | Lines | Size | Usage |
7676|------------|-------|------|-------|
7777| **Generator Pattern Guide** ⭐⭐ | 2220-2306 | 87 lines | `read_file(target_file, offset=2220, limit=87)` |
7878| **🎯 Understanding Purpose** ⭐⭐ NEW | 2307-2377 | 71 lines | `read_file(target_file, offset=2307, limit=71)` |
7979| Step 1-4: Analysis Logic | 2378-2457 | 80 lines | `read_file(target_file, offset=2378, limit=80)` |
80- | **Step 5: Define Generator** ⭐ | 2458-2579 | 122 lines | `read_file(target_file, offset=2458, limit=122 )` |
81- | **✅ Verification Checklist** ⭐⭐ NEW | 2580-2700 | 121 lines | `read_file(target_file, offset=2580 , limit=121 )` |
82- | Step 6: Omit Generator | 2701-2727 | 27 lines | `read_file(target_file, offset=2701 , limit=27)` |
80+ | **Step 5: Define Generator** ⭐ UPDATED | 2458-2634 | 177 lines | `read_file(target_file, offset=2458, limit=177 )` |
81+ | **✅ Verification Checklist** ⭐⭐ NEW | 2635-2776 | 142 lines | `read_file(target_file, offset=2635 , limit=142 )` |
82+ | Step 6: Omit Generator | 2779-2805 | 27 lines | `read_file(target_file, offset=2779 , limit=27)` |
8383
8484**💡 Typical Usage Patterns**:
8585```python
@@ -101,22 +101,22 @@ read_file(target_file, offset=2220, limit=87)
101101# **Understanding Purpose**: NEW - MetaSpec scope clarification (71 lines) ⭐⭐ v0.9.2
102102read_file(target_file, offset=2307, limit=71)
103103
104- # **✅ Verification Checklist**: NEW - Post-generation validation (121 lines) ⭐⭐ v0.9.2
105- read_file(target_file, offset=2580 , limit=121 )
104+ # **✅ Verification Checklist**: NEW - Post-generation validation (142 lines) ⭐⭐ v0.9.3
105+ read_file(target_file, offset=2635 , limit=142 )
106106
107- # **Generator Logic**: Complete Component 5 (508 lines total) ⭐⭐⭐ v0.9.2
108- read_file(target_file, offset=2220 , limit=508 )
107+ # **Generator Logic**: Complete Component 5 (565 lines total) ⭐⭐⭐ v0.9.3
108+ read_file(target_file, offset=2214 , limit=565 )
109109
110110# Slash Commands: Component 4 overview (106 lines)
111111read_file(target_file, offset=1016, limit=106)
112112```
113113
114- **Token Savings (v0.9.2 )**:
115- - Full file: 3463 lines (~11,736 tokens)
114+ **Token Savings (v0.9.3 )**:
115+ - Full file: 3541 lines (~12,000 tokens)
116116- **Targeted reading: 60-523 lines (~200-1,770 tokens)**
117- - **Step 4.5 only: 77 lines (~260 tokens) - 98 % savings** 🏆
118- - **Step 5d only: 121 lines (~410 tokens) - 97 % savings** 🏆
119- - **Generator Pattern only: 87 lines (~295 tokens) - 97 % savings** 🏆
117+ - **Step 5 (Generator with deployment): 177 lines (~600 tokens) - 95 % savings** 🏆
118+ - **Verification Checklist: 142 lines (~480 tokens) - 96 % savings** 🏆
119+ - **Generator Pattern only: 87 lines (~295 tokens) - 98 % savings** 🏆
120120- **Overall savings: 84-98% tokens** 🎉
121121
122122---
@@ -2472,10 +2472,15 @@ Check Toolkit Type Check Toolkit Type
24722472
24732473**Generation Targets** (Project files):
24742474- **Project structure**: Create `.{toolkit}/`, `memory/`, `specs/` directories
2475- - **Specification files**: Render `{entity}-spec.yaml ` from templates
2475+ - **Specification files**: Render `{entity}-spec.md ` from templates (default: Markdown; alternatives: YAML, JSON, TOML)
24762476- **Constitution**: Generate `memory/constitution.md` from principles template
24772477- **README**: Create project README with toolkit usage guide
2478- - **Commands**: Generate custom slash commands (if specified)
2478+ - **Slash Commands**: Deploy toolkit's slash commands to `.{toolkit}/commands/`
2479+ - ✅ **Always deploy** all slash command files (`*.md`) from `templates/{source}/commands/`
2480+ - ✅ **Target location**: `.{toolkit}/commands/` directory in user projects
2481+ - ✅ **Purpose**: AI assistant operational guides (read by AI in user projects)
2482+ - ✅ **Method**: Direct file copy (NOT Jinja2 rendering)
2483+ - ⚠️ **Not optional** - Critical for AI-driven workflows
24792484
24802485**Architecture Pattern** (Follow MetaSpec):
24812486```python
@@ -2510,21 +2515,71 @@ class {Toolkit}Generator:
25102515 # 5. Build project structure
25112516 project = self._build_structure(files)
25122517
2513- # 6. Write to disk (atomic)
2518+ # 6. Deploy slash commands (if toolkit has them)
2519+ self._deploy_slash_commands(output_dir)
2520+
2521+ # 7. Write to disk (atomic)
25142522 self._write_files(project, output_dir)
25152523
25162524 return GeneratedProject(files=files)
25172525```
25182526
2527+ **Command Deployment Implementation**:
2528+ ```python
2529+ def _deploy_slash_commands(self, output_dir: Path) -> None:
2530+ """
2531+ Deploy toolkit's slash commands to user project.
2532+
2533+ Copies all command files from toolkit's templates to
2534+ `.{toolkit}/commands/` so AI assistants can read them in user projects.
2535+
2536+ Args:
2537+ output_dir: Target project directory
2538+
2539+ Behavior:
2540+ - Copies all *.md files from templates/{source}/commands/
2541+ - Creates `.{toolkit}/commands/` directory if needed
2542+ - Preserves original .md format (no Jinja2 rendering)
2543+ - Skips if no commands directory exists in templates
2544+ """
2545+ # Get toolkit's command directory from package
2546+ commands_source = Path(__file__).parent.parent / "templates" / "{source}" / "commands"
2547+
2548+ if not commands_source.exists():
2549+ return # No commands to deploy (optional component)
2550+
2551+ # Create target directory in user project
2552+ commands_target = output_dir / f".{self.toolkit_name}" / "commands"
2553+ commands_target.mkdir(parents=True, exist_ok=True)
2554+
2555+ # Copy all command files (direct copy, no rendering)
2556+ for cmd_file in commands_source.glob("*.md"):
2557+ shutil.copy(cmd_file, commands_target / cmd_file.name)
2558+ logger.debug(f"Deployed command: {cmd_file.name}")
2559+ ```
2560+
25192561**Templates**:
2520- - **Location**: `src/{toolkit_name}/templates/` directory
2562+ - **Location**: `src/{toolkit_name}/templates/{source}/` directory
2563+ - `{source}`: Domain-specific subdirectory (e.g., `mcp`, `marketing`, `api`)
2564+ - ⚠️ **Note**: Most toolkits don't need a `base/` directory - put templates directly in `{source}/`
25212565- **Format**: Plain files or Jinja2 templates (`.j2` extension)
25222566- **Customization**: User-overridable in `.{toolkit}/templates/`
2523- - **Required Templates**:
2524- - `constitution.md` or `constitution.md.j2` - Project principles
2525- - `spec-template.yaml` or `spec-template.yaml.j2` - Specification template
2526- - `readme-template.md` or `readme-template.md.j2` - Project README
2527- - `command-template.md.j2` (optional) - Custom command template
2567+
2568+ - **Required Templates** (in `templates/{source}/`):
2569+ - `constitution.md.j2` - Project principles template (domain-specific, not generic)
2570+ - `spec-template.md.j2` - Specification template
2571+ - **Default format**: Markdown (`.md`)
2572+ - **Alternative formats**: YAML (`.yaml`), JSON (`.json`), TOML (`.toml`), or custom
2573+ - **Choose based on**: Domain conventions and parsing requirements
2574+ - `readme.md.j2` - Project README template
2575+ - `.gitignore.j2` - Git ignore rules template
2576+
2577+ - **Required Command Deployment** (if toolkit has slash commands):
2578+ - **Source**: `templates/{source}/commands/*.md` (same `{source}` as above)
2579+ - **Target**: `.{toolkit}/commands/*.md` (in user projects)
2580+ - **Method**: Direct file copy (NOT Jinja2 rendering)
2581+ - **Purpose**: AI assistant operational guides
2582+ - **When**: Always deploy during project initialization
25282583
25292584**Input**:
25302585- **Project name** (string): Name for the new project
@@ -2593,6 +2648,29 @@ Run this checklist to catch common mistakes:
25932648| **Templates location** | ✅ `src/{toolkit}/templates/` | ❌ Domain-specific templates |
25942649| **Template content** | ✅ Constitution, README, spec templates | ❌ Post/article templates |
25952650
2651+ ##### ✅ Slash Commands Deployment Checklist
2652+
2653+ **Verify that your Generator properly deploys slash commands to user projects:**
2654+
2655+ | Check | Correct | Wrong |
2656+ |-------|---------|-------|
2657+ | **Commands deployed?** | ✅ All `.md` files in `.{toolkit}/commands/` | ❌ Empty or missing directory |
2658+ | **Command count** | ✅ Matches toolkit's command count | ❌ Missing commands |
2659+ | **File format** | ✅ Original `.md` format preserved | ❌ Rendered as `.j2` or modified |
2660+ | **Deployment method** | ✅ Direct file copy using `shutil.copy()` | ❌ Jinja2 rendering |
2661+ | **Target location** | ✅ `.{toolkit}/commands/*.md` | ❌ Wrong directory or filename |
2662+ | **AI accessible** | ✅ AI can read commands in user project | ❌ Commands only in toolkit source |
2663+ | **Timing** | ✅ Deployed during `init` command | ❌ Manual copy required |
2664+
2665+ **Command Deployment Verification**:
2666+ ```python
2667+ # After running: {toolkit} init my-project
2668+ # Verify:
2669+ assert (my-project / ".{toolkit}" / "commands").exists()
2670+ assert len(list((my-project / ".{toolkit}" / "commands").glob("*.md"))) > 0
2671+ assert (my-project / ".{toolkit}" / "commands" / "{toolkit}.{command}.md").exists()
2672+ ```
2673+
25962674##### 📋 Specific Validation Rules
25972675
25982676**Rule 1: Generator Purpose**
0 commit comments