@atlashub/smartstack-cli 3.2.0 → 3.3.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 (33) hide show
  1. package/dist/index.js +605 -25
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/ba-reader.md +1 -1
  5. package/templates/agents/ba-writer.md +8 -1
  6. package/templates/skills/business-analyse/SKILL.md +21 -23
  7. package/templates/skills/business-analyse/_architecture.md +123 -0
  8. package/templates/skills/business-analyse/_elicitation.md +206 -0
  9. package/templates/skills/business-analyse/_module-loop.md +56 -0
  10. package/templates/skills/business-analyse/_shared.md +75 -531
  11. package/templates/skills/business-analyse/_suggestions.md +34 -0
  12. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  13. package/templates/skills/business-analyse/questionnaire.md +2 -2
  14. package/templates/skills/business-analyse/react/components.md +1 -1
  15. package/templates/skills/business-analyse/react/schema.md +1 -1
  16. package/templates/skills/business-analyse/references/html-data-mapping.md +294 -0
  17. package/templates/skills/business-analyse/schemas/feature-schema.json +1 -1
  18. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  19. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +1 -1
  20. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  21. package/templates/skills/business-analyse/steps/step-00-init.md +13 -10
  22. package/templates/skills/business-analyse/steps/step-01-cadrage.md +2 -0
  23. package/templates/skills/business-analyse/steps/step-02-decomposition.md +5 -3
  24. package/templates/skills/business-analyse/steps/{step-03-specify.md → step-03a-specify.md} +16 -606
  25. package/templates/skills/business-analyse/steps/step-03b-compile.md +670 -0
  26. package/templates/skills/business-analyse/steps/step-04-consolidation.md +7 -5
  27. package/templates/skills/business-analyse/steps/step-05a-handoff.md +727 -0
  28. package/templates/skills/business-analyse/steps/step-05b-deploy.md +479 -0
  29. package/templates/skills/business-analyse/steps/step-06-extract.md +4 -2
  30. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  31. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +161 -0
  32. package/templates/skills/business-analyse/templates/tpl-progress.md +171 -0
  33. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -1682
@@ -0,0 +1,670 @@
1
+ ---
2
+ name: step-03b-compile
3
+ description: Module specification compilation, validation, HTML deployment, and loop decision
4
+ model: opus
5
+ next_step: steps/step-03a-specify.md OR steps/step-04-consolidation.md (conditional)
6
+ ---
7
+
8
+ > **Context files:** `_shared.md` | `_module-loop.md`
9
+
10
+ # Step 3b: 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
+ - **ID NAMING RULE (MANDATORY, NO EXCEPTION):**
20
+ All IDs MUST include a module prefix to guarantee application-wide uniqueness.
21
+ The prefix is derived from the module code initials (2-4 chars):
22
+ UserManagement → UM | VehicleManagement → VM | PartsInventory → PI
23
+ RepairManagement → RM | MaintenanceSchedule → MS | DataSync → DS
24
+ Notifications → NT | Dashboard → DB | Orders → OR | Customers → CU
25
+
26
+ Patterns:
27
+ UC-{PREFIX}-{NNN} → UC-RM-001, UC-PI-003
28
+ BR-{CAT}-{PREFIX}-{NNN} → BR-VAL-RM-001, BR-CALC-PI-002
29
+ FR-{PREFIX}-{NNN} → FR-RM-001
30
+ OBJ-{PREFIX}-{NNN} → OBJ-RM-001
31
+ AC-{PREFIX}-{NNN} → AC-RM-001
32
+ RISK-{PREFIX}-{NNN} → RISK-RM-001
33
+
34
+ NEVER use bare IDs (UC-001, BR-VAL-001) in multi-module mode.
35
+ - **SCHEMA CONFORMITY RULE:**
36
+ ALL data MUST fit within the defined feature-schema.json structure.
37
+ NEVER create custom top-level fields (KPIDefinitions, ChartConfigurations, etc.)
38
+ Dashboard modules MUST use specification.dashboards[] (it exists in the schema).
39
+ If truly needed, use specification.extensions: {} (additionalProperties: true).
40
+
41
+ ## YOUR TASK
42
+
43
+ Compile all data collected in step-03a into the module feature.json: write specification (8a-8l), validate, update status, deploy incremental HTML, and decide loop continuation.
44
+
45
+ ---
46
+
47
+ ### 8. Full Specification
48
+
49
+ Generate the complete specification for this module. **Each subsection below includes a STRUCTURE CARD showing the EXACT JSON format. Follow them precisely.**
50
+
51
+ #### 8a. Actors
52
+
53
+ Inherited from application roles → mapped to module permissions.
54
+
55
+ > **STRUCTURE CARD: specification.actors[]**
56
+ > ```json
57
+ > {
58
+ > "role": "Sales Manager",
59
+ > "description": "Creates and approves orders",
60
+ > "permissions": [
61
+ > "business.{app}.{module}.read",
62
+ > "business.{app}.{module}.create",
63
+ > "business.{app}.{module}.update"
64
+ > ]
65
+ > }
66
+ > ```
67
+ > **MANDATORY fields:** `role`, `permissions` (array of permission paths)
68
+ > **FORBIDDEN fields:** Do NOT use `systemRole`. Use `permissions` array.
69
+
70
+ #### 8b. Use Cases (UC-{PREFIX}-NNN)
71
+
72
+ Per section: list, create, read, update, delete, approve, etc.
73
+
74
+ > **STRUCTURE CARD: specification.useCases[]**
75
+ > ```json
76
+ > {
77
+ > "id": "UC-{PREFIX}-001",
78
+ > "name": "Create Order",
79
+ > "primaryActor": "Sales Representative",
80
+ > "permission": "business.{app}.{module}.create",
81
+ > "preconditions": ["Customer exists", "Products in stock"],
82
+ > "postconditions": ["Order created with Draft status"],
83
+ > "mainScenario": [
84
+ > "1. User navigates to creation form",
85
+ > "2. User fills in required fields",
86
+ > "3. System validates data (BR-VAL-{PREFIX}-001)",
87
+ > "4. System creates the record",
88
+ > "5. System displays confirmation"
89
+ > ],
90
+ > "alternativeScenarios": [
91
+ > { "name": "Validation failure", "steps": ["1. System detects invalid data", "2. System highlights errors"] }
92
+ > ],
93
+ > "errorScenarios": [
94
+ > { "name": "Server error", "steps": ["1. System shows error message", "2. Data preserved for retry"] }
95
+ > ],
96
+ > "linkedRules": ["BR-VAL-{PREFIX}-001", "BR-WF-{PREFIX}-002"]
97
+ > }
98
+ > ```
99
+ > **MANDATORY fields:** `id`, `name`, `primaryActor`, `permission`, `mainScenario`, `linkedRules`
100
+ > **FORBIDDEN fields:** Do NOT use `actor` (use `primaryActor`), `linkedBRs` (use `linkedRules`), `linkedFRs` (not in UC, FRs link to UCs instead)
101
+
102
+ #### 8c. Functional Requirements (FR-{PREFIX}-NNN)
103
+
104
+ Linked to BRs and UCs.
105
+
106
+ > **STRUCTURE CARD: specification.functionalRequirements[]**
107
+ > ```json
108
+ > {
109
+ > "id": "FR-{PREFIX}-001",
110
+ > "statement": "System MUST validate customer budget before order creation",
111
+ > "priority": "must|should|could",
112
+ > "linkedRules": ["BR-VAL-{PREFIX}-001"],
113
+ > "linkedUseCases": ["UC-{PREFIX}-001"],
114
+ > "acceptanceCriteria": [
115
+ > "Order rejected if total > budget",
116
+ > "Error message displayed with remaining budget"
117
+ > ]
118
+ > }
119
+ > ```
120
+ > **MANDATORY fields:** `id`, `statement`, `priority`, `linkedUseCases`
121
+ > **FORBIDDEN fields:** Do NOT use `name`/`description` (use `statement` with System MUST/SHOULD/COULD format), `linkedUCs` (use `linkedUseCases`), `linkedBRs` (use `linkedRules`)
122
+
123
+ #### 8d. Permission Matrix
124
+
125
+ Roles × resources × operations with full paths.
126
+
127
+ > **STRUCTURE CARD: specification.permissionMatrix**
128
+ > ```json
129
+ > {
130
+ > "permissions": [
131
+ > { "path": "business.{app}.{module}.read", "action": "read", "description": "View records" },
132
+ > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create new records" },
133
+ > { "path": "business.{app}.{module}.update", "action": "update", "description": "Update existing records" },
134
+ > { "path": "business.{app}.{module}.delete", "action": "delete", "description": "Delete records" },
135
+ > { "path": "business.{app}.{module}.export", "action": "export", "description": "Export data" }
136
+ > ],
137
+ > "roleAssignments": [
138
+ > { "role": "{App} Admin", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update", "business.{app}.{module}.delete", "business.{app}.{module}.export"] },
139
+ > { "role": "{App} Manager", "permissions": ["business.{app}.{module}.read", "business.{app}.{module}.create", "business.{app}.{module}.update"] },
140
+ > { "role": "{App} Viewer", "permissions": ["business.{app}.{module}.read"] }
141
+ > ]
142
+ > }
143
+ > ```
144
+ > **STRUCTURE:** Object with 2 arrays: `permissions[]` and `roleAssignments[]`
145
+ > **FORBIDDEN:** Do NOT use a flat array with `resource`/`roles` fields. Always use the nested structure above.
146
+
147
+ #### 8e. Navigation
148
+
149
+ Module → Sections → Resources (levels 3-4-5 of the hierarchy).
150
+
151
+ > **STRUCTURE CARD: specification.navigation**
152
+ > ```json
153
+ > {
154
+ > "entries": [
155
+ > { "level": "module", "code": "{module}", "labels": {"fr": "...", "en": "..."}, "route": "/business/{app}/{module}", "icon": "list" },
156
+ > { "level": "section", "code": "list", "labels": {"fr": "Liste", "en": "List", "it": "Elenco", "de": "Liste"}, "route": "/business/{app}/{module}/list", "icon": "list" },
157
+ > { "level": "section", "code": "dashboard", "labels": {"fr": "Dashboard", "en": "Dashboard"}, "route": "/business/{app}/{module}/dashboard", "icon": "chart-bar", "isNew": true }
158
+ > ]
159
+ > }
160
+ > ```
161
+
162
+ #### 8f. SeedData Core
163
+
164
+ 5 MANDATORY typed arrays — each with structured objects, NOT flat strings or objects.
165
+
166
+ > **STRUCTURE CARD: specification.seedDataCore**
167
+ > ```json
168
+ > {
169
+ > "navigationModules": [
170
+ > { "code": "{module}", "label": "{Module Name}", "icon": "list", "route": "/business/{app}/{module}", "parentCode": "{app}", "sort": 1 }
171
+ > ],
172
+ > "navigationTranslations": [
173
+ > { "moduleCode": "{module}", "language": "fr", "label": "..." },
174
+ > { "moduleCode": "{module}", "language": "en", "label": "..." },
175
+ > { "moduleCode": "{module}", "language": "it", "label": "..." },
176
+ > { "moduleCode": "{module}", "language": "de", "label": "..." }
177
+ > ],
178
+ > "permissions": [
179
+ > { "path": "business.{app}.{module}.read", "action": "read", "description": "View {module}" },
180
+ > { "path": "business.{app}.{module}.create", "action": "create", "description": "Create {module}" }
181
+ > ],
182
+ > "rolePermissions": [
183
+ > { "role": "{App} Admin", "permissionPath": "business.{app}.{module}.*" },
184
+ > { "role": "{App} Manager", "permissionPath": "business.{app}.{module}.read" }
185
+ > ],
186
+ > "permissionConstants": [
187
+ > { "constantName": "{Module}Read", "path": "business.{app}.{module}.read" },
188
+ > { "constantName": "{Module}Create", "path": "business.{app}.{module}.create" }
189
+ > ]
190
+ > }
191
+ > ```
192
+ > **MANDATORY:** All 5 arrays must be present. Each element must be an object, NOT a string.
193
+ > **FORBIDDEN:** Do NOT use `navigationModule` (singular string), `permissions` as flat string array, `rolePermissions` as flat object, `permissionsConstants` as comma-separated string.
194
+
195
+ #### 8g. Gherkin Scenarios
196
+
197
+ BDD acceptance tests per UC.
198
+
199
+ > **STRUCTURE CARD: specification.gherkinScenarios[]**
200
+ > ```json
201
+ > {
202
+ > "feature": "{Module} Management",
203
+ > "scenarios": [
204
+ > {
205
+ > "name": "Create a new record with valid data",
206
+ > "tags": ["@{module}", "@create", "@smoke"],
207
+ > "given": ["An authenticated user with role Manager", "No existing record with code 'TEST-001'"],
208
+ > "when": ["The user fills the creation form", "The user submits the form"],
209
+ > "then": ["The record is created with Draft status", "A success message is displayed"]
210
+ > }
211
+ > ]
212
+ > }
213
+ > ```
214
+ > **STRUCTURE:** Object with `feature` string + `scenarios[]` array. Each scenario has `given`, `when`, `then` as ARRAYS of strings.
215
+ > **FORBIDDEN:** Do NOT use flat arrays of `{uc, scenario, given, when, then}` where given/when/then are single strings.
216
+
217
+ #### 8h. Validations
218
+
219
+ Field validation rules per entity.
220
+
221
+ > **STRUCTURE CARD: specification.validations[]**
222
+ > ```json
223
+ > {
224
+ > "entity": "Order",
225
+ > "field": "amount",
226
+ > "rules": ["required", "decimal", "min:0.01", "max:999999.99"],
227
+ > "errorMessageKey": "validation.{module}.amount.invalid"
228
+ > }
229
+ > ```
230
+ > **MANDATORY fields:** `entity`, `field`, `rules` (array), `errorMessageKey`
231
+ > **FORBIDDEN fields:** Do NOT use `rule` (singular string) or `message` (use `errorMessageKey`).
232
+
233
+ #### 8i. Business Messages
234
+
235
+ Minimum 4: success, error CRUD, error validation, error permission.
236
+
237
+ > **STRUCTURE CARD: specification.messages[]**
238
+ > ```json
239
+ > {
240
+ > "code": "{MODULE}-SUCCESS-CREATE",
241
+ > "type": "success|error|warning|info",
242
+ > "title": "Record Created",
243
+ > "message": "The record {code} has been created successfully.",
244
+ > "i18nKey": "message.{module}.created"
245
+ > }
246
+ > ```
247
+ > **MANDATORY fields:** `code`, `type`, `message`, `i18nKey`
248
+ > **FORBIDDEN:** Do NOT omit `title` or `i18nKey`. Every message MUST have an i18n key.
249
+
250
+ #### 8j. Entity Lifecycle
251
+
252
+ State machines for entities with status/state.
253
+ **Note:** If depth = full and 3a-state was executed, lifeCycles are already defined. Verify completeness and add any missing states/transitions.
254
+
255
+ > **STRUCTURE CARD: specification.lifeCycles[]**
256
+ > ```json
257
+ > {
258
+ > "entity": "Order",
259
+ > "field": "status",
260
+ > "initialState": "draft",
261
+ > "states": [
262
+ > { "id": "draft", "displayName": "Brouillon", "color": "gray", "allowedTransitions": ["submitted"], "isTerminal": false },
263
+ > { "id": "submitted", "displayName": "Soumis", "color": "blue", "allowedTransitions": ["approved", "rejected"], "isTerminal": false },
264
+ > { "id": "approved", "displayName": "Approuvé", "color": "green", "allowedTransitions": ["archived"], "isTerminal": false },
265
+ > { "id": "rejected", "displayName": "Rejeté", "color": "red", "allowedTransitions": [], "isTerminal": true },
266
+ > { "id": "archived", "displayName": "Archivé", "color": "purple", "allowedTransitions": [], "isTerminal": true }
267
+ > ],
268
+ > "transitions": [
269
+ > {
270
+ > "from": "draft", "to": "submitted", "action": "submit",
271
+ > "label": { "fr": "Soumettre", "en": "Submit" },
272
+ > "permission": "business.{app}.{module}.update",
273
+ > "guards": ["BR-VAL-{PREFIX}-001"],
274
+ > "effects": [{ "type": "notification", "target": "role:manager", "template": "{module}-submitted" }],
275
+ > "confirm": true
276
+ > }
277
+ > ]
278
+ > }
279
+ > ```
280
+ > **MANDATORY:** `states` MUST be an array of OBJECTS with `id`, `displayName`, `color`, `allowedTransitions`, `isTerminal`. NEVER use flat string arrays.
281
+ > **Colors:** gray (draft/new), blue (in-progress), green (active/approved), yellow (warning/pending), orange (review), red (error/rejected), purple (archived/terminal)
282
+ > **FORBIDDEN:** Do NOT use `states: ["Active", "Inactive"]` (flat strings), `terminalStates` (use `isTerminal: true` on each state).
283
+
284
+ #### 8k. API Endpoints
285
+
286
+ RESTful routes following SmartStack patterns.
287
+
288
+ > **STRUCTURE CARD: specification.apiEndpoints[]**
289
+ > ```json
290
+ > {
291
+ > "method": "GET|POST|PUT|PATCH|DELETE",
292
+ > "path": "/api/business/{app}/{module}",
293
+ > "permission": "business.{app}.{module}.read",
294
+ > "requestDto": "Get{Module}Query",
295
+ > "responseDto": "{Module}Dto[]",
296
+ > "description": "List all records with pagination and filters"
297
+ > }
298
+ > ```
299
+ > **MANDATORY fields:** `method`, `path`, `permission`, `description`
300
+ > **Recommended:** Include `requestDto` and `responseDto` for implementation clarity.
301
+
302
+ #### 8l. i18n Keys
303
+
304
+ Translation keys for all UI text (4 languages: fr, en, it, de).
305
+
306
+ > **STRUCTURE CARD: specification.i18nKeys**
307
+ > ```json
308
+ > {
309
+ > "title": { "fr": "{Module}", "en": "{Module}", "it": "{Module}", "de": "{Module}" },
310
+ > "list": { "title": { "fr": "Liste", "en": "List" }, "empty": { "fr": "Aucun enregistrement", "en": "No records" } },
311
+ > "create": { "title": { "fr": "Nouveau", "en": "New" } },
312
+ > "detail": { "title": { "fr": "Détail", "en": "Detail" } },
313
+ > "buttons": { "create": { "fr": "Créer", "en": "Create" }, "edit": { "fr": "Modifier", "en": "Edit" }, "delete": { "fr": "Supprimer", "en": "Delete" } },
314
+ > "validation": { "required": { "fr": "Ce champ est requis", "en": "This field is required" } }
315
+ > }
316
+ > ```
317
+
318
+ ### 9. Per-Module Validation
319
+
320
+ > **Fused from old step-03-validate.md, run INLINE after specification.**
321
+
322
+ #### 9a. Completeness Checks
323
+
324
+ | Section | Minimum | Status |
325
+ |---------|---------|--------|
326
+ | actors | 2 | PASS/FAIL |
327
+ | useCases | 2 | PASS/FAIL |
328
+ | functionalRequirements | 4 | PASS/FAIL |
329
+ | permissionMatrix | 1 resource × 2 roles | PASS/FAIL |
330
+ | entities | 1 | PASS/FAIL |
331
+ | wireframes | 1 per section (BLOCKING) | PASS/FAIL |
332
+ | gherkinScenarios | 2 per UC | PASS/FAIL |
333
+ | validations | 1 | PASS/FAIL |
334
+ | messages | 4 | PASS/FAIL |
335
+ | lifeCycles | 1 (if entity has status) | PASS/FAIL |
336
+ | seedDataCore | 5 sections present | PASS/FAIL (BLOCKING) |
337
+
338
+ #### 9b. Consistency Checks
339
+
340
+ - Every UC has ≥1 linked FR
341
+ - Every FR has ≥1 linked BR
342
+ - All BR references exist in analysis.businessRules
343
+ - All actors appear in permissionMatrix
344
+ - Permission paths use full format: `business.{app}.{module}.{resource}.{action}`
345
+ - rolePermissions paths match permissions paths
346
+ - API routes use consistent prefix
347
+
348
+ #### 9c. Convention Checks
349
+
350
+ - UC-NNN format
351
+ - FR-NNN format
352
+ - BR-{CATEGORY}-NNN format
353
+ - Entity names PascalCase
354
+ - Field names camelCase
355
+ - Permission paths dot-separated lowercase
356
+
357
+ #### 9d. Decision
358
+
359
+ IF validation PASS:
360
+ Display summary, ask client for confirmation
361
+
362
+ IF validation FAIL:
363
+ Display errors, offer:
364
+ ```
365
+ options:
366
+ - label: "Auto-corriger"
367
+ description: "Corriger automatiquement les erreurs détectées"
368
+ - label: "Réviser manuellement"
369
+ description: "Revenir aux sections problématiques"
370
+ - label: "Forcer la validation"
371
+ description: "Accepter malgré les erreurs (risqué)"
372
+ ```
373
+
374
+ #### 9e. Write Module Validation Section (MANDATORY)
375
+
376
+ > **The module feature.json MUST have a `validation` section recording the results of steps 9a-9d.**
377
+
378
+ ```
379
+ ba-writer.enrichSection({
380
+ featureId: {module_feature_id},
381
+ section: "validation",
382
+ data: {
383
+ validatedAt: "{ISO timestamp}",
384
+ completenessChecks: [
385
+ { "section": "useCases", "count": {count}, "minimum": 2, "status": "PASS|FAIL" },
386
+ { "section": "functionalRequirements", "count": {count}, "minimum": 4, "status": "PASS|FAIL" },
387
+ { "section": "wireframes", "count": {count}, "minimum": {section_count}, "status": "PASS|FAIL" },
388
+ { "section": "seedDataCore", "count": 5, "minimum": 5, "status": "PASS|FAIL" }
389
+ ],
390
+ consistencyChecks: [
391
+ { "check": "UC-FR linkage", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
392
+ { "check": "BR references valid", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" },
393
+ { "check": "Permission path format", "passed": {n}, "warnings": {n}, "errors": {n}, "status": "PASS|FAIL" }
394
+ ],
395
+ conventionChecks: [
396
+ { "check": "ID naming with module prefix", "status": "PASS|FAIL", "details": "..." },
397
+ { "check": "Entity names PascalCase", "status": "PASS|FAIL", "details": "..." }
398
+ ],
399
+ semanticChecks: [
400
+ { "check": "orphan-permissions", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
401
+ { "check": "uc-sans-fr", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false },
402
+ { "check": "missing-wireframes", "module": "{currentModule}", "status": "PASS|WARNING|ERROR", "details": "...", "autoFixed": false }
403
+ ],
404
+ warnings: ["List of non-blocking warnings"],
405
+ decision: {
406
+ "approved": true,
407
+ "reason": "All checks passed",
408
+ "approvalMode": "standard",
409
+ "approvedBy": "Client",
410
+ "approvedAt": "{ISO timestamp}"
411
+ }
412
+ }
413
+ })
414
+ ```
415
+
416
+ ### 10. Module Summary with Roles & Permissions
417
+
418
+ Display comprehensive summary:
419
+
420
+ ```
421
+ ═══════════════════════════════════════════════════════════
422
+ MODULE SPÉCIFIÉ: {currentModule} ({currentModuleIndex + 1}/{total})
423
+ ═══════════════════════════════════════════════════════════
424
+
425
+ | Aspect | Valeur |
426
+ |--------|--------|
427
+ | Entités | {count} ({entity names}) |
428
+ | Business Rules | {count} (VAL: X, CALC: Y, WF: Z) |
429
+ | Use Cases | {count} (UC-001 → UC-NNN) |
430
+ | Exigences | {count} FRs |
431
+ | Sections | {count} ({section names}) |
432
+ | Maquettes | {count} wireframes |
433
+ | Permissions | {count} paths |
434
+ | Tests Gherkin | {count} scénarios |
435
+ | Messages | {count} |
436
+
437
+ ### Rôles & Permissions pour {currentModule}
438
+ | Rôle | Permissions |
439
+ |------|------------|
440
+ | {App} Admin | business.{app}.{module}.* |
441
+ | {App} Manager | read, create, update, assign |
442
+ | {App} Contributor | read, create, update |
443
+ | {App} Viewer | read |
444
+
445
+ → Validation: {PASS/FAIL}
446
+ ═══════════════════════════════════════════════════════════
447
+ ```
448
+
449
+ Ask via AskUserQuestion:
450
+
451
+ ```
452
+ question: "Le module {currentModule} est-il correctement spécifié ?"
453
+ header: "Module"
454
+ options:
455
+ - label: "Validé"
456
+ description: "Passer au module suivant"
457
+ - label: "Réviser"
458
+ description: "Modifier des éléments du module"
459
+ ```
460
+
461
+ ### 11. Write Module Feature.json
462
+
463
+ ```
464
+ // Write analysis section with ALL subsections
465
+ ba-writer.enrichSection({
466
+ featureId: {module_feature_id},
467
+ section: "analysis",
468
+ data: {
469
+ objectives: [{id, objective, metric, target}], // from 6a
470
+ entities: [{name, description, attributes, relationships}], // from 6b — SCHEMA FORMAT
471
+ businessRules: [{id, name, category, statement, priority, conditions, examples, testability}], // from 7 — SCHEMA FORMAT
472
+ processFlow: {entryPoints, mainFlow, decisionPoints, alternativeFlows}, // from 6c
473
+ dataLifecycle: {retentionPeriod, archiveStrategy, gdprCompliance, states} // from 6d
474
+ }
475
+ })
476
+
477
+ // Write specification section with ALL subsections
478
+ ba-writer.enrichSection({
479
+ featureId: {module_feature_id},
480
+ section: "specification",
481
+ data: {
482
+ actors: [{role, description, permissions}], // 8a
483
+ useCases: [{id, name, primaryActor, permission, mainScenario, linkedRules}], // 8b
484
+ functionalRequirements: [{id, statement, priority, linkedRules, linkedUseCases, acceptanceCriteria}], // 8c
485
+ permissionMatrix: {permissions: [], roleAssignments: []}, // 8d
486
+ navigation: {entries: []}, // 8e
487
+ seedDataCore: {navigationModules, navigationTranslations, permissions, rolePermissions, permissionConstants}, // 8f
488
+ gherkinScenarios: [{feature, scenarios: [{name, tags, given, when, then}]}], // 8g
489
+ validations: [{entity, field, rules, errorMessageKey}], // 8h
490
+ messages: [{code, type, title, message, i18nKey}], // 8i
491
+ lifeCycles: [{entity, field, initialState, states: [{id, displayName, color, allowedTransitions, isTerminal}], transitions}], // 8j
492
+ apiEndpoints: [{method, path, permission, requestDto, responseDto, description}], // 8k
493
+ i18nKeys: {...}, // 8l
494
+ sections: [{code, labels, route, icon, permission, wireframe, useCases, businessRules, resources}], // from 3a-bis
495
+ dashboards: [{code, title, kpis, filters, refreshMode}], // from 3d
496
+ uiWireframes: [{screen, section, mockup, elements, actions, componentMapping, layout}] // from 3b
497
+ }
498
+ })
499
+
500
+ // Write validation results from step 9
501
+ // (Already written in step 9e above)
502
+
503
+ ba-writer.updateStatus({module_feature_id}, "specified")
504
+
505
+ // Update master
506
+ ba-writer.updateModuleStatus({feature_id}, {currentModule.code}, "specified")
507
+ ```
508
+
509
+ ### 11-bis. Deploy Incremental Interactive HTML (MANDATORY)
510
+
511
+ > **After each module is specified, deploy/update the interactive HTML document with all available data.**
512
+ > This allows the client to review completed modules while the next module is being specified.
513
+ > The HTML is incrementally enriched: after module 1, only module 1 specs appear; after module 2, both appear; etc.
514
+
515
+ **Source:** `html/ba-interactive.html` (relative to skill root = `~/.claude/skills/business-analyse/html/`)
516
+
517
+ **Destination:** `docs/business/{app}/business-analyse/v{version}/ba-interactive.html`
518
+
519
+ **Steps:**
520
+
521
+ 1. **Read sources:**
522
+ - Read the HTML template from skill directory
523
+ - Read the master feature.json (application level — now updated with current module status)
524
+ - Read EACH completed module's feature.json (including the one just specified)
525
+
526
+ 2. **Build FEATURE_DATA object:**
527
+
528
+ > **Use the EXACT SAME mapping defined in step-05b-deploy.md section 3.**
529
+ > The mapping is identical — the only difference is that `moduleSpecs` only includes completed modules.
530
+ > Modules not yet specified will NOT appear in `moduleSpecs` (their entry in `modules[]` will show `status: "pending"`).
531
+
532
+ Follow step-05 section 9d "Step 2: Build FEATURE_DATA object" for the complete mapping pseudocode:
533
+ - `metadata`, `cadrage`, `modules[]`, `dependencies[]` → from master feature.json
534
+ - `moduleSpecs[moduleCode]` → only for modules with status "specified" (completed so far)
535
+ - `consolidation` → empty `{ interactions: [], e2eFlows: [] }` (not yet consolidated)
536
+ - `handoff` → empty `{}` (not yet handed off)
537
+
538
+ 3. **Replace placeholders in template:**
539
+ - Serialize the FEATURE_DATA object as JSON (2-space indentation)
540
+ - Replace `{{FEATURE_DATA}}` with the serialized JSON
541
+ - Replace `{{APPLICATION_NAME}}` → `{application_name}`
542
+ - Replace `{{APPLICATION_ID}}` → `{feature_id}`
543
+ - Replace `{{VERSION}}` → `{version}`
544
+ - Replace `{{CREATED_AT}}` → `{ISO timestamp}`
545
+
546
+ 4. **Write and confirm:**
547
+
548
+ ```
549
+ ✓ Interactive HTML updated (incremental):
550
+ Path: docs/business/{app}/business-analyse/v{version}/ba-interactive.html
551
+ Modules included: {completedModules.length}/{totalModules} specified
552
+ - {completedModule1}: {uc_count} UCs, {br_count} BRs, {entity_count} entities
553
+ - {completedModule2}: ...
554
+ Remaining: {pendingModules.join(', ')} (will be added after specification)
555
+ → Client can open in browser to review completed modules now.
556
+ ```
557
+
558
+ > **WHY incremental?** The client doesn't have to wait until handoff to start reviewing.
559
+ > While module 2 is being specified, the client can already give feedback on module 1.
560
+ > Each incremental deployment OVERWRITES the previous HTML (latest state always).
561
+ > The FINAL deployment at step-05 (handoff) will include consolidation and handoff data.
562
+
563
+ ---
564
+
565
+ ### 12. Loop Decision
566
+
567
+ ```
568
+ ba-writer.advanceModuleLoop({feature_id})
569
+ → Increments currentModuleIndex
570
+ → Updates completedModules
571
+ → Updates currentModule
572
+
573
+ IF currentModuleIndex < moduleOrder.length:
574
+ Display: "→ Module suivant: {nextModule} ({currentModuleIndex + 1}/{total})"
575
+ Load: steps/step-03a-specify.md
576
+
577
+ IF currentModuleIndex >= moduleOrder.length:
578
+ Display: "═══ Tous les modules spécifiés! Passage à la consolidation... ═══"
579
+ ba-writer.updateStatus({feature_id}, "specified")
580
+ Load: steps/step-04-consolidation.md
581
+ ```
582
+
583
+ ---
584
+
585
+ ## SELF-VERIFICATION (MANDATORY before loading next step)
586
+
587
+ Before proceeding to step-03a (next module) or step-04 (consolidation), VERIFY:
588
+
589
+ 1. **Module feature.json has specification section** with ALL sub-sections (actors, useCases, functionalRequirements, permissionMatrix, navigation, seedDataCore, gherkinScenarios, validations, messages, lifeCycles, apiEndpoints, i18nKeys, sections, uiWireframes)
590
+ 2. **Module feature.json status** = "specified" (set by section 11)
591
+ 3. **Master modules[].status** for this module = "specified" (set by section 11)
592
+ 4. **ba-interactive.html exists** and includes data for this module (set by section 11-bis)
593
+
594
+ **IF any check fails → FIX before proceeding.** Do NOT advance the module loop with incomplete data.
595
+
596
+ ---
597
+
598
+ ## SINGLE-MODULE MODE
599
+
600
+ When only 1 module in moduleOrder:
601
+
602
+ - Same full specification flow
603
+ - Skip cross-module references (section 5)
604
+ - After validation → direct to step-04-consolidation.md (auto-consolidation)
605
+
606
+ ---
607
+
608
+ ## RESUME SUPPORT
609
+
610
+ IF the step is resumed (e.g., after interruption):
611
+
612
+ ```
613
+ Read metadata.workflow.currentModuleIndex
614
+ Read metadata.workflow.currentModule
615
+ → Resume at the correct module
616
+ → If module has partial data, show what exists and continue from there
617
+ ```
618
+
619
+ ---
620
+
621
+ ## CONTEXT MANAGEMENT
622
+
623
+ | Loaded | Not Loaded |
624
+ |--------|------------|
625
+ | _shared.md | Other module feature.json (full) |
626
+ | feature-schema.json | Questionnaires not needed |
627
+ | Questionnaires for this module | Templates |
628
+ | Completed modules summary (100 lines max) | React viewer files |
629
+
630
+ ---
631
+
632
+ ## STATE VARIABLES
633
+
634
+ | Variable | Description |
635
+ |----------|-------------|
636
+ | `{currentModule}` | Current module being specified |
637
+ | `{currentModuleIndex}` | Index in moduleOrder |
638
+ | `{completedModules}` | Array of already specified module codes |
639
+ | `{module_feature_id}` | Feature ID for the module-level feature.json |
640
+
641
+ ---
642
+
643
+ ## SUCCESS METRICS
644
+
645
+ - All sections walked through with client
646
+ - ASCII mockups generated and validated for EVERY section (1 wireframe per section minimum)
647
+ - Entities defined with business attributes
648
+ - Business rules extracted and categorized
649
+ - Per-module validation PASS
650
+ - Client confirmed module specification
651
+ - Module feature.json written
652
+ - Master updated with module status
653
+ - **Interactive HTML deployed/updated with completed module data (incremental)**
654
+ - Loop advanced correctly
655
+
656
+ ## FAILURE MODES
657
+
658
+ - Validation FAIL → offer auto-correct / manual revise / force
659
+ - Client rejects → revise specific sections
660
+ - Cross-module reference error → clarify with client
661
+ - Interruption → resumable via workflow state
662
+
663
+ ---
664
+
665
+ ## NEXT STEP
666
+
667
+ Conditional:
668
+
669
+ - IF modules remaining → Load `steps/step-03a-specify.md`
670
+ - IF all modules done → Load `steps/step-04-consolidation.md`