@atlashub/smartstack-cli 2.3.0 → 2.5.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 (33) hide show
  1. package/.documentation/cli-commands.html +1 -1
  2. package/.documentation/init.html +1 -1
  3. package/.documentation/installation.html +1 -1
  4. package/dist/index.js +1213 -815
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/templates/agents/ba-reader.md +114 -9
  8. package/templates/agents/ba-writer.md +108 -27
  9. package/templates/agents/mcp-healthcheck.md +1 -1
  10. package/templates/ralph/README.md +1 -1
  11. package/templates/ralph/ralph.config.yaml +1 -1
  12. package/templates/skills/_shared.md +60 -0
  13. package/templates/skills/application/steps/step-00-init.md +32 -8
  14. package/templates/skills/business-analyse/SKILL.md +65 -42
  15. package/templates/skills/business-analyse/_shared.md +161 -51
  16. package/templates/skills/business-analyse/questionnaire/00-application.md +166 -0
  17. package/templates/skills/business-analyse/questionnaire.md +63 -19
  18. package/templates/skills/business-analyse/react/application-viewer.md +242 -0
  19. package/templates/skills/business-analyse/react/components.md +60 -8
  20. package/templates/skills/business-analyse/react/schema.md +238 -7
  21. package/templates/skills/business-analyse/schemas/application-schema.json +389 -0
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +74 -3
  23. package/templates/skills/business-analyse/steps/step-00-init.md +110 -44
  24. package/templates/skills/business-analyse/steps/step-01-cadrage.md +259 -0
  25. package/templates/skills/business-analyse/steps/step-02-decomposition.md +282 -0
  26. package/templates/skills/business-analyse/steps/step-03-specify.md +489 -0
  27. package/templates/skills/business-analyse/steps/step-04-consolidation.md +336 -0
  28. package/templates/skills/business-analyse/steps/step-05-handoff.md +1119 -0
  29. package/templates/skills/mcp/SKILL.md +2 -2
  30. package/templates/skills/business-analyse/steps/step-01-analyse.md +0 -523
  31. package/templates/skills/business-analyse/steps/step-02-specify.md +0 -899
  32. package/templates/skills/business-analyse/steps/step-03-validate.md +0 -1009
  33. package/templates/skills/business-analyse/steps/step-04-handoff.md +0 -1802
@@ -0,0 +1,336 @@
1
+ ---
2
+ name: step-04-consolidation
3
+ description: Cross-module consolidation - interactions, permission coherence, E2E flows, final approval
4
+ model: sonnet
5
+ next_step: steps/step-05-handoff.md
6
+ ---
7
+
8
+ # Step 4: Consolidation
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+ - ALWAYS load summaries of ALL completed modules
12
+ - NEVER duplicate module content - work with summaries only
13
+ - ALWAYS validate permission coherence across modules
14
+ - This step auto-validates for single-module (trivial consolidation)
15
+ - Final client approval is BLOCKING before handoff
16
+
17
+ ## YOUR TASK
18
+ Consolidate all specified modules into a coherent application. Detect cross-module interactions, verify permission coherence, trace E2E flows, and obtain final client approval.
19
+
20
+ ---
21
+
22
+ ## EXECUTION SEQUENCE
23
+
24
+ ### 1. Read Module Summaries
25
+
26
+ ```
27
+ ba-reader.getCompletedModulesSummary({feature_id})
28
+ → For each module: code, entities[], key BRs, permissions[], dependencies
29
+ → Max 100 lines per module summary
30
+
31
+ ba-reader.readApplicationContext({feature_id})
32
+ → cadrage.applicationRoles, modules[], dependencyGraph
33
+ ```
34
+
35
+ IF status already "consolidated":
36
+ Display: "Consolidation already completed. Loading next step."
37
+ Load: steps/step-05-handoff.md
38
+ STOP
39
+
40
+ ### 2. Cross-Module Interactions
41
+
42
+ **2a. Foreign Key References**
43
+
44
+ For each dependency edge in dependencyGraph:
45
+ ```json
46
+ {
47
+ "from": "Orders",
48
+ "to": "Customers",
49
+ "type": "FK",
50
+ "references": [
51
+ {
52
+ "sourceEntity": "Order",
53
+ "sourceField": "CustomerId",
54
+ "targetEntity": "Customer",
55
+ "targetField": "Id",
56
+ "cardinality": "N:1",
57
+ "cascadeDelete": false,
58
+ "required": true
59
+ }
60
+ ]
61
+ }
62
+ ```
63
+
64
+ Verify each FK reference exists in the corresponding module's entities.
65
+ IF missing → WARNING + ask user to confirm or add.
66
+
67
+ **2b. Shared Entities**
68
+
69
+ Detect entities referenced by multiple modules:
70
+ ```json
71
+ {
72
+ "sharedEntities": [
73
+ {
74
+ "entity": "Customer",
75
+ "definedIn": "Customers",
76
+ "referencedBy": ["Orders", "Invoices"],
77
+ "referenceType": "FK"
78
+ }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ **2c. Event-Based Interactions**
84
+
85
+ Identify event flows between modules:
86
+ ```json
87
+ {
88
+ "events": [
89
+ {
90
+ "producer": "Orders",
91
+ "event": "OrderApproved",
92
+ "consumers": ["Invoices"],
93
+ "description": "When an order is approved, an invoice is auto-generated"
94
+ }
95
+ ]
96
+ }
97
+ ```
98
+
99
+ **2d. Shared Reference Data**
100
+
101
+ Identify shared lookup/reference tables:
102
+ ```json
103
+ {
104
+ "sharedReferenceData": [
105
+ {
106
+ "table": "Currency",
107
+ "usedBy": ["Orders", "Invoices"],
108
+ "owner": "shared"
109
+ }
110
+ ]
111
+ }
112
+ ```
113
+
114
+ ### 3. Permission Coherence
115
+
116
+ > **All modules MUST use the same application-level roles.**
117
+
118
+ **3a. Role Consistency**
119
+
120
+ Verify all modules use the applicationRoles defined in cadrage:
121
+ ```
122
+ FOR each module in completedModules:
123
+ FOR each role in module.specification.permissionMatrix.roles:
124
+ IF role NOT IN cadrage.applicationRoles → ERROR
125
+ ```
126
+
127
+ **3b. Permission Path Format**
128
+
129
+ Verify all permission paths follow the pattern:
130
+ `business.{app}.{module}.{resource}.{action}`
131
+
132
+ Check for:
133
+ - Inconsistent app prefix → ERROR
134
+ - Missing module segment → ERROR
135
+ - Shortcut paths (not full format) → ERROR
136
+
137
+ **3c. Role Hierarchy Coherence**
138
+
139
+ Verify the role hierarchy is respected across all modules:
140
+ ```
141
+ Admin ⊃ Manager ⊃ Contributor ⊃ Viewer
142
+
143
+ FOR each module:
144
+ IF Admin has fewer permissions than Manager → ERROR
145
+ IF Manager has fewer permissions than Contributor → ERROR
146
+ IF Contributor has fewer permissions than Viewer → ERROR
147
+ ```
148
+
149
+ **3d. Permission Conflicts**
150
+
151
+ Detect conflicting permission assignments:
152
+ ```json
153
+ {
154
+ "conflicts": [
155
+ {
156
+ "role": "Manager",
157
+ "module1": "Orders",
158
+ "permission1": "business.sales.orders.approve",
159
+ "module2": "Invoices",
160
+ "permission2": "business.sales.invoices.approve",
161
+ "issue": "Manager can approve orders but not invoices - is this intentional?"
162
+ }
163
+ ]
164
+ }
165
+ ```
166
+
167
+ Present conflicts to user via AskUserQuestion:
168
+ ```
169
+ question: "Le Manager peut approuver les commandes mais pas les factures. Est-ce intentionnel ?"
170
+ header: "Permissions"
171
+ options:
172
+ - label: "Oui, intentionnel"
173
+ description: "Les factures nécessitent un niveau d'approbation supérieur"
174
+ - label: "Non, corriger"
175
+ description: "Le Manager devrait aussi pouvoir approuver les factures"
176
+ ```
177
+
178
+ ### 4. End-to-End Flows
179
+
180
+ Identify business processes that span multiple modules:
181
+
182
+ ```json
183
+ {
184
+ "e2eFlows": [
185
+ {
186
+ "name": "Order to Invoice",
187
+ "steps": [
188
+ { "module": "Customers", "action": "Customer exists", "permission": "customers.read" },
189
+ { "module": "Products", "action": "Products selected", "permission": "products.read" },
190
+ { "module": "Orders", "action": "Order created", "permission": "orders.create" },
191
+ { "module": "Orders", "action": "Order approved", "permission": "orders.approve" },
192
+ { "module": "Invoices", "action": "Invoice generated", "permission": "invoices.create" },
193
+ { "module": "Invoices", "action": "Invoice sent", "permission": "invoices.update" }
194
+ ],
195
+ "actors": ["Contributor (create)", "Manager (approve)"],
196
+ "data": "Customer → Order → OrderLines (Products) → Invoice → InvoiceLines"
197
+ }
198
+ ]
199
+ }
200
+ ```
201
+
202
+ Display each E2E flow as a diagram:
203
+ ```
204
+ Customer ──[read]──→ Order ──[create]──→ Order ──[approve]──→ Invoice ──[create]──→ Invoice ──[send]──→
205
+ (Customers) (Orders) (Orders) (Invoices) (Invoices)
206
+ Contributor Contributor Manager System Manager
207
+ ```
208
+
209
+ ### 5. Global Risk Assessment
210
+
211
+ Evaluate application-level risks:
212
+
213
+ | Risk | Metric | Threshold | Status |
214
+ |------|--------|-----------|--------|
215
+ | Total entities | {sum across modules} | ≤20 | PASS/WARNING |
216
+ | Total BRs | {sum across modules} | ≤50 | PASS/WARNING |
217
+ | Cross-module dependencies | {edge count} | ≤10 | PASS/WARNING |
218
+ | Shared entities | {count} | ≤5 | PASS/WARNING |
219
+ | E2E flow length | {max steps} | ≤8 | PASS/WARNING |
220
+ | Permission paths | {total} | ≤100 | PASS/WARNING |
221
+
222
+ ### 6. Consolidation Summary
223
+
224
+ Display comprehensive summary:
225
+ ```
226
+ ═══════════════════════════════════════════════════════════
227
+ CONSOLIDATION - {application_name}
228
+ ═══════════════════════════════════════════════════════════
229
+
230
+ ### Modules ({count})
231
+ | Module | Entités | BRs | UCs | Complexité |
232
+ |--------|---------|-----|-----|------------|
233
+ {for each module}
234
+
235
+ ### Interactions Cross-Module
236
+ - FK References: {count}
237
+ - Shared Entities: {count}
238
+ - Events: {count}
239
+ - Shared Data: {count}
240
+
241
+ ### Permissions
242
+ - Roles: {count} (coherent: ✓/✗)
243
+ - Total paths: {count}
244
+ - Conflicts resolved: {count}
245
+
246
+ ### E2E Flows
247
+ {for each flow: name, modules involved, actors}
248
+
249
+ ### Risques Globaux
250
+ {risk assessment table}
251
+
252
+ ═══════════════════════════════════════════════════════════
253
+ ```
254
+
255
+ ### 7. Final Client Approval (BLOCKING)
256
+
257
+ Ask via AskUserQuestion:
258
+ ```
259
+ question: "La spécification complète de l'application est prête. Validez-vous l'ensemble ?"
260
+ header: "Approbation"
261
+ options:
262
+ - label: "Approuvé"
263
+ description: "Passer au handoff pour la phase d'implémentation"
264
+ - label: "Réviser un module"
265
+ description: "Retourner à la spécification d'un module spécifique"
266
+ - label: "Modifier les interactions"
267
+ description: "Ajuster les interactions cross-module"
268
+ ```
269
+
270
+ IF "Réviser un module":
271
+ Ask which module → set currentModuleIndex to that module → load step-03-specify.md
272
+
273
+ IF "Modifier les interactions":
274
+ Re-enter section 2-4 of this step
275
+
276
+ ### 8. Write Consolidation
277
+
278
+ ```
279
+ ba-writer.enrichSection({
280
+ featureId: {feature_id},
281
+ section: "consolidation",
282
+ data: {
283
+ crossModuleInteractions: { fkReferences, sharedEntities, events, sharedReferenceData },
284
+ permissionCoherence: { roleConsistency, pathFormat, hierarchy, conflicts, resolved },
285
+ e2eFlows: [...],
286
+ globalRiskAssessment: {...}
287
+ }
288
+ })
289
+
290
+ ba-writer.updateStatus({feature_id}, "consolidated")
291
+ ```
292
+
293
+ Add changelog entry:
294
+ ```json
295
+ {
296
+ "step": "step-04-consolidation",
297
+ "timestamp": "...",
298
+ "changes": [
299
+ "Cross-module interactions: X FK, Y events, Z shared entities",
300
+ "Permission coherence: validated ({count} paths, {conflicts} conflicts resolved)",
301
+ "E2E flows: {count} identified",
302
+ "Global risk: {level}",
303
+ "Client approval: APPROVED"
304
+ ]
305
+ }
306
+ ```
307
+
308
+ ---
309
+
310
+ ## SINGLE-MODULE MODE
311
+
312
+ When only 1 module:
313
+ 1. Skip cross-module interactions (no other modules)
314
+ 2. Skip permission coherence check (only one module)
315
+ 3. Skip E2E flows (single module)
316
+ 4. Auto-approve (no cross-module concerns)
317
+ 5. Write minimal consolidation section
318
+ 6. Display: "Module unique - consolidation automatique ✓"
319
+ 7. Proceed to step-05-handoff.md
320
+
321
+ ---
322
+
323
+ ## CONTEXT MANAGEMENT
324
+
325
+ | Loaded | Not Loaded |
326
+ |--------|------------|
327
+ | _shared.md | Full module feature.json files |
328
+ | Module summaries (100 lines each) | Questionnaires |
329
+ | Master feature.json | Templates |
330
+ | cadrage section | React viewer files |
331
+
332
+ ---
333
+
334
+ ## NEXT STEP
335
+
336
+ Load: `./step-05-handoff.md`