Skip to content

Commit 84552a4

Browse files
committed
feat(v0.9.3): Slash Commands Deployment Documentation Fix
Complete guidance on deploying slash commands to user projects Key Changes: - Updated Generation Targets: Clear explanation that slash commands deployment is always required - Added _deploy_slash_commands() implementation example with detailed code - Added Slash Commands Deployment Checklist to catch deployment errors - Clarified template structure: templates/{source}/ (most toolkits don't need base/) - Clarified default spec format: Markdown (.md), alternatives: YAML, JSON, TOML - Updated navigation tables (3541 lines, Component 5: 565 lines, 84-98% token savings) Impact: - Prevents implementers from missing critical AI-driven workflow support - Future toolkits will correctly deploy commands to user projects - Clear distinction between templates that need rendering vs direct copy - AI assistants can access operational guides in user projects Documentation Quality: - Complete code examples with deployment logic - Verification checklist for implementers - Aligned with MetaSpec's own implementation patterns
1 parent fc171fd commit 84552a4

File tree

6 files changed

+284
-39
lines changed

6 files changed

+284
-39
lines changed

CHANGELOG.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,107 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
---
1111

12+
## [0.9.3] - 2025-11-19
13+
14+
### 📋 Slash Commands Deployment Documentation Fix
15+
16+
**Issue**: Generator Pattern documentation incomplete regarding slash commands deployment
17+
**Severity**: MEDIUM (Documentation completeness)
18+
**Source**: marketing-spec-kit implementation feedback
19+
**Status**: ✅ Resolved
20+
21+
#### 🚨 Problem
22+
23+
MetaSpec v0.9.2's `/metaspec.sdd.specify` command had incomplete documentation on deploying slash commands to user projects. The phrase "Generate custom slash commands (if specified)" was misleading, causing implementers to miss this critical step.
24+
25+
**Consequences**:
26+
- Implementers didn't deploy slash commands to user projects
27+
- User projects lacked `.{toolkit}/commands/` directory
28+
- AI assistants couldn't access operational guides
29+
- Core AI-driven workflow value was lost
30+
31+
#### 🔧 Implemented Fixes
32+
33+
**Fix 1: Updated Generation Targets** (Line 2473-2483)
34+
35+
**Before**:
36+
```markdown
37+
- **Commands**: Generate custom slash commands (if specified)
38+
```
39+
40+
**After**:
41+
```markdown
42+
- **Slash Commands**: Deploy toolkit's slash commands to `.{toolkit}/commands/`
43+
- ✅ Always deploy all slash command files (*.md)
44+
- ✅ Target location: `.{toolkit}/commands/` in user projects
45+
- ✅ Purpose: AI assistant operational guides
46+
- ✅ Method: Direct file copy (NOT Jinja2 rendering)
47+
- ⚠️ Not optional - Critical for AI-driven workflows
48+
```
49+
50+
**Fix 2: Added Command Deployment Implementation** (Line 2527-2559)
51+
52+
Added detailed `_deploy_slash_commands()` method with:
53+
- Clear docstring explaining purpose
54+
- Source/target directory specification
55+
- Direct file copy approach (not rendering)
56+
- Graceful handling when no commands exist
57+
58+
**Fix 3: Added Slash Commands Deployment Checklist** (Line 2645-2666)
59+
60+
New verification table checking:
61+
- Commands deployed correctly
62+
- File format preserved
63+
- AI accessibility
64+
- Proper timing (during init)
65+
66+
**Fix 4: Updated Required Templates List** (Line 2565-2576)
67+
68+
Added "Required Command Deployment" section specifying:
69+
- Source/target paths
70+
- Deployment method
71+
- Purpose clarification
72+
- Timing requirements
73+
74+
#### 📊 Impact
75+
76+
**Documentation Quality**:
77+
- ✅ Clear guidance on slash commands deployment
78+
- ✅ Complete code examples with `_deploy_slash_commands()`
79+
- ✅ Verification checklist for implementers
80+
- ✅ Aligned with MetaSpec's own implementation
81+
82+
**Implementation Correctness**:
83+
- ✅ Future toolkits will correctly deploy commands
84+
- ✅ AI-driven workflows will work out-of-the-box
85+
- ✅ Consistent with MetaSpec architecture patterns
86+
87+
#### 🔄 Migration Path
88+
89+
**For existing toolkits** (like marketing-spec-kit):
90+
91+
1. **Add command deployment logic** to Generator:
92+
```python
93+
def _deploy_slash_commands(self, output_dir: Path) -> None:
94+
# Copy from templates/{source}/commands/ to .{toolkit}/commands/
95+
```
96+
97+
2. **Update project structure** description in spec.md
98+
3. **Verify** using new checklist
99+
4. **Re-release** toolkit with fix
100+
101+
**For new toolkits**:
102+
- Follow updated `/metaspec.sdd.specify` guidance
103+
- Run verification checklist
104+
- Commands will deploy automatically
105+
106+
#### 📚 Related Documentation
107+
108+
- Generator implementation: `src/metaspec/generator.py` (Line 310, 328, 342)
109+
- Base AGENTS.md: Documents `.metaspec/commands/` purpose
110+
111+
---
112+
12113
## [0.9.2] - 2025-11-18
13114

14115
### 🎯 Toolkit Type Detection & Simplified Generator Pattern

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,20 @@ uv run mypy src/metaspec # Type check
510510

511511
## 🏗️ Status
512512

513-
**Current Version**: v0.9.2 (Alpha) 🚀
514-
515-
**Latest Updates** (v0.9.2):
516-
- 🎯 **Toolkit Type Detection & Simplified Generator Pattern** - Architecture clarity
517-
- ✅ Removed "Domain Application" concept from `/metaspec.sdd.specify` (MetaSpec only generates Specification Toolkits)
518-
- 🔍 Simplified Step 4.5: Unified guidance for all toolkits (deleted 190 lines of confusion)
519-
- ⚠️ Unified Generator template: Single pattern for all Specification Toolkits (removed Option B)
520-
- 📝 Added Post-Generation verification checklist (Step 5d, +122 lines)
521-
- 🎓 Clarified MetaSpec architecture: Layer 1 (MetaSpec) → Layer 2 (Spec Toolkit) → Layer 3 (Domain App)
513+
**Current Version**: v0.9.3 (Alpha) 🚀
514+
515+
**Latest Updates** (v0.9.3):
516+
- 📋 **Slash Commands Deployment Documentation Fix** - Complete guidance on deploying commands to user projects
517+
- ✅ Updated Generation Targets: Clear explanation of slash commands deployment (always required, not optional)
518+
- 🔧 Added `_deploy_slash_commands()` implementation example with detailed code
519+
- ✅ Added Slash Commands Deployment Checklist to catch deployment errors
520+
- 📁 Clarified template structure: `templates/{source}/` (most toolkits don't need `base/`)
521+
- 🎯 Prevents implementers from missing critical AI-driven workflow support
522+
523+
**Previous Updates** (v0.9.2):
524+
- 🎯 Toolkit Type Detection & Simplified Generator Pattern
525+
- ✅ Removed "Domain Application" concept (MetaSpec only generates Specification Toolkits)
526+
- 🔍 Simplified Step 4.5 and unified Generator template
522527

523528
**Previous Updates** (v0.9.1):
524529
- 🎯 Generator Pattern Clarification - Added guidance and validation (Dimension L)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "meta-spec"
3-
version = "0.9.2"
3+
version = "0.9.3"
44
description = "Meta-specification framework for generating Spec-Driven X (SD-X) toolkits for AI agents"
55
readme = "README.md"
66
requires-python = ">=3.11"

src/metaspec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from YAML definitions.
66
"""
77

8-
__version__ = "0.9.2"
8+
__version__ = "0.9.3"
99

1010
__all__ = ["__version__"]
1111

src/metaspec/templates/meta/sdd/commands/specify.md.j2

Lines changed: 106 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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
102102
read_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)
111111
read_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

Comments
 (0)