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