@atlashub/smartstack-cli 4.18.0 → 4.20.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 (164) 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 +706 -85
  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 +32 -6
  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/07-render-handoff.js +1 -1
  51. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  52. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  53. package/templates/skills/business-analyse/html/src/template.html +1 -1
  54. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  55. package/templates/skills/business-analyse/questionnaire/01-context.md +11 -157
  56. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +101 -0
  57. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +92 -0
  58. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +6 -0
  59. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  60. package/templates/skills/business-analyse/questionnaire.md +22 -280
  61. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  62. package/templates/skills/business-analyse/react/components.md +4 -4
  63. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  64. package/templates/skills/business-analyse/react/schema.md +14 -14
  65. package/templates/skills/business-analyse/references/acceptance-criteria.md +21 -21
  66. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  67. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  68. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +5 -5
  69. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  70. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  71. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  72. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  73. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  74. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  75. package/templates/skills/business-analyse/references/robustness-checks.md +36 -36
  76. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  77. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  78. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  79. package/templates/skills/business-analyse/references/validation-checklist.md +3 -3
  80. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  81. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  82. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  83. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  84. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  85. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  87. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  88. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  89. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -4
  90. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  91. package/templates/skills/business-analyse/steps/step-01-cadrage.md +50 -216
  92. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  93. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  94. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  95. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  96. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  97. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  98. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  99. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  100. package/templates/skills/business-analyse/templates-react.md +2 -2
  101. package/templates/skills/derive-prd/SKILL.md +92 -0
  102. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  103. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  104. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  105. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  106. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  107. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -263
  108. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  109. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  110. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  111. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  112. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  113. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  114. package/templates/skills/documentation/SKILL.md +7 -0
  115. package/templates/skills/ralph-loop/SKILL.md +2 -1
  116. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  118. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  119. package/templates/skills/business-analyse/_architecture.md +0 -124
  120. package/templates/skills/business-analyse/_elicitation.md +0 -206
  121. package/templates/skills/business-analyse/_module-loop.md +0 -115
  122. package/templates/skills/business-analyse/_rules.md +0 -142
  123. package/templates/skills/business-analyse/_suggestions.md +0 -34
  124. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  125. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  126. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  127. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  128. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  129. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  130. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  131. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  132. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  133. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  134. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  135. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  136. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  137. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  138. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  139. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  140. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  141. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  142. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  143. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  144. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  145. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  146. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  147. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  148. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  149. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  150. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  151. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  152. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  153. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  154. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  155. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  156. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  157. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  158. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  159. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  160. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  161. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  162. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  163. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  164. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -1,691 +0,0 @@
1
- ---
2
- name: step-03d-validate
3
- description: Per-module validation, write feature.json, incremental HTML deploy, loop decision
4
- model: sonnet
5
- next_step: steps/step-03a1-setup.md OR steps/step-04a-collect.md (conditional)
6
- ---
7
-
8
- > **Context files:** `_shared.md` | `_module-loop.md` | `_rules.md`
9
-
10
- # Step 3d: Validation & Loop
11
-
12
- ## MANDATORY EXECUTION RULES
13
-
14
- - ALWAYS use ULTRATHINK mode
15
- - This step VALIDATES the specification from step-03c, writes it to feature.json, and decides loop continuation
16
- - ALWAYS verify specification completeness before writing
17
- - ALL communication in `{language}`
18
- - ALWAYS run the iteration safety guard BEFORE the loop decision (max 30 modules hard cap, 15 warning)
19
-
20
- ## MODE DETECTION (inherited from step-03a1)
21
-
22
- > **CRITICAL: Re-check your execution mode before proceeding.**
23
-
24
- **IF you are running as a TEAM AGENT** (your prompt contains `PROPOSE & REVIEW` or `team-lead` as recipient):
25
- → **NEVER** use `AskUserQuestion` in ANY phase below
26
- → Phase 3: if validation fails, AUTO-CORRECT silently (no user options)
27
- → Phase 6: **SKIP section 12** — go directly to section 12-bis (Agent Mode)
28
- → After writing feature.json, send `PROPOSAL_READY` to team lead via SendMessage
29
- → NEVER present options/menus to the user — you are an autonomous agent
30
-
31
- **IF you are running in the MAIN CONVERSATION** (classic inline mode):
32
- → Normal interactive mode — use `AskUserQuestion` as documented
33
- → Section 12-bis does NOT apply to you
34
-
35
- - **Rules:** See `_rules.md` § "ID Naming Convention" (MANDATORY, NO EXCEPTION)
36
-
37
- ## YOUR TASK
38
-
39
- Validate the module specification for completeness and consistency, write to feature.json, deploy incremental HTML, and decide whether to loop to the next module or proceed to consolidation.
40
-
41
- ---
42
-
43
- ## Phase 1: AUTO-FIX (silent — no output)
44
-
45
- > **Apply all auto-fix rules BEFORE validation. No user interaction, no display.**
46
-
47
- **1a. Wireframe field names** — Apply `_rules.md` § "Auto-Fix: Wireframe Field Names":
48
- - For each wireframe in `specification.uiWireframes` (or `specification.wireframes`):
49
- - Rename `title` → `screen`, `name` → `screen`, `ascii` → `mockup`, `content` → `mockup` (only if canonical field absent)
50
- - Store normalized wireframes under `specification.uiWireframes`
51
-
52
- **1b. Entity attribute types** — Apply `_rules.md` § "Auto-Fix: Entity Attribute Type Inference":
53
- - For each entity attribute missing a `type` field, infer from the name pattern table
54
- - Normalize free-text `validation` into structured `maxLength` where applicable
55
- - Default `required` to `true` if undefined
56
- - Log count of auto-fixed attributes as a warning (defense-in-depth — step-03c should have caught these)
57
-
58
- ---
59
-
60
- ## Phase 2: VALIDATE (single pass)
61
-
62
- > **CRITICAL:** Checks MUST count ACTUAL elements in arrays, NOT declarative values.
63
- > A check that reports PASS when the array is empty is a LIE and BLOCKS downstream quality.
64
- > **Minimums:** See `_rules.md` § "Minimum Counts (Authoritative)" for all thresholds.
65
-
66
- Run ALL checks in a single pass. Each check has: name | minimum | blocking? | how to verify.
67
-
68
- ### Completeness Checks
69
-
70
- | Check | Min | Blocking | How to verify |
71
- |-------|-----|----------|---------------|
72
- | entities | ≥ 2 | YES | `analysis.entities.length >= 2` |
73
- | entity attributes (each) | ≥ 3 | YES | Every entity has `attributes.length >= 3` |
74
- | entitySchemaFormat | attributes[] not fields[] | YES | `analysis.entities.every(e => e.attributes?.length > 0)` — no `tableName` or `primaryKey` |
75
- | entityAttributeTypes | ALL have `type` | YES | `analysis.entities.every(e => e.attributes.every(a => a.type))` |
76
- | actors | ≥ 2 | YES | `specification.actors.length >= 2` |
77
- | useCases | ≥ 6 | YES | `specification.useCases.length >= 6` |
78
- | functionalRequirements | ≥ 4 | YES | `specification.functionalRequirements.length >= 4` |
79
- | permissionMatrix | ≥ 5 perms, ≥ 2 roles | YES | `permissionMatrix.permissions.length >= 5 && permissionMatrix.roleAssignments.length >= 2` |
80
- | sections | ≥ 2 | YES | `specification.sections.length >= 2` |
81
- | wireframes | 1 per section | YES | `uiWireframes.length >= sections.length` (check BOTH key names) |
82
- | wireframeSchema | All required fields | YES | Every wireframe has: `screen`, `section`, `mockupFormat`, `elements[]` (non-empty), `componentMapping[]`, `layout` (object), `permissionsRequired[]` |
83
- | navigation | entries[] present | YES | `specification.navigation?.entries?.length >= 1` |
84
- | seedDataCore | 9 arrays present | YES | See seedDataCore detail below |
85
- | messages | ≥ 4 | YES | `specification.messages.length >= 4` |
86
- | validations | ≥ 1 | YES | `specification.validations.length >= 1` |
87
- | apiEndpoints | ≥ 5 | YES | `specification.apiEndpoints.length >= 5` |
88
- | i18nKeys | ≥ 42 leaves, 4 langs | YES | All leaf keys have fr/en/it/de |
89
- | gherkinScenarios | array, ≥ 1 entry | YES | `Array.isArray(gherkinScenarios) && gherkinScenarios.length >= 1` |
90
- | gherkinCount | ≥ 2 scenarios | NO (WARN) | Total scenario count across all entries |
91
- | lifeCycles | ≥ 1 (if entity has status) | YES | `specification.lifeCycles.length >= 1` if applicable |
92
- | dataLifecycle | present | YES | `analysis.dataLifecycle !== undefined` |
93
- | navigationIcons | non-null | YES | All navigation modules have non-null icon |
94
-
95
- **seedDataCore detail:** Verify all 9 arrays per `_rules.md` § "Minimum Counts":
96
-
97
- | Array | Min (1st module) | Min (2nd+ module) |
98
- |---|---|---|
99
- | navigationApplications | 1 | 0 |
100
- | applicationRoles | 1 | 0 |
101
- | navigationModules | 1 | 1 |
102
- | navigationSections | 1 | 1 |
103
- | navigationResources | 1 | 1 |
104
- | navigationTranslations | 2 | 2 |
105
- | permissions | 1 | 1 |
106
- | rolePermissions | 1 | 1 |
107
- | permissionConstants | 1 | 1 |
108
-
109
- ### Consistency Checks
110
-
111
- | Check | Blocking | Rule |
112
- |-------|----------|------|
113
- | UC-FR linkage | YES | Every UC has ≥ 1 linked FR |
114
- | FR-BR linkage | NO (WARN) | Every FR has ≥ 1 linked BR |
115
- | BR references valid | YES | All BR references exist in `analysis.businessRules` |
116
- | Actors in permissions | YES | All actors appear in `permissionMatrix` |
117
- | Permission path format | YES | Module-level `{app}.{module}.{action}` or section-level `{app}.{module}.{section}.{action}` |
118
- | rolePermissions paths | YES | All paths match `permissions` paths |
119
- | API route prefix | YES | Consistent prefix across endpoints |
120
-
121
- ### Convention Checks
122
-
123
- | Check | Blocking | Rule |
124
- |-------|----------|------|
125
- | UC ID format | YES | `UC-{PREFIX}-{NNN}` with module prefix |
126
- | FR ID format | YES | `FR-{PREFIX}-{NNN}` |
127
- | BR ID format | YES | `BR-{CAT}-{PREFIX}-{NNN}` |
128
- | Entity names | YES | PascalCase |
129
- | Field names | YES | camelCase |
130
- | Permission paths | YES | Dot-separated lowercase |
131
- | Navigation routes | YES | No `/list` or `/detail/:id` suffixes |
132
-
133
- ### Format Checks
134
-
135
- > See `_rules.md` § "Format Checks" for canonical rules.
136
-
137
- | Check | Blocking | Rule |
138
- |-------|----------|------|
139
- | gherkinFormat | YES | Array `[{feature, scenarios}]`, not single object |
140
- | gherkinContent | YES | Each entry has `feature` (string) + `scenarios` (array) |
141
- | validationFormat | YES | `validations[].rules` is array, not singular string |
142
- | messageFormat | YES | `messages[]` has `message` field |
143
- | wireframeFields | YES | Uses `screen` (not `title`/`name`), `mockup` (not `ascii`/`content`) |
144
-
145
- ### Failure Handling
146
-
147
- IF any blocking check fails:
148
- - **CONDITIONAL LOAD:** Read `references/validation-checklist.md` for detailed fix guidance
149
- - Display table of failures with details and fix recommendations
150
- - **BLOCKING ERROR:** Module specification incomplete → fix all failures before proceeding
151
-
152
- IF all blocking checks pass:
153
- - Display warning count (non-blocking)
154
- - Proceed to Phase 3
155
-
156
- ---
157
-
158
- ## Phase 3: DECIDE + WRITE VALIDATION
159
-
160
- ### 3a. Decision
161
-
162
- > **TEAM AGENT MODE:** If running as team agent, SKIP AskUserQuestion. On FAIL → auto-correct silently. On PASS → proceed directly. NEVER present options to the user.
163
-
164
- **INLINE MODE ONLY (main conversation):**
165
-
166
- IF validation PASS:
167
- Display summary, ask client for confirmation
168
-
169
- IF validation FAIL:
170
- Display errors, offer:
171
- ```
172
- options:
173
- - label: "Auto-corriger"
174
- description: "Corriger automatiquement les erreurs détectées"
175
- - label: "Réviser manuellement"
176
- description: "Revenir aux sections problématiques"
177
- - label: "Forcer la validation"
178
- description: "Accepter malgré les erreurs (risqué)"
179
- ```
180
-
181
- ### 3b. Write Module Validation Section (MANDATORY)
182
-
183
- > **The module feature.json MUST have a `validation` section recording the results of Phase 2.**
184
-
185
- ```
186
- ba-writer.enrichSection({
187
- featureId: {module_feature_id},
188
- section: "validation",
189
- data: {
190
- validatedAt: "{ISO timestamp}",
191
- completenessChecks: [
192
- { "section": "useCases", "count": {count}, "minimum": 6, "status": "PASS|FAIL" },
193
- { "section": "functionalRequirements", "count": {count}, "minimum": 4, "status": "PASS|FAIL" },
194
- { "section": "wireframes", "count": {count}, "minimum": {section_count}, "status": "PASS|FAIL" },
195
- { "section": "seedDataCore", "count": 9, "minimum": 9, "status": "PASS|FAIL" }
196
- ],
197
- consistencyChecks: [
198
- { "check": "UC-FR linkage", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
199
- { "check": "BR references valid", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
200
- { "check": "Permission path format", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" }
201
- ],
202
- conventionChecks: [
203
- { "check": "ID naming with module prefix", "status": "PASS|FAIL", "details": "..." },
204
- { "check": "Entity names PascalCase", "status": "PASS|FAIL", "details": "..." }
205
- ],
206
- semanticChecks: [
207
- { "check": "orphan-permissions", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
208
- { "check": "uc-sans-fr", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
209
- { "check": "missing-wireframes", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false }
210
- ],
211
- warnings: ["List of non-blocking warnings"],
212
- decision: {
213
- "approved": true,
214
- "reason": "All checks passed",
215
- "approvalMode": "standard",
216
- "approvedBy": "Client",
217
- "approvedAt": "{ISO timestamp}"
218
- }
219
- }
220
- })
221
- ```
222
-
223
- ---
224
-
225
- ## Phase 4: SUMMARY + WRITE FEATURE.JSON
226
-
227
- ### 4a. Module Summary with Roles & Permissions
228
-
229
- Display comprehensive summary:
230
-
231
- ```
232
- ═══════════════════════════════════════════════════════════
233
- MODULE SPÉCIFIÉ: {currentModule} ({currentModuleIndex + 1}/{total})
234
- ═══════════════════════════════════════════════════════════
235
-
236
- | Aspect | Valeur |
237
- |--------|--------|
238
- | Entités | {count} ({entity names}) |
239
- | Business Rules | {count} (VAL: X, CALC: Y, WF: Z) |
240
- | Use Cases | {count} (UC-001 → UC-NNN) |
241
- | Exigences | {count} FRs |
242
- | Sections | {count} ({section names}) |
243
- | Maquettes | {count} wireframes |
244
- | Permissions | {count} paths |
245
- | Tests Gherkin | {count} scénarios |
246
- | Messages | {count} |
247
-
248
- ### Rôles & Permissions pour {currentModule}
249
- | Rôle | Permissions |
250
- |------|------------|
251
- | {App} Admin | {app}.{module}.* |
252
- | {App} Manager | read, create, update, assign |
253
- | {App} Contributor | read, create, update |
254
- | {App} Viewer | read |
255
-
256
- → Validation: {PASS/FAIL}
257
- ═══════════════════════════════════════════════════════════
258
-
259
- {IF validation PASS}:
260
- → Module validé automatiquement
261
- → Passage automatique au module suivant (Phase 6)
262
-
263
- {IF validation FAIL}:
264
- → Afficher les erreurs et offrir les options de correction (Phase 3)
265
- ```
266
-
267
- > **Anti-Premature-Completion Guard:** NEVER say "the analysis is complete" or "ready for /ralph-loop" at this point.
268
- > Step-03d is the END of SPECIFICATION, NOT the end of the BA workflow.
269
- > Steps 04a → 04b → 04c (consolidation) + 05a → 05b → 05c (handoff) are STILL REQUIRED.
270
- > **FORBIDDEN phrases:** "L'analyse métier est complète", "Prêt pour /ralph-loop", "Vous pouvez maintenant lancer /ralph-loop"
271
- > **REQUIRED phrasing:** "Module {name} spécifié. {Remaining} modules restants." or "Tous les modules spécifiés. Passage à la consolidation (étapes 04a-04c)..."
272
-
273
- ### 4b. Write Module Feature.json
274
-
275
- ```
276
- // Write analysis section with ALL subsections
277
- ba-writer.enrichSection({
278
- featureId: {module_feature_id},
279
- section: "analysis",
280
- data: {
281
- objectives: [{id, objective, metric, target}], // from 6a
282
- entities: [{name, description, attributes, relationships}], // from 6b — SCHEMA FORMAT
283
- businessRules: [{id, name, category, statement, priority, conditions, examples, testability}], // from 7 — SCHEMA FORMAT
284
- processFlow: {entryPoints, mainFlow, decisionPoints, alternativeFlows}, // from 6c
285
- dataLifecycle: {retentionPeriod, archiveStrategy, gdprCompliance, states} // from 6d
286
- }
287
- })
288
-
289
- // Write specification section with ALL subsections
290
- ba-writer.enrichSection({
291
- featureId: {module_feature_id},
292
- section: "specification",
293
- data: {
294
- actors: [{role, description, permissions}], // 8a
295
- useCases: [{id, name, primaryActor, permission, mainScenario, linkedRules}], // 8b
296
- functionalRequirements: [{id, statement, priority, linkedRules, linkedUseCases, acceptanceCriteria}], // 8c
297
- permissionMatrix: {permissions: [], roleAssignments: []}, // 8d
298
- navigation: {entries: []}, // 8e
299
- seedDataCore: {navigationApplications, applicationRoles, navigationModules, navigationSections, navigationResources, navigationTranslations, permissions, rolePermissions, permissionConstants}, // 8f (9 arrays)
300
- gherkinScenarios: [{feature, scenarios: [{name, tags, given, when, then}]}], // 8g
301
- validations: [{entity, field, rules, errorMessageKey}], // 8h
302
- messages: [{code, type, title, message, i18nKey}], // 8i
303
- lifeCycles: [{entity, field, initialState, states: [{id, displayName, color, allowedTransitions, isTerminal}], transitions}], // 8j
304
- apiEndpoints: [{method, path, permission, requestDto, responseDto, description}], // 8k
305
- i18nKeys: {...}, // 8l
306
- sections: [{code, labels, route, icon, permission, wireframe, useCases, businessRules, resources}], // from 3a-bis
307
- dashboards: [{code, title, kpis, filters, refreshMode}], // from 3d
308
- uiWireframes: [{screen, section, mockup, elements, actions, componentMapping, layout}] // from 3b
309
- }
310
- })
311
-
312
- // Write validation results from Phase 3
313
- // (Already written in Phase 3b above)
314
-
315
- ba-writer.updateStatus({module_feature_id}, "specified")
316
-
317
- // Update master
318
- ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "specified")
319
- ```
320
-
321
- ---
322
-
323
- ## Phase 5: VERIFY (bash)
324
-
325
- > **CRITICAL:** The validation checks in Phase 2 are interpreted by the model — they can be "passed" incorrectly.
326
- > This bash check reads the REAL file on disk and provides an objective verification.
327
- >
328
- > **Canonical acceptance criteria (AC-01 to AC-17):** See [references/acceptance-criteria.md](../references/acceptance-criteria.md).
329
- > The script below EXTENDS those criteria with step-03d-specific checks:
330
- > - Navigation entries present (`specification.navigation.entries`)
331
- > - `analysis.dataLifecycle` section present
332
- > - `validation` section recorded
333
- > - i18n 4-language completeness (AC-18)
334
- >
335
- > If you need the standalone script (for debugging or handoff gate), use the one in `acceptance-criteria.md`.
336
-
337
- ```bash
338
- MODULE_JSON="{module_feature_json_path}"
339
- node -e "
340
- const fs = require('fs');
341
- const data = JSON.parse(fs.readFileSync(process.argv[1], 'utf-8'));
342
- const spec = data.specification || {};
343
- const analysis = data.analysis || {};
344
- const wf = spec.uiWireframes || spec.wireframes || [];
345
- const sections = spec.sections || [];
346
- const checks = [
347
- ['entities >= 2', (analysis.entities||[]).length, 2],
348
- ['useCases >= 2', (spec.useCases||[]).length, 2],
349
- ['FRs >= 4', (spec.functionalRequirements||[]).length,4],
350
- ['wireframes >= 1', wf.length, 1],
351
- ['wireframes >= sections', wf.length, sections.length],
352
- ['sections >= 1', sections.length, 1],
353
- // CP-02: modules 2+ may have navigationApplications=[] and applicationRoles=[] (correct per _rules.md)
354
- // Minimum = 9 for first module, 7 for subsequent modules
355
- ['seedDataCore arrays', (() => { const sdc=spec.seedDataCore||{}; return Object.keys(sdc).filter(k=>Array.isArray(sdc[k])&&sdc[k].length>0).length; })(), (() => { const sdc=spec.seedDataCore||{}; const hasApp=(sdc.navigationApplications||[]).length>0||(sdc.applicationRoles||[]).length>0; return hasApp?9:7; })()],
356
- ['gherkin is array', Array.isArray(spec.gherkinScenarios)?1:0, 1],
357
- ['apiEndpoints >= 1', (spec.apiEndpoints||[]).length, 1],
358
- ['messages >= 4', (spec.messages||[]).length, 4],
359
- ['validations >= 1', (spec.validations||[]).length, 1],
360
- ['navigation entries', (spec.navigation?.entries||[]).length, 1],
361
- ['dataLifecycle', analysis.dataLifecycle ? 1 : 0, 1],
362
- ['validation section', data.validation ? 1 : 0, 1]
363
- ];
364
- // AC-18: i18n 4 languages check
365
- const i18n = spec.i18nKeys || {};
366
- const i18nLangs = ['fr','en','it','de'];
367
- let i18nMissing = 0;
368
- function checkI18nLeaf(obj) {
369
- if (typeof obj !== 'object' || obj === null) return;
370
- const hasLang = i18nLangs.some(l => typeof obj[l] === 'string');
371
- if (hasLang) { i18nLangs.forEach(l => { if (!obj[l]) i18nMissing++; }); }
372
- else { Object.values(obj).forEach(v => checkI18nLeaf(v)); }
373
- }
374
- checkI18nLeaf(i18n);
375
- checks.push(['i18n 4 languages (missing keys)', 0, i18nMissing > 10 ? 1 : 0]);
376
-
377
- const fails = checks.filter(c => c[1] < c[2]);
378
- fails.forEach(f => console.error('FAIL: ' + f[0] + ' = ' + f[1] + ' (min: ' + f[2] + ')'));
379
- if (i18nMissing > 0 && i18nMissing <= 10) { console.warn('WARNING: ' + i18nMissing + ' i18n leaf keys missing translations (IT/DE)'); }
380
- // Check wireframe content
381
- const emptyWf = wf.filter(w => !w.mockup && !w.ascii && !w.content);
382
- if (emptyWf.length > 0) { fails.push(['wireframe content', 0, 1]); console.error('FAIL: ' + emptyWf.length + ' wireframes have EMPTY content'); }
383
- // Check entity attribute types
384
- const badAttrs = (analysis.entities||[]).flatMap(e => (e.attributes||[]).filter(a => !a.type).map(a => e.name+'.'+a.name));
385
- if (badAttrs.length > 0) { fails.push(['attr.type', 0, 1]); console.error('FAIL: attributes without type: ' + badAttrs.join(', ')); }
386
- // AC-15: Validation rules format
387
- const badRules = (spec.validations||[]).filter(v => v.rules && !Array.isArray(v.rules));
388
- if (badRules.length > 0) { fails.push(['AC-15: rules not array', badRules.length, 0]); console.error('FAIL: AC-15: ' + badRules.length + ' validations have rules as string'); }
389
- // AC-16: Messages must have message field
390
- const noMsg = (spec.messages||[]).filter(m => !m.message);
391
- if (noMsg.length > 0) { fails.push(['AC-16: message missing', noMsg.length, 0]); console.error('FAIL: AC-16: ' + noMsg.length + ' messages missing message field'); }
392
- // AC-17: Gherkin content structure
393
- if (Array.isArray(spec.gherkinScenarios)) { const badG = spec.gherkinScenarios.filter(g => !g.feature || !Array.isArray(g.scenarios)); if (badG.length > 0) { fails.push(['AC-17: gherkin content', badG.length, 0]); console.error('FAIL: AC-17: ' + badG.length + ' gherkin entries invalid'); } }
394
- if (fails.length > 0) { console.error('BLOCKING: ' + fails.length + ' acceptance criteria failed'); process.exit(1); }
395
- console.log('PASS: All acceptance criteria met');
396
- " "$MODULE_JSON"
397
- ```
398
-
399
- IF this check FAILS:
400
- - Identify which criteria failed from the output
401
- - Fix the corresponding data (re-read from conversation context, re-generate, or re-run the step that produces it)
402
- - Re-write to feature.json
403
- - Re-run this check until PASS
404
-
405
- ---
406
-
407
- ## Phase 6: DEPLOY + ROUTE
408
-
409
- ### 6a. Deploy Incremental Interactive HTML (MANDATORY)
410
-
411
- > **After each module is specified, deploy/update the interactive HTML document with all available data.**
412
- > The client can review completed modules while the next module is being specified.
413
-
414
- See [references/validate-incremental-html.md](../references/validate-incremental-html.md) for the complete deployment process (read sources, build FEATURE_DATA, replace placeholders, write HTML).
415
-
416
- Uses the **same mapping** as step-05b-deploy.md — only difference is `moduleSpecs` only includes completed modules.
417
-
418
- ---
419
-
420
- ### 6b. Iteration Safety Guard (MAX MODULES CHECK)
421
-
422
- > **DEFENSIVE CHECK — Run BEFORE loop decision to prevent infinite loops.**
423
-
424
- ```
425
- // Read loop state from feature.json
426
- const moduleOrder = metadata.workflow.moduleOrder || [];
427
- const completedModules = metadata.workflow.completedModules || [];
428
- const currentModuleIndex = metadata.workflow.currentModuleIndex || 0;
429
- const totalModules = moduleOrder.length;
430
-
431
- // Guard thresholds
432
- const MAX_MODULES_WARN = 15;
433
- const MAX_MODULES_BLOCK = 30;
434
-
435
- IF totalModules > MAX_MODULES_BLOCK:
436
- BLOCKING ERROR:
437
- "Module count ({totalModules}) exceeds maximum allowed ({MAX_MODULES_BLOCK}).
438
- This is likely a decomposition error. Return to step-02-decomposition.md
439
- and consolidate or split into multiple applications."
440
- STOP — do not continue loop
441
-
442
- IF totalModules > MAX_MODULES_WARN:
443
- WARNING (non-blocking):
444
- "Module count ({totalModules}) is high. Consider whether some modules
445
- could be grouped or split into separate applications.
446
- Continuing with {totalModules - completedModules.length} modules remaining."
447
-
448
- // Sanity check: currentModuleIndex should never exceed totalModules
449
- IF currentModuleIndex >= totalModules AND completedModules.length < totalModules:
450
- BLOCKING ERROR:
451
- "Loop state inconsistency: currentModuleIndex ({currentModuleIndex}) >= totalModules ({totalModules})
452
- but only {completedModules.length} modules are marked complete.
453
- Fix: Check metadata.workflow in feature.json and correct the state manually."
454
- STOP
455
- ```
456
-
457
- ---
458
-
459
- ### 6c. Loop Decision (section 12)
460
-
461
- > **TEAM AGENT MODE: SKIP THIS ENTIRE SECTION.** If you are a team agent (your prompt contains `PROPOSE & REVIEW`), go directly to **section 12-bis** below. Section 12 is for inline mode ONLY. You MUST NOT load the next step or advance the module loop — the team lead handles orchestration.
462
-
463
- **INLINE MODE ONLY (main conversation):**
464
-
465
- ```
466
- ba-writer.advanceModuleLoop({feature_id})
467
- → Increments currentModuleIndex
468
- → Updates completedModules
469
- → Updates currentModule
470
-
471
- IF currentModuleIndex < moduleOrder.length:
472
- Display: "→ Module suivant: {nextModule} ({currentModuleIndex + 1}/{total})"
473
- Load: steps/step-03a1-setup.md
474
-
475
- IF currentModuleIndex >= moduleOrder.length:
476
- ba-writer.updateStatus({feature_id}, "specified")
477
-
478
- // CHECKPOINT: Save progress BEFORE transition (protects against context exhaustion)
479
- ba-writer.enrichSection({
480
- featureId: {feature_id},
481
- section: "metadata.workflow",
482
- data: {
483
- lastCompletedStep: "step-03d-validate",
484
- allModulesSpecified: true
485
- }
486
- })
487
-
488
- // CHECK: Are we in project mode (multi-application)?
489
- IF workflow.mode === "project":
490
- // APPLICATION LOOP: Check if more applications remain
491
- projectFeature = ba-reader.findProjectFeature()
492
- ba-writer.updateApplicationStatus(projectId, currentApp.code, "specified")
493
- ba-writer.advanceApplicationLoop(projectId)
494
-
495
- IF projectFeature.metadata.workflow.currentApplicationIndex + 1 < projectFeature.metadata.workflow.applicationOrder.length:
496
- nextApp = projectFeature.metadata.workflow.applicationOrder[currentApplicationIndex + 1]
497
- Display: "═══ Application {currentApp.name} terminée ({N}/{total}). Prochaine : {nextApp} ═══"
498
- Display: "⚠ NE PAS lancer /ralph-loop — d'autres applications et la consolidation sont encore nécessaires."
499
- // Load step-02 for next application's module decomposition
500
- Load: steps/step-02-decomposition.md
501
- ELSE:
502
- Display: "═══ Toutes les applications spécifiées! Passage à la consolidation cross-application... ═══"
503
- Display: "⚠ NE PAS lancer /ralph-loop — la consolidation et le handoff sont encore nécessaires."
504
- ba-writer.updateStatus(projectId, "specified")
505
- Load: steps/step-04a-collect.md
506
- ELSE:
507
- // SINGLE APPLICATION: Current behavior
508
- Display: "═══ Tous les modules spécifiés! Passage à la consolidation (04a→04c) puis handoff (05a→05c)... ═══"
509
- Display: "⚠ NE PAS lancer /ralph-loop — la consolidation et le handoff sont encore nécessaires."
510
-
511
- // MANDATORY TRANSITION — DO NOT STOP HERE
512
- // If context is near exhaustion, the checkpoint above ensures the user
513
- // can resume with /business-analyse and it will route to step-04a automatically.
514
- Load: steps/step-04a-collect.md
515
- ```
516
-
517
- ---
518
-
519
- ## 12-bis. Agent Mode: Send Proposal to Team Lead
520
-
521
- **IF running as TEAM AGENT (autonomous mode — detected in step-03a1 MODE DETECTION):**
522
-
523
- After all validation checks PASS and module feature.json is written:
524
-
525
- ### A. Build Structured Summary
526
-
527
- Read the written module feature.json via ba-reader and build:
528
-
529
- ```
530
- ## Module: {moduleCode} — Specification Summary
531
-
532
- ### Entities ({count})
533
- | Entity | Key Attributes | Relationships |
534
- |--------|---------------|---------------|
535
- | {name} | {attr1} ({type}), {attr2} ({type}), ... | → {relatedEntity} (FK) |
536
-
537
- ### Sections ({count})
538
- | Section | Description | Resources |
539
- |---------|-------------|-----------|
540
- | {code} | {description} | {resource1}, {resource2}, ... |
541
-
542
- ### Use Cases ({count})
543
- - {UC-ID}: {title}
544
-
545
- ### Business Rules ({count})
546
- - {BR-ID}: {title} ({category})
547
-
548
- ### Permissions
549
- - {permission.path}: {roles with access}
550
-
551
- ### Seed Data Counts
552
- - Modules: {n} | Sections: {n} | Resources: {n}
553
- - Translations: {n} | Permissions: {n} | Role mappings: {n} | Constants: {n}
554
-
555
- ### Wireframes
556
- - {section}: {1-line description of layout and key components}
557
- ```
558
-
559
- ### B. Send Proposal
560
-
561
- ```
562
- SendMessage({
563
- type: "message",
564
- recipient: "team-lead",
565
- content: "PROPOSAL_READY:{moduleCode}\n\n{structured_summary}",
566
- summary: "{moduleCode} specification ready for review"
567
- })
568
- ```
569
-
570
- ### C. Wait for Response
571
-
572
- **WAIT** for team lead to respond:
573
-
574
- - **`APPROVED:{moduleCode}`** → Proceed to step D (Module Complete)
575
- - **`REVISION:{moduleCode}\n{feedback}`** → Apply changes:
576
- 1. Read the feedback
577
- 2. Update the relevant sections in feature.json via ba-writer
578
- 3. Re-run validation checks (Phase 2)
579
- 4. Re-build summary and send new `PROPOSAL_READY`
580
- 5. Max **3 revision cycles** — after 3, send `ERROR:{moduleCode}:Max revisions reached` and stop
581
-
582
- ### D. Module Complete
583
-
584
- After approval:
585
-
586
- ```
587
- ba-writer.updateModuleStatus({feature_id}, {moduleCode}, "specified")
588
- ```
589
-
590
- ```
591
- SendMessage({
592
- type: "message",
593
- recipient: "team-lead",
594
- content: "MODULE_COMPLETE:{moduleCode}",
595
- summary: "{moduleCode} module complete"
596
- })
597
- ```
598
-
599
- Then WAIT — the team lead will send you a `shutdown_request`.
600
- Do NOT loop to next module. The team lead handles module ordering and will spawn a new agent for the next module.
601
-
602
- ### E. Shutdown (MANDATORY)
603
-
604
- When you receive a `shutdown_request` from the team lead:
605
-
606
- ```
607
- SendMessage({
608
- type: "shutdown_response",
609
- request_id: "{requestId from the shutdown_request message}",
610
- approve: true
611
- })
612
- ```
613
-
614
- This terminates your process. Do NOT output any text after `shutdown_response`.
615
-
616
- **Sequence reminder:** APPROVED → MODULE_COMPLETE → shutdown_request → shutdown_response (4 separate steps, never skip).
617
-
618
- ---
619
-
620
- ## SINGLE-MODULE MODE
621
-
622
- When only 1 module in moduleOrder:
623
-
624
- - Same full validation flow
625
- - Skip cross-module references (section 5)
626
- - After validation → direct to step-04a-collect.md (auto-consolidation)
627
-
628
- ---
629
-
630
- ## RESUME SUPPORT
631
-
632
- IF the step is resumed (e.g., after interruption):
633
-
634
- ```
635
- Read metadata.workflow.currentModuleIndex
636
- Read metadata.workflow.currentModule
637
- → Resume at the correct module
638
- → If module has partial data, show what exists and continue from there
639
- ```
640
-
641
- ---
642
-
643
- ## CONTEXT MANAGEMENT
644
-
645
- | Loaded | Not Loaded |
646
- |--------|------------|
647
- | _shared.md | Other module feature.json (full) |
648
- | _rules.md | Questionnaires not needed |
649
- | feature-schema.json | Templates |
650
- | Completed modules summary (100 lines max) | React viewer files |
651
-
652
- ---
653
-
654
- ## STATE VARIABLES
655
-
656
- | Variable | Description |
657
- |----------|-------------|
658
- | `{currentModule}` | Current module being specified |
659
- | `{currentModuleIndex}` | Index in moduleOrder |
660
- | `{completedModules}` | Array of already specified module codes |
661
- | `{module_feature_id}` | Feature ID for the module-level feature.json |
662
-
663
- ---
664
-
665
- ## SUCCESS METRICS
666
-
667
- - Module specification validation PASS
668
- - Per-module validation results recorded in feature.json
669
- - Client confirmed module specification
670
- - Module feature.json written with all sections
671
- - Master updated with module status
672
- - Interactive HTML deployed/updated with completed module data (incremental)
673
- - Loop advanced correctly or consolidation phase initiated
674
-
675
- ---
676
-
677
- ## FAILURE MODES
678
-
679
- - Validation FAIL → offer auto-correct / manual revise / force
680
- - Client rejects → revise specific sections via step-03a or step-03b
681
- - Cross-module reference error → clarify with client
682
- - Interruption → resumable via workflow state
683
-
684
- ---
685
-
686
- ## NEXT STEP
687
-
688
- Conditional:
689
-
690
- - IF modules remaining → Load `steps/step-03a1-setup.md`
691
- - IF all modules done → Load `steps/step-04a-collect.md`