@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,516 +0,0 @@
1
- ---
2
- name: step-03c-compile
3
- description: Module specification compilation - actors, use cases, FRs, permissions, navigation, seed data, Gherkin, i18n
4
- model: opus
5
- next_step: steps/step-03d-validate.md
6
- ---
7
-
8
- > **Context files:** `_shared.md` | `_module-loop.md` | `_rules.md`
9
-
10
- # Step 3c: Specification Compilation
11
-
12
- ## MANDATORY EXECUTION RULES
13
-
14
- - ALWAYS use ULTRATHINK mode
15
- - This step COMPILES the specification from the interactive phase (step-03a) into feature.json
16
- - ALWAYS validate specification completeness before writing
17
- - ALL communication in `{language}`
18
- - NEVER skip per-module validation
19
- - **Rules:** See `_rules.md` § "ID Naming Convention" and § "Schema Conformity" (MANDATORY, NO EXCEPTION)
20
-
21
- ## YOUR TASK
22
-
23
- Compile all data collected in step-03a (data) and step-03b (UI) into the module specification: generate actors, use cases, functional requirements, permission matrix, navigation, seed data, Gherkin scenarios, validations, messages, lifecycle, API endpoints, and i18n keys.
24
-
25
- ---
26
-
27
- ### 8. Full Specification
28
-
29
- Generate the complete specification for this module. **Each subsection below includes a STRUCTURE CARD showing the EXACT JSON format. Follow them precisely.**
30
-
31
- > **Reference:** Load `references/compilation-structure-cards.md` for all STRUCTURE CARD definitions and type inference guidance.
32
-
33
- #### ENTITY ATTRIBUTE SCHEMA (MANDATORY — applies to ALL entities in section 6b of step-03a)
34
-
35
- > **CRITICAL:** Entity attributes MUST use STRUCTURED properties, not free-text validation strings.
36
- > The ralph-loop needs parseable types to generate correct C# code.
37
-
38
- **MANDATORY fields:** `name`, `type`
39
- **type values:** `string`, `int`, `long`, `decimal`, `double`, `bool`, `DateTime`, `DateOnly`, `TimeOnly`, `Guid`, `enum:{EnumName}`, `byte[]`
40
-
41
- The reference includes:
42
- - Detailed STRUCTURE CARD for entity attributes (with FK examples)
43
- - Type inference priority table for auto-fixing missing types
44
- - BaseEntity inheritance rules (tenantId, createdAt, updatedAt, createdBy, updatedBy)
45
-
46
- #### ENTITY ATTRIBUTE FORMAT POST-CHECK (BLOCKING — runs for EVERY module including the first)
47
-
48
- > **CRITICAL:** This check ensures EVERY entity attribute has a structured `type` field.
49
- > It runs for ALL modules, not just modules 2+. The first module is NOT exempt.
50
- > Without `type`, ralph-loop cannot generate correct C# properties, EF configurations, or validators.
51
-
52
- **Reference:** Load `references/compilation-structure-cards.md` § "Type Inference Priority Table" for the complete auto-fix logic and inference patterns.
53
-
54
- After compiling entities for this module:
55
- 1. Verify every entity attribute has a `type` field (not free-text only)
56
- 2. Apply auto-fix logic (infer from validation string or attribute name patterns)
57
- 3. Normalize free-text validation into structured maxLength/validation properties
58
- 4. Ensure required defaults to true if absent
59
-
60
- ---
61
-
62
- #### 8a-8l. Specification Structure Cards
63
-
64
- > **Reference:** Load `references/compilation-structure-cards.md` for all STRUCTURE CARD definitions.
65
-
66
- The reference includes detailed JSON templates for:
67
- - **8a. Actors** — role and permissions mapping
68
- - **8b. Use Cases** — UC-{PREFIX}-NNN format with scenarios
69
- - **8c. Functional Requirements** — FR-{PREFIX}-NNN format
70
- - **8d. Permission Matrix** — role assignments and paths
71
- - **8e. Navigation** — module, sections, and resources
72
- - **8f. SeedData Core** — 9 mandatory arrays
73
- - **8g. Gherkin Scenarios** — BDD format (MUST be array)
74
- - **8h. Validations** — field rules and error keys
75
- - **8i. Messages** — success/error/warning/info types
76
- - **8j. Entity Lifecycle** — state machines
77
- - **8k. API Endpoints** — RESTful routes
78
- - **8l. i18n Keys** — 4 languages (fr, en, it, de)
79
-
80
- #### 8b. Use Cases (UC-{PREFIX}-NNN)
81
-
82
- Per section: list, create, read, update, delete, approve, etc.
83
-
84
- > **STRUCTURE CARD: specification.useCases[]**
85
- > ```json
86
- > {
87
- > "id": "UC-{PREFIX}-001",
88
- > "name": "Create Order",
89
- > "primaryActor": "Sales Representative",
90
- > "permission": "{app}.{module}.create",
91
- > "preconditions": ["Customer exists", "Products in stock"],
92
- > "postconditions": ["Order created with Draft status"],
93
- > "mainScenario": [
94
- > "1. User navigates to creation form",
95
- > "2. User fills in required fields",
96
- > "3. System validates data (BR-VAL-{PREFIX}-001)",
97
- > "4. System creates the record",
98
- > "5. System displays confirmation"
99
- > ],
100
- > "alternativeScenarios": [
101
- > { "name": "Validation failure", "steps": ["1. System detects invalid data", "2. System highlights errors"] }
102
- > ],
103
- > "errorScenarios": [
104
- > { "name": "Server error", "steps": ["1. System shows error message", "2. Data preserved for retry"] }
105
- > ],
106
- > "linkedRules": ["BR-VAL-{PREFIX}-001", "BR-WF-{PREFIX}-002"]
107
- > }
108
- > ```
109
- > **MANDATORY fields:** `id`, `name`, `primaryActor`, `permission`, `mainScenario`, `linkedRules`
110
- > **FORBIDDEN fields:** Do NOT use `actor` (use `primaryActor`), `linkedBRs` (use `linkedRules`), `linkedFRs` (not in UC, FRs link to UCs instead)
111
-
112
- #### 8c. Functional Requirements (FR-{PREFIX}-NNN)
113
-
114
- Linked to BRs and UCs.
115
-
116
- > **STRUCTURE CARD: specification.functionalRequirements[]**
117
- > ```json
118
- > {
119
- > "id": "FR-{PREFIX}-001",
120
- > "statement": "System MUST validate customer budget before order creation",
121
- > "priority": "must|should|could",
122
- > "linkedRules": ["BR-VAL-{PREFIX}-001"],
123
- > "linkedUseCases": ["UC-{PREFIX}-001"],
124
- > "acceptanceCriteria": [
125
- > "Order rejected if total > budget",
126
- > "Error message displayed with remaining budget"
127
- > ]
128
- > }
129
- > ```
130
- > **MANDATORY fields:** `id`, `statement`, `priority`, `linkedUseCases`
131
- > **FORBIDDEN fields:** Do NOT use `name`/`description` (use `statement` with System MUST/SHOULD/COULD format), `linkedUCs` (use `linkedUseCases`), `linkedBRs` (use `linkedRules`)
132
-
133
- #### 8d. Permission Matrix
134
-
135
- Roles × resources × operations with full paths.
136
-
137
- > **STRUCTURE CARD: specification.permissionMatrix**
138
- > ```json
139
- > {
140
- > "permissions": [
141
- > { "path": "{app}.{module}.read", "action": "read", "description": "View records" },
142
- > { "path": "{app}.{module}.create", "action": "create", "description": "Create new records" },
143
- > { "path": "{app}.{module}.update", "action": "update", "description": "Update existing records" },
144
- > { "path": "{app}.{module}.delete", "action": "delete", "description": "Delete records" },
145
- > { "path": "{app}.{module}.export", "action": "export", "description": "Export data" },
146
- > { "path": "{app}.{module}.dashboard.read", "action": "read", "description": "View dashboard (section-level)" }
147
- > ],
148
- > "roleAssignments": [
149
- > { "role": "{App} Admin", "permissions": ["{app}.{module}.read", "{app}.{module}.create", "{app}.{module}.update", "{app}.{module}.delete", "{app}.{module}.export", "{app}.{module}.dashboard.read"] },
150
- > { "role": "{App} Manager", "permissions": ["{app}.{module}.read", "{app}.{module}.create", "{app}.{module}.update", "{app}.{module}.dashboard.read"] },
151
- > { "role": "{App} Viewer", "permissions": ["{app}.{module}.read"] }
152
- > ]
153
- > }
154
- > ```
155
- > **STRUCTURE:** Object with 2 arrays: `permissions[]` and `roleAssignments[]`
156
- > **Permission levels:** Module-level = `{app}.{module}.{action}` (3 segments). Section-level = `{app}.{module}.{section}.{action}` (4 segments, for sections needing distinct access like dashboard, approve, import).
157
- > **FORBIDDEN:** Do NOT use a flat array with `resource`/`roles` fields. Always use the nested structure above.
158
-
159
- #### 8e. Navigation
160
-
161
- Module → Sections → Resources (levels 2-3-4 of the hierarchy).
162
-
163
- > **STRUCTURE CARD: specification.navigation**
164
- > ```json
165
- > {
166
- > "entries": [
167
- > { "level": "module", "code": "{module}", "labels": {"fr": "...", "en": "...", "it": "...", "de": "..."}, "route": "/{app}/{module}", "icon": "list" },
168
- > { "level": "section", "code": "list", "labels": {"fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste"}, "route": "/{app}/{module}", "icon": "list" },
169
- > { "level": "section", "code": "dashboard", "labels": {"fr": "Tableau de bord", "en": "Dashboard", "it": "Cruscotto", "de": "Dashboard"}, "route": "/{app}/{module}/dashboard", "icon": "chart-bar", "isNew": true }
170
- > ]
171
- > }
172
- > ```
173
-
174
- #### 8e-POST-CHECK: Navigation Enforcement (BLOCKING)
175
-
176
- > **CRITICAL:** `specification.navigation.entries[]` is MANDATORY. If absent, auto-generate from sections.
177
-
178
- **Auto-generation rule:** If `specification.navigation.entries[]` is empty or absent, generate it from `specification.sections[]`:
179
-
180
- 1. Create a module-level entry: `level: "module"`, `code: {module}`, labels in 4 languages, `route: /{app}/{module}`, `icon: "list"`
181
- 2. For each section in `specification.sections[]`, create a section-level entry:
182
- - `code` = section.code
183
- - `labels` = section.name (or section.code) in all 4 languages
184
- - `route` = section.route (or `/{app}/{module}/{section.code}`)
185
- - `icon` = section.icon (or `"file-text"` default)
186
- 3. **Language completeness:** For every entry, verify all 4 languages (fr, en, it, de) exist in `labels`. If missing, copy from `en` → `fr` → first available value.
187
-
188
- #### 8f. SeedData Core
189
-
190
- 9 MANDATORY typed arrays — each with structured objects, NOT flat strings or objects.
191
-
192
- > **STRUCTURE CARD: specification.seedDataCore**
193
- > ```json
194
- > {
195
- > "navigationApplications": [
196
- > { "code": "{app}", "label": "{Application Name}", "icon": "{icon}", "route": "/{app-kebab}", "sort": 1 }
197
- > ],
198
- > "applicationRoles": [
199
- > { "code": "admin", "name": "{App} Admin", "permissions": "*" },
200
- > { "code": "manager", "name": "{App} Manager", "permissions": "CRU" },
201
- > { "code": "contributor", "name": "{App} Contributor", "permissions": "CR" },
202
- > { "code": "viewer", "name": "{App} Viewer", "permissions": "R" }
203
- > ],
204
- > "navigationModules": [
205
- > { "code": "{module}", "label": "{Module Name}", "icon": "list", "route": "/{app}/{module}", "parentCode": "{app}", "sort": 1 }
206
- > ],
207
- > "navigationSections": [
208
- > { "code": "list", "label": "Liste", "icon": "List", "route": "/{app}/{module}", "parentCode": "{module}", "permission": "{app}.{module}.read", "sort": 1 },
209
- > { "code": "detail", "label": "Détail", "icon": "FileText", "route": "/{app}/{module}/:id", "parentCode": "{module}", "permission": "{app}.{module}.read", "sort": 2, "navigation": "hidden" },
210
- > { "code": "dashboard", "label": "Dashboard", "icon": "BarChart", "route": "/{app}/{module}/dashboard", "parentCode": "{module}", "permission": "{app}.{module}.dashboard.read", "sort": 3 }
211
- > ],
212
- > "navigationResources": [
213
- > { "code": "{module}-grid", "type": "SmartTable", "entity": "{Entity}", "parentCode": "list", "permission": "{app}.{module}.read" },
214
- > { "code": "{module}-detail-card", "type": "DetailCard", "entity": "{Entity}", "parentCode": "detail", "permission": "{app}.{module}.read" }
215
- > ],
216
- > "navigationTranslations": [
217
- > { "moduleCode": "{module}", "language": "fr", "label": "..." },
218
- > { "moduleCode": "{module}", "language": "en", "label": "..." },
219
- > { "moduleCode": "{module}", "language": "it", "label": "..." },
220
- > { "moduleCode": "{module}", "language": "de", "label": "..." }
221
- > ],
222
- > "permissions": [
223
- > { "path": "{app}.{module}.read", "action": "read", "description": "View {module}" },
224
- > { "path": "{app}.{module}.create", "action": "create", "description": "Create {module}" },
225
- > { "path": "{app}.{module}.dashboard.read", "action": "read", "description": "View {module} dashboard (section-level)" }
226
- > ],
227
- > "rolePermissions": [
228
- > { "role": "{App} Admin", "permissionPath": "{app}.{module}.*" },
229
- > { "role": "{App} Manager", "permissionPath": "{app}.{module}.read" }
230
- > ],
231
- > "permissionConstants": [
232
- > { "constantName": "{Module}Read", "path": "{app}.{module}.read" },
233
- > { "constantName": "{Module}Create", "path": "{app}.{module}.create" }
234
- > ]
235
- > }
236
- > ```
237
- > **MANDATORY:** All 9 arrays must be present. Each element must be an object, NOT a string.
238
- > **NOTE:** `navigationApplications` and `applicationRoles` are populated from the application identity confirmed in step-01b. They are written ONCE for the first module processed and remain empty `[]` for subsequent modules.
239
- > **CRITICAL:** `navigationSections` and `navigationResources` are DERIVED from `specification.sections[]` — use the transform algorithm below (section 8f-bis).
240
- > **IMPORTANT:** `create` and `edit` are NEVER sections — they are action pages reached via buttons. Do NOT include them in `navigationSections`. Only include actual sidebar sections (list, dashboard, approve, import, etc.) and hidden route sections (detail).
241
- > **FORBIDDEN:** Do NOT use `navigationModule` (singular string), `permissions` as flat string array, `rolePermissions` as flat object, `permissionsConstants` as comma-separated string.
242
- >
243
- > **FORBIDDEN in navigation routes:**
244
- > - `/{app}/{module}/list` → use `/{app}/{module}` (list IS the module route)
245
- > - `/{app}/{module}/detail/:id` → use `/{app}/{module}/:id`
246
- > - Navigation routes must match React Router paths exactly
247
-
248
- #### 8f-bis. Transform Sections into Navigation SeedData
249
-
250
- > **CRITICAL:** `navigationSections` and `navigationResources` must be generated from `specification.sections[]`.
251
- > This ensures the navigation hierarchy (Module → Section → Resource) is complete in the database.
252
-
253
- **Transform algorithm (2 steps):**
254
-
255
- **Step 1 — Sections → navigationSections:** For each section in `specification.sections[]` (indexed from 0), create one entry:
256
-
257
- | Field | Source |
258
- |---|---|
259
- | `code` | `section.code` (e.g., "list", "detail", "dashboard") |
260
- | `label` | `section.labels.fr` (default language) |
261
- | `icon` | `section.icon` (Lucide icon name) |
262
- | `route` | `section.route` (full route path) |
263
- | `parentCode` | `metadata.module` (module code) |
264
- | `permission` | `section.permission` |
265
- | `sort` | index + 1 (1-based display order) |
266
-
267
- **Step 2 — Resources → navigationResources:** For each resource in each section's `resources[]`, create one entry:
268
-
269
- | Field | Source |
270
- |---|---|
271
- | `code` | `resource.code` (e.g., "employees-grid") |
272
- | `type` | `resource.type` (e.g., "SmartTable", "SmartForm") |
273
- | `entity` | `resource.entity` (e.g., "Employee") |
274
- | `parentCode` | `section.code` (parent section code) |
275
- | `permission` | `resource.permission` (optional, can inherit from section) |
276
-
277
- **Write seedDataCore to specification:**
278
-
279
- ```
280
- ba-writer.enrichSection({
281
- feature_id,
282
- section: "specification",
283
- data: {
284
- seedDataCore: {
285
- navigationApplications: [ ... ], // FROM step-01b identity (only for first module, else [])
286
- applicationRoles: [ ... ], // FROM cadrage.applicationRoles (only for first module, else [])
287
- navigationModules: [ ... ],
288
- navigationSections: navigationSections, // DERIVED
289
- navigationResources: navigationResources, // DERIVED
290
- navigationTranslations: [ ... ],
291
- permissions: [ ... ],
292
- rolePermissions: [ ... ],
293
- permissionConstants: [ ... ]
294
- }
295
- }
296
- })
297
- ```
298
-
299
- > **NOTE:** This step writes ONLY seedDataCore. The FULL specification write (actors, useCases, wireframes, sections, etc.) happens in step-03d section 11.
300
- > ALL data from 8a-8l MUST be carried forward to step-03d. Do NOT discard in-memory data.
301
-
302
- **Validation:**
303
-
304
- - EVERY section in `specification.sections[]` MUST appear in `navigationSections`
305
- - EVERY resource in `specification.sections[].resources[]` MUST appear in `navigationResources`
306
- - Total count: `navigationSections.length === specification.sections.length`
307
- - Total count: `navigationResources.length === sum(sections[].resources.length)`
308
-
309
- #### 8g. Gherkin Scenarios
310
-
311
- BDD acceptance tests per UC.
312
-
313
- > **STRUCTURE CARD: specification.gherkinScenarios[]**
314
- > ```json
315
- > {
316
- > "feature": "{Module} Management",
317
- > "scenarios": [
318
- > {
319
- > "name": "Create a new record with valid data",
320
- > "tags": ["@{module}", "@create", "@smoke"],
321
- > "given": ["An authenticated user with role Manager", "No existing record with code 'TEST-001'"],
322
- > "when": ["The user fills the creation form", "The user submits the form"],
323
- > "then": ["The record is created with Draft status", "A success message is displayed"]
324
- > }
325
- > ]
326
- > }
327
- > ```
328
- > **STRUCTURE:** MUST be an ARRAY of objects (NOT a single object). Each object has `feature` string + `scenarios[]` array. Each scenario has `given`, `when`, `then` as ARRAYS of strings.
329
- > **FORBIDDEN:** Do NOT use flat arrays of `{uc, scenario, given, when, then}` where given/when/then are single strings.
330
- > **FORBIDDEN:** Do NOT use a single object `{feature, scenarios}` — MUST be an ARRAY `[{feature, scenarios}]` even with one feature.
331
-
332
- #### 8h. Validations
333
-
334
- Field validation rules per entity.
335
-
336
- > **STRUCTURE CARD: specification.validations[]**
337
- > ```json
338
- > {
339
- > "entity": "Order",
340
- > "field": "amount",
341
- > "rules": ["required", "decimal", "min:0.01", "max:999999.99"],
342
- > "errorMessageKey": "validation.{module}.amount.invalid"
343
- > }
344
- > ```
345
- > **MANDATORY fields:** `entity`, `field`, `rules` (array), `errorMessageKey`
346
- > **FORBIDDEN fields:** Do NOT use `rule` (singular string) or `message` (use `errorMessageKey`).
347
-
348
- #### 8i. Business Messages
349
-
350
- Minimum 4: success, error CRUD, error validation, error permission.
351
-
352
- > **STRUCTURE CARD: specification.messages[]**
353
- > ```json
354
- > {
355
- > "code": "{MODULE}-SUCCESS-CREATE",
356
- > "type": "success|error|warning|info",
357
- > "title": "Record Created",
358
- > "message": "The record {code} has been created successfully.",
359
- > "i18nKey": "message.{module}.created"
360
- > }
361
- > ```
362
- > **MANDATORY fields:** `code`, `type`, `message`, `i18nKey`
363
- > **FORBIDDEN:** Do NOT omit `title` or `i18nKey`. Every message MUST have an i18n key.
364
-
365
- #### 8j. Entity Lifecycle
366
-
367
- State machines for entities with status/state.
368
- **Note:** If depth = full and 3a-state was executed, lifeCycles are already defined. Verify completeness and add any missing states/transitions.
369
-
370
- > **STRUCTURE CARD: specification.lifeCycles[]**
371
- > ```json
372
- > {
373
- > "entity": "Order",
374
- > "field": "status",
375
- > "initialState": "draft",
376
- > "states": [
377
- > { "id": "draft", "displayName": "Brouillon", "color": "gray", "allowedTransitions": ["submitted"], "isTerminal": false },
378
- > { "id": "submitted", "displayName": "Soumis", "color": "blue", "allowedTransitions": ["approved", "rejected"], "isTerminal": false },
379
- > { "id": "approved", "displayName": "Approuvé", "color": "green", "allowedTransitions": ["archived"], "isTerminal": false },
380
- > { "id": "rejected", "displayName": "Rejeté", "color": "red", "allowedTransitions": [], "isTerminal": true },
381
- > { "id": "archived", "displayName": "Archivé", "color": "purple", "allowedTransitions": [], "isTerminal": true }
382
- > ],
383
- > "transitions": [
384
- > {
385
- > "from": "draft", "to": "submitted", "action": "submit",
386
- > "label": { "fr": "Soumettre", "en": "Submit" },
387
- > "permission": "{app}.{module}.update",
388
- > "guards": ["BR-VAL-{PREFIX}-001"],
389
- > "effects": [{ "type": "notification", "target": "role:manager", "template": "{module}-submitted" }],
390
- > "confirm": true
391
- > }
392
- > ]
393
- > }
394
- > ```
395
- > **MANDATORY:** `states` MUST be an array of OBJECTS with `id`, `displayName`, `color`, `allowedTransitions`, `isTerminal`. NEVER use flat string arrays.
396
- > **Colors:** gray (draft/new), blue (in-progress), green (active/approved), yellow (warning/pending), orange (review), red (error/rejected), purple (archived/terminal)
397
- > **FORBIDDEN:** Do NOT use `states: ["Active", "Inactive"]` (flat strings), `terminalStates` (use `isTerminal: true` on each state).
398
-
399
- #### 8k. API Endpoints
400
-
401
- RESTful routes following SmartStack patterns.
402
-
403
- > **STRUCTURE CARD: specification.apiEndpoints[]**
404
- > ```json
405
- > {
406
- > "method": "GET|POST|PUT|PATCH|DELETE",
407
- > "path": "/api/{app}/{module}",
408
- > "permission": "{app}.{module}.read",
409
- > "requestDto": "Get{Module}Query",
410
- > "responseDto": "{Module}Dto[]",
411
- > "description": "List all records with pagination and filters"
412
- > }
413
- > ```
414
- > **MANDATORY fields:** `method`, `path`, `permission`, `description`
415
- > **Recommended:** Include `requestDto` and `responseDto` for implementation clarity.
416
-
417
- #### 8l. i18n Keys
418
-
419
- Translation keys for all UI text (4 languages: fr, en, it, de).
420
-
421
- > **STRUCTURE CARD: specification.i18nKeys**
422
- > **CRITICAL:** ALL leaf translation keys MUST have 4 languages (fr, en, it, de). IT/DE can use shorter translations but MUST exist.
423
- > ```json
424
- > {
425
- > "title": { "fr": "{Module}", "en": "{Module}", "it": "{Module}", "de": "{Module}" },
426
- > "list": {
427
- > "title": { "fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste" },
428
- > "empty": { "fr": "Aucun enregistrement", "en": "No records", "it": "Nessun record", "de": "Keine Einträge" }
429
- > },
430
- > "create": { "title": { "fr": "Nouveau", "en": "New", "it": "Nuovo", "de": "Neu" } },
431
- > "detail": { "title": { "fr": "Détail", "en": "Detail", "it": "Dettaglio", "de": "Detail" } },
432
- > "buttons": {
433
- > "create": { "fr": "Créer", "en": "Create", "it": "Crea", "de": "Erstellen" },
434
- > "edit": { "fr": "Modifier", "en": "Edit", "it": "Modifica", "de": "Bearbeiten" },
435
- > "delete": { "fr": "Supprimer", "en": "Delete", "it": "Elimina", "de": "Löschen" },
436
- > "save": { "fr": "Enregistrer", "en": "Save", "it": "Salva", "de": "Speichern" },
437
- > "cancel": { "fr": "Annuler", "en": "Cancel", "it": "Annulla", "de": "Abbrechen" }
438
- > },
439
- > "validation": {
440
- > "required": { "fr": "Ce champ est requis", "en": "This field is required", "it": "Campo obbligatorio", "de": "Pflichtfeld" }
441
- > }
442
- > }
443
- > ```
444
-
445
- #### 8l-POST-CHECK: i18n 4 Languages Enforcement (BLOCKING)
446
-
447
- > **CRITICAL:** i18n keys with missing IT/DE translations are a recurring issue.
448
- > This POST-CHECK walks ALL leaf keys and auto-fills missing translations.
449
-
450
- **Auto-fill rule:** Traverse all nodes in `specification.i18nKeys` recursively.
451
-
452
- - A **leaf node** is any object that has at least one key among `fr`, `en`, `it`, `de` whose value is a string.
453
- - For each leaf node, ensure all 4 language keys exist as strings.
454
- - **Fallback order** for missing languages: copy from `en` → `fr` → first available string value in the node.
455
- - Log the count of auto-filled translations as a warning.
456
-
457
- ---
458
-
459
- ## SELF-VERIFICATION (MANDATORY before loading next step)
460
-
461
- Before loading step-03d-validate, verify all 12 subsections (8a-8l) are populated:
462
-
463
- 1. **8a. Actors** - At least 2 roles with permissions
464
- 2. **8b. Use Cases** - At least 2 UCs with complete structure
465
- 3. **8c. Functional Requirements** - At least 4 FRs with linked UCs and BRs
466
- 4. **8d. Permission Matrix** - Resources and role assignments defined
467
- 5. **8e. Navigation** - Module, sections, and resource routes specified
468
- 6. **8f. SeedData Core** - All 9 arrays populated with structured objects (navigationApplications, applicationRoles, navigationModules, navigationSections, navigationResources, navigationTranslations, permissions, rolePermissions, permissionConstants)
469
- 7. **8g. Gherkin Scenarios** - BDD scenarios for each major UC
470
- 8. **8h. Validations** - Field rules with error message keys
471
- 9. **8i. Business Messages** - Minimum 4 messages (success, error CRUD, validation, permission)
472
- 10. **8j. Entity Lifecycle** - State machines with transitions if entity has status
473
- 11. **8k. API Endpoints** - RESTful routes with permissions
474
- 12. **8l. i18n Keys** - Translation keys in 4 languages (fr, en, it, de)
475
-
476
- 13. **Wireframes present** — `(specification.uiWireframes || specification.wireframes || []).length >= 1` (BLOCKING)
477
- Quick check: the wireframe data from step-03b MUST still be in memory OR persisted to feature.json
478
-
479
- 14. **Wireframes create/edit** — For each data-centric section with a create form, a wireframe `{section}-create` MUST exist (BLOCKING).
480
- For each modifiable entity, a wireframe `{section}-edit` SHOULD exist (WARNING if absent).
481
- Create/edit wireframes are action-page wireframes — they are NOT separate navigation sections.
482
- They describe the full-page form layout (fields, validation, submit/cancel buttons).
483
- (step-03b now writes wireframes intermediately). If wireframes are empty:
484
- - First, re-read the module feature.json to check if step-03b wrote them
485
- - If present in file but not in memory → load them from file
486
- - If absent everywhere → **STOP** and reload step-03b to regenerate wireframes
487
-
488
- **IF any subsection is missing → STOP and request the missing data before proceeding.**
489
-
490
- **ABSOLUTE FORMAT CHECKS (apply to ALL modules, including the first):**
491
-
492
- > These checks validate against the canonical schema — NOT comparatively against another module.
493
- > They run BEFORE the SCHEMA UNIFORMITY comparative check, ensuring the first module has the
494
- > correct format before being used as baseline for subsequent modules.
495
-
496
- > **Rules:** Apply `_rules.md` § "Format Checks" and § "Auto-Fix: Wireframe Field Names" to all specification data before proceeding.
497
- >
498
- > Specifically: wrap gherkin in array if needed, normalize validation rules to arrays, ensure messages have `message` field, normalize wireframe field names, verify entity attribute types.
499
-
500
- **SCHEMA UNIFORMITY CHECK (multi-module mode):**
501
- IF this is NOT the first module in moduleOrder:
502
- Compare THIS module's specification structure against the FIRST specified module:
503
- - `gherkinScenarios` MUST be array (not object) in ALL modules
504
- - `validations[].rules` MUST be array (not singular `rule`) in ALL modules
505
- - `messages[]` MUST have `message` field in ALL modules
506
- - `specification.apiEndpoints[]` MUST be present in ALL modules
507
- - `specification.i18nKeys` MUST be present in ALL modules
508
- - `analysis.entities[].attributes[].type` MUST be present on ALL attributes in ALL modules
509
- - IF first module has free-text-only attributes without `type` field → AUTO-FIX with type inference
510
- IF any structural divergence detected → AUTO-FIX to match the canonical format before proceeding.
511
-
512
- ---
513
-
514
- ## NEXT STEP
515
-
516
- Load: `steps/step-03d-validate.md`