@atlashub/smartstack-cli 3.5.0 → 3.6.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 (40) hide show
  1. package/dist/index.js +13 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/skills/business-analyse/SKILL.md +26 -15
  5. package/templates/skills/business-analyse/_architecture.md +1 -1
  6. package/templates/skills/business-analyse/_elicitation.md +1 -1
  7. package/templates/skills/business-analyse/_module-loop.md +4 -4
  8. package/templates/skills/business-analyse/html/ba-interactive.html +39 -10
  9. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  10. package/templates/skills/business-analyse/questionnaire.md +2 -2
  11. package/templates/skills/business-analyse/react/components.md +1 -1
  12. package/templates/skills/business-analyse/react/schema.md +1 -1
  13. package/templates/skills/business-analyse/references/html-data-mapping.md +4 -3
  14. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  15. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  16. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +1 -0
  17. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  18. package/templates/skills/business-analyse/steps/step-00-init.md +29 -0
  19. package/templates/skills/business-analyse/steps/step-01-cadrage.md +166 -6
  20. package/templates/skills/business-analyse/steps/step-02-decomposition.md +4 -4
  21. package/templates/skills/business-analyse/steps/{step-03a-specify.md → step-03a-data.md} +10 -359
  22. package/templates/skills/business-analyse/steps/step-03b-ui.md +414 -0
  23. package/templates/skills/business-analyse/steps/step-03c-compile.md +343 -0
  24. package/templates/skills/business-analyse/steps/{step-03b-compile.md → step-03d-validate.md} +26 -308
  25. package/templates/skills/business-analyse/steps/step-04-consolidation.md +2 -2
  26. package/templates/skills/business-analyse/steps/step-05a-handoff.md +49 -292
  27. package/templates/skills/business-analyse/steps/step-05b-mapping.md +302 -0
  28. package/templates/skills/business-analyse/steps/step-05c-deploy.md +296 -0
  29. package/templates/skills/business-analyse/steps/step-05d-html.md +326 -0
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +1 -1
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  33. package/templates/skills/controller/steps/step-03-generate.md +2 -1
  34. package/templates/skills/ralph-loop/SKILL.md +17 -2
  35. package/templates/skills/ralph-loop/references/core-seed-data.md +538 -0
  36. package/templates/skills/ralph-loop/steps/step-00-init.md +2 -0
  37. package/templates/skills/ralph-loop/steps/step-01-task.md +25 -2
  38. package/templates/skills/ralph-loop/steps/step-02-execute.md +39 -15
  39. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -4
  40. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -475
@@ -0,0 +1,302 @@
1
+ ---
2
+ name: step-05b-mapping
3
+ description: BR-to-code mapping, API endpoint summary, write handoff to feature.json
4
+ model: sonnet
5
+ next_step: steps/step-05c-deploy.md
6
+ ---
7
+
8
+ > **Context files:** `_shared.md` | `_architecture.md`
9
+
10
+ # Step 5b: Handoff - Mapping & Write
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** derive mappings from feature.json (NEVER independently)
15
+ - **NEVER** invent entities/FRs/BRs not in feature.json
16
+ - **ALL** API routes from specification.apiEndpoints (exact copy)
17
+ - **Permission** paths from specification.permissionMatrix (full format)
18
+
19
+ ## YOUR TASK
20
+
21
+ Map business rules to code implementation points, generate API endpoint summary, and write the complete handoff data to EACH module feature.json AND master feature.json.
22
+
23
+ ---
24
+
25
+ ## EXECUTION SEQUENCE
26
+
27
+ ### 5. Map Business Rules to Code
28
+
29
+ Derive from `analysis.businessRules[]` of **EACH module**.
30
+
31
+ Generate complete mapping for each BR:
32
+
33
+ ```json
34
+ {
35
+ "brToCodeMapping": [
36
+ {
37
+ "ruleId": "BR-VAL-001",
38
+ "title": "Order total must equal sum of item prices",
39
+ "module": "{moduleCode}",
40
+ "severity": "critical",
41
+ "implementationPoints": [
42
+ {
43
+ "layer": "Domain",
44
+ "component": "Order.cs",
45
+ "method": "CalculateTotal()",
46
+ "implementation": "Validate sum equals sum of OrderItems.Price"
47
+ },
48
+ {
49
+ "layer": "Application",
50
+ "component": "CreateOrderService.cs",
51
+ "method": "Handle()",
52
+ "implementation": "Calculate total before persisting"
53
+ },
54
+ {
55
+ "layer": "API",
56
+ "component": "OrdersController.cs",
57
+ "method": "CreateOrder()",
58
+ "implementation": "Return validation error if total mismatch"
59
+ },
60
+ {
61
+ "layer": "Frontend",
62
+ "component": "OrderForm.tsx",
63
+ "method": "calculateTotal()",
64
+ "implementation": "Real-time calculation on item change"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "ruleId": "BR-SEC-002",
70
+ "title": "User can only view orders from their tenant",
71
+ "module": "{moduleCode}",
72
+ "severity": "critical",
73
+ "implementationPoints": [
74
+ {
75
+ "layer": "Domain",
76
+ "component": "Order.cs",
77
+ "method": "Validate()",
78
+ "implementation": "Check TenantId matches user context"
79
+ },
80
+ {
81
+ "layer": "Infrastructure",
82
+ "component": "OrderRepository.cs",
83
+ "method": "GetUserOrders()",
84
+ "implementation": "Filter by TenantId in WHERE clause"
85
+ },
86
+ {
87
+ "layer": "API",
88
+ "component": "OrdersController.cs",
89
+ "method": "GetOrders()",
90
+ "implementation": "Enforce permission check + tenant filter"
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ }
96
+ ```
97
+
98
+ For each BR include:
99
+ - **ruleId**: Reference to analysis.businessRules[].id
100
+ - **title**: The rule statement
101
+ - **module**: Which module it belongs to
102
+ - **severity**: "critical", "high", "medium", "low"
103
+ - **implementationPoints**: Array of {layer, component, method, implementation}
104
+
105
+ Layers: Domain, Application, Infrastructure, API, Frontend
106
+
107
+ ---
108
+
109
+ ### 6. API Endpoint Summary
110
+
111
+ > **ABSOLUTE RULE:** Copy **EXACTLY** from `specification.apiEndpoints[]`. **NEVER** reinvent routes.
112
+
113
+ Generate summary with full details:
114
+
115
+ ```json
116
+ {
117
+ "apiEndpointSummary": [
118
+ {
119
+ "operation": "ListOrders",
120
+ "method": "GET",
121
+ "route": "/api/business/orders",
122
+ "linkedUC": "UC-001",
123
+ "linkedFR": "FR-001",
124
+ "permissions": ["business.orders.read"],
125
+ "requestSchema": { "type": "query", "params": ["pageNumber", "pageSize", "status"] },
126
+ "responseSchema": { "type": "PaginatedOrderDto[]" },
127
+ "errorCodes": [401, 403, 400, 500],
128
+ "module": "{moduleCode}"
129
+ },
130
+ {
131
+ "operation": "CreateOrder",
132
+ "method": "POST",
133
+ "route": "/api/business/orders",
134
+ "linkedUC": "UC-002",
135
+ "linkedFR": "FR-002",
136
+ "permissions": ["business.orders.create"],
137
+ "requestSchema": { "type": "body", "schema": "CreateOrderDto" },
138
+ "responseSchema": { "type": "OrderDto" },
139
+ "errorCodes": [400, 401, 403, 422, 500],
140
+ "module": "{moduleCode}"
141
+ }
142
+ ]
143
+ }
144
+ ```
145
+
146
+ For each endpoint:
147
+ - **operation**: Use case name or operation name
148
+ - **method**: HTTP method (GET, POST, PUT, DELETE, PATCH)
149
+ - **route**: Full API path from specification
150
+ - **linkedUC**: Use case ID(s) this endpoint implements
151
+ - **linkedFR**: Feature requirement ID(s)
152
+ - **permissions**: Array of exact permission paths
153
+ - **requestSchema**: Input contract (query params or body)
154
+ - **responseSchema**: Output contract
155
+ - **errorCodes**: Expected HTTP error codes
156
+ - **module**: Which module
157
+
158
+ Total endpoints = count of specification.apiEndpoints[] across all modules.
159
+
160
+ ---
161
+
162
+ ### 7. Write Handoff to Feature.json
163
+
164
+ > **BLOCKING RULE: The handoff MUST be written in EACH module feature.json.**
165
+ > A handoff at master level alone is INSUFFICIENT. Ralph-loop consumes module-level handoffs.
166
+ > An empty module handoff (`"handoff": {}`) is a CRITICAL BUG that blocks all downstream generation.
167
+
168
+ #### 7a. Module Handoff Loop (MANDATORY)
169
+
170
+ > **STRUCTURE CARD: handoff** — Field names are EXACT. Include ALL fields below.
171
+ > **PATH RULE:** All backend paths MUST include `{ContextPascal}/{ApplicationName}/` hierarchy (see section 4 of step-05a).
172
+ > ```json
173
+ > {
174
+ > "complexity": "simple|medium|complex",
175
+ > "filesToCreate": {
176
+ > "domain": [{"path": "src/Domain/Entities/{Ctx}/{App}/{Mod}/{Entity}.cs", "type": "Entity|ValueObject|Enum", "linkedFRs": [], "linkedUCs": [], "module": "..."}],
177
+ > "application": [{"path": "src/Application/Services/{Ctx}/{App}/{Mod}/{Svc}Service.cs", "type": "Service|Dto|Validator", "linkedFRs": [], "linkedUCs": [], "module": "..."}],
178
+ > "infrastructure": [{"path": "src/Infrastructure/Persistence/Configurations/{Ctx}/{App}/{Mod}/{Entity}Configuration.cs", "type": "EFConfiguration", "linkedFRs": [], "module": "..."}],
179
+ > "api": [{"path": "src/API/Controllers/{CtxShort}/{App}/{Entity}Controller.cs", "type": "ApiController", "linkedUCs": [], "linkedFRs": [], "module": "..."}],
180
+ > "frontend": [{"path": "src/pages/{Mod}/{Page}Page.tsx", "type": "Page|Component|Hook|DashboardPage", "linkedUCs": [], "linkedWireframes": [], "module": "..."}],
181
+ > "seedData": [{"path": "src/Infrastructure/Persistence/Seeding/Data/{Mod}/...SeedData.cs", "type": "SeedData", "category": "core|business", "source": "...", "module": "..."}],
182
+ > "tests": [{"path": "src/Tests/Unit/Domain/{Ctx}/{App}/{Mod}/{Entity}Tests.cs", "type": "UnitTests|IntegrationTests|SecurityTests", "linkedFRs": [], "linkedUCs": [], "module": "..."}]
183
+ > },
184
+ > "brToCodeMapping": [{"ruleId": "BR-...", "files": ["path1", "path2"], "implementation": "description"}],
185
+ > "apiEndpointSummary": [{"method": "GET|POST|PUT|DELETE", "path": "/api/...", "permission": "business.{app}.{module}.{action}", "linkedUC": "UC-..."}],
186
+ > "prdFile": ".ralph/prd-{module}.json",
187
+ > "totalFiles": 0,
188
+ > "totalTasks": 0,
189
+ > "handedOffAt": "{ISO timestamp}"
190
+ > }
191
+ > ```
192
+ > **MANDATORY fields:** ALL of the above. `filesToCreate` MUST have all 7 categories (even if empty arrays).
193
+ > **FORBIDDEN:** `handoff: {}` (empty object is a CRITICAL BUG). Missing `brToCodeMapping` or `apiEndpointSummary`.
194
+
195
+ **For i = 0; i < modules.length; i++:**
196
+
197
+ ```
198
+ 1. moduleCode = modules[i].code
199
+ 2. moduleFeatureId = modules[i].featureJsonPath or find via ba-reader.findFeature()
200
+ 3. Read the module feature.json via ba-reader.findFeature(moduleFeatureId)
201
+ 4. Build the handoff payload for THIS module:
202
+ - complexity (from step-05a calculation)
203
+ - filesToCreate (full 7-category structure from step-05a section 4, filtered for this module)
204
+ - brToCodeMapping (from this step section 5, filtered for this module)
205
+ - apiEndpointSummary (from this step section 6, filtered for this module)
206
+ - prdFile path
207
+ - totalFiles count
208
+ - totalTasks count
209
+ - handedOffAt timestamp
210
+
211
+ 5. Write via ba-writer:
212
+ ba-writer.enrichModuleHandoff({
213
+ moduleFeatureId: {moduleFeatureId},
214
+ handoffData: {
215
+ complexity: "{simple|medium|complex}",
216
+ filesToCreate: {...},
217
+ brToCodeMapping: [...],
218
+ apiEndpointSummary: [...],
219
+ prdFile: ".ralph/prd-{moduleCode}.json",
220
+ totalFiles: {count},
221
+ totalTasks: {count},
222
+ handedOffAt: "{ISO timestamp}"
223
+ }
224
+ })
225
+
226
+ 6. VERIFICATION (MANDATORY - done automatically by enrichModuleHandoff):
227
+ - handoff !== {}
228
+ - handoff.filesToCreate has 7 categories
229
+ - handoff.brToCodeMapping.length > 0
230
+ IF verification fails → STOP, report error, do NOT continue
231
+
232
+ 7. Display progress:
233
+ "✓ Handoff module {i+1}/{N} : {moduleCode} ({fileCount} fichiers, {brCount} BRs mappées)"
234
+ ```
235
+
236
+ #### 7b. Master Handoff (after ALL modules written successfully)
237
+
238
+ ```
239
+ ba-writer.enrichSection({
240
+ featureId: {feature_id},
241
+ section: "handoff",
242
+ data: {
243
+ status: "handed-off",
244
+ complexity: "{simple|medium|complex}",
245
+ implementationStrategy: "{strategy}",
246
+ moduleCount: {count},
247
+ moduleOrder: [...],
248
+ totalFilesToCreate: {sum across all modules},
249
+ totalTasks: {sum across all modules},
250
+ prdStructure: "per-module | consolidated",
251
+ prdFiles: [
252
+ { module: "{module1}", path: ".ralph/prd-{module1}.json" },
253
+ { module: "{module2}", path: ".ralph/prd-{module2}.json" }
254
+ ],
255
+ progressTrackerPath: ".ralph/progress.txt",
256
+ handedOffAt: "{ISO timestamp}"
257
+ }
258
+ })
259
+ ```
260
+
261
+ #### 7c. Final Verification (BLOCKING)
262
+
263
+ ```
264
+ count = 0
265
+ FOR each module in modules[]:
266
+ Read module feature.json
267
+ IF module.handoff !== {} AND module.status === "handed-off":
268
+ count++
269
+
270
+ IF count < modules.length:
271
+ → BLOCKING ERROR: {modules.length - count} modules missing handoff
272
+ → List the missing modules by name
273
+ → DO NOT proceed to step-05c
274
+ → Return to 7a for missing modules only
275
+
276
+ IF count === modules.length:
277
+ ba-writer.updateStatus({feature_id}, "handed-off")
278
+ Display: "✓ Handoff complet: {count}/{modules.length} modules avec handoff valide"
279
+ ```
280
+
281
+ Status journey: analyze → consolidate → handed-off
282
+
283
+ ---
284
+
285
+ ## SELF-VERIFICATION (MANDATORY before loading step-05c-deploy)
286
+
287
+ Before proceeding to step-05c-deploy.md, VERIFY:
288
+
289
+ 1. **ALL module feature.json** have `handoff` section with 7 categories in `filesToCreate` (domain, application, infrastructure, api, frontend, seedData, tests)
290
+ 2. **ALL module feature.json** have `handoff.brToCodeMapping.length > 0`
291
+ 3. **ALL module feature.json** have `handoff.apiEndpointSummary.length > 0`
292
+ 4. **ALL module feature.json** status = "handed-off"
293
+ 5. **Master feature.json** has `handoff` section with implementationStrategy, moduleOrder, totalFilesToCreate
294
+ 6. **Master status** = "handed-off"
295
+
296
+ **IF any check fails → FIX before proceeding.** Do NOT generate artifacts without complete handoff data.
297
+
298
+ ---
299
+
300
+ ## NEXT STEP
301
+
302
+ Load: `steps/step-05c-deploy.md`
@@ -0,0 +1,296 @@
1
+ ---
2
+ name: step-05c-deploy
3
+ description: Generate prd.json, progress.txt, update BA manifest, display completion summary
4
+ model: sonnet
5
+ next_step: steps/step-05d-html.md
6
+ ---
7
+
8
+ > **Context files:** `_shared.md`
9
+
10
+ # Step 5c: Deploy Artifacts
11
+
12
+ ## MANDATORY EXECUTION RULES
13
+
14
+ - **ALWAYS** verify all module handoffs are complete before generating artifacts
15
+ - **ALWAYS** derive prd.json from feature.json (NEVER independently)
16
+ - **NEVER** invent entities/FRs/BRs not in feature.json
17
+ - **ALWAYS** update BA manifest at docs/business/index.json
18
+
19
+ ## YOUR TASK
20
+
21
+ Generate deployment artifacts from the handoff data written in step-05a: prd.json (per module), progress.txt, and update the BA manifest. The interactive HTML document is handled in step-05d.
22
+
23
+ ---
24
+
25
+ ## EXECUTION SEQUENCE
26
+
27
+ ### 0. Pre-flight Verification
28
+
29
+ Before generating ANY artifact, verify step-05a completed successfully:
30
+
31
+ ```
32
+ FOR each module in modules[]:
33
+ Read module feature.json
34
+ IF module.handoff === {} OR module.status !== "handed-off":
35
+ → BLOCKING ERROR: Module {module.code} has no handoff data
36
+ → Return to step-05a-handoff.md
37
+ ```
38
+
39
+ IF all modules have valid handoff → proceed.
40
+
41
+ ---
42
+
43
+ ### 1. Generate prd.json (PROGRAMMATIC)
44
+
45
+ > **RULE:** prd.json is extracted by CLI code, **NEVER** generated by LLM.
46
+ > The `ss derive-prd` command performs a deterministic data transformation from feature.json.
47
+
48
+ **For each module:**
49
+
50
+ ```
51
+ Execute: ss derive-prd --feature {moduleFeaturePath} --output .ralph/prd-{moduleCode}.json
52
+ ```
53
+
54
+ **For consolidated view (multi-module, optional):**
55
+
56
+ ```
57
+ Execute: ss derive-prd --application {masterFeaturePath}
58
+ → Generates .ralph/prd-{moduleCode}.json for each module
59
+ ```
60
+
61
+ **Verification:** After execution, read the generated prd.json and display summary:
62
+
63
+ ```
64
+ prd.json generated for module {moduleCode}:
65
+ - Use cases: {count}
66
+ - Functional requirements: {count}
67
+ - Business rules: {count}
68
+ - API endpoints: {count}
69
+ - Sections: {count}
70
+ - Files to create: {count}
71
+ - BR-to-code mappings: {count}
72
+ ```
73
+
74
+ **Key guarantees:**
75
+ - Source MUST reference feature.json path (traceability)
76
+ - All data is EXACT COPY from feature.json (no transformation, no invention)
77
+ - prd.json version: "2.0.0"
78
+ - source.type: "ba-handoff-programmatic"
79
+
80
+ **POST-CHECK (BLOCKING — DO NOT SKIP):**
81
+
82
+ After `ss derive-prd` execution, read the generated prd-{moduleCode}.json and verify structural integrity:
83
+
84
+ ```javascript
85
+ const prd = readJSON(`.ralph/prd-${moduleCode}.json`);
86
+ const featureHandoff = moduleFeature.handoff.filesToCreate;
87
+
88
+ // 1. Verify structure: filesToCreate MUST be under implementation (NOT root level)
89
+ if (prd.filesToCreate && !prd.implementation?.filesToCreate) {
90
+ BLOCKING_ERROR("prd.json has filesToCreate at ROOT level — this is NOT from ss derive-prd");
91
+ BLOCKING_ERROR("Re-run: ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json");
92
+ STOP;
93
+ }
94
+
95
+ // 2. Verify ALL 7 categories present and match feature.json
96
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests'];
97
+ for (const cat of categories) {
98
+ const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
99
+ const featureCount = featureHandoff[cat]?.length ?? 0;
100
+ if (prdCount !== featureCount) {
101
+ BLOCKING_ERROR(`${cat}: prd has ${prdCount} files but feature.json has ${featureCount}`);
102
+ }
103
+ }
104
+ ```
105
+
106
+ Display verification table:
107
+
108
+ ```
109
+ POST-CHECK: prd-{moduleCode}.json integrity
110
+ | Category | feature.json | prd.json | Match |
111
+ |----------------|-------------|----------|-------|
112
+ | domain | {n} | {n} | OK/FAIL |
113
+ | application | {n} | {n} | OK/FAIL |
114
+ | infrastructure | {n} | {n} | OK/FAIL |
115
+ | api | {n} | {n} | OK/FAIL |
116
+ | frontend | {n} | {n} | OK/FAIL |
117
+ | seedData | {n} | {n} | OK/FAIL |
118
+ | tests | {n} | {n} | OK/FAIL |
119
+ ```
120
+
121
+ IF ANY category shows FAIL → **STOP AND RE-RUN `ss derive-prd`**. DO NOT proceed with incomplete PRD.
122
+
123
+ ---
124
+
125
+ ### 2. Initialize Progress Tracker
126
+
127
+ > **Template:** Read `templates/tpl-progress.md` for the complete progress tracker template structure.
128
+ > Populate the template with module-specific data from feature.json handoff sections.
129
+
130
+ **Progress Tracker Rules:**
131
+ - One section per module, in topological order (dependencies first)
132
+ - CORE SeedData ALWAYS 5 entries (mandatory)
133
+ - Business SeedData varies by module
134
+ - Hierarchical task structure (module -> layer -> tasks)
135
+ - Each task is independent, assignable checkbox
136
+ - Effort estimate per module (simple/medium/complex)
137
+ - Summary with totals across all modules
138
+ - Cross-module tasks only if multi-module
139
+
140
+ ---
141
+
142
+ ### 3. Update BA Manifest (MANDATORY)
143
+
144
+ > **The BA manifest enables the SmartStack web app to discover and display all available business analyses.**
145
+ > It is a JSON index file at `docs/business/index.json` that lists all feature.json files.
146
+
147
+ **Path:** `docs/business/index.json` (project root relative)
148
+
149
+ **Schema:**
150
+ ```json
151
+ {
152
+ "version": "1.0",
153
+ "updatedAt": "{ISO timestamp}",
154
+ "analyses": [
155
+ {
156
+ "appCode": "{app_code}",
157
+ "appName": "{application_name}",
158
+ "moduleCode": null | "{module_code}",
159
+ "moduleName": "{module_name}",
160
+ "version": "{version}",
161
+ "status": "handed-off",
162
+ "featureDescription": "{feature_description}",
163
+ "path": "{app_code}/business-analyse/v{version}/feature.json",
164
+ "updatedAt": "{ISO timestamp}"
165
+ }
166
+ ]
167
+ }
168
+ ```
169
+
170
+ **Update logic:**
171
+
172
+ 1. Read existing manifest at `docs/business/index.json` (or create empty `{ "version": "1.0", "updatedAt": "", "analyses": [] }`)
173
+ 2. For the APPLICATION-level feature.json:
174
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == null` AND `version == {version}`
175
+ - If found: update `status`, `updatedAt`, `featureDescription`
176
+ - If not found: append new entry with `moduleCode: null` and `path: "{app_code}/business-analyse/v{version}/feature.json"`
177
+ 3. For EACH MODULE-level feature.json:
178
+ - Find existing entry where `appCode == {app_code}` AND `moduleCode == {module_code}` AND `version == {version}`
179
+ - If found: update `status`, `updatedAt`, `featureDescription`
180
+ - If not found: append new entry with `moduleCode: "{module_code}"` and `path: "{app_code}/{module_code}/business-analyse/v{version}/feature.json"`
181
+ 4. Update root `updatedAt` to current timestamp
182
+ 5. Write manifest back to `docs/business/index.json`
183
+
184
+ **Display confirmation:**
185
+ ```
186
+ ✓ BA manifest updated: docs/business/index.json
187
+ Entries: {total_count} ({app_count} applications, {module_count} modules)
188
+ Web viewer: /system/docs/ba
189
+ ```
190
+
191
+ **Why a manifest?**
192
+ - The web app needs to discover available BAs without scanning the filesystem
193
+ - Static file serving (no backend API needed)
194
+ - Incremental updates: each handoff adds/updates only its entries
195
+ - Consumed by the SmartStack web app BA viewer at `/system/docs/ba`
196
+
197
+ ---
198
+
199
+ ### 4. Completion Summary
200
+
201
+ Display the completion summary after successful artifact deployment:
202
+
203
+ > **Reference:** Read `templates/tpl-launch-displays.md` for user-facing display templates.
204
+
205
+ ```
206
+ ═══════════════════════════════════════════════════════════════
207
+ [OK] BUSINESS ANALYSE TERMINEE - {application_name}
208
+ ═══════════════════════════════════════════════════════════════
209
+
210
+ Modules: {count} ({names})
211
+ Strategy: {strategy}
212
+ Files: {total files across all modules}
213
+ Tasks: {total tasks} ({core_count} CORE + {biz_count} business + {dev_count} development)
214
+ Complexity: {complexity}
215
+ Effort: {total_days} days ({total_hours} hours)
216
+
217
+ [DIR] Artefacts generés:
218
+ ✓ feature.json (master + per-module) - spécification complète
219
+ ✓ .ralph/prd.json or .ralph/prd-{module}.json - task breakdown
220
+ ✓ .ralph/progress.txt - tracker de progression
221
+ ✓ ba-interactive.html - document de revue interactif (step-05d)
222
+
223
+ [TARGET] Prochaines étapes:
224
+ 1. Finaliser le document interactif (HTML)
225
+ 2. Ouvrir ba-interactive.html dans le navigateur
226
+ 3. Partager avec les stakeholders pour validation
227
+ 4. Si retours --> relancer /business-analyse pour une nouvelle itération
228
+ 5. Une fois validé, lancer le développement:
229
+
230
+ /ralph-loop -r
231
+
232
+ ═══════════════════════════════════════════════════════════════
233
+ ```
234
+
235
+ **No AskUserQuestion here.** Proceed directly to step-05d.
236
+
237
+ ---
238
+
239
+ ## SELF-VERIFICATION
240
+
241
+ Before proceeding to step-05d, VERIFY:
242
+
243
+ 1. **`.ralph/prd-{module}.json`** exists for ALL modules (file size > 100 bytes each)
244
+ 2. **`.ralph/progress.txt`** exists (file size > 500 bytes)
245
+ 3. **`docs/business/index.json`** exists with correct entry count (1 app + N modules)
246
+
247
+ **IF any check fails → GENERATE the missing artifact before proceeding to step-05d.**
248
+
249
+ ---
250
+
251
+ ## MODE SUPPORT
252
+
253
+ ### Standard Mode
254
+
255
+ Full handoff with all implementation details:
256
+ - All 7 file categories
257
+ - Complete BR-to-code mapping
258
+ - Full API endpoint summary
259
+ - Detailed prd.json
260
+ - Comprehensive progress tracker
261
+
262
+ ### Micro Mode (use_case = micro)
263
+
264
+ Simplified handoff with minimal scope:
265
+ - Only essential CRUD entity + controller
266
+ - 3 core SeedData entries (omit some optional ones)
267
+ - Basic prd.json with simplified sections
268
+ - Lightweight progress.txt
269
+ - Display `/ralph-loop -r` command for later use
270
+
271
+ ### Delta Mode (use_case = refactoring)
272
+
273
+ Focused handoff for changes:
274
+ - Only affected modules listed
275
+ - Reuse existing implementation patterns
276
+ - Highlight what changed vs baseline
277
+ - Update only affected prd.json sections
278
+ - Progress tracker shows only delta tasks
279
+
280
+ ---
281
+
282
+ ## TROUBLESHOOTING
283
+
284
+ | Issue | Resolution |
285
+ |-------|-----------|
286
+ | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
287
+ | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
288
+ | progress.txt incomplete | Ensure all 5 CORE SeedData entries are present per module. Check topological order. |
289
+ | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 3. |
290
+ | Manifest entries incorrect | Verify appCode, moduleCode, and version match feature.json metadata exactly. |
291
+
292
+ ---
293
+
294
+ ## NEXT STEP
295
+
296
+ Load: steps/step-05d-html.md