@atlashub/smartstack-cli 4.18.0 → 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 (160) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +318 -415
  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 +21 -21
  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 +5 -5
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  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 -36
  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 +3 -3
  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 -4
  87. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +54 -180
  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 -263
  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 +2 -1
  112. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  113. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  114. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  115. package/templates/skills/business-analyse/_architecture.md +0 -124
  116. package/templates/skills/business-analyse/_elicitation.md +0 -206
  117. package/templates/skills/business-analyse/_module-loop.md +0 -115
  118. package/templates/skills/business-analyse/_rules.md +0 -142
  119. package/templates/skills/business-analyse/_suggestions.md +0 -34
  120. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  121. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  122. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  123. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  124. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  125. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  126. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  127. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  128. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  129. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  130. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  131. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  132. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  134. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  135. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  136. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  137. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  138. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  139. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  140. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  141. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  142. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  143. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  144. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  145. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  146. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  147. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  148. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  149. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  150. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  151. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  152. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  153. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  154. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  155. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  156. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  157. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  158. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  159. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  160. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -1,17 +0,0 @@
1
- ---
2
- name: step-04-consolidation
3
- description: "DEPRECATED REDIRECT - All references now point directly to step-04a-collect.md"
4
- model: opus
5
- next_step: steps/step-04a-collect.md
6
- ---
7
-
8
- > **DEPRECATED:** This file is no longer loaded in normal workflow. All step references now point directly to `step-04a-collect.md`. This file is kept for historical reference only.
9
-
10
- # Step 4: Consolidation (Refactored)
11
-
12
- Refactored into 3 sub-steps:
13
- 1. **step-04a-collect.md** - Collect module summaries and cross-module interactions
14
- 2. **step-04b-analyze.md** - Analyze permissions, validation, E2E flows, and risks
15
- 3. **step-04c-decide.md** - Obtain final approval and write consolidation
16
-
17
- Flow: step-04a-collect → step-04b-analyze → step-04c-decide → step-05a-handoff
@@ -1,415 +0,0 @@
1
- ---
2
- name: step-04a-collect
3
- description: Collect module summaries and cross-module interactions
4
- model: opus
5
- next_step: steps/step-04b-analyze.md
6
- ---
7
-
8
- > **Context files:** `_shared.md` | `_suggestions.md`
9
-
10
- # Step 4a: Collect - Module Summaries & Cross-Module Interactions
11
-
12
- ## MANDATORY EXECUTION RULES
13
- - ALWAYS load summaries of ALL completed modules
14
- - NEVER duplicate module content - work with summaries only
15
- - This step auto-validates for single-module (trivial consolidation)
16
-
17
- ## YOUR TASK
18
- Collect module summaries and identify all cross-module interactions (FK references, shared entities, events, shared data).
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 step-05a-handoff."
37
- Load: steps/step-05a-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
- **2e. Cross-Module Reference Validation (ENHANCED)**
115
-
116
- > **CRITICAL:** Verify ALL cross-module entity references are resolvable.
117
- > **Purpose:** Prevent broken FK references and runtime errors in ralph-loop.
118
-
119
- **Process:**
120
-
121
- 1. **Build Entity Registry:**
122
- ```javascript
123
- const entityRegistry = {};
124
- for (const module of completedModules) {
125
- entityRegistry[module.code] = {
126
- entities: module.analysis.entities.map(e => ({
127
- name: e.name,
128
- attributes: e.attributes.map(a => a.name),
129
- pk: e.attributes.find(a => a.name === "Id" || a.unique)?.name || "Id"
130
- }))
131
- };
132
- }
133
- ```
134
-
135
- 2. **Extract Cross-Module References:**
136
-
137
- For EACH module, scan all entity relationships:
138
- ```javascript
139
- for (const entity of module.analysis.entities) {
140
- for (const rel of entity.relationships) {
141
- // Detect cross-module reference
142
- if (rel.target.includes(".")) {
143
- // Format: "ModuleName.EntityName.FieldName" or "ModuleName.EntityName"
144
- const [targetModule, targetEntity, targetField] = rel.target.split(".");
145
-
146
- // Validate: target module exists
147
- if (!entityRegistry[targetModule]) {
148
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent module "${targetModule}"`);
149
- }
150
-
151
- // Validate: target entity exists in target module
152
- const targetModuleEntities = entityRegistry[targetModule].entities;
153
- const resolvedEntity = targetModuleEntities.find(e => e.name === targetEntity);
154
- if (!resolvedEntity) {
155
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent entity "${targetEntity}" in module "${targetModule}"`);
156
- }
157
-
158
- // Validate: target field exists (if specified)
159
- if (targetField && !resolvedEntity.attributes.includes(targetField)) {
160
- BLOCKING_ERROR(`Module ${module.code}: Entity ${entity.name} references non-existent field "${targetField}" on "${targetModule}.${targetEntity}"`);
161
- }
162
-
163
- // Record valid reference
164
- crossModuleReferences.push({
165
- sourceModule: module.code,
166
- sourceEntity: entity.name,
167
- sourceField: rel.sourceField || `${targetEntity}Id`,
168
- targetModule,
169
- targetEntity,
170
- targetField: targetField || resolvedEntity.pk,
171
- type: rel.type,
172
- cardinality: rel.cardinality || "N:1",
173
- status: "RESOLVED"
174
- });
175
- }
176
- }
177
- }
178
- ```
179
-
180
- 3. **Validate Dependency Graph Alignment:**
181
-
182
- ```javascript
183
- // For each cross-module reference, verify dependency edge exists
184
- for (const ref of crossModuleReferences) {
185
- const dependencyExists = dependencyGraph.edges.find(edge =>
186
- edge.from === ref.sourceModule && edge.to === ref.targetModule
187
- );
188
-
189
- if (!dependencyExists) {
190
- WARNING(`Dependency missing: ${ref.sourceModule} → ${ref.targetModule}`);
191
- WARNING(`Reason: ${ref.sourceEntity}.${ref.sourceField} references ${ref.targetModule}.${ref.targetEntity}`);
192
-
193
- // Auto-fix: add missing dependency edge
194
- dependencyGraph.edges.push({
195
- from: ref.sourceModule,
196
- to: ref.targetModule,
197
- type: "FK",
198
- reason: `${ref.sourceEntity}.${ref.sourceField} → ${ref.targetEntity}`
199
- });
200
-
201
- // Recalculate topological order
202
- topologicalOrder = calculateTopologicalOrder(dependencyGraph);
203
- }
204
- }
205
- ```
206
-
207
- 4. **Display Cross-Module Reference Map:**
208
-
209
- ```
210
- ═══════════════════════════════════════════════════════════════
211
- CROSS-MODULE REFERENCES VALIDATED
212
- ═══════════════════════════════════════════════════════════════
213
-
214
- | Source Module | Source Entity | Target | Type | Status |
215
- |---------------|---------------|--------|------|--------|
216
- | TimeTracking | TimeEntry | Projects.Project.Id | FK (N:1) | ✓ RESOLVED |
217
- | LeaveManagement | LeaveRequest | Projects.Employee.Id | FK (N:1) | ✓ RESOLVED |
218
- | AbsenceManagement | Absence | Projects.Employee.Id | FK (N:1) | ✓ RESOLVED |
219
- | Reporting | ProjectReport | Projects.Project.Id | FK (N:1) | ✓ RESOLVED |
220
-
221
- Total: {count} cross-module references
222
- All references RESOLVED ✓
223
- ═══════════════════════════════════════════════════════════════
224
- ```
225
-
226
- 5. **Detect Circular Dependencies:**
227
-
228
- ```javascript
229
- const cycles = detectCycles(dependencyGraph);
230
-
231
- if (cycles.length > 0) {
232
- BLOCKING_ERROR("Circular dependencies detected:");
233
- for (const cycle of cycles) {
234
- ERROR(` ${cycle.join(" → ")}`);
235
- }
236
-
237
- ACTIONS:
238
- 1. Review module dependencies
239
- 2. Break cycles by:
240
- - Moving shared entities to a separate "Core" module
241
- - Using event-driven communication instead of FK
242
- - Removing unnecessary dependencies
243
- 3. Re-run step-02 decomposition with fixed dependencies
244
-
245
- STOP - DO NOT PROCEED TO HANDOFF
246
- }
247
- ```
248
-
249
- 6. **Store Cross-Module Interaction Data:**
250
-
251
- ```javascript
252
- ba-writer.enrichSection({
253
- featureId: {feature_id},
254
- section: "consolidation",
255
- data: {
256
- crossModuleInteractions: crossModuleReferences.map(ref => ({
257
- fromModule: ref.sourceModule,
258
- toModule: ref.targetModule,
259
- interactionType: "FK_REFERENCE",
260
- description: `${ref.sourceEntity}.${ref.sourceField} → ${ref.targetModule}.${ref.targetEntity}.${ref.targetField}`,
261
- entities: [ref.sourceEntity, ref.targetEntity],
262
- cardinality: ref.cardinality,
263
- status: ref.status
264
- }))
265
- }
266
- });
267
- ```
268
-
269
- **Success Criteria:**
270
- - ✓ All cross-module references resolved
271
- - ✓ Dependency graph aligned with actual references
272
- - ✓ No circular dependencies
273
- - ✓ Topological order valid
274
-
275
- **Failure Handling:**
276
- - BLOCKING errors for unresolved references
277
- - Auto-fix missing dependency edges (with warning)
278
- - Manual intervention required for circular dependencies
279
-
280
- ---
281
-
282
- ### 2f. Cross-Application Validation (Project Mode Only)
283
-
284
- > **Only runs when `workflow.mode === "project"`** (multi-application feature).
285
- > Validates cross-application interactions identified during step-01b.
286
-
287
- ```
288
- IF workflow.mode !== "project":
289
- SKIP this section entirely
290
- → Proceed to section 6 storage
291
- ```
292
-
293
- **Process:**
294
-
295
- 1. **Load project feature.json:**
296
- ```
297
- projectFeature = ba-reader.findProjectFeature()
298
- applications = projectFeature.applications
299
- applicationGraph = projectFeature.applicationDependencyGraph
300
- ```
301
-
302
- 2. **Cross-Application Shared Entities:**
303
- ```javascript
304
- const crossAppSharedEntities = [];
305
- for (const app1 of applications) {
306
- for (const app2 of applications) {
307
- if (app1.code === app2.code) continue;
308
- for (const mod1 of app1.modules) {
309
- for (const mod2 of app2.modules) {
310
- // Detect entity name overlap or FK references across apps
311
- const shared = findSharedEntities(mod1.entities, mod2.entities);
312
- if (shared.length > 0) {
313
- crossAppSharedEntities.push({
314
- entity: shared[0].name,
315
- definedInApp: app1.code,
316
- definedInModule: mod1.code,
317
- referencedByApp: app2.code,
318
- referencedByModule: mod2.code,
319
- referenceType: shared[0].type
320
- });
321
- }
322
- }
323
- }
324
- }
325
- }
326
- ```
327
-
328
- 3. **Cross-Application Permission Path Consistency:**
329
- ```javascript
330
- // Verify permission paths use correct prefix per application
331
- for (const app of applications) {
332
- const expectedPrefix = toKebabCase(app.code);
333
- for (const mod of app.modules) {
334
- for (const perm of mod.permissions || []) {
335
- if (!perm.path.startsWith(expectedPrefix)) {
336
- WARNING(`Permission path mismatch in ${app.code}/${mod.code}: "${perm.path}" should start with "${expectedPrefix}"`);
337
- }
338
- }
339
- }
340
- }
341
- ```
342
-
343
- 4. **Cross-Application Role Name Consistency:**
344
- ```javascript
345
- // Check for role name conflicts across applications
346
- const allRoles = {};
347
- for (const app of applications) {
348
- for (const role of app.applicationRoles || []) {
349
- if (allRoles[role.role] && allRoles[role.role].level !== role.level) {
350
- WARNING(`Role "${role.role}" has different levels: ${allRoles[role.role].app}=${allRoles[role.role].level} vs ${app.code}=${role.level}`);
351
- }
352
- allRoles[role.role] = { app: app.code, level: role.level };
353
- }
354
- }
355
- ```
356
-
357
- 5. **Store Cross-Application Data:**
358
- ```javascript
359
- ba-writer.enrichSection({
360
- featureId: {project_id},
361
- section: "consolidation.crossApplicationInteractions",
362
- data: crossAppSharedEntities.map(shared => ({
363
- fromApplication: shared.definedInApp,
364
- fromModule: shared.definedInModule,
365
- toApplication: shared.referencedByApp,
366
- toModule: shared.referencedByModule,
367
- interactionType: shared.referenceType,
368
- entity: shared.entity,
369
- description: `${shared.entity} defined in ${shared.definedInApp}/${shared.definedInModule}, referenced by ${shared.referencedByApp}/${shared.referencedByModule}`
370
- }))
371
- });
372
- ```
373
-
374
- 6. **Display Cross-Application Interaction Map:**
375
-
376
- ```
377
- ═══════════════════════════════════════════════════════════════
378
- CROSS-APPLICATION INTERACTIONS
379
- ═══════════════════════════════════════════════════════════════
380
-
381
- | Source App | Source Module | Target App | Target Module | Entity | Type |
382
- |------------|-------------|------------|--------------|--------|------|
383
- | HR | Employees | SelfService | LeaveRequests | Employee | FK |
384
-
385
- Shared entities: {count}
386
- Permission paths: {valid_count}/{total_count} consistent
387
- Role conflicts: {conflict_count}
388
- ═══════════════════════════════════════════════════════════════
389
- ```
390
-
391
- ---
392
-
393
- ## SINGLE-MODULE MODE
394
-
395
- When only 1 module:
396
- 1. Skip cross-module interactions (no other modules)
397
- 2. Display: "Module unique - interactions cross-module non applicables ✓"
398
- 3. Proceed directly to step-04c-decide.md (skip analysis)
399
-
400
- ---
401
-
402
- ## CONTEXT MANAGEMENT
403
-
404
- | Loaded | Not Loaded |
405
- |--------|------------|
406
- | _shared.md | Full module feature.json files |
407
- | Module summaries (100 lines each) | Questionnaires |
408
- | Master feature.json | Templates |
409
- | cadrage section | React viewer files |
410
-
411
- ---
412
-
413
- ## NEXT STEP
414
-
415
- Load: `./step-04b-analyze.md`
@@ -1,163 +0,0 @@
1
- ---
2
- name: step-04b-analyze
3
- description: Analyze permission coherence, semantic validation, E2E flows, and global risks
4
- model: opus
5
- next_step: steps/step-04c-decide.md
6
- ---
7
-
8
- > **Context files:** `_shared.md`
9
-
10
- # Step 4b: Analyze - Permission Coherence & Validation
11
-
12
- ## MANDATORY EXECUTION RULES
13
- - ALWAYS validate permission coherence across modules
14
- - ALWAYS execute semantic validation checks
15
- - E2E flows are OPTIONAL (informational only)
16
-
17
- ## YOUR TASK
18
- Validate permission coherence, execute semantic checks, identify E2E business flows, and assess global application risks.
19
-
20
- ---
21
-
22
- ## EXECUTION SEQUENCE
23
-
24
- ### 3. Permission Coherence
25
-
26
- > **Reference:** Load `references/analysis-semantic-checks.md` § "Permission Coherence Checks" for complete validation logic.
27
-
28
- **All modules MUST use the same application-level roles.**
29
-
30
- Execute these checks:
31
-
32
- **3a. Role Consistency** — Verify all modules use the applicationRoles defined in cadrage
33
-
34
- **3b. Permission Path Format** — Verify paths follow 3-segment (module-level) or 4-segment (section-level) patterns
35
-
36
- **3c. Role Hierarchy Coherence** — Verify: Admin ⊃ Manager ⊃ Contributor ⊃ Viewer
37
-
38
- **3d. Permission Conflicts** — Detect conflicts (e.g., Manager can approve in Orders but not Invoices)
39
- - Present conflicts to user via AskUserQuestion for intentionality confirmation
40
-
41
- **3e. Permission-Role Coherence Across Modules (WARNING)** — For each role, verify permission PATTERN is consistent across ALL modules
42
- - Some permission differences may be intentional (store as WARNING, not ERROR)
43
-
44
- ### 4. Semantic Validation (MANDATORY)
45
-
46
- > **Reference:** Load `references/analysis-semantic-checks.md` for complete semantic check definitions and blocking rules.
47
-
48
- For EACH module feature.json, execute 13 checks:
49
- - Permission orpheline (WARNING)
50
- - UC sans FR (WARNING)
51
- - Entity sans endpoint (WARNING)
52
- - UC sans scenario (WARNING)
53
- - Role sans permissions (WARNING)
54
- - Navigation sans traduction (ERROR)
55
- - LifeCycle terminal (WARNING)
56
- - Schema conformity (ERROR)
57
- - Wireframe coverage (ERROR)
58
- - Doublon entity (ERROR)
59
- - Permission fantome (ERROR)
60
- - Dashboard coverage (WARNING)
61
- - Permission-UC alignment (WARNING)
62
-
63
- Store results in consolidation.semanticChecks[] with format: {check, module, status, details, autoFixed}
64
-
65
- **Blocking rule:**
66
- - 0 ERROR → PASS
67
- - ≥1 ERROR → BLOCK (fix before handoff, ask user for each)
68
- - WARNING only → PASS with user notification
69
-
70
- ### 4-bis. Structural Schema Conformity Check (MANDATORY)
71
-
72
- > **Post-generation validation.** After semantic checks, verify ALL module feature.json files conform to JSON schema.
73
-
74
- See [references/consolidation-structural-checks.md](../references/consolidation-structural-checks.md) for the full 6-category structural check:
75
- - **A.** Required Sections Presence (18 sections)
76
- - **B.** Field Name Conformity (forbidden vs correct fields)
77
- - **C.** ID Pattern Conformity (BR, UC, FR, Permissions)
78
- - **D.** Cross-Module ID Uniqueness
79
- - **E.** Wireframe Layout Completeness
80
- - **F.** SeedDataCore Translation Coverage
81
-
82
- **Blocking rule:** 0 ERROR → PASS. ≥1 ERROR → BLOCK (attempt auto-fix, re-write, re-check).
83
-
84
- ### 5. End-to-End Flows
85
-
86
- > **Reference:** Load `references/analysis-semantic-checks.md` § "E2E Flow Template" for the complete format.
87
-
88
- Identify business processes that span multiple modules:
89
- - Build flow with module → action → permission chain
90
- - List actors involved and their roles
91
- - Map data flow (entities referenced across modules)
92
- - Display as diagrams for user understanding
93
-
94
- ### 6. Global Risk Assessment
95
-
96
- > **Reference:** Load `references/analysis-semantic-checks.md` § "Global Risk Assessment Metrics" for complete evaluation.
97
-
98
- Evaluate application-level risks using these metrics:
99
- - Total entities (≤20)
100
- - Total BRs (≤50)
101
- - Cross-module dependencies (≤10)
102
- - Shared entities (≤5)
103
- - E2E flow length (≤8 steps max)
104
- - Permission paths (≤100)
105
-
106
- ### 7. Consolidation Summary
107
-
108
- Display comprehensive summary:
109
- ```
110
- ═══════════════════════════════════════════════════════════
111
- CONSOLIDATION - {application_name}
112
- ═══════════════════════════════════════════════════════════
113
-
114
- ### Modules ({count})
115
- | Module | Entités | BRs | UCs | Complexité |
116
- |--------|---------|-----|-----|------------|
117
- {for each module}
118
-
119
- ### Interactions Cross-Module
120
- - FK References: {count}
121
- - Shared Entities: {count}
122
- - Events: {count}
123
- - Shared Data: {count}
124
-
125
- ### Permissions
126
- - Roles: {count} (coherent: ✓/✗)
127
- - Total paths: {count}
128
- - Conflicts resolved: {count}
129
-
130
- ### E2E Flows
131
- {for each flow: name, modules involved, actors}
132
-
133
- ### Risques Globaux
134
- {risk assessment table}
135
-
136
- ═══════════════════════════════════════════════════════════
137
- ```
138
-
139
- ---
140
-
141
- ## SINGLE-MODULE MODE
142
-
143
- When only 1 module:
144
- 1. Skip permission coherence check (only one module)
145
- 2. Skip E2E flows (single module)
146
- 3. Execute semantic validation (still required)
147
- 4. Auto-approve global risks (no cross-module complexity)
148
-
149
- ---
150
-
151
- ## CONTEXT MANAGEMENT
152
-
153
- | Loaded | Not Loaded |
154
- |--------|------------|
155
- | _shared.md | Full module feature.json files |
156
- | Module summaries | Questionnaires |
157
- | consolidation section (from step-04a) | Templates |
158
-
159
- ---
160
-
161
- ## NEXT STEP
162
-
163
- Load: `./step-04c-decide.md`