@atlashub/smartstack-cli 4.17.1 → 4.19.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 (167) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +321 -413
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +703 -82
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +31 -5
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  51. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  52. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  53. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +142 -0
  54. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +94 -0
  55. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +150 -0
  56. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  57. package/templates/skills/business-analyse/questionnaire.md +23 -280
  58. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  59. package/templates/skills/business-analyse/react/components.md +4 -4
  60. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  61. package/templates/skills/business-analyse/react/schema.md +14 -14
  62. package/templates/skills/business-analyse/references/acceptance-criteria.md +25 -25
  63. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  64. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +7 -7
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +14 -12
  67. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  68. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  69. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  70. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  71. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  72. package/templates/skills/business-analyse/references/robustness-checks.md +36 -33
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  76. package/templates/skills/business-analyse/references/validation-checklist.md +9 -6
  77. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  78. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  79. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  80. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  81. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  82. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  83. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  84. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  85. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -3
  87. package/templates/skills/business-analyse/steps/step-00-init.md +93 -134
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +136 -172
  89. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  90. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  91. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  92. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  93. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  94. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  95. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  96. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  97. package/templates/skills/business-analyse/templates-react.md +2 -2
  98. package/templates/skills/derive-prd/SKILL.md +92 -0
  99. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  100. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  101. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  102. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  103. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  104. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -258
  105. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  106. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  107. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  108. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  109. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  110. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  111. package/templates/skills/ralph-loop/SKILL.md +10 -4
  112. package/templates/skills/ralph-loop/references/category-completeness.md +20 -4
  113. package/templates/skills/ralph-loop/references/compact-loop.md +80 -48
  114. package/templates/skills/ralph-loop/references/init-resume-recovery.md +4 -2
  115. package/templates/skills/ralph-loop/references/parallel-execution.md +27 -27
  116. package/templates/skills/ralph-loop/steps/step-00-init.md +19 -9
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +12 -4
  118. package/templates/skills/ralph-loop/steps/step-02-execute.md +9 -4
  119. package/templates/skills/ralph-loop/steps/step-03-commit.md +1 -1
  120. package/templates/skills/ralph-loop/steps/step-04-check.md +5 -21
  121. package/templates/skills/ralph-loop/steps/step-05-report.md +6 -1
  122. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  123. package/templates/skills/business-analyse/_architecture.md +0 -124
  124. package/templates/skills/business-analyse/_elicitation.md +0 -206
  125. package/templates/skills/business-analyse/_module-loop.md +0 -115
  126. package/templates/skills/business-analyse/_suggestions.md +0 -34
  127. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  128. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  129. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  130. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  131. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  132. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  134. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  135. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  136. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  137. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -43
  138. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  139. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  140. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  141. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  142. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  143. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -362
  144. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  145. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  146. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  147. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  148. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  149. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  150. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  151. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1022
  152. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  153. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  154. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  155. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  156. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -506
  157. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -301
  158. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -425
  159. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -611
  160. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -783
  161. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  162. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  163. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  164. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  165. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -840
  166. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  167. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -1,172 +1,172 @@
1
- # Progress Tracker Template (templates/tpl-progress.md)
2
-
3
- > **Used by:** step-05b-deploy (section 2: Initialize Progress Tracker)
4
- > **Purpose:** Template structure for .ralph/progress.txt - populate with module-specific data
5
-
6
- ## Template
7
-
8
- ```
9
- ═════════════════════════════════════════════════════════════════
10
- SMARTSTACK RALPH LOOP - PROGRESS TRACKER
11
- Project: {project_name} | Application: {app_name}
12
- Modules: {count} ({moduleOrder.join(', ')})
13
- Strategy: {implementation_strategy}
14
- Created: {timestamp}
15
- Status: HANDED-OFF
16
- ═════════════════════════════════════════════════════════════════
17
-
18
- {For each module in topological order:}
19
- [MODULE: {module_name}] ({complexity})
20
- Status: NOT STARTED
21
- Dependencies: {list of module dependencies or "FOUNDATION"}
22
-
23
- [DOMAIN] Entity & Value Object Definitions
24
- □ Define {Entity1} entity with properties and validation
25
- □ Define {Entity2} entity with relationships
26
- □ Define {ValueObject1} value object
27
- □ Define domain exceptions
28
- □ Total: X tasks
29
-
30
- [SEEDDATA-CORE] Core Configuration (MANDATORY)
31
- □ NavigationApplicationSeedData - Application navigation entry (once per app)
32
- □ ApplicationRolesSeedData - Application-scoped roles (once per app)
33
- □ NavigationModuleSeedData - Module navigation structure (per module)
34
- □ PermissionsSeedData - RBAC permissions (per module)
35
- □ RolesSeedData - Role-permission mappings (per module)
36
- □ {App}SeedDataProvider - IClientSeedDataProvider (4 methods)
37
- Total: 2 app-level + 3 per-module + 1 provider
38
-
39
- [SEEDDATA] Business Reference Data
40
- □ Seed {Entity1} reference data
41
- □ Seed {Entity2} lookup values
42
- □ Total: Y business seed tasks
43
-
44
- [APPLICATION] Services & Business Logic
45
- □ Create {ServiceName}Service for {UC1}
46
- □ Create {DtoName}Dto for API contracts
47
- □ Create {ValidatorName}Validator for input validation
48
- □ Implement query handlers
49
- Total: Z tasks
50
-
51
- [INFRASTRUCTURE] Repositories & Persistence
52
- □ Create {Entity1}Repository with CRUD + custom queries
53
- □ Create {Entity2}Repository
54
- □ Configure DbContext for module
55
- □ Setup specifications for complex queries
56
- □ Create IClientSeedDataProvider (client projects ONLY - injects core seeds at runtime)
57
- □ Create DevDataSeeder + SeedConstants (if first module)
58
- □ Total: A tasks
59
-
60
- [API] REST Endpoints & Controllers
61
- □ Create {ModuleNameController} GET endpoints (List, GetById)
62
- □ Create {ModuleNameController} POST endpoint (Create)
63
- □ Create {ModuleNameController} PUT endpoint (Update)
64
- □ Create {ModuleNameController} DELETE endpoint (Delete)
65
- □ Implement error handling and validation responses
66
- Total: B tasks
67
-
68
- [FRONTEND] UI Components & Pages (wireframe-driven)
69
- □ Create {ModuleName}Page for listing [wireframe: {module}-list]
70
- □ Create {ModuleName}DetailPage for viewing [wireframe: {module}-detail]
71
- □ Create {ModuleName}Form component for creation/edit [wireframe: {module}-create]
72
- □ Create custom hook use{ModuleName}
73
- □ Implement pagination, filtering, sorting
74
- □ Validate all pages match their wireframe layout
75
- □ ⚠️ Routes MUST be INSIDE the AppLayout wrapper
76
- Total: C tasks
77
-
78
- [I18N] Internationalization Keys
79
- □ Define i18n keys for {Module} UI labels
80
- □ Setup translations for locales: fr, en, it, de
81
- Total: D keys
82
-
83
- [TESTS] Unit & Integration Tests
84
- □ Unit tests for {Entity} domain logic
85
- □ Unit tests for {ServiceName}Service
86
- □ Integration tests for {ModuleNameController}
87
- □ Security tests for authorization & tenant isolation
88
- □ E2E tests for critical user flows
89
- Total: E unit + F integration + G security = H tests
90
-
91
- [QA] Quality Assurance
92
- □ Code review against SmartStack conventions
93
- □ Test coverage minimum 80%
94
- □ Security scan for OWASP vulnerabilities
95
- □ Performance testing under load
96
- Total: 4 QA tasks
97
-
98
- Module Total: X + 5 + Y + Z + A + B + C + D + H + 4 = {module_total} tasks
99
- Estimated Effort: {simple/medium/complex} - {1-3/3-8/8-15} days
100
-
101
- {If multi-module:}
102
- [CROSS-MODULE] Integration Tasks
103
- Status: NOT STARTED
104
- Dependencies: All modules COMPLETED
105
-
106
- □ Verify cross-module entity relationships
107
- □ Test cross-module API dependencies
108
- □ Validate permission matrix across modules
109
- □ E2E flow tests spanning multiple modules
110
- □ Cross-module data consistency checks
111
- □ Integration test suite for module interactions
112
- Total: 6 CROSS-MODULE tasks
113
-
114
- ═════════════════════════════════════════════════════════════════
115
- SUMMARY
116
- ═════════════════════════════════════════════════════════════════
117
- Total Modules: {count}
118
- Total Tasks: {total_count}
119
- - CORE SeedData: {count} × 5 = {total_core}
120
- - Business Tasks: {total_biz}
121
- - Development: {total_dev}
122
- - Tests: {total_tests}
123
- - QA: {total_qa}
124
- - Cross-Module: {cross_module_count or 0}
125
-
126
- Strategy: {strategy}
127
- Module Order: {topological order with dependencies noted}
128
-
129
- Complexity Distribution:
130
- Simple: {count} modules ({estimate} days each)
131
- Medium: {count} modules ({estimate} days each)
132
- Complex: {count} modules ({estimate} days each)
133
-
134
- Total Effort Estimate: {total_days} days ({total_hours} hours)
135
- Per Developer (2): {total_days / 2} days
136
- Parallel Potential: {strategy_efficiency_percent}%
137
-
138
- ═════════════════════════════════════════════════════════════════
139
- LEGEND
140
- ═════════════════════════════════════════════════════════════════
141
- □ = Task not started
142
- ✓ = Task completed
143
- ⚠ = Task in progress
144
- ✗ = Task failed / blocked
145
-
146
- COLORS:
147
- [DOMAIN] = Domain Model & Business Logic
148
- [SEEDDATA-CORE] = MANDATORY core configuration (5 entries)
149
- [SEEDDATA] = Business reference & lookup data
150
- [APPLICATION] = Services, DTOs, Validators
151
- [INFRASTRUCTURE] = Repositories, DbContext, ORM
152
- [API] = REST controllers & endpoints
153
- [FRONTEND] = React pages, components, hooks
154
- [I18N] = Internationalization
155
- [TESTS] = Unit, Integration, Security, E2E
156
- [QA] = Code quality, coverage, security
157
- [CROSS-MODULE] = Multi-module integration (if applicable)
158
-
159
- ═════════════════════════════════════════════════════════════════
160
- ```
161
-
162
- ## Progress Tracker Rules
163
-
164
- - One section per module, in topological order (dependencies first)
165
- - CORE SeedData ALWAYS 5 entries (mandatory)
166
- - Business SeedData varies by module
167
- - Hierarchical task structure (module → layer → tasks)
168
- - Each task is independent, assignable checkbox
169
- - Effort estimate per module (simple/medium/complex)
170
- - Summary with totals across all modules
171
- - Identified dependencies for parallel execution
172
- - Cross-module tasks only if multi-module
1
+ # Progress Tracker Template (templates/tpl-progress.md)
2
+
3
+ > **Used by:** step-05-deploy (section 4: Generate progress.txt)
4
+ > **Purpose:** Template structure for .ralph/progress.txt - populate with module-specific data
5
+
6
+ ## Template
7
+
8
+ ```
9
+ ═════════════════════════════════════════════════════════════════
10
+ SMARTSTACK RALPH LOOP - PROGRESS TRACKER
11
+ Project: {project_name} | Application: {app_name}
12
+ Modules: {count} ({moduleOrder.join(', ')})
13
+ Strategy: {implementation_strategy}
14
+ Created: {timestamp}
15
+ Status: HANDED-OFF
16
+ ═════════════════════════════════════════════════════════════════
17
+
18
+ {For each module in topological order:}
19
+ [MODULE: {module_name}] ({complexity})
20
+ Status: NOT STARTED
21
+ Dependencies: {list of module dependencies or "FOUNDATION"}
22
+
23
+ [DOMAIN] Entity & Value Object Definitions
24
+ □ Define {Entity1} entity with properties and validation
25
+ □ Define {Entity2} entity with relationships
26
+ □ Define {ValueObject1} value object
27
+ □ Define domain exceptions
28
+ □ Total: X tasks
29
+
30
+ [SEEDDATA-CORE] Core Configuration (MANDATORY)
31
+ □ NavigationApplicationSeedData - Application navigation entry (once per app)
32
+ □ ApplicationRolesSeedData - Application-scoped roles (once per app)
33
+ □ NavigationModuleSeedData - Module navigation structure (per module)
34
+ □ PermissionsSeedData - RBAC permissions (per module)
35
+ □ RolesSeedData - Role-permission mappings (per module)
36
+ □ {App}SeedDataProvider - IClientSeedDataProvider (4 methods)
37
+ Total: 2 app-level + 3 per-module + 1 provider
38
+
39
+ [SEEDDATA] Business Reference Data
40
+ □ Seed {Entity1} reference data
41
+ □ Seed {Entity2} lookup values
42
+ □ Total: Y business seed tasks
43
+
44
+ [APPLICATION] Services & Business Logic
45
+ □ Create {ServiceName}Service for {UC1}
46
+ □ Create {DtoName}Dto for API contracts
47
+ □ Create {ValidatorName}Validator for input validation
48
+ □ Implement query handlers
49
+ Total: Z tasks
50
+
51
+ [INFRASTRUCTURE] Repositories & Persistence
52
+ □ Create {Entity1}Repository with CRUD + custom queries
53
+ □ Create {Entity2}Repository
54
+ □ Configure DbContext for module
55
+ □ Setup specifications for complex queries
56
+ □ Create IClientSeedDataProvider (client projects ONLY - injects core seeds at runtime)
57
+ □ Create DevDataSeeder + SeedConstants (if first module)
58
+ □ Total: A tasks
59
+
60
+ [API] REST Endpoints & Controllers
61
+ □ Create {ModuleNameController} GET endpoints (List, GetById)
62
+ □ Create {ModuleNameController} POST endpoint (Create)
63
+ □ Create {ModuleNameController} PUT endpoint (Update)
64
+ □ Create {ModuleNameController} DELETE endpoint (Delete)
65
+ □ Implement error handling and validation responses
66
+ Total: B tasks
67
+
68
+ [FRONTEND] UI Components & Pages (wireframe-driven)
69
+ □ Create {ModuleName}Page for listing [wireframe: {module}-list]
70
+ □ Create {ModuleName}DetailPage for viewing [wireframe: {module}-detail]
71
+ □ Create {ModuleName}Form component for creation/edit [wireframe: {module}-create]
72
+ □ Create custom hook use{ModuleName}
73
+ □ Implement pagination, filtering, sorting
74
+ □ Validate all pages match their wireframe layout
75
+ □ ⚠️ Routes MUST be INSIDE the AppLayout wrapper
76
+ Total: C tasks
77
+
78
+ [I18N] Internationalization Keys
79
+ □ Define i18n keys for {Module} UI labels
80
+ □ Setup translations for locales: fr, en, it, de
81
+ Total: D keys
82
+
83
+ [TESTS] Unit & Integration Tests
84
+ □ Unit tests for {Entity} domain logic
85
+ □ Unit tests for {ServiceName}Service
86
+ □ Integration tests for {ModuleNameController}
87
+ □ Security tests for authorization & tenant isolation
88
+ □ E2E tests for critical user flows
89
+ Total: E unit + F integration + G security = H tests
90
+
91
+ [QA] Quality Assurance
92
+ □ Code review against SmartStack conventions
93
+ □ Test coverage minimum 80%
94
+ □ Security scan for OWASP vulnerabilities
95
+ □ Performance testing under load
96
+ Total: 4 QA tasks
97
+
98
+ Module Total: X + 5 + Y + Z + A + B + C + D + H + 4 = {module_total} tasks
99
+ Estimated Effort: {simple/medium/complex} - {1-3/3-8/8-15} days
100
+
101
+ {If multi-module:}
102
+ [CROSS-MODULE] Integration Tasks
103
+ Status: NOT STARTED
104
+ Dependencies: All modules COMPLETED
105
+
106
+ □ Verify cross-module entity relationships
107
+ □ Test cross-module API dependencies
108
+ □ Validate permission matrix across modules
109
+ □ E2E flow tests spanning multiple modules
110
+ □ Cross-module data consistency checks
111
+ □ Integration test suite for module interactions
112
+ Total: 6 CROSS-MODULE tasks
113
+
114
+ ═════════════════════════════════════════════════════════════════
115
+ SUMMARY
116
+ ═════════════════════════════════════════════════════════════════
117
+ Total Modules: {count}
118
+ Total Tasks: {total_count}
119
+ - CORE SeedData: {count} × 5 = {total_core}
120
+ - Business Tasks: {total_biz}
121
+ - Development: {total_dev}
122
+ - Tests: {total_tests}
123
+ - QA: {total_qa}
124
+ - Cross-Module: {cross_module_count or 0}
125
+
126
+ Strategy: {strategy}
127
+ Module Order: {topological order with dependencies noted}
128
+
129
+ Complexity Distribution:
130
+ Simple: {count} modules ({estimate} days each)
131
+ Medium: {count} modules ({estimate} days each)
132
+ Complex: {count} modules ({estimate} days each)
133
+
134
+ Total Effort Estimate: {total_days} days ({total_hours} hours)
135
+ Per Developer (2): {total_days / 2} days
136
+ Parallel Potential: {strategy_efficiency_percent}%
137
+
138
+ ═════════════════════════════════════════════════════════════════
139
+ LEGEND
140
+ ═════════════════════════════════════════════════════════════════
141
+ □ = Task not started
142
+ ✓ = Task completed
143
+ ⚠ = Task in progress
144
+ ✗ = Task failed / blocked
145
+
146
+ COLORS:
147
+ [DOMAIN] = Domain Model & Business Logic
148
+ [SEEDDATA-CORE] = MANDATORY core configuration (5 entries)
149
+ [SEEDDATA] = Business reference & lookup data
150
+ [APPLICATION] = Services, DTOs, Validators
151
+ [INFRASTRUCTURE] = Repositories, DbContext, ORM
152
+ [API] = REST controllers & endpoints
153
+ [FRONTEND] = React pages, components, hooks
154
+ [I18N] = Internationalization
155
+ [TESTS] = Unit, Integration, Security, E2E
156
+ [QA] = Code quality, coverage, security
157
+ [CROSS-MODULE] = Multi-module integration (if applicable)
158
+
159
+ ═════════════════════════════════════════════════════════════════
160
+ ```
161
+
162
+ ## Progress Tracker Rules
163
+
164
+ - One section per module, in topological order (dependencies first)
165
+ - CORE SeedData ALWAYS 5 entries (mandatory)
166
+ - Business SeedData varies by module
167
+ - Hierarchical task structure (module → layer → tasks)
168
+ - Each task is independent, assignable checkbox
169
+ - Effort estimate per module (simple/medium/complex)
170
+ - Summary with totals across all modules
171
+ - Identified dependencies for parallel execution
172
+ - Cross-module tasks only if multi-module
@@ -5,7 +5,7 @@ argument-hint: "[-m N] [-c TEXT] [-v] <task description>"
5
5
  ---
6
6
 
7
7
  <objective>
8
- Execute the Ralph Weegund technique — iterative module orchestration. Ralph reads PRDs from `/business-analyse`, resolves task dependencies, and delegates all code generation to `/apex -d`. Uses progress persistence and Agent Teams for multi-module parallelization.
8
+ Execute the Ralph Weegund technique — iterative module orchestration. Ralph reads PRDs from `/derive-prd`, resolves task dependencies, and delegates all code generation to `/apex -d`. Uses progress persistence and Agent Teams for multi-module parallelization.
9
9
 
10
10
  **Key principle:** Ralph ORCHESTRATES (task selection, module sequencing, PRD state, reporting). All code generation is delegated to `/apex`.
11
11
  </objective>
@@ -15,6 +15,7 @@ Execute the Ralph Weegund technique — iterative module orchestration. Ralph re
15
15
  **From Business Analysis (RECOMMENDED):**
16
16
  ```bash
17
17
  /business-analyse MyFeature
18
+ # Then: /derive-prd
18
19
  # Then: /ralph-loop -r
19
20
  ```
20
21
 
@@ -43,9 +44,9 @@ Execute the Ralph Weegund technique — iterative module orchestration. Ralph re
43
44
 
44
45
  **Single module:**
45
46
  1. Init: parse flags, verify MCP, setup .ralph/ (step-00)
46
- 2. Load tasks from prd.json — unified v3 has pre-computed tasks (step-01, READ ONCE)
47
- 3. Execute first task (step-02, READ ONCE)
48
- 4. Commit + update progress (step-03, READ ONCE)
47
+ 2. Load tasks from prd.json — unified v3 has pre-computed tasks (step-01, step FILE read once)
48
+ 3. Execute first task (step-02, step FILE read once)
49
+ 4. Commit + update progress (step-03, step FILE read once)
49
50
  5. Check completion → enter COMPACT LOOP (step-04)
50
51
  6. **COMPACT LOOP** (step-04 → references/compact-loop.md):
51
52
  - Find eligible → batch by category (max 5) → execute → test → commit → loop
@@ -105,6 +106,7 @@ LOAD → DELEGATE TO /apex -d → VERIFY PRD STATE → COMMIT PRD → NEXT MODUL
105
106
  | `{section_phases}` | SectionPhase[] | Phase execution plan (Phase 0: foundation, Phase 1..N: per-section) |
106
107
  | `{parallel_mode}` | boolean | Teams mode enabled via `-p` flag. Ralph generates Phase 0 (entities) sequentially, then spawns parallel teammates. |
107
108
  | `{team_name}` | string\|null | Team name for parallel mode (e.g., "smartstack-hr") |
109
+ | `{team_active}` | boolean | True after `TeamCreate`, false after `TeamDelete`. Used in step-04 section 3a to send `MODULE_COMPLETE` to team-lead instead of advancing the module queue locally. |
108
110
  </state_variables>
109
111
 
110
112
  <mcp_requirements>
@@ -162,6 +164,10 @@ When the user invokes `/ralph-loop`, they are giving you the instruction to:
162
164
  | 04 | `steps/step-04-check.md` | Check completion, compact loop entry | ~185 |
163
165
  | 05 | `steps/step-05-report.md` | Generate final report | ~150 |
164
166
 
167
+ > **"Read Once" rule:** Each **step file** (step-01 to step-04) is loaded only once at the start of the first iteration. From iteration 2 onward, `compact-loop.md` drives the loop inline — step files are NOT re-read. This reduces context consumption. **Exception:** prd.json is re-read every iteration (it changes); step files are not.
168
+
169
+ > **Distinction:** `/apex -d prd.json` is invoked every iteration (B2 of compact-loop) — that is normal and expected. "Read Once" applies only to the step instruction files, not to data files or apex delegations.
170
+
165
171
  **Reference files (loaded conditionally):**
166
172
  | File | Loaded when |
167
173
  |------|-------------|
@@ -151,14 +151,30 @@ if (guardrailsNeeded.length > 0) {
151
151
 
152
152
  ## Artifact Verification
153
153
 
154
- After category check, verify artifacts actually exist for completed tasks:
154
+ After category check, verify artifacts actually exist for completed tasks.
155
+
156
+ > **Patterns read from PRD metadata first** (`prd.metadata.artifactPatterns`), falling back to SmartStack defaults.
157
+ > This allows non-standard project structures to work without hardcoded paths.
155
158
 
156
159
  ```javascript
157
160
  const completedCats = new Set(prd.tasks.filter(t => t.status === 'completed').map(t => t.category));
161
+
162
+ // Read custom patterns from PRD metadata (set by ss derive-prd based on project structure)
163
+ const customPatterns = prd.metadata?.artifactPatterns || {};
164
+
158
165
  const artifactChecks = {
159
- 'frontend': () => glob.sync('**/src/pages/**/*.tsx').length > 0,
160
- 'test': () => glob.sync('tests/**/*Tests.cs').length > 0,
161
- 'api': () => glob.sync('src/*/Controllers/**/*Controller.cs').length > 0
166
+ 'frontend': () => {
167
+ const patterns = customPatterns.frontend || ['**/src/pages/**/*.tsx', '**/src/app/**/*.tsx'];
168
+ return patterns.some(p => glob.sync(p).length > 0);
169
+ },
170
+ 'test': () => {
171
+ const patterns = customPatterns.test || ['tests/**/*Tests.cs', '**/*.spec.ts', '**/*.test.ts'];
172
+ return patterns.some(p => glob.sync(p).length > 0);
173
+ },
174
+ 'api': () => {
175
+ const patterns = customPatterns.api || ['src/*/Controllers/**/*Controller.cs', 'src/**/controllers/**/*.ts'];
176
+ return patterns.some(p => glob.sync(p).length > 0);
177
+ }
162
178
  };
163
179
 
164
180
  for (const [cat, check] of Object.entries(artifactChecks)) {
@@ -36,7 +36,7 @@ if (prd._sectionSplit?.enabled) {
36
36
 
37
37
  if (!nextPhase) {
38
38
  // All phases done — check if master PRD tasks are all complete
39
- goto CHECK_COMPLETION;
39
+ // → STOP this section. Return to step-04 section 1 (CHECK_COMPLETION path).
40
40
  }
41
41
 
42
42
  const depsOk = nextPhase.dependsOn.every(depIdx =>
@@ -46,7 +46,7 @@ if (prd._sectionSplit?.enabled) {
46
46
  if (!depsOk) {
47
47
  // Phase blocked — should not happen with topological sort
48
48
  console.warn(`Phase ${nextPhase.phase} blocked — dependencies incomplete`);
49
- goto CHECK_COMPLETION;
49
+ // → STOP this section. Return to step-04 section 1 (CHECK_COMPLETION path).
50
50
  }
51
51
 
52
52
  const phaseLabel = nextPhase.type === 'foundation'
@@ -54,11 +54,14 @@ if (prd._sectionSplit?.enabled) {
54
54
  : `Phase ${nextPhase.phase}: Section "${nextPhase.sectionCode}" (${nextPhase.entities.length} entities)`;
55
55
  console.log(`[{iteration}/{max}] SECTION SPLIT: ${phaseLabel}`);
56
56
 
57
- // INVOKE /apex -d {nextPhase.prdFile}
58
- // Apex sees a normal (smaller) PRD and executes normally
57
+ // MANDATORY: execute this skill call now (not pseudo-code)
58
+ ```
59
+
60
+ **INVOKE `/apex -d {nextPhase.prdFile}`**
61
+
62
+ Apex sees a focused PRD for this phase only. After apex returns, continue:
59
63
 
60
- // After apex returns: merge results back into master PRD
61
- // Read references/section-splitting.md sections 7-9
64
+ ```javascript
62
65
  const phasePrd = readJSON(nextPhase.prdFile);
63
66
  for (const phaseTask of phasePrd.tasks) {
64
67
  const masterTask = prd.tasks.find(t => t.id === phaseTask.id);
@@ -96,7 +99,7 @@ if (prd._sectionSplit?.enabled) {
96
99
  writeJSON('.ralph/prd.json', prd);
97
100
 
98
101
  // → Skip to section C (commit PRD state), then D (loop back)
99
- goto COMMIT_PRD;
102
+ // → SKIP sections A and B. Jump directly to section C (COMMIT_PRD) below.
100
103
  }
101
104
  ```
102
105
 
@@ -112,43 +115,65 @@ if (prd._sectionSplit?.enabled) {
112
115
  ```javascript
113
116
  const MAX_RETRIES = 3;
114
117
 
118
+ // DEAD-END PRE-CHECK: verify if we are truly stuck BEFORE resetting retries.
119
+ // Resetting retries FIRST would mask a dead-end — the check must run on the raw state.
120
+ const failedBeforeRetry = prd.tasks.filter(t => t.status === 'failed');
121
+ const retriableBeforeReset = failedBeforeRetry.filter(t => (t._retryCount || 0) < MAX_RETRIES);
122
+ const hasPendingBeforeRetry = prd.tasks.some(t => t.status === 'pending');
123
+ const allDoneBeforeRetry = prd.tasks.every(t => t.status === 'completed' || t.status === 'skipped');
124
+
125
+ const isDeadEnd = !hasPendingBeforeRetry && !allDoneBeforeRetry && retriableBeforeReset.length === 0;
126
+
127
+ if (isDeadEnd) {
128
+ // TRUE dead-end: no pending tasks, not all done, and no retries left.
129
+ // Mark prd.status = 'failed' NOW so step-04 section 4 routes to step-05.
130
+ // Then fall through to `eligible.length === 0` below which returns to step-04.
131
+ console.log(`DEAD-END: ${prd.tasks.filter(t=>t.status==='completed').length} done, ${failedBeforeRetry.length} failed (retries exhausted), ${prd.tasks.filter(t=>t.status==='blocked').length} blocked`);
132
+ prd.status = 'failed';
133
+ writeJSON('.ralph/prd.json', prd);
134
+ // DO NOT reset retries below — skip to eligible search (will find 0 tasks → CHECK_COMPLETION)
135
+ }
136
+
115
137
  // RETRY: Reset failed tasks to pending if retries remain (max 3 attempts per task)
116
- for (const task of prd.tasks) {
117
- if (task.status !== 'failed') continue;
118
- const retryCount = task._retryCount || 0;
119
- if (retryCount < MAX_RETRIES) {
120
- task.status = 'pending';
121
- task._retryCount = retryCount + 1;
122
- task.error = null;
123
- console.log(`RETRY [${task.id}] attempt ${retryCount + 1}/${MAX_RETRIES}: ${task.description.substring(0, 60)}`);
138
+ // Skipped when isDeadEnd = true (no retriable tasks remain anyway).
139
+ if (!isDeadEnd) {
140
+ for (const task of prd.tasks) {
141
+ if (task.status !== 'failed') continue;
142
+ const retryCount = task._retryCount || 0;
143
+ if (retryCount < MAX_RETRIES) {
144
+ task.status = 'pending';
145
+ task._retryCount = retryCount + 1;
146
+ task.error = null;
147
+ console.log(`RETRY [${task.id}] attempt ${retryCount + 1}/${MAX_RETRIES}: ${task.description.substring(0, 60)}`);
148
+ }
124
149
  }
125
- }
126
150
 
127
- // Unblock tasks whose dependencies are no longer failed (due to retries above)
128
- for (const task of prd.tasks) {
129
- if (task.status !== 'blocked') continue;
130
- const stillBlocked = task.dependencies.some(depId => {
131
- const dep = prd.tasks.find(t => t.id === depId);
132
- return dep && (dep.status === 'failed' || dep.status === 'blocked');
133
- });
134
- if (!stillBlocked) {
135
- task.status = 'pending';
136
- task.error = null;
137
- console.log(`UNBLOCKED [${task.id}]: dependencies resolved`);
151
+ // Unblock tasks whose dependencies are no longer failed (due to retries above)
152
+ for (const task of prd.tasks) {
153
+ if (task.status !== 'blocked') continue;
154
+ const stillBlocked = task.dependencies.some(depId => {
155
+ const dep = prd.tasks.find(t => t.id === depId);
156
+ return dep && (dep.status === 'failed' || dep.status === 'blocked');
157
+ });
158
+ if (!stillBlocked) {
159
+ task.status = 'pending';
160
+ task.error = null;
161
+ console.log(`UNBLOCKED [${task.id}]: dependencies resolved`);
162
+ }
138
163
  }
139
- }
140
164
 
141
- // Block pending tasks whose dependencies are still failed/blocked
142
- for (const task of prd.tasks) {
143
- if (task.status !== 'pending') continue;
144
- const depsBlocked = task.dependencies.some(depId => {
145
- const dep = prd.tasks.find(t => t.id === depId);
146
- return dep && (dep.status === 'failed' || dep.status === 'blocked');
147
- });
148
- if (depsBlocked) { task.status = 'blocked'; task.error = 'Blocked by failed dependency'; }
149
- }
165
+ // Block pending tasks whose dependencies are still failed/blocked
166
+ for (const task of prd.tasks) {
167
+ if (task.status !== 'pending') continue;
168
+ const depsBlocked = task.dependencies.some(depId => {
169
+ const dep = prd.tasks.find(t => t.id === depId);
170
+ return dep && (dep.status === 'failed' || dep.status === 'blocked');
171
+ });
172
+ if (depsBlocked) { task.status = 'blocked'; task.error = 'Blocked by failed dependency'; }
173
+ }
150
174
 
151
- writeJSON('.ralph/prd.json', prd);
175
+ writeJSON('.ralph/prd.json', prd);
176
+ } // end if (!isDeadEnd)
152
177
 
153
178
  // Find ALL eligible tasks (dependencies met)
154
179
  const eligible = prd.tasks.filter(task => {
@@ -160,8 +185,8 @@ const eligible = prd.tasks.filter(task => {
160
185
  });
161
186
 
162
187
  if (eligible.length === 0) {
163
- // Dead-end or all done — return to step-04 sections 2-4
164
- goto CHECK_COMPLETION;
188
+ // All done or dead-end — return to step-04 sections 2-4
189
+ // [goto CHECK_COMPLETION]
165
190
  }
166
191
 
167
192
  // BATCH: group by category, take first group (max 5)
@@ -265,21 +290,28 @@ chore(ralph): update PRD state — iteration {iteration}
265
290
  Tasks: {completed}/{batch_size} completed via /apex
266
291
  Overall: {totalCompleted}/{total}
267
292
 
268
- Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
293
+ Co-Authored-By: Claude AI <noreply@anthropic.com>
269
294
  EOF
270
295
  )"
271
296
  ```
272
297
 
273
298
  ### C4. PRD Sync Verification (HARD CHECK)
274
299
 
275
- ```javascript
276
- const prdVerify = readJSON('.ralph/prd.json');
277
- const actuallyCompleted = prdVerify.tasks.filter(t => batchIds.includes(t.id) && t.status === 'completed');
300
+ > **Note:** `prdCheck` (read in C1) is the authoritative post-apex snapshot.
301
+ > `completed` (from B3) was computed on a DIFFERENT read — do NOT mix the two.
302
+ > Re-derive the count from `prdCheck` to avoid stale-reference mismatches.
278
303
 
279
- if (actuallyCompleted.length !== completed) {
280
- console.error('PRD SYNC ERROR: Mismatch between apex results and prd.json');
281
- // Force re-read apex may have written after our read
282
- // DO NOT overwrite apex is the source of truth for task statuses
304
+ ```javascript
305
+ // Re-derive completed count from the SAME object used for the commit (prdCheck)
306
+ const actuallyCompleted = prdCheck.tasks.filter(t => batchIds.includes(t.id) && t.status === 'completed').length;
307
+ const actuallyFailed = prdCheck.tasks.filter(t => batchIds.includes(t.id) && t.status === 'failed').length;
308
+
309
+ if (actuallyCompleted !== completed) {
310
+ console.warn(`PRD SYNC WARNING: B3 reported ${completed} completed, prdCheck shows ${actuallyCompleted}`);
311
+ console.warn('Using prdCheck as source of truth (apex may have written between reads)');
312
+ // DO NOT overwrite prdCheck — apex is the source of truth for task statuses
313
+ // Update local `completed` variable for progress reporting consistency
314
+ completed = actuallyCompleted;
283
315
  }
284
316
  ```
285
317
 
@@ -88,7 +88,9 @@ if (handoffStatus === 'handed-off') {
88
88
  console.log('BA artifacts detected without PRD — auto-recovering...');
89
89
 
90
90
  // Call ss derive-prd to generate PRD files
91
- const result = exec(`ss derive-prd --application ${masterFeature}`);
91
+ // Flag: --feature (path to feature.json) — matches ss derive-prd CLI convention
92
+ // See also: step-05c-ralph-readiness.md section 2 "Fix: ss derive-prd --feature {path} --output ..."
93
+ const result = exec(`ss derive-prd --feature ${masterFeature}`);
92
94
 
93
95
  if (result.exitCode !== 0) {
94
96
  console.error('ss derive-prd failed — cannot auto-recover');
@@ -107,7 +109,7 @@ if (handoffStatus === 'handed-off') {
107
109
  // BA handoff NOT complete
108
110
  console.warn(`⚠ BA handoff status: "${handoffStatus}" (expected "handed-off")`);
109
111
  console.warn('Cannot auto-recover PRD files without complete handoff');
110
- console.warn('Run /business-analyse to complete the handoff, then retry /ralph-loop');
112
+ console.warn('Run /derive-prd to generate the handoff, then retry /ralph-loop');
111
113
  STOP;
112
114
  }
113
115
  ```