@dzhechkov/p-replicator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +314 -0
- package/bin/cli.js +4 -0
- package/package.json +62 -0
- package/src/cli.js +160 -0
- package/src/commands/doctor.js +151 -0
- package/src/commands/init.js +155 -0
- package/src/commands/list.js +133 -0
- package/src/commands/remove.js +111 -0
- package/src/commands/update.js +102 -0
- package/src/utils.js +280 -0
- package/templates/.claude/agents/doc-validator.md +92 -0
- package/templates/.claude/agents/harvest-coordinator.md +91 -0
- package/templates/.claude/agents/product-discoverer.md +57 -0
- package/templates/.claude/agents/replicate-coordinator.md +98 -0
- package/templates/.claude/commands/harvest.md +106 -0
- package/templates/.claude/commands/replicate.md +389 -0
- package/templates/.claude/rules/replicate-pipeline.md +92 -0
- package/templates/.claude/skills/brutal-honesty-review/README.md +218 -0
- package/templates/.claude/skills/brutal-honesty-review/SKILL.md +225 -0
- package/templates/.claude/skills/brutal-honesty-review/resources/assessment-rubrics.md +295 -0
- package/templates/.claude/skills/brutal-honesty-review/resources/review-template.md +102 -0
- package/templates/.claude/skills/brutal-honesty-review/scripts/assess-code.sh +179 -0
- package/templates/.claude/skills/brutal-honesty-review/scripts/assess-tests.sh +223 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +374 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/claude-md-strategy.md +178 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/enhanced-recommendations.md +416 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/extended-mapping.md +370 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/automation-commands.md +733 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-agents.md +416 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-hooks-commands.md +524 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/ddd-skills.md +350 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/enhanced-claude-md.md +235 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle-ent.md +400 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle.md +325 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-suggestions.md +423 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/insights-system.md +349 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/mcp.md +274 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/start-command.md +283 -0
- package/templates/.claude/skills/explore/SKILL.md +215 -0
- package/templates/.claude/skills/explore/references/questioning-techniques.md +151 -0
- package/templates/.claude/skills/explore/references/task-brief-templates.md +355 -0
- package/templates/.claude/skills/goap-research-ed25519/SKILL.md +415 -0
- package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +658 -0
- package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +544 -0
- package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +560 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +662 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +720 -0
- package/templates/.claude/skills/knowledge-extractor/SKILL.md +412 -0
- package/templates/.claude/skills/knowledge-extractor/examples/rate-limiting-extraction.md +259 -0
- package/templates/.claude/skills/knowledge-extractor/modules/01-agent-review.md +192 -0
- package/templates/.claude/skills/knowledge-extractor/modules/02-classify.md +122 -0
- package/templates/.claude/skills/knowledge-extractor/modules/03-decontextualize.md +156 -0
- package/templates/.claude/skills/knowledge-extractor/modules/04-integrate.md +178 -0
- package/templates/.claude/skills/knowledge-extractor/references/artifact-categories.md +342 -0
- package/templates/.claude/skills/knowledge-extractor/references/decontextualization-guide.md +247 -0
- package/templates/.claude/skills/knowledge-extractor/references/maturity-model.md +153 -0
- package/templates/.claude/skills/knowledge-extractor/templates/artifact-card.md +60 -0
- package/templates/.claude/skills/knowledge-extractor/templates/harvest-report.md +70 -0
- package/templates/.claude/skills/knowledge-extractor/templates/toolkit-harvest.md +38 -0
- package/templates/.claude/skills/pipeline-forge/SKILL.md +523 -0
- package/templates/.claude/skills/pipeline-forge/examples/replicate-analysis.md +291 -0
- package/templates/.claude/skills/pipeline-forge/references/patterns-catalog.md +408 -0
- package/templates/.claude/skills/pipeline-forge/references/quality-gates.md +268 -0
- package/templates/.claude/skills/pipeline-forge/references/skill-anatomy.md +292 -0
- package/templates/.claude/skills/pipeline-forge/templates/agent-template.md +60 -0
- package/templates/.claude/skills/pipeline-forge/templates/command-template.md +80 -0
- package/templates/.claude/skills/pipeline-forge/templates/pipeline-template.md +137 -0
- package/templates/.claude/skills/pipeline-forge/templates/skill-template.md +132 -0
- package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +562 -0
- package/templates/.claude/skills/requirements-validator/SKILL.md +121 -0
- package/templates/.claude/skills/requirements-validator/assets/templates/bdd-feature-template.feature +69 -0
- package/templates/.claude/skills/requirements-validator/references/bdd-patterns.md +184 -0
- package/templates/.claude/skills/requirements-validator/references/invest-criteria.md +121 -0
- package/templates/.claude/skills/requirements-validator/references/scoring-system.md +134 -0
- package/templates/.claude/skills/requirements-validator/references/smart-criteria.md +130 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/SKILL.md +194 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-cjm-example.md +100 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-module1-example.md +88 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/01-intelligence.md +328 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/02-product-customers.md +221 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/025-cjm-prototype.md +206 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/03-market-competition.md +402 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/04-business-finance.md +287 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/05-growth-engine.md +290 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/06-playbook-synthesis.md +286 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/references/blue-ocean-canvas.md +39 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/references/industry-benchmarks.md +67 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/references/jtbd-canvas.md +48 -0
- package/templates/.claude/skills/sparc-prd-mini/SKILL.md +955 -0
- package/templates/.claude/skills/sparc-prd-mini/references/sparc-methodology.md +360 -0
- package/templates/.claude/skills/sparc-prd-mini/templates/CLAUDE.md +91 -0
- package/templates/.claude/skills/sparc-prd-mini/templates/prd.md +336 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
# DDD-Specific Hooks & Commands Templates
|
|
2
|
+
|
|
3
|
+
Enhanced hooks and commands for DDD-aware Claude Code instruments.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Fitness Function Hooks (settings.json)
|
|
8
|
+
|
|
9
|
+
**Source:** docs/fitness/fitness-functions.md
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"hooks": {
|
|
14
|
+
"PreToolUse": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "Write|Edit",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/validate-aggregate-size.sh \"$CLAUDE_FILE_PATH\"",
|
|
21
|
+
"timeout": 10
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"PostToolUse": [
|
|
27
|
+
{
|
|
28
|
+
"matcher": "Write|Edit",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "if [[ \"$CLAUDE_FILE_PATH\" == *aggregate* ]] || [[ \"$CLAUDE_FILE_PATH\" == *entity* ]]; then \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-ddd-patterns.sh \"$CLAUDE_FILE_PATH\"; fi",
|
|
33
|
+
"timeout": 30
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"matcher": "Write|Edit",
|
|
39
|
+
"hooks": [
|
|
40
|
+
{
|
|
41
|
+
"type": "command",
|
|
42
|
+
"command": "if [[ \"$CLAUDE_FILE_PATH\" == *.test.* ]] || [[ \"$CLAUDE_FILE_PATH\" == *.spec.* ]]; then npm test -- --testPathPattern=\"$(basename $CLAUDE_FILE_PATH)\" --coverage 2>/dev/null || true; fi",
|
|
43
|
+
"timeout": 120
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"Stop": [
|
|
49
|
+
{
|
|
50
|
+
"hooks": [
|
|
51
|
+
{
|
|
52
|
+
"type": "prompt",
|
|
53
|
+
"prompt": "Before stopping, verify: 1) All aggregate invariants enforced, 2) Domain events emitted for state changes, 3) Tests cover Gherkin scenarios, 4) Fitness functions pass.",
|
|
54
|
+
"timeout": 30
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Hook Scripts
|
|
66
|
+
|
|
67
|
+
### validate-aggregate-size.sh
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
#!/bin/bash
|
|
71
|
+
# Validates aggregate doesn't exceed size limits
|
|
72
|
+
# Source: Fitness Function FF-02
|
|
73
|
+
|
|
74
|
+
FILE="$1"
|
|
75
|
+
MAX_ENTITIES={{MAX_ENTITIES_FROM_FITNESS}}
|
|
76
|
+
MAX_METHODS={{MAX_METHODS_FROM_FITNESS}}
|
|
77
|
+
|
|
78
|
+
# Count entities (rough heuristic)
|
|
79
|
+
ENTITY_COUNT=$(grep -c "class.*Entity" "$FILE" 2>/dev/null || echo 0)
|
|
80
|
+
|
|
81
|
+
if [ "$ENTITY_COUNT" -gt "$MAX_ENTITIES" ]; then
|
|
82
|
+
echo "❌ VIOLATION: Aggregate has $ENTITY_COUNT entities (max: $MAX_ENTITIES)"
|
|
83
|
+
echo "Consider splitting into multiple aggregates"
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
echo "✅ Aggregate size OK"
|
|
88
|
+
exit 0
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### check-ddd-patterns.sh
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
#!/bin/bash
|
|
95
|
+
# Checks DDD patterns compliance
|
|
96
|
+
# Source: DDD Tactical docs
|
|
97
|
+
|
|
98
|
+
FILE="$1"
|
|
99
|
+
VIOLATIONS=0
|
|
100
|
+
|
|
101
|
+
# Check for direct entity modification
|
|
102
|
+
if grep -q "entity\." "$FILE" && ! grep -q "aggregate\." "$FILE"; then
|
|
103
|
+
echo "⚠️ WARNING: Possible direct entity modification without aggregate"
|
|
104
|
+
((VIOLATIONS++))
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Check for missing event emission after state change
|
|
108
|
+
if grep -q "this\.\w* =" "$FILE" && ! grep -q "emit\|publish\|dispatch" "$FILE"; then
|
|
109
|
+
echo "⚠️ WARNING: State change without domain event"
|
|
110
|
+
((VIOLATIONS++))
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
if [ "$VIOLATIONS" -gt 0 ]; then
|
|
114
|
+
echo "Found $VIOLATIONS potential DDD violations"
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
exit 0 # Warnings only, don't block
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## /validate-ddd Command
|
|
123
|
+
|
|
124
|
+
**Source:** Fitness Functions, DDD Tactical
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
---
|
|
128
|
+
description: Validate DDD patterns and fitness functions. $ARGUMENTS: scope (all|aggregate|context) or specific path.
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
# /validate-ddd $ARGUMENTS
|
|
132
|
+
|
|
133
|
+
## Purpose
|
|
134
|
+
|
|
135
|
+
Run DDD validation checks against project code, verifying aggregate boundaries, invariants, and fitness function compliance.
|
|
136
|
+
|
|
137
|
+
## Validation Checks
|
|
138
|
+
|
|
139
|
+
### Aggregate Validation
|
|
140
|
+
- [ ] Single aggregate root per file
|
|
141
|
+
- [ ] All modifications through aggregate root
|
|
142
|
+
- [ ] Invariants checked before state changes
|
|
143
|
+
- [ ] Events emitted for state changes
|
|
144
|
+
|
|
145
|
+
### Fitness Functions
|
|
146
|
+
{{FITNESS_FUNCTIONS_LIST}}
|
|
147
|
+
|
|
148
|
+
### Bounded Context Validation
|
|
149
|
+
- [ ] No cross-context direct dependencies
|
|
150
|
+
- [ ] Anti-corruption layers in place
|
|
151
|
+
- [ ] Shared kernel properly isolated
|
|
152
|
+
|
|
153
|
+
## Process
|
|
154
|
+
|
|
155
|
+
1. Parse $ARGUMENTS to determine scope
|
|
156
|
+
2. Scan relevant files
|
|
157
|
+
3. Run validation checks
|
|
158
|
+
4. Calculate fitness scores
|
|
159
|
+
5. Report violations with suggestions
|
|
160
|
+
|
|
161
|
+
## Examples
|
|
162
|
+
|
|
163
|
+
`/validate-ddd all` — Validate entire project
|
|
164
|
+
`/validate-ddd aggregate OrderAggregate` — Validate specific aggregate
|
|
165
|
+
`/validate-ddd context Orders` — Validate bounded context
|
|
166
|
+
|
|
167
|
+
## Output Format
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
═══════════════════════════════════════════
|
|
171
|
+
DDD Validation Report: {{SCOPE}}
|
|
172
|
+
═══════════════════════════════════════════
|
|
173
|
+
|
|
174
|
+
## Aggregates
|
|
175
|
+
✅ OrderAggregate: Valid
|
|
176
|
+
⚠️ CustomerAggregate: 2 warnings
|
|
177
|
+
❌ PaymentAggregate: 1 violation
|
|
178
|
+
|
|
179
|
+
## Fitness Functions
|
|
180
|
+
| Function | Target | Actual | Status |
|
|
181
|
+
|----------|--------|--------|--------|
|
|
182
|
+
| BC Independence | 100% | 98% | ⚠️ |
|
|
183
|
+
| Aggregate Size | ≤7 | 5 | ✅ |
|
|
184
|
+
|
|
185
|
+
## Violations
|
|
186
|
+
1. PaymentAggregate: Direct entity modification (line 45)
|
|
187
|
+
Fix: Route through aggregate root method
|
|
188
|
+
|
|
189
|
+
## Score: 85/100
|
|
190
|
+
═══════════════════════════════════════════
|
|
191
|
+
```
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## /test Command (Enhanced with Gherkin)
|
|
197
|
+
|
|
198
|
+
**Source:** Gherkin tests, Pseudocode
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
---
|
|
202
|
+
description: Run or generate tests from Gherkin scenarios. $ARGUMENTS: feature name, scenario, or "all".
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
# /test $ARGUMENTS
|
|
206
|
+
|
|
207
|
+
## Purpose
|
|
208
|
+
|
|
209
|
+
Run existing tests or generate new tests from Gherkin feature files.
|
|
210
|
+
|
|
211
|
+
## Available Features
|
|
212
|
+
|
|
213
|
+
{{GHERKIN_FEATURES_LIST}}
|
|
214
|
+
|
|
215
|
+
## Process
|
|
216
|
+
|
|
217
|
+
1. Parse $ARGUMENTS:
|
|
218
|
+
- Feature name → Run/generate for feature
|
|
219
|
+
- Scenario name → Run/generate specific scenario
|
|
220
|
+
- "all" → Run full test suite
|
|
221
|
+
- "generate [feature]" → Generate tests from Gherkin
|
|
222
|
+
|
|
223
|
+
2. If generating:
|
|
224
|
+
- Load feature file
|
|
225
|
+
- Match with pseudocode
|
|
226
|
+
- Generate test implementation
|
|
227
|
+
|
|
228
|
+
3. If running:
|
|
229
|
+
- Execute test command
|
|
230
|
+
- Report results with coverage
|
|
231
|
+
|
|
232
|
+
## Examples
|
|
233
|
+
|
|
234
|
+
`/test OrderPlacement` — Run OrderPlacement tests
|
|
235
|
+
`/test all` — Run all tests
|
|
236
|
+
`/test generate OrderPlacement` — Generate tests from feature
|
|
237
|
+
`/test "Successfully place order"` — Run specific scenario
|
|
238
|
+
|
|
239
|
+
## Gherkin → Test Example
|
|
240
|
+
|
|
241
|
+
From `docs/tests/order-placement.feature`:
|
|
242
|
+
```gherkin
|
|
243
|
+
Scenario: Successfully place order
|
|
244
|
+
Given I am a verified customer
|
|
245
|
+
And all items are in stock
|
|
246
|
+
When I place the order
|
|
247
|
+
Then the order should be created
|
|
248
|
+
And I should receive confirmation
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Generates:
|
|
252
|
+
```{{LANGUAGE}}
|
|
253
|
+
{{GENERATED_TEST_TEMPLATE}}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Output Format
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
═══════════════════════════════════════════
|
|
260
|
+
Test Results: {{SCOPE}}
|
|
261
|
+
═══════════════════════════════════════════
|
|
262
|
+
|
|
263
|
+
✅ Passed: 12
|
|
264
|
+
❌ Failed: 1
|
|
265
|
+
⏭️ Skipped: 0
|
|
266
|
+
|
|
267
|
+
Coverage:
|
|
268
|
+
- Lines: 85%
|
|
269
|
+
- Branches: 78%
|
|
270
|
+
|
|
271
|
+
Failed:
|
|
272
|
+
- OrderPlacement > should handle out of stock
|
|
273
|
+
Expected: OutOfStockError
|
|
274
|
+
Actual: undefined
|
|
275
|
+
═══════════════════════════════════════════
|
|
276
|
+
```
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## /deploy Command (Enhanced)
|
|
282
|
+
|
|
283
|
+
**Source:** COMPLETION_CHECKLIST.md
|
|
284
|
+
|
|
285
|
+
```markdown
|
|
286
|
+
---
|
|
287
|
+
description: Run deployment checklist and deploy to environment. $ARGUMENTS: environment (dev|staging|prod).
|
|
288
|
+
disable-model-invocation: true
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# /deploy $ARGUMENTS
|
|
292
|
+
|
|
293
|
+
## Purpose
|
|
294
|
+
|
|
295
|
+
Execute deployment workflow following COMPLETION_CHECKLIST.md.
|
|
296
|
+
|
|
297
|
+
## Pre-Deployment Checklist
|
|
298
|
+
|
|
299
|
+
{{FROM_COMPLETION_CHECKLIST}}
|
|
300
|
+
|
|
301
|
+
## Environments
|
|
302
|
+
|
|
303
|
+
| Env | Requires | Auto-approve |
|
|
304
|
+
|-----|----------|--------------|
|
|
305
|
+
| dev | Tests pass | Yes |
|
|
306
|
+
| staging | Tests + Review | Yes |
|
|
307
|
+
| prod | All checks + Manual | No |
|
|
308
|
+
|
|
309
|
+
## Process
|
|
310
|
+
|
|
311
|
+
1. Parse $ARGUMENTS for target environment
|
|
312
|
+
2. Run pre-deployment checklist:
|
|
313
|
+
- [ ] Tests pass
|
|
314
|
+
- [ ] Fitness functions pass
|
|
315
|
+
- [ ] DDD validation clean
|
|
316
|
+
- [ ] Security scan clean
|
|
317
|
+
- [ ] Build succeeds
|
|
318
|
+
3. Execute deployment:
|
|
319
|
+
- dev: Auto-deploy
|
|
320
|
+
- staging: Deploy after checks
|
|
321
|
+
- prod: Require explicit confirmation
|
|
322
|
+
4. Run post-deployment verification
|
|
323
|
+
|
|
324
|
+
## Examples
|
|
325
|
+
|
|
326
|
+
`/deploy dev` — Deploy to development
|
|
327
|
+
`/deploy staging` — Deploy to staging with checks
|
|
328
|
+
`/deploy prod` — Production deployment (requires confirmation)
|
|
329
|
+
|
|
330
|
+
## Output Format
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
═══════════════════════════════════════════
|
|
334
|
+
Deployment: {{ENVIRONMENT}}
|
|
335
|
+
═══════════════════════════════════════════
|
|
336
|
+
|
|
337
|
+
## Pre-Deployment Checks
|
|
338
|
+
✅ Tests: Passed (45/45)
|
|
339
|
+
✅ Fitness: 95/100
|
|
340
|
+
✅ DDD: Valid
|
|
341
|
+
✅ Security: Clean
|
|
342
|
+
✅ Build: Success
|
|
343
|
+
|
|
344
|
+
## Deployment
|
|
345
|
+
🚀 Deploying to {{ENVIRONMENT}}...
|
|
346
|
+
✅ Deployment complete
|
|
347
|
+
|
|
348
|
+
## Post-Deployment
|
|
349
|
+
✅ Health check: Passed
|
|
350
|
+
✅ Smoke tests: Passed
|
|
351
|
+
|
|
352
|
+
## Summary
|
|
353
|
+
Deployed: v1.2.3
|
|
354
|
+
Time: 2m 34s
|
|
355
|
+
URL: https://{{ENVIRONMENT}}.example.com
|
|
356
|
+
═══════════════════════════════════════════
|
|
357
|
+
```
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## /context Command (NEW)
|
|
363
|
+
|
|
364
|
+
**Source:** .ai-context/, DDD Strategic
|
|
365
|
+
|
|
366
|
+
```markdown
|
|
367
|
+
---
|
|
368
|
+
description: Show or switch project context. $ARGUMENTS: context name or "list".
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
# /context $ARGUMENTS
|
|
372
|
+
|
|
373
|
+
## Purpose
|
|
374
|
+
|
|
375
|
+
Navigate bounded contexts and show relevant domain information.
|
|
376
|
+
|
|
377
|
+
## Available Contexts
|
|
378
|
+
|
|
379
|
+
{{BOUNDED_CONTEXTS_LIST}}
|
|
380
|
+
|
|
381
|
+
## Process
|
|
382
|
+
|
|
383
|
+
1. Parse $ARGUMENTS:
|
|
384
|
+
- "list" → Show all contexts
|
|
385
|
+
- Context name → Show context details
|
|
386
|
+
- Empty → Show current context
|
|
387
|
+
|
|
388
|
+
2. Display:
|
|
389
|
+
- Context responsibilities
|
|
390
|
+
- Aggregates in context
|
|
391
|
+
- Related contexts (upstream/downstream)
|
|
392
|
+
- Key domain events
|
|
393
|
+
|
|
394
|
+
## Examples
|
|
395
|
+
|
|
396
|
+
`/context list` — List all bounded contexts
|
|
397
|
+
`/context Orders` — Show Orders context details
|
|
398
|
+
`/context` — Show current context
|
|
399
|
+
|
|
400
|
+
## Output Format
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
═══════════════════════════════════════════
|
|
404
|
+
Bounded Context: Orders
|
|
405
|
+
═══════════════════════════════════════════
|
|
406
|
+
|
|
407
|
+
## Responsibilities
|
|
408
|
+
- Order placement and management
|
|
409
|
+
- Order fulfillment tracking
|
|
410
|
+
- Order history
|
|
411
|
+
|
|
412
|
+
## Aggregates
|
|
413
|
+
- OrderAggregate
|
|
414
|
+
- OrderItemEntity
|
|
415
|
+
- ShippingAddressVO
|
|
416
|
+
|
|
417
|
+
## Domain Events
|
|
418
|
+
- OrderPlaced
|
|
419
|
+
- OrderShipped
|
|
420
|
+
- OrderCancelled
|
|
421
|
+
|
|
422
|
+
## Relationships
|
|
423
|
+
- Upstream: Customers (Customer data)
|
|
424
|
+
- Downstream: Shipping (Fulfillment)
|
|
425
|
+
|
|
426
|
+
## Key Invariants
|
|
427
|
+
- Order total must match item sum
|
|
428
|
+
- Cannot modify shipped orders
|
|
429
|
+
═══════════════════════════════════════════
|
|
430
|
+
```
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Rules Templates (DDD-Enhanced)
|
|
436
|
+
|
|
437
|
+
### domain-model.md Rule
|
|
438
|
+
|
|
439
|
+
**Source:** DDD Strategic, DDD Tactical
|
|
440
|
+
|
|
441
|
+
```markdown
|
|
442
|
+
# Domain Model Rules
|
|
443
|
+
|
|
444
|
+
## Bounded Context Rules
|
|
445
|
+
|
|
446
|
+
- **DO:** Keep aggregates within single bounded context
|
|
447
|
+
- **DO:** Use anti-corruption layer for cross-context calls
|
|
448
|
+
- **DO:** Define clear context boundaries in code structure
|
|
449
|
+
- **DON'T:** Share entities across bounded contexts
|
|
450
|
+
- **DON'T:** Directly call into another context's aggregates
|
|
451
|
+
|
|
452
|
+
## Aggregate Rules
|
|
453
|
+
|
|
454
|
+
- **DO:** Modify entities only through aggregate root
|
|
455
|
+
- **DO:** Check invariants before state changes
|
|
456
|
+
- **DO:** Emit domain events for significant state changes
|
|
457
|
+
- **DO:** Keep aggregates small (≤{{MAX_ENTITIES}} entities)
|
|
458
|
+
- **DON'T:** Reference other aggregate roots directly
|
|
459
|
+
- **DON'T:** Perform I/O inside aggregate methods
|
|
460
|
+
|
|
461
|
+
## Entity Rules
|
|
462
|
+
|
|
463
|
+
- **DO:** Use value objects for identity
|
|
464
|
+
- **DO:** Implement equals based on identity only
|
|
465
|
+
- **DON'T:** Create entities without aggregate context
|
|
466
|
+
|
|
467
|
+
## Value Object Rules
|
|
468
|
+
|
|
469
|
+
- **DO:** Make all properties immutable
|
|
470
|
+
- **DO:** Implement equals on all properties
|
|
471
|
+
- **DO:** Validate in constructor
|
|
472
|
+
- **DON'T:** Include identity (ID) in value objects
|
|
473
|
+
- **DON'T:** Add setter methods
|
|
474
|
+
|
|
475
|
+
## Domain Event Rules
|
|
476
|
+
|
|
477
|
+
- **DO:** Use past tense naming (OrderPlaced, not PlaceOrder)
|
|
478
|
+
- **DO:** Include aggregate ID in event
|
|
479
|
+
- **DO:** Make event payload immutable
|
|
480
|
+
- **DO:** Include timestamp
|
|
481
|
+
- **DON'T:** Include behavior in events
|
|
482
|
+
|
|
483
|
+
## Rationale
|
|
484
|
+
|
|
485
|
+
Following DDD tactical patterns ensures:
|
|
486
|
+
- Clear boundaries and ownership
|
|
487
|
+
- Consistent transactional boundaries
|
|
488
|
+
- Auditable state changes
|
|
489
|
+
- Loose coupling between contexts
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### fitness-functions.md Rule
|
|
493
|
+
|
|
494
|
+
**Source:** docs/fitness/fitness-functions.md
|
|
495
|
+
|
|
496
|
+
```markdown
|
|
497
|
+
# Fitness Functions
|
|
498
|
+
|
|
499
|
+
## Architecture Fitness
|
|
500
|
+
|
|
501
|
+
| ID | Rule | Target | Automated |
|
|
502
|
+
|----|------|--------|-----------|
|
|
503
|
+
{{FITNESS_FUNCTIONS_TABLE}}
|
|
504
|
+
|
|
505
|
+
## Validation Commands
|
|
506
|
+
|
|
507
|
+
Run validation:
|
|
508
|
+
```bash
|
|
509
|
+
/validate-ddd all
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
## Thresholds
|
|
513
|
+
|
|
514
|
+
| Metric | Warning | Error |
|
|
515
|
+
|--------|---------|-------|
|
|
516
|
+
| BC Independence | <95% | <90% |
|
|
517
|
+
| Aggregate Size | >5 | >7 |
|
|
518
|
+
| Method Complexity | >10 | >15 |
|
|
519
|
+
| Test Coverage | <80% | <70% |
|
|
520
|
+
|
|
521
|
+
## Rationale
|
|
522
|
+
|
|
523
|
+
Fitness functions provide automated architectural governance, ensuring the system maintains desired qualities as it evolves.
|
|
524
|
+
```
|