@atlashub/smartstack-cli 3.10.0 → 3.13.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 (35) 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 +2 -2
  6. package/templates/agents/db-reader.md +149 -0
  7. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +9 -19
  8. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +12 -2
  9. package/templates/skills/business-analyse/references/deploy-data-build.md +36 -25
  10. package/templates/skills/business-analyse/references/detection-strategies.md +424 -0
  11. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -0
  12. package/templates/skills/business-analyse/references/prd-generation.md +258 -0
  13. package/templates/skills/business-analyse/references/validate-incremental-html.md +47 -4
  14. package/templates/skills/business-analyse/references/validation-checklist.md +281 -0
  15. package/templates/skills/business-analyse/steps/step-00-init.md +50 -221
  16. package/templates/skills/business-analyse/steps/step-01-cadrage.md +8 -22
  17. package/templates/skills/business-analyse/steps/step-03a-data.md +20 -446
  18. package/templates/skills/business-analyse/steps/step-03a1-setup.md +356 -0
  19. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +143 -0
  20. package/templates/skills/business-analyse/steps/step-03b-ui.md +3 -0
  21. package/templates/skills/business-analyse/steps/step-03c-compile.md +1 -1
  22. package/templates/skills/business-analyse/steps/step-03d-validate.md +21 -262
  23. package/templates/skills/business-analyse/steps/step-04-consolidation.md +21 -606
  24. package/templates/skills/business-analyse/steps/step-04a-collect.md +304 -0
  25. package/templates/skills/business-analyse/steps/step-04b-analyze.md +239 -0
  26. package/templates/skills/business-analyse/steps/step-04c-decide.md +186 -0
  27. package/templates/skills/business-analyse/steps/step-05b-deploy.md +21 -0
  28. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +27 -35
  29. package/templates/skills/debug/SKILL.md +156 -53
  30. package/templates/skills/debug/references/team-protocol.md +232 -0
  31. package/templates/skills/ralph-loop/references/category-rules.md +46 -0
  32. package/templates/skills/ralph-loop/references/compact-loop.md +32 -2
  33. package/templates/skills/ralph-loop/references/core-seed-data.md +60 -0
  34. package/templates/skills/ralph-loop/steps/step-00-init.md +64 -1
  35. package/templates/skills/ralph-loop/steps/step-04-check.md +27 -2
@@ -1,628 +1,43 @@
1
1
  ---
2
2
  name: step-04-consolidation
3
- description: Cross-module consolidation - interactions, permission coherence, E2E flows, final approval
3
+ description: Cross-module consolidation - REDIRECTS to step-04a (refactored into 3 sub-steps)
4
4
  model: opus
5
- next_step: steps/step-05a-handoff.md
5
+ next_step: steps/step-04a-collect.md
6
6
  ---
7
7
 
8
- > **Context files:** `_shared.md` | `_suggestions.md`
8
+ > **NOTICE:** This step has been refactored into 3 sub-steps for better context management.
9
9
 
10
- # Step 4: Consolidation
10
+ # Step 4: Consolidation (Entry Point)
11
11
 
12
- ## MANDATORY EXECUTION RULES
13
- - ALWAYS load summaries of ALL completed modules
14
- - NEVER duplicate module content - work with summaries only
15
- - ALWAYS validate permission coherence across modules
16
- - This step auto-validates for single-module (trivial consolidation)
17
- - Final client approval is BLOCKING before handoff
12
+ This step has been divided into 3 focused sub-steps:
18
13
 
19
- ## YOUR TASK
20
- Consolidate all specified modules into a coherent application. Detect cross-module interactions, verify permission coherence, trace E2E flows, and obtain final client approval.
14
+ 1. **step-04a-collect.md** - Collect module summaries and cross-module interactions
15
+ 2. **step-04b-analyze.md** - Analyze permissions, validation, E2E flows, and risks
16
+ 3. **step-04c-decide.md** - Obtain final approval and write consolidation
21
17
 
22
18
  ---
23
19
 
24
- ## EXECUTION SEQUENCE
20
+ ## Automatic Redirect
25
21
 
26
- ### 1. Read Module Summaries
22
+ **Loading:** `./step-04a-collect.md`
27
23
 
28
- ```
29
- ba-reader.getCompletedModulesSummary({feature_id})
30
- → For each module: code, entities[], key BRs, permissions[], dependencies
31
- → Max 100 lines per module summary
32
-
33
- ba-reader.readApplicationContext({feature_id})
34
- → cadrage.applicationRoles, modules[], dependencyGraph
35
- ```
36
-
37
- IF status already "consolidated":
38
- Display: "Consolidation already completed. Loading next step."
39
- Load: steps/step-05a-handoff.md
40
- STOP
41
-
42
- ### 2. Cross-Module Interactions
43
-
44
- **2a. Foreign Key References**
45
-
46
- For each dependency edge in dependencyGraph:
47
- ```json
48
- {
49
- "from": "Orders",
50
- "to": "Customers",
51
- "type": "FK",
52
- "references": [
53
- {
54
- "sourceEntity": "Order",
55
- "sourceField": "CustomerId",
56
- "targetEntity": "Customer",
57
- "targetField": "Id",
58
- "cardinality": "N:1",
59
- "cascadeDelete": false,
60
- "required": true
61
- }
62
- ]
63
- }
64
- ```
65
-
66
- Verify each FK reference exists in the corresponding module's entities.
67
- IF missing → WARNING + ask user to confirm or add.
68
-
69
- **2b. Shared Entities**
70
-
71
- Detect entities referenced by multiple modules:
72
- ```json
73
- {
74
- "sharedEntities": [
75
- {
76
- "entity": "Customer",
77
- "definedIn": "Customers",
78
- "referencedBy": ["Orders", "Invoices"],
79
- "referenceType": "FK"
80
- }
81
- ]
82
- }
83
- ```
84
-
85
- **2c. Event-Based Interactions**
86
-
87
- Identify event flows between modules:
88
- ```json
89
- {
90
- "events": [
91
- {
92
- "producer": "Orders",
93
- "event": "OrderApproved",
94
- "consumers": ["Invoices"],
95
- "description": "When an order is approved, an invoice is auto-generated"
96
- }
97
- ]
98
- }
99
- ```
100
-
101
- **2d. Shared Reference Data**
102
-
103
- Identify shared lookup/reference tables:
104
- ```json
105
- {
106
- "sharedReferenceData": [
107
- {
108
- "table": "Currency",
109
- "usedBy": ["Orders", "Invoices"],
110
- "owner": "shared"
111
- }
112
- ]
113
- }
114
- ```
115
-
116
- **2e. Cross-Module Reference Validation (ENHANCED)**
117
-
118
- > **CRITICAL:** Verify ALL cross-module entity references are resolvable.
119
- > **Purpose:** Prevent broken FK references and runtime errors in ralph-loop.
120
-
121
- **Process:**
122
-
123
- 1. **Build Entity Registry:**
124
- ```javascript
125
- const entityRegistry = {};
126
- for (const module of completedModules) {
127
- entityRegistry[module.code] = {
128
- entities: module.analysis.entities.map(e => ({
129
- name: e.name,
130
- attributes: e.attributes.map(a => a.name),
131
- pk: e.attributes.find(a => a.name === "Id" || a.unique)?.name || "Id"
132
- }))
133
- };
134
- }
135
- ```
136
-
137
- 2. **Extract Cross-Module References:**
138
-
139
- For EACH module, scan all entity relationships:
140
- ```javascript
141
- for (const entity of module.analysis.entities) {
142
- for (const rel of entity.relationships) {
143
- // Detect cross-module reference
144
- if (rel.target.includes(".")) {
145
- // Format: "ModuleName.EntityName.FieldName" or "ModuleName.EntityName"
146
- const [targetModule, targetEntity, targetField] = rel.target.split(".");
147
-
148
- // Validate: target module exists
149
- if (!entityRegistry[targetModule]) {
150
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent module "${targetModule}"`);
151
- }
152
-
153
- // Validate: target entity exists in target module
154
- const targetModuleEntities = entityRegistry[targetModule].entities;
155
- const resolvedEntity = targetModuleEntities.find(e => e.name === targetEntity);
156
- if (!resolvedEntity) {
157
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent entity "${targetEntity}" in module "${targetModule}"`);
158
- }
159
-
160
- // Validate: target field exists (if specified)
161
- if (targetField && !resolvedEntity.attributes.includes(targetField)) {
162
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent field "${targetField}" on "${targetModule}.${targetEntity}"`);
163
- }
164
-
165
- // Record valid reference
166
- crossModuleReferences.push({
167
- sourceModule: module.code,
168
- sourceEntity: entity.name,
169
- sourceField: rel.sourceField || `${targetEntity}Id`,
170
- targetModule,
171
- targetEntity,
172
- targetField: targetField || resolvedEntity.pk,
173
- type: rel.type,
174
- cardinality: rel.cardinality || "N:1",
175
- status: "RESOLVED"
176
- });
177
- }
178
- }
179
- }
180
- ```
181
-
182
- 3. **Validate Dependency Graph Alignment:**
183
-
184
- ```javascript
185
- // For each cross-module reference, verify dependency edge exists
186
- for (const ref of crossModuleReferences) {
187
- const dependencyExists = dependencyGraph.edges.find(edge =>
188
- edge.from === ref.sourceModule && edge.to === ref.targetModule
189
- );
190
-
191
- if (!dependencyExists) {
192
- WARNING(`Dependency missing: ${ref.sourceModule} → ${ref.targetModule}`);
193
- WARNING(`Reason: ${ref.sourceEntity}.${ref.sourceField} references ${ref.targetModule}.${ref.targetEntity}`);
194
-
195
- // Auto-fix: add missing dependency edge
196
- dependencyGraph.edges.push({
197
- from: ref.sourceModule,
198
- to: ref.targetModule,
199
- type: "FK",
200
- reason: `${ref.sourceEntity}.${ref.sourceField} → ${ref.targetEntity}`
201
- });
202
-
203
- // Recalculate topological order
204
- topologicalOrder = calculateTopologicalOrder(dependencyGraph);
205
- }
206
- }
207
- ```
208
-
209
- 4. **Display Cross-Module Reference Map:**
210
-
211
- ```
212
- ═══════════════════════════════════════════════════════════════
213
- CROSS-MODULE REFERENCES VALIDATED
214
- ═══════════════════════════════════════════════════════════════
215
-
216
- | Source Module | Source Entity | Target | Type | Status |
217
- |---------------|---------------|--------|------|--------|
218
- | TimeTracking | TimeEntry | Projects.Project.Id | FK (N:1) | ✓ RESOLVED |
219
- | LeaveManagement | LeaveRequest | Projects.Employee.Id | FK (N:1) | ✓ RESOLVED |
220
- | AbsenceManagement | Absence | Projects.Employee.Id | FK (N:1) | ✓ RESOLVED |
221
- | Reporting | ProjectReport | Projects.Project.Id | FK (N:1) | ✓ RESOLVED |
222
-
223
- Total: {count} cross-module references
224
- All references RESOLVED ✓
225
- ═══════════════════════════════════════════════════════════════
226
- ```
227
-
228
- 5. **Detect Circular Dependencies:**
229
-
230
- ```javascript
231
- const cycles = detectCycles(dependencyGraph);
232
-
233
- if (cycles.length > 0) {
234
- BLOCKING_ERROR("Circular dependencies detected:");
235
- for (const cycle of cycles) {
236
- ERROR(` ${cycle.join(" → ")}`);
237
- }
238
-
239
- ACTIONS:
240
- 1. Review module dependencies
241
- 2. Break cycles by:
242
- - Moving shared entities to a separate "Core" module
243
- - Using event-driven communication instead of FK
244
- - Removing unnecessary dependencies
245
- 3. Re-run step-02 decomposition with fixed dependencies
246
-
247
- STOP - DO NOT PROCEED TO HANDOFF
248
- }
249
- ```
250
-
251
- 6. **Store Cross-Module Interaction Data:**
252
-
253
- ```javascript
254
- ba-writer.enrichSection({
255
- featureId: {feature_id},
256
- section: "consolidation",
257
- data: {
258
- crossModuleInteractions: crossModuleReferences.map(ref => ({
259
- fromModule: ref.sourceModule,
260
- toModule: ref.targetModule,
261
- interactionType: "FK_REFERENCE",
262
- description: `${ref.sourceEntity}.${ref.sourceField} → ${ref.targetModule}.${ref.targetEntity}.${ref.targetField}`,
263
- entities: [ref.sourceEntity, ref.targetEntity],
264
- cardinality: ref.cardinality,
265
- status: ref.status
266
- }))
267
- }
268
- });
269
- ```
270
-
271
- **Success Criteria:**
272
- - ✓ All cross-module references resolved
273
- - ✓ Dependency graph aligned with actual references
274
- - ✓ No circular dependencies
275
- - ✓ Topological order valid
276
-
277
- **Failure Handling:**
278
- - BLOCKING errors for unresolved references
279
- - Auto-fix missing dependency edges (with warning)
280
- - Manual intervention required for circular dependencies
281
-
282
- ### 3. Permission Coherence
283
-
284
- > **All modules MUST use the same application-level roles.**
285
-
286
- **3a. Role Consistency**
287
-
288
- Verify all modules use the applicationRoles defined in cadrage:
289
- ```
290
- FOR each module in completedModules:
291
- FOR each role in module.specification.permissionMatrix.roles:
292
- IF role NOT IN cadrage.applicationRoles → ERROR
293
- ```
294
-
295
- **3b. Permission Path Format**
296
-
297
- Verify all permission paths follow the pattern:
298
- `business.{app}.{module}.{resource}.{action}`
299
-
300
- Check for:
301
- - Inconsistent app prefix → ERROR
302
- - Missing module segment → ERROR
303
- - Shortcut paths (not full format) → ERROR
304
-
305
- **3c. Role Hierarchy Coherence**
306
-
307
- Verify the role hierarchy is respected across all modules:
308
- ```
309
- Admin ⊃ Manager ⊃ Contributor ⊃ Viewer
310
-
311
- FOR each module:
312
- IF Admin has fewer permissions than Manager → ERROR
313
- IF Manager has fewer permissions than Contributor → ERROR
314
- IF Contributor has fewer permissions than Viewer → ERROR
315
- ```
316
-
317
- **3d. Permission Conflicts**
318
-
319
- Detect conflicting permission assignments:
320
- ```json
321
- {
322
- "conflicts": [
323
- {
324
- "role": "Manager",
325
- "module1": "Orders",
326
- "permission1": "business.sales.orders.approve",
327
- "module2": "Invoices",
328
- "permission2": "business.sales.invoices.approve",
329
- "issue": "Manager can approve orders but not invoices - is this intentional?"
330
- }
331
- ]
332
- }
333
- ```
334
-
335
- Present conflicts to user via AskUserQuestion:
336
- ```
337
- question: "Le Manager peut approuver les commandes mais pas les factures. Est-ce intentionnel ?"
338
- header: "Permissions"
339
- options:
340
- - label: "Oui, intentionnel"
341
- description: "Les factures nécessitent un niveau d'approbation supérieur"
342
- - label: "Non, corriger"
343
- description: "Le Manager devrait aussi pouvoir approuver les factures"
344
- ```
345
-
346
- ### 4. Semantic Validation (MANDATORY)
347
-
348
- For EACH module feature.json, execute these checks:
349
-
350
- | # | Check | Rule | Severity |
351
- |---|-------|------|----------|
352
- | 1 | Permission orpheline | Every permissionMatrix.permissions[].path is used by at least one useCases[].permission | WARNING |
353
- | 2 | UC sans FR | Every useCases[].id is referenced by at least one functionalRequirements[].linkedUseCases[] | WARNING |
354
- | 3 | Entity sans endpoint | Every entities[].name has at least one endpoint in apiEndpoints[] | WARNING |
355
- | 4 | UC sans scenario | Every useCases[].mainScenario has at least 2 steps | WARNING |
356
- | 5 | Role sans permissions | Every applicationRole has at least one entry in roleAssignments[] | WARNING |
357
- | 6 | Navigation sans traduction | Every navigation.entries[].code has translations in 4 languages in seedDataCore.navigationTranslations[] | ERROR |
358
- | 7 | LifeCycle terminal | Every lifeCycles[].states[] has at least one state with isTerminal: true | WARNING |
359
- | 8 | Schema conformity | No custom fields outside defined schema (no KPIDefinitions, ChartConfigurations, etc.) | ERROR |
360
- | 9 | Wireframe coverage | Every navigation section has a corresponding uiWireframes[].screen | ERROR |
361
- | 10 | Doublon entity | No entity with same name in two different modules (unless shared via dependencyGraph) | ERROR |
362
-
363
- Store results in consolidation.semanticChecks[]:
364
- ```json
365
- {
366
- "check": "permission-orpheline",
367
- "module": "RepairManagement",
368
- "status": "PASS|WARNING|ERROR",
369
- "details": "Permission business.freebike.repairmanagement.export not referenced by any UC",
370
- "autoFixed": false
371
- }
372
- ```
373
-
374
- **Blocking rule:**
375
- - 0 ERROR → PASS
376
- - ≥1 ERROR → BLOCK (fix before handoff, ask user for each)
377
- - WARNING only → PASS with user notification
378
-
379
- ### 4-bis. Structural Schema Conformity Check (MANDATORY)
380
-
381
- > **Post-generation validation.** After semantic checks, verify ALL module feature.json files conform to JSON schema.
382
-
383
- See [references/consolidation-structural-checks.md](../references/consolidation-structural-checks.md) for the full 6-category structural check:
384
- - **A.** Required Sections Presence (18 sections)
385
- - **B.** Field Name Conformity (forbidden vs correct fields)
386
- - **C.** ID Pattern Conformity (BR, UC, FR, Permissions)
387
- - **D.** Cross-Module ID Uniqueness
388
- - **E.** Wireframe Layout Completeness
389
- - **F.** SeedDataCore Translation Coverage
390
-
391
- **Blocking rule:** 0 ERROR → PASS. ≥1 ERROR → BLOCK (attempt auto-fix, re-write, re-check).
392
-
393
- ### 5. End-to-End Flows
394
-
395
- Identify business processes that span multiple modules:
396
-
397
- ```json
398
- {
399
- "e2eFlows": [
400
- {
401
- "name": "Order to Invoice",
402
- "steps": [
403
- { "module": "Customers", "action": "Customer exists", "permission": "customers.read" },
404
- { "module": "Products", "action": "Products selected", "permission": "products.read" },
405
- { "module": "Orders", "action": "Order created", "permission": "orders.create" },
406
- { "module": "Orders", "action": "Order approved", "permission": "orders.approve" },
407
- { "module": "Invoices", "action": "Invoice generated", "permission": "invoices.create" },
408
- { "module": "Invoices", "action": "Invoice sent", "permission": "invoices.update" }
409
- ],
410
- "actors": ["Contributor (create)", "Manager (approve)"],
411
- "data": "Customer → Order → OrderLines (Products) → Invoice → InvoiceLines"
412
- }
413
- ]
414
- }
415
- ```
416
-
417
- Display each E2E flow as a diagram:
418
- ```
419
- Customer ──[read]──→ Order ──[create]──→ Order ──[approve]──→ Invoice ──[create]──→ Invoice ──[send]──→
420
- (Customers) (Orders) (Orders) (Invoices) (Invoices)
421
- Contributor Contributor Manager System Manager
422
- ```
423
-
424
- ### 6. Global Risk Assessment
425
-
426
- Evaluate application-level risks:
427
-
428
- | Risk | Metric | Threshold | Status |
429
- |------|--------|-----------|--------|
430
- | Total entities | {sum across modules} | ≤20 | PASS/WARNING |
431
- | Total BRs | {sum across modules} | ≤50 | PASS/WARNING |
432
- | Cross-module dependencies | {edge count} | ≤10 | PASS/WARNING |
433
- | Shared entities | {count} | ≤5 | PASS/WARNING |
434
- | E2E flow length | {max steps} | ≤8 | PASS/WARNING |
435
- | Permission paths | {total} | ≤100 | PASS/WARNING |
436
-
437
- ### 7. Consolidation Summary
438
-
439
- Display comprehensive summary:
440
- ```
441
- ═══════════════════════════════════════════════════════════
442
- CONSOLIDATION - {application_name}
443
- ═══════════════════════════════════════════════════════════
444
-
445
- ### Modules ({count})
446
- | Module | Entités | BRs | UCs | Complexité |
447
- |--------|---------|-----|-----|------------|
448
- {for each module}
449
-
450
- ### Interactions Cross-Module
451
- - FK References: {count}
452
- - Shared Entities: {count}
453
- - Events: {count}
454
- - Shared Data: {count}
455
-
456
- ### Permissions
457
- - Roles: {count} (coherent: ✓/✗)
458
- - Total paths: {count}
459
- - Conflicts resolved: {count}
460
-
461
- ### E2E Flows
462
- {for each flow: name, modules involved, actors}
463
-
464
- ### Risques Globaux
465
- {risk assessment table}
466
-
467
- ═══════════════════════════════════════════════════════════
468
- ```
469
-
470
- ### 8. Final Client Approval (BLOCKING)
471
-
472
- Ask via AskUserQuestion:
473
- ```
474
- question: "La spécification complète de l'application est prête. Validez-vous l'ensemble ?"
475
- header: "Approbation"
476
- options:
477
- - label: "Approuvé"
478
- description: "Passer au handoff pour la phase d'implémentation"
479
- - label: "Réviser un module"
480
- description: "Retourner à la spécification d'un module spécifique"
481
- - label: "Modifier les interactions"
482
- description: "Ajuster les interactions cross-module"
483
- ```
484
-
485
- IF "Réviser un module":
486
- Ask which module → set currentModuleIndex to that module → load step-03a-data.md
487
-
488
- IF "Modifier les interactions":
489
- Re-enter section 2-4 of this step
490
-
491
- ### 9. Write Consolidation
492
-
493
- > **STRUCTURE CARD: consolidation** — Must match `application-schema.json`. Follow this structure exactly.
494
-
495
- ```
496
- ba-writer.enrichSection({
497
- featureId: {feature_id},
498
- section: "consolidation",
499
- data: {
500
- crossModuleInteractions: [
501
- {
502
- "fromModule": "Orders",
503
- "toModule": "Customers",
504
- "interactionType": "FK-reference|event-publish|event-subscribe|shared-lookup|cascade-delete|cascade-update",
505
- "description": "Order references customer via FK",
506
- "entities": ["Order→Customer"]
507
- }
508
- ],
509
- sharedEntities: [
510
- {
511
- "entity": "Customer",
512
- "ownerModule": "Customers",
513
- "referencedBy": ["Orders", "Invoices"],
514
- "sharedFields": ["code", "name"]
515
- }
516
- ],
517
- permissionCoherence: {
518
- "rolesConsistent": true,
519
- "pathFormatConsistent": true,
520
- "hierarchyRespected": true,
521
- "conflicts": [],
522
- "warnings": []
523
- },
524
- e2eFlows: [
525
- {
526
- "name": "Order to Invoice",
527
- "modules": ["Customers", "Orders", "Invoices"],
528
- "steps": [
529
- { "module": "Orders", "action": "Create order", "permission": "business.sales.orders.create", "dataFlow": "Customer → Order" }
530
- ]
531
- }
532
- ],
533
- globalRiskAssessment: [
534
- {
535
- "risk": "Cross-module coupling complexity",
536
- "category": "coupling|complexity|dependency-chain|security|scope",
537
- "severity": "critical|high|medium|low",
538
- "mitigation": "Event-driven communication instead of direct FK"
539
- }
540
- ],
541
- semanticChecks: [
542
- { "check": "permission-orpheline", "status": "PASS|WARNING|ERROR", "details": "..." },
543
- { "check": "uc-sans-fr", "status": "PASS|WARNING|ERROR", "details": "..." },
544
- { "check": "wireframe-coverage", "status": "PASS|WARNING|ERROR", "details": "..." }
545
- ],
546
- decision: {
547
- "approved": true,
548
- "reason": "All cross-module validations passed",
549
- "approvedBy": "Client",
550
- "approvedAt": "{ISO timestamp}"
551
- }
552
- }
553
- })
554
-
555
- ba-writer.updateStatus({feature_id}, "consolidated")
556
- ```
557
-
558
- > **STRUCTURE DIFFERENCES FROM OLD FORMAT:**
559
- > - `crossModuleInteractions` is a FLAT ARRAY (not `{fkReferences, sharedEntities, events}` nested object)
560
- > - `sharedEntities` is TOP-LEVEL (not nested inside crossModuleInteractions)
561
- > - `decision` is an OBJECT with `approved`, `reason`, `approvedBy`, `approvedAt` (not `clientApproval` string)
562
- > - `globalRiskAssessment` is an ARRAY of risk objects (not `{totalEntities: {value, threshold}}`)
563
-
564
- Add changelog entry:
565
- ```json
566
- {
567
- "step": "step-04-consolidation",
568
- "timestamp": "...",
569
- "changes": [
570
- "Cross-module interactions: X FK, Y events, Z shared entities",
571
- "Permission coherence: validated ({count} paths, {conflicts} conflicts resolved)",
572
- "E2E flows: {count} identified",
573
- "Global risk: {level}",
574
- "Client approval: APPROVED"
575
- ]
576
- }
577
- ```
578
-
579
- ---
580
-
581
- ## SINGLE-MODULE MODE
582
-
583
- When only 1 module:
584
- 1. Skip cross-module interactions (no other modules)
585
- 2. Skip permission coherence check (only one module)
586
- 3. Skip E2E flows (single module)
587
- 4. Auto-approve (no cross-module concerns)
588
- 5. Write minimal consolidation section
589
- 6. Display: "Module unique - consolidation automatique ✓"
590
- 7. Proceed to step-05a-handoff.md
591
-
592
- ---
593
-
594
- ## CONTEXT MANAGEMENT
595
-
596
- | Loaded | Not Loaded |
597
- |--------|------------|
598
- | _shared.md | Full module feature.json files |
599
- | Module summaries (100 lines each) | Questionnaires |
600
- | Master feature.json | Templates |
601
- | cadrage section | React viewer files |
24
+ The consolidation process will execute in sequence:
25
+ - step-04a-collect → step-04b-analyze → step-04c-decide → step-05a-handoff
602
26
 
603
27
  ---
604
28
 
605
- ## WORKFLOW STATE SAVE (for resume support)
29
+ ## Why Refactored?
606
30
 
607
- After consolidation approval, update workflow state to enable resume if context is exhausted during handoff steps:
31
+ **Before:** 628 lines in single file (exceeded 400-line recommendation)
608
32
 
609
- ```
610
- ba-writer.enrichSection({
611
- featureId: {feature_id},
612
- section: "metadata.workflow",
613
- data: {
614
- lastCompletedStep: "step-04-consolidation",
615
- readyForHandoff: true
616
- }
617
- })
618
- ```
33
+ **After:** 3 focused files (~200-280 lines each)
619
34
 
620
- > **Why:** Steps 05a-05b arrive late in the conversation when context may be near exhaustion.
621
- > If BA is interrupted during handoff, the user can resume with `/business-analyse` which will
622
- > detect `lastCompletedStep: "step-04-consolidation"` and resume directly at step-05a.
35
+ **Benefits:**
36
+ - Better context management
37
+ - Clearer separation of concerns (collect analyze → decide)
38
+ - Easier to resume from specific consolidation phase
39
+ - Reduced cognitive load per step
623
40
 
624
41
  ---
625
42
 
626
- ## NEXT STEP
627
-
628
- Load: `./step-05a-handoff.md`
43
+ **Proceeding to step-04a-collect.md...**