@atlashub/smartstack-cli 3.9.0 → 3.12.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.
Files changed (48) hide show
  1. package/dist/index.js +2544 -2461
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +479 -6185
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/ba-writer.md +178 -0
  7. package/templates/agents/db-reader.md +149 -0
  8. package/templates/skills/application/references/application-roles-template.md +227 -0
  9. package/templates/skills/application/references/provider-template.md +30 -6
  10. package/templates/skills/application/steps/step-03-roles.md +45 -7
  11. package/templates/skills/application/steps/step-03b-provider.md +13 -6
  12. package/templates/skills/business-analyse/SKILL.md +56 -4
  13. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +477 -0
  14. package/templates/skills/business-analyse/references/cache-warming-strategy.md +578 -0
  15. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +9 -19
  16. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +12 -2
  17. package/templates/skills/business-analyse/references/deploy-data-build.md +36 -25
  18. package/templates/skills/business-analyse/references/detection-strategies.md +424 -0
  19. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -0
  20. package/templates/skills/business-analyse/references/prd-generation.md +258 -0
  21. package/templates/skills/business-analyse/references/robustness-checks.md +538 -0
  22. package/templates/skills/business-analyse/references/validate-incremental-html.md +47 -4
  23. package/templates/skills/business-analyse/references/validation-checklist.md +281 -0
  24. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +33 -1
  25. package/templates/skills/business-analyse/steps/step-00-init.md +70 -75
  26. package/templates/skills/business-analyse/steps/step-01-cadrage.md +8 -22
  27. package/templates/skills/business-analyse/steps/step-03a-data.md +20 -410
  28. package/templates/skills/business-analyse/steps/step-03a1-setup.md +356 -0
  29. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +143 -0
  30. package/templates/skills/business-analyse/steps/step-03b-ui.md +3 -0
  31. package/templates/skills/business-analyse/steps/step-03c-compile.md +72 -3
  32. package/templates/skills/business-analyse/steps/step-03d-validate.md +36 -3
  33. package/templates/skills/business-analyse/steps/step-04-consolidation.md +21 -440
  34. package/templates/skills/business-analyse/steps/step-04a-collect.md +304 -0
  35. package/templates/skills/business-analyse/steps/step-04b-analyze.md +239 -0
  36. package/templates/skills/business-analyse/steps/step-04c-decide.md +186 -0
  37. package/templates/skills/business-analyse/steps/step-05a-handoff.md +44 -0
  38. package/templates/skills/business-analyse/steps/step-05b-deploy.md +42 -2
  39. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +518 -0
  40. package/templates/skills/controller/steps/step-03-generate.md +184 -24
  41. package/templates/skills/controller/templates.md +11 -2
  42. package/templates/skills/debug/SKILL.md +156 -53
  43. package/templates/skills/debug/references/team-protocol.md +232 -0
  44. package/templates/skills/ralph-loop/references/category-rules.md +46 -0
  45. package/templates/skills/ralph-loop/references/compact-loop.md +32 -2
  46. package/templates/skills/ralph-loop/references/core-seed-data.md +233 -21
  47. package/templates/skills/ralph-loop/steps/step-00-init.md +64 -1
  48. package/templates/skills/ralph-loop/steps/step-04-check.md +27 -2
@@ -0,0 +1,518 @@
1
+ ---
2
+ name: step-05c-ralph-readiness
3
+ description: Validation gate before ralph-loop - verify completeness, integrity, and readiness
4
+ model: sonnet
5
+ next_step: null
6
+ ---
7
+
8
+ > **Context files:** `_shared.md`
9
+
10
+ # Step 5c: Ralph Readiness Check
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** run ALL validation checks (NEVER skip)
15
+ - **BLOCKING RULE:** If ANY check fails → STOP, DO NOT proceed to ralph-loop
16
+ - **ALWAYS** provide actionable fix instructions for failures
17
+ - **NEVER** auto-launch ralph-loop (user triggers manually)
18
+ - **ALL** PRD files must be generated and validated before proceeding
19
+
20
+ ## YOUR TASK
21
+
22
+ Perform comprehensive validation to ensure the business analysis is ready for implementation via /ralph-loop. This is a **BLOCKING** gate - all checks must pass before development can proceed.
23
+
24
+ ---
25
+
26
+ ## EXECUTION SEQUENCE
27
+
28
+ ### 0. Introduction
29
+
30
+ Display validation banner:
31
+
32
+ ```
33
+ ═══════════════════════════════════════════════════════════════
34
+ RALPH READINESS CHECK - {application_name}
35
+ ═══════════════════════════════════════════════════════════════
36
+ Validating business analysis completeness before development...
37
+ ```
38
+
39
+ ---
40
+
41
+ ### 1. Module Status Validation
42
+
43
+ **Objective:** Verify all modules have completed handoff.
44
+
45
+ **Process:**
46
+
47
+ 1. Read master feature.json via ba-reader
48
+ 2. For EACH module in modules[]:
49
+ ```
50
+ a. Check module.status === "handed-off"
51
+ b. If module.featureJsonPath exists, read module feature.json
52
+ c. Verify module feature.json status === "handed-off"
53
+ d. Verify module feature.json handoff section exists and is not empty
54
+ ```
55
+
56
+ 3. Display validation table:
57
+
58
+ ```
59
+ | Module | Master Status | Module Status | Handoff Present | Result |
60
+ |--------|--------------|---------------|-----------------|--------|
61
+ | Projects | handed-off | handed-off | ✓ | PASS |
62
+ | TimeTracking | handed-off | handed-off | ✓ | PASS |
63
+ | Reporting | specified | specified | ✗ | FAIL |
64
+ ```
65
+
66
+ **IF ANY module shows FAIL:**
67
+ - **BLOCKING ERROR:** List failed modules
68
+ - **FIX:** Return to step-05a-handoff.md for missing modules
69
+ - **STOP** - do not proceed to next check
70
+
71
+ ---
72
+
73
+ ### 2. PRD Files Validation
74
+
75
+ **Objective:** Verify all PRD files are generated and structurally valid.
76
+
77
+ **Process:**
78
+
79
+ 1. For EACH module in modules[]:
80
+ ```
81
+ a. Locate expected PRD file: .ralph/prd-{moduleCode}.json
82
+ b. Verify file exists
83
+ c. Read PRD file
84
+ d. Verify structure (see [references/prd-generation.md](../references/prd-generation.md))
85
+ ```
86
+
87
+ 2. **PRD Structure Validation:**
88
+
89
+ Perform the 4 mandatory PRD structure checks:
90
+ - **Check 1:** Version must be "3.0.0"
91
+ - **Check 2:** filesToCreate must be under `implementation` (NOT root level)
92
+ - **Check 3:** All 7 categories present (domain, application, infrastructure, api, frontend, seedData, tests)
93
+ - **Check 4:** File counts match feature.json handoff counts
94
+
95
+ ```javascript
96
+ const prdErrors = validateAllPRDs(modules);
97
+
98
+ IF prdErrors.length > 0:
99
+ // CONDITIONAL LOAD: Only load PRD reference on validation failure
100
+ Read references/prd-generation.md
101
+ Display:
102
+ - PRD v3.0 structure requirements
103
+ - Detailed validation logic for failed checks
104
+ - Common errors & fix commands for each failure
105
+ - Generation command reference
106
+
107
+ BLOCKING ERROR: {prdErrors.length} PRD file(s) invalid
108
+ → Fix all PRD errors before proceeding
109
+
110
+ ELSE:
111
+ All PRD files valid ✓
112
+ → Continue to dependency graph validation
113
+ ```
114
+
115
+ **Optimization:** The detailed 300-line prd-generation.md is loaded **only when PRD validation fails** (saves ~12,000 tokens on success path).
116
+
117
+ 3. Display PRD validation table:
118
+
119
+ ```
120
+ | Module | PRD File | Version | Structure | File Counts | Result |
121
+ |--------|----------|---------|-----------|-------------|--------|
122
+ | Projects | ✓ exists | 3.0.0 | ✓ valid | 42/42 match | PASS |
123
+ | TimeTracking | ✓ exists | 3.0.0 | ✓ valid | 37/37 match | PASS |
124
+ | Reporting | ✗ missing | - | - | - | FAIL |
125
+ ```
126
+
127
+ **IF ANY PRD shows FAIL:**
128
+ - **BLOCKING ERROR:** List failed PRDs with specific issues
129
+ - **FIX:** Re-run `ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json`
130
+ - **STOP** - do not proceed to next check
131
+
132
+ ---
133
+
134
+ ### 3. Dependency Graph Validation
135
+
136
+ **Objective:** Verify module dependencies are resolvable and topologically ordered.
137
+
138
+ **Process:**
139
+
140
+ 1. Read master feature.json dependencyGraph
141
+ 2. For each edge in dependencyGraph.edges[]:
142
+ ```
143
+ a. Verify source module exists in modules[]
144
+ b. Verify target module exists in modules[]
145
+ c. Verify no circular dependencies
146
+ ```
147
+
148
+ 3. Verify topologicalOrder matches actual dependencies:
149
+ ```
150
+ For each module M in topologicalOrder:
151
+ For each dependency D of M:
152
+ D must appear BEFORE M in topologicalOrder
153
+ ```
154
+
155
+ 4. Display dependency validation:
156
+
157
+ ```
158
+ ✓ Dependency graph valid
159
+ ✓ No circular dependencies detected
160
+ ✓ Topological order correct: [Projects, TimeTracking, LeaveManagement, AbsenceManagement, Reporting]
161
+ ✓ 4 dependency edges validated
162
+ ```
163
+
164
+ **IF validation fails:**
165
+ - **BLOCKING ERROR:** Report circular dependencies or invalid edges
166
+ - **FIX:** Return to step-02-decomposition.md to fix dependency graph
167
+ - **STOP** - do not proceed to next check
168
+
169
+ ---
170
+
171
+ ### 4. Cross-Module References Validation
172
+
173
+ **Objective:** Verify all cross-module entity references are resolvable.
174
+
175
+ **Process:**
176
+
177
+ 1. For EACH module feature.json:
178
+ ```
179
+ a. Extract all entity names from analysis.entities[]
180
+ b. Build map: {moduleName -> [entityNames]}
181
+ ```
182
+
183
+ 2. For EACH module feature.json:
184
+ ```
185
+ a. Extract all relationships from analysis.entities[].relationships[]
186
+ b. For each relationship.target:
187
+ - Extract module prefix (first segment before dot)
188
+ - Verify referenced module exists
189
+ - Verify referenced entity exists in target module
190
+ ```
191
+
192
+ 3. Display cross-reference validation:
193
+
194
+ ```
195
+ Cross-Module References Validated:
196
+ ✓ TimeTracking.TimeEntry.projectId → Projects.Project.id
197
+ ✓ LeaveManagement.LeaveRequest.employeeId → Projects.Employee.id
198
+ ✓ AbsenceManagement.Absence.employeeId → Projects.Employee.id
199
+ ✓ Reporting.ProjectReport.projectId → Projects.Project.id
200
+
201
+ Total: 4 cross-module references, all resolvable
202
+ ```
203
+
204
+ **IF ANY reference is unresolvable:**
205
+ - **BLOCKING ERROR:** List broken references with module and field names
206
+ - **FIX:** Return to step-03a-data.md for affected modules to fix entity references
207
+ - **STOP** - do not proceed to next check
208
+
209
+ ---
210
+
211
+ ### 5. Handoff Completeness Check
212
+
213
+ **Objective:** Verify all required handoff sections are complete and non-empty.
214
+
215
+ **Process:**
216
+
217
+ For EACH module feature.json:
218
+
219
+ 1. **filesToCreate validation:**
220
+ ```
221
+ - handoff.filesToCreate must be an object
222
+ - All 7 categories must exist: domain, application, infrastructure, api, frontend, seedData, tests
223
+ - Each category must be a non-empty array
224
+ - Each file entry must have: path, type, module
225
+ ```
226
+
227
+ 2. **brToCodeMapping validation:**
228
+ ```
229
+ - handoff.brToCodeMapping must be a non-empty array
230
+ - Each entry must have: ruleId, files[], implementation
231
+ - All ruleIds must reference existing BRs in analysis.businessRules[]
232
+ ```
233
+
234
+ 3. **apiEndpointSummary validation:**
235
+ ```
236
+ - handoff.apiEndpointSummary must be a non-empty array
237
+ - Each entry must have: method, path, permission, linkedUC
238
+ - All linkedUCs must reference existing UCs in specification.useCases[]
239
+ ```
240
+
241
+ 4. **Metadata validation:**
242
+ ```
243
+ - handoff.complexity must be "simple|medium|complex"
244
+ - handoff.totalFiles must be > 0
245
+ - handoff.totalTasks must be > 0
246
+ - handoff.handedOffAt must be valid ISO timestamp
247
+ ```
248
+
249
+ 5. Display completeness summary:
250
+
251
+ ```
252
+ Handoff Completeness:
253
+ Module: Projects
254
+ ✓ filesToCreate: 7 categories, 42 files total
255
+ ✓ brToCodeMapping: 8 business rules mapped
256
+ ✓ apiEndpointSummary: 12 endpoints documented
257
+ ✓ complexity: medium
258
+ ✓ metadata complete
259
+
260
+ Module: TimeTracking
261
+ ✓ filesToCreate: 7 categories, 37 files total
262
+ ✓ brToCodeMapping: 10 business rules mapped
263
+ ✓ apiEndpointSummary: 15 endpoints documented
264
+ ✓ complexity: complex
265
+ ✓ metadata complete
266
+ ```
267
+
268
+ **IF ANY module has incomplete handoff:**
269
+ - **BLOCKING ERROR:** List missing or invalid sections per module
270
+ - **FIX:** Return to step-05a-handoff.md for affected modules
271
+ - **STOP** - do not proceed to next check
272
+
273
+ ---
274
+
275
+ ### 6. i18n Keys Validation
276
+
277
+ **Objective:** Verify all required i18n keys are defined for all 4 languages.
278
+
279
+ **Process:**
280
+
281
+ For EACH module feature.json:
282
+
283
+ 1. Extract all i18n keys from specification.i18nKeys[]
284
+ 2. Verify each key has translations for: fr, en, nl, de
285
+ 3. Check for common missing patterns:
286
+ ```
287
+ - Entity names (singular + plural)
288
+ - Field labels
289
+ - Validation error messages
290
+ - Success/error messages
291
+ - Navigation labels
292
+ - Button labels
293
+ ```
294
+
295
+ 4. Display i18n validation:
296
+
297
+ ```
298
+ i18n Keys Validation:
299
+ Module: Projects
300
+ ✓ 42 keys defined
301
+ ✓ All keys have 4 languages (fr, en, nl, de)
302
+ ✓ Entity keys complete
303
+ ✓ Validation message keys complete
304
+ ✓ Navigation keys complete
305
+
306
+ Module: TimeTracking
307
+ ⚠ 37 keys defined
308
+ ⚠ Missing translation for "timeEntry.validation.overlapping" in DE
309
+ ✓ Entity keys complete
310
+ ```
311
+
312
+ **IF ANY missing translations:**
313
+ - **WARNING:** List missing translations (not blocking, but should be fixed)
314
+ - **RECOMMEND:** Add missing translations before proceeding
315
+ - Allow user to continue or fix
316
+
317
+ ---
318
+
319
+ ### 7. Master Feature Validation
320
+
321
+ **Objective:** Verify master feature.json has all required application-level data.
322
+
323
+ **Process:**
324
+
325
+ 1. Read master feature.json
326
+ 2. Verify status === "handed-off"
327
+ 3. Verify handoff section exists with:
328
+ ```
329
+ - implementationStrategy defined
330
+ - moduleOrder matches modules[]
331
+ - totalFilesToCreate === sum of all module totalFiles
332
+ - totalTasks === sum of all module totalTasks
333
+ - prdFiles array has entry for each module
334
+ ```
335
+
336
+ 4. Display master validation:
337
+
338
+ ```
339
+ Master Feature Validation:
340
+ ✓ Status: handed-off
341
+ ✓ Implementation strategy: module par module
342
+ ✓ Module order: [Projects, TimeTracking, LeaveManagement, AbsenceManagement, Reporting]
343
+ ✓ Total files: 183 (matches sum of modules)
344
+ ✓ Total tasks: 247 (matches sum of modules)
345
+ ✓ PRD files: 5 (one per module)
346
+ ```
347
+
348
+ **IF master validation fails:**
349
+ - **BLOCKING ERROR:** List missing or invalid sections
350
+ - **FIX:** Return to step-05a-handoff.md to fix master handoff
351
+ - **STOP** - do not proceed
352
+
353
+ ---
354
+
355
+ ### 8. Progress Tracker Validation
356
+
357
+ **Objective:** Verify progress.txt is generated and complete.
358
+
359
+ **Process:**
360
+
361
+ 1. Verify file exists: `.ralph/progress.txt`
362
+ 2. Read file and verify structure:
363
+ ```
364
+ - Has header with application name
365
+ - Has summary section
366
+ - Has section for each module
367
+ - Each module section has tasks by layer
368
+ - Has completion checkboxes ([ ] format)
369
+ ```
370
+
371
+ 3. Count total tasks and verify matches master.handoff.totalTasks
372
+
373
+ 4. Display progress tracker validation:
374
+
375
+ ```
376
+ Progress Tracker Validation:
377
+ ✓ File exists: .ralph/progress.txt
378
+ ✓ Size: 12.3 KB
379
+ ✓ Modules: 5 sections present
380
+ ✓ Tasks: 247 checkboxes (matches master)
381
+ ✓ Structure: valid markdown format
382
+ ```
383
+
384
+ **IF progress tracker invalid:**
385
+ - **WARNING:** Progress tracker issues (not blocking)
386
+ - **RECOMMEND:** Re-generate via step-05b-deploy.md
387
+ - Allow user to continue
388
+
389
+ ---
390
+
391
+ ### 9. Final Readiness Report
392
+
393
+ **Objective:** Display comprehensive readiness summary and next steps.
394
+
395
+ **Process:**
396
+
397
+ 1. Aggregate all validation results
398
+ 2. Calculate readiness score:
399
+ ```
400
+ passedChecks / totalChecks * 100
401
+ ```
402
+
403
+ 3. Display final report:
404
+
405
+ ```
406
+ ═══════════════════════════════════════════════════════════════
407
+ RALPH READINESS CHECK - COMPLETE
408
+ ═══════════════════════════════════════════════════════════════
409
+
410
+ Validation Summary:
411
+ ✓ Module status validation: PASS (5/5 modules)
412
+ ✓ PRD files validation: PASS (5/5 files)
413
+ ✓ Dependency graph validation: PASS (4 edges)
414
+ ✓ Cross-module references validation: PASS (4 references)
415
+ ✓ Handoff completeness check: PASS (5/5 modules)
416
+ ⚠ i18n keys validation: WARNING (1 missing translation)
417
+ ✓ Master feature validation: PASS
418
+ ✓ Progress tracker validation: PASS
419
+
420
+ Readiness Score: 100% (7/7 critical checks passed, 1 warning)
421
+
422
+ ═══════════════════════════════════════════════════════════════
423
+
424
+ Status: READY FOR DEVELOPMENT ✓
425
+
426
+ Next Steps:
427
+ 1. Address warnings (recommended but not blocking):
428
+ - Add missing DE translation for "timeEntry.validation.overlapping" in TimeTracking module
429
+
430
+ 2. Review progress tracker: .ralph/progress.txt
431
+
432
+ 3. When ready, launch development:
433
+
434
+ /ralph-loop -r
435
+
436
+ 4. Ralph-loop will:
437
+ - Process modules in topological order: [Projects, TimeTracking, LeaveManagement, AbsenceManagement, Reporting]
438
+ - Generate 183 files across 7 layers
439
+ - Execute 247 tasks tracked in progress.txt
440
+
441
+ ═══════════════════════════════════════════════════════════════
442
+ ```
443
+
444
+ **IF readiness score < 100% (critical checks failed):**
445
+
446
+ ```
447
+ ═══════════════════════════════════════════════════════════════
448
+ RALPH READINESS CHECK - FAILED
449
+ ═══════════════════════════════════════════════════════════════
450
+
451
+ Status: NOT READY FOR DEVELOPMENT ✗
452
+
453
+ Critical Issues Found:
454
+ ✗ Module status validation: FAIL (1/5 modules incomplete)
455
+ - Reporting module status is "specified", must be "handed-off"
456
+ - Fix: Return to step-05a-handoff.md for Reporting module
457
+
458
+ ✗ PRD files validation: FAIL (1/5 files invalid)
459
+ - prd-Reporting.json has wrong structure (filesToCreate at root level)
460
+ - Fix: Re-run ss derive-prd --feature docs/business/HumanResources/Reporting/business-analyse/v1.0/feature.json --output .ralph/prd-Reporting.json
461
+
462
+ Required Actions:
463
+ 1. Fix all critical issues listed above
464
+ 2. Re-run validation: load step-05c-ralph-readiness.md
465
+ 3. Only proceed to /ralph-loop when all critical checks pass
466
+
467
+ DO NOT PROCEED TO /ralph-loop UNTIL ALL CRITICAL CHECKS PASS
468
+ ═══════════════════════════════════════════════════════════════
469
+ ```
470
+
471
+ ---
472
+
473
+ ## SELF-VERIFICATION
474
+
475
+ Before displaying final report, VERIFY:
476
+
477
+ 1. **ALL validation checks executed** (never skip)
478
+ 2. **Results clearly marked** (PASS/FAIL/WARNING)
479
+ 3. **Actionable fixes provided** for all failures
480
+ 4. **Readiness score calculated** correctly
481
+ 5. **Next steps displayed** with exact commands
482
+ 6. **Blocking errors prevent progression** (no false positives)
483
+
484
+ ---
485
+
486
+ ## SUCCESS CRITERIA
487
+
488
+ - All 7 critical validation checks executed
489
+ - Clear PASS/FAIL/WARNING status for each check
490
+ - Readiness score displayed (100% = all critical checks passed)
491
+ - Actionable fix instructions for all failures
492
+ - User can proceed to /ralph-loop only if readiness score = 100%
493
+ - Warnings documented but not blocking
494
+
495
+ ---
496
+
497
+ ## NOTES
498
+
499
+ **Why this gate matters:**
500
+
501
+ - Prevents incomplete handoffs from reaching development
502
+ - Catches structural issues early (PRD validation)
503
+ - Verifies cross-module integrity before code generation
504
+ - Ensures ralph-loop has all required data to proceed
505
+ - Reduces failed development attempts and rework
506
+
507
+ **When to run this gate:**
508
+
509
+ - Automatically at end of step-05b-deploy.md (recommended)
510
+ - Manually before /ralph-loop if user wants to verify
511
+ - After fixing any handoff issues to re-validate
512
+
513
+ **What happens if checks fail:**
514
+
515
+ - Development is BLOCKED until issues are fixed
516
+ - User returns to appropriate step to fix issues
517
+ - Re-run validation after fixes
518
+ - Only proceed when all critical checks pass