@atlashub/smartstack-cli 3.17.0 → 3.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 (43) hide show
  1. package/dist/index.js +3 -0
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/gitflow/start.md +2 -2
  5. package/templates/skills/business-analyse/SKILL.md +5 -5
  6. package/templates/skills/business-analyse/_shared.md +46 -20
  7. package/templates/skills/business-analyse/html/ba-interactive.html +57 -107
  8. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +13 -0
  9. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +1 -1
  10. package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +11 -20
  11. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +1 -3
  12. package/templates/skills/business-analyse/html/src/template.html +31 -83
  13. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +71 -3
  14. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +11 -8
  15. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +7 -5
  16. package/templates/skills/business-analyse/references/deploy-data-build.md +42 -14
  17. package/templates/skills/business-analyse/references/deploy-modes.md +1 -1
  18. package/templates/skills/business-analyse/references/entity-architecture-decision.md +218 -0
  19. package/templates/skills/business-analyse/references/robustness-checks.md +2 -1
  20. package/templates/skills/business-analyse/references/spec-auto-inference.md +70 -16
  21. package/templates/skills/business-analyse/references/ui-resource-cards.md +149 -0
  22. package/templates/skills/business-analyse/steps/step-00-init.md +23 -5
  23. package/templates/skills/business-analyse/steps/step-01-cadrage.md +220 -32
  24. package/templates/skills/business-analyse/steps/step-02-decomposition.md +35 -26
  25. package/templates/skills/business-analyse/steps/step-03a1-setup.md +122 -32
  26. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +8 -0
  27. package/templates/skills/business-analyse/steps/step-03b-ui.md +68 -5
  28. package/templates/skills/business-analyse/steps/step-03d-validate.md +34 -1
  29. package/templates/skills/business-analyse/steps/step-05a-handoff.md +99 -2
  30. package/templates/skills/business-analyse/steps/step-05b-deploy.md +44 -8
  31. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +226 -41
  32. package/templates/skills/business-analyse/steps/step-06-review.md +2 -1
  33. package/templates/skills/business-analyse/templates/tpl-handoff.md +5 -4
  34. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +4 -1
  35. package/templates/skills/business-analyse/templates-frd.md +5 -4
  36. package/templates/skills/gitflow/references/start-local-config.md +6 -3
  37. package/templates/skills/gitflow/steps/step-start.md +2 -2
  38. package/templates/skills/ralph-loop/SKILL.md +41 -1
  39. package/templates/skills/ralph-loop/references/category-rules.md +96 -2
  40. package/templates/skills/ralph-loop/references/compact-loop.md +85 -24
  41. package/templates/skills/ralph-loop/steps/step-00-init.md +30 -54
  42. package/templates/skills/ralph-loop/steps/step-01-task.md +102 -1
  43. package/templates/skills/ralph-loop/steps/step-04-check.md +87 -40
@@ -6,6 +6,7 @@ next_step: steps/step-03a2-analysis.md
6
6
  ---
7
7
 
8
8
  > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_module-loop.md`
9
+ > **Reference (5-bis):** `references/entity-architecture-decision.md` — Entity scoring, domain coherence, section patterns
9
10
 
10
11
  # Step 3a1: Setup - Module Initialization
11
12
 
@@ -198,31 +199,36 @@ Total: {N} requirements mapped to this module
198
199
 
199
200
  For each module, propose standard sections based on module type:
200
201
 
201
- | Module Type | Typical Sections |
202
- |-------------|-----------------|
203
- | data-centric | list, detail, create, edit |
204
- | workflow | list, detail, create, edit, approve, history |
205
- | integration | list, detail, config, sync, logs |
206
- | reporting | dashboard, detail, export, schedule |
207
- | full-module | list, detail, create, edit, approve, history, reports, settings |
202
+ > **RULE:** Sections = functional zones only. `list` is ALWAYS present (default).
203
+ > `create`/`edit` = actions within the `list` page (modal/drawer). `detail` = tabbed page from list click.
204
+
205
+ | Module Type | Sections (functional zones) | Detail page tabs (from list click) |
206
+ |-------------|---------------------------|-----------------------------------|
207
+ | data-centric | list | Infos, {relations} |
208
+ | workflow | list, approve | Infos, {relations}, Historique |
209
+ | integration | list | Infos, Config, Logs, Sync |
210
+ | reporting | dashboard | — |
211
+ | full-module | list, dashboard, approve | Infos, {relations}, Historique |
212
+
213
+ **Section `list` is automatic and ALWAYS included.** Ask ONLY about additional functional sections:
208
214
 
209
215
  Ask via AskUserQuestion:
210
216
 
211
217
  ```
212
- question: "Quelles sections le module {currentModule} doit-il avoir ?"
218
+ question: "{language == 'fr'
219
+ ? 'Le module {currentModule} aura une page liste (avec création et détail par onglets). Quelles sections fonctionnelles supplémentaires souhaitez-vous ?'
220
+ : 'Module {currentModule} will have a list page (with create and tabbed detail). Which additional functional sections do you want?'}"
213
221
  header: "Sections"
214
222
  multiSelect: true
215
223
  options:
216
- - label: "Liste"
217
- description: "Page de liste avec filtres, tri et pagination"
218
- - label: "Détail"
219
- description: "Page de détail d'un enregistrement"
220
- - label: "Création/Édition"
221
- description: "Formulaire de création et de modification"
222
- - label: "Validation/Approbation"
223
- description: "Workflow de validation avec changement de statut"
224
224
  - label: "Dashboard"
225
- description: "Tableau de bord avec KPIs, graphiques (Recharts) et métriques clés"
225
+ description: "{language == 'fr' ? 'Tableau de bord avec KPIs, graphiques et métriques clés' : 'Dashboard with KPIs, charts and key metrics'}"
226
+ - label: "Validation/Approbation"
227
+ description: "{language == 'fr' ? 'File d\'approbation avec workflow de changement de statut' : 'Approval queue with status change workflow'}"
228
+ - label: "Import en masse"
229
+ description: "{language == 'fr' ? 'Import CSV/Excel avec mapping et validation' : 'CSV/Excel import with mapping and validation'}"
230
+ - label: "{language == 'fr' ? 'Aucune (liste seule)' : 'None (list only)'}"
231
+ description: "{language == 'fr' ? 'Le module n\'a besoin que de la page liste avec détail' : 'Module only needs the list page with detail'}"
226
232
  ```
227
233
 
228
234
  #### 3a-depth. Determine Specification Depth
@@ -285,7 +291,7 @@ See [references/spec-auto-inference.md](../references/spec-auto-inference.md) fo
285
291
  - Entity attribute → SmartTable column mapping (9 type rules)
286
292
  - Entity attribute → SmartForm field mapping (8 type rules)
287
293
  - Auto-generated sections per featureType (5 types)
288
- - Section generation rules (list, create, detail, edit, dashboard)
294
+ - Component generation rules (list section, create form in modal, detail page with tabs, dashboard section)
289
295
  - Status/lifecycle enhancement rules
290
296
 
291
297
  Write auto-generated sections to `specification.sections[]` via ba-writer.enrichSection()
@@ -351,40 +357,124 @@ options:
351
357
 
352
358
  #### 5-bis. Unresolved Entity Dependencies (New Module Detection)
353
359
 
354
- > **When an entity reference is detected that does NOT belong to any completed or planned module, apply the Entity Sourcing Pattern from step-01-cadrage (section 4d-bis).**
360
+ > **When an entity reference is detected that does NOT belong to any completed or planned module, apply the SAME intelligent Entity Sourcing Pattern as step-01-cadrage (section 4d-bis).**
361
+ > **Reference:** Load [references/entity-architecture-decision.md](../references/entity-architecture-decision.md) for scoring grid, decision tree, and section patterns.
355
362
 
356
363
  For each entity referenced by {currentModule} that is NOT covered by any existing/planned module:
357
364
 
365
+ ##### A. ULTRATHINK: Silent Analysis (NO output to client)
366
+
367
+ > **Same intelligence as cadrage 4d-bis. Score the entity, assess domain coherence, recommend.**
368
+
369
+ ```
370
+ ULTRATHINK — Entity Architecture Analysis for {entity_name} (discovered during specification of {currentModule}):
371
+
372
+ 1. DOMAIN COHERENCE
373
+ - Application domain: {app_description}
374
+ - Entity fit: CORE | SUPPORT | PERIPHERAL
375
+ - Justification: {1 sentence}
376
+
377
+ 2. ENTITY SCORING (5 criteria, 0-3 each — from scoring grid in reference)
378
+ - Lifecycle: {score}/3
379
+ - Actors: {score}/3
380
+ - Relations: {score}/3
381
+ - Volume: {score}/3
382
+ - Autonomy: {score}/3
383
+ - TOTAL: {total}/15 → {classification}
384
+
385
+ 3. PRE-CLASSIFICATION CHECK (from entity patterns in reference, section 10 of suggestion-catalog)
386
+ - Match? → {yes: which pattern | no: use scoring}
387
+
388
+ 4. RECOMMENDATION
389
+ - Option: {in_this_module | new_module | external_system | config_list}
390
+ - Confidence: HIGH | MEDIUM | LOW
391
+ - Reasoning: {1-2 sentences}
392
+
393
+ 5. IF recommendation = new_module → PRE-BUILD ARCHITECTURE
394
+ - Module code: {PascalCase}
395
+ - Section `list` + detail page tabs
396
+ - Additional sections (ONLY functional zones)
397
+ - Impact on dependency graph
398
+ ```
399
+
400
+ ##### B. Present Analysis & Recommendation
401
+
402
+ **BEFORE AskUserQuestion, display as markdown:**
403
+
404
+ ```
405
+ ### {language == "fr" ? "Analyse" : "Analysis"} : {entity_plural}
406
+
407
+ {language == "fr"
408
+ ? "Pendant la spécification de **{currentModule}**, j'ai détecté une référence aux **{entity_plural}** qui ne font partie d'aucun module existant."
409
+ : "During specification of **{currentModule}**, I detected a reference to **{entity_plural}** not covered by any existing module."}
410
+
411
+ {language == "fr" ? "**Mon analyse :**" : "**My analysis:**"}
412
+ - {language == "fr" ? "Cohérence domaine" : "Domain coherence"} : **{CORE|SUPPORT|PERIPHERAL}** — {justification}
413
+ - {language == "fr" ? "Score de complexité" : "Complexity score"} : **{score}/15** ({classification})
414
+ - **{language == "fr" ? "Recommandation" : "Recommendation"}** : **{recommended_option}** — {reasoning}
415
+ ```
416
+
417
+ **IF recommendation = new_module AND confidence >= MEDIUM, ALSO display the architecture proposal** (same format as cadrage 4d-bis Phase 2: Context/Application/Module table + Sections table + Detail tabs table + Impact).
418
+
419
+ ##### C. Ask with Recommended Option First
420
+
358
421
  ```
359
422
  question: "{language == 'fr'
360
- ? 'Les {entity_plural} référencés par {currentModule} ne font partie d\'aucun module. Comment les gérer ?'
361
- : '{entity_plural} referenced by {currentModule} are not part of any module. How should they be managed?'}"
423
+ ? 'Comment souhaitez-vous gérer les {entity_plural} ?'
424
+ : 'How do you want to manage {entity_plural}?'}"
362
425
  header: "{entity_name}"
363
426
  options:
364
- - label: "{language == 'fr' ? 'Dans ce module' : 'In this module'}"
427
+ (ORDER: recommended option FIRST with "(Recommandé)"/"(Recommended)", then remaining 3)
428
+
429
+ IF recommendation = new_module:
430
+ - label: "{language == 'fr' ? 'Nouveau module dédié (Recommandé)' : 'New dedicated module (Recommended)'}"
365
431
  description: "{language == 'fr'
366
- ? 'Gérer les {entity_plural} comme une section/entité de {currentModule}'
367
- : 'Manage {entity_plural} as a section/entity of {currentModule}'}"
368
- - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
432
+ ? 'Module {ModuleCode} avec page liste, détail par onglets, permissions dédiées'
433
+ : '{ModuleCode} module with list page, tabbed detail, dedicated permissions'}"
434
+ - label: "{language == 'fr' ? 'Dans ce module' : 'In this module'}"
369
435
  description: "{language == 'fr'
370
- ? 'Créer un module complet avec CRUD, permissions et navigation'
371
- : 'Create a full module with CRUD, permissions and navigation'}"
436
+ ? 'Onglet dans la page détail de {currentModule}'
437
+ : 'Tab in {currentModule} detail page'}"
372
438
  - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
373
- description: "{language == 'fr'
374
- ? 'Import ou API depuis un autre système'
375
- : 'Import or API from another system'}"
439
+ description: "..."
376
440
  - label: "{language == 'fr' ? 'Liste de référence' : 'Reference list'}"
441
+ description: "..."
442
+
443
+ IF recommendation = config_list:
444
+ - label: "{language == 'fr' ? 'Liste de référence (Recommandé)' : 'Reference list (Recommended)'}"
377
445
  description: "{language == 'fr'
378
446
  ? 'Table de lookup configurable par l\'admin'
379
447
  : 'Admin-configurable lookup table'}"
448
+ - (3 remaining options in logical order)
449
+
450
+ IF recommendation = in_this_module:
451
+ - label: "{language == 'fr' ? 'Dans ce module (Recommandé)' : 'In this module (Recommended)'}"
452
+ description: "{language == 'fr'
453
+ ? 'Onglet dans la page détail de {currentModule}'
454
+ : 'Tab in {currentModule} detail page'}"
455
+ - (3 remaining options)
456
+
457
+ IF confidence = LOW:
458
+ (all 4 options in neutral order, NO "(Recommandé)" tag)
380
459
  ```
381
460
 
461
+ ##### D. Process Answer
462
+
463
+ | Choice | Action |
464
+ |--------|--------|
465
+ | **Dans ce module** | Entity becomes a sub-entity of {currentModule}. Add as a **tab in the detail page**. Add to this module's `analysis.entities[]`. |
466
+ | **Nouveau module dédié** | Add new module to master `modules[]` via ba-writer with proposed architecture (sections, detail tabs, dependencies). The `list` section is ALWAYS the main section. Additional sections ONLY for functional zones. |
467
+ | **Système externe** | Flag for integration. Add to `coverageMatrix` as integration. |
468
+ | **Liste de référence** | Lookup table, admin-managed. No module, no section. |
469
+
382
470
  **IF "Nouveau module dédié" is selected:**
383
471
  1. Add new module to master `modules[]` via ba-writer (status: "pending", sortOrder: after current module)
384
472
  2. Update dependency graph: current module depends on the new module
385
- 3. **WARNING:** The new module will need specification AFTER the current one. Display:
473
+ 3. **Display:**
386
474
  ```
387
- " Nouveau module '{entity_name}' ajouté. Il sera spécifié après {currentModule}."
475
+ "{language == 'fr'
476
+ ? '⚠ Nouveau module {ModuleCode} ajouté au graphe de dépendances. Il sera spécifié après {currentModule}.'
477
+ : '⚠ New module {ModuleCode} added to dependency graph. It will be specified after {currentModule}.'}"
388
478
  ```
389
479
  4. Update `metadata.workflow.moduleOrder` to include the new module (inserted after its dependents)
390
480
 
@@ -6,6 +6,7 @@ next_step: steps/step-03b-ui.md
6
6
  ---
7
7
 
8
8
  > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_module-loop.md`
9
+ > **Reference (check 7):** `references/entity-architecture-decision.md` — Entity scoring for unresolved relationship targets
9
10
 
10
11
  # Step 3a2: Analysis - Entities & Business Logic
11
12
 
@@ -151,6 +152,13 @@ Before proceeding to step-03b-ui.md, VERIFY:
151
152
  4. **Module status in master** = "in-progress" (set by section 2 above)
152
153
  5. **Master modules[].featureJsonPath** for this module ≠ null (set by ba-writer.create)
153
154
  6. **Sections identified** with clear roles and entities assigned
155
+ 7. **Unresolved relationship targets (BLOCKING)** — For EACH entity's `relationships[].target`:
156
+ - Check if the target entity exists in THIS module's `entities[]`
157
+ - OR in a completed/planned module's `entities[]`
158
+ - OR is a known config list / external system reference
159
+ - **IF unresolved:** Apply the Entity Sourcing Pattern from step-03a1 section 5-bis
160
+ (ULTRATHINK scoring + domain coherence + recommendation + AskUserQuestion)
161
+ - This catches entities discovered DURING analysis that weren't identified in setup
154
162
 
155
163
  **IF any check fails → FIX before proceeding.** Do NOT load step-03b-ui with incomplete data.
156
164
 
@@ -199,6 +199,64 @@ A wireframe without `componentMapping` or `layout` will FAIL validation in step
199
199
 
200
200
  > **IF client rejects a mockup:** Revise and re-propose until validated. Do NOT proceed without client approval on the layout.
201
201
 
202
+ ### 3b-detail. Generate Detail Page Wireframe (MANDATORY for each list section)
203
+
204
+ > **BLOCKING RULE:** Every module with a `list` section MUST also have a detail page wireframe. The detail page is NOT a separate navigation entry — it is reached by clicking a row in the list. Its wireframe goes in `specification.uiWireframes[]` with `section: "detail"`.
205
+
206
+ **Procedural sequence (MANDATORY):**
207
+
208
+ 1. **Determine detail tabs** from these sources (in priority order):
209
+ a. `coverageMatrix[].detailTabs` from cadrage (if specified)
210
+ b. Entity relationships: one tab per 1:N relationship (SmartTable of children)
211
+ c. Auto-inferred: Info tab (always first), History tab (if entity has lifeCycles)
212
+
213
+ 2. **Generate** an ASCII mockup for the detail page with tabbed layout:
214
+
215
+ ```
216
+ ╔═══════════════════════════════════════════════════════════╗
217
+ ║ ← Retour à la liste ║
218
+ ╠═══════════════════════════════════════════════════════════╣
219
+ ║ {Entity} : {code} — {name} ● {Statut} [✏️ 🗑️] ║
220
+ ╠═══════════════════════════════════════════════════════════╣
221
+ ║ [ Informations ] [ {Relation1} ] [ Historique ] ║
222
+ ╠═══════════════════════════════════════════════════════════╣
223
+ ║ ║
224
+ ║ ┌── Informations ────────────────────────────────────┐ ║
225
+ ║ │ Code │ VAL-001 │ ║
226
+ ║ │ Nom │ Exemple de nom │ ║
227
+ ║ │ Type │ Standard │ ║
228
+ ║ │ Responsable │ Jean Dupont │ ║
229
+ ║ │ Date début │ 15.01.2026 │ ║
230
+ ║ │ Description │ Lorem ipsum dolor sit amet... │ ║
231
+ ║ └────────────────────────────────────────────────────┘ ║
232
+ ║ [ Modifier ] ║
233
+ ║ ║
234
+ ╚═══════════════════════════════════════════════════════════╝
235
+ ```
236
+
237
+ Adaptation rules for the detail mockup:
238
+ - **Header**: entity code + name + status badge (if lifeCycles) + action buttons (edit, delete)
239
+ - **Back button**: navigates to `/business/{app}/{module}/list`
240
+ - **Tabs**: one per identified tab (Info + relations + history)
241
+ - **Info tab content**: all entity attributes as label:value pairs (read-only by default)
242
+ - **Edit button**: toggles the Info tab into SmartForm edit mode
243
+ - **Relation tab content**: show a SmartTable for each 1:N child entity filtered by parent ID
244
+ - **History tab content**: Timeline/audit log (only if entity has lifeCycles)
245
+
246
+ 3. **For entities with state machine (lifeCycles)**, add transition buttons in the header:
247
+ ```
248
+ ║ {Entity}: {code} — {name} ● Brouillon [Soumettre] [✏️] ║
249
+ ```
250
+ Transition buttons are contextual: only show actions allowed from the current state.
251
+
252
+ 4. **Display** the detail mockup in conversation with header `### {Module} — Détail — Wireframe` and validate with client alongside the list wireframe.
253
+
254
+ 5. **Store** in `specification.uiWireframes[]` with `section: "detail"`.
255
+ See [references/ui-resource-cards.md](../references/ui-resource-cards.md) "Detail Page Wireframe" for exact JSON format.
256
+
257
+ 6. **Create the detail section** in `specification.sections[]` with `navigation: "hidden"` and route `/business/{app}/{module}/detail/:id`.
258
+ See [references/ui-resource-cards.md](../references/ui-resource-cards.md) "Detail Page section" for exact JSON format.
259
+
202
260
  ### 3b-bis. Wireframe-to-Component Mapping
203
261
 
204
262
  After client validates the mockup, map each wireframe element to a SmartStack React component:
@@ -212,6 +270,10 @@ After client validates the mockup, map each wireframe element to a SmartStack Re
212
270
  | ActionButton | `Button` + `RequirePermission` | Always wrapped in permission check |
213
271
  | StatusBadge | `StatusBadge` | Uses entity lifecycle states |
214
272
  | DetailCard | `EntityDetailCard` | Standard detail layout |
273
+ | DetailHeader | `EntityDetailHeader` | Entity title + status badge + actions |
274
+ | BackButton | `BackButton` | Navigate back to list |
275
+ | TabPanel | `Tabs` | Tabbed content container |
276
+ | Timeline | `AuditTimeline` | History/audit log display |
215
277
  | Form | `SmartForm` | FluentValidation-backed |
216
278
  | KpiCard | `StatCard` (Recharts) | Dashboard KPI display |
217
279
  | Chart:bar/line/pie | Recharts `BarChart`/`LineChart`/`PieChart` | CSS variables for colors |
@@ -248,9 +310,9 @@ For EACH wireframe generated in 3b, generate a `layout` object alongside the ASC
248
310
 
249
311
  For each section, identify what resources/components are needed:
250
312
 
251
- - List section → DataGrid, FilterBar, SearchInput, ExportButton
252
- - Detail sectionDetailCard, StatusBadge, ActionButtons, Timeline
253
- - Create sectionForm, ValidationMessages, SubmitButton
313
+ - List section → DataGrid, FilterBar, SearchInput, ExportButton, CreateButton
314
+ - Detail page (from list click) BackButton, DetailHeader, StatusBadge, TabPanel, DetailCard, SmartForm (edit mode), SmartTable (relation tabs), Timeline (history tab)
315
+ - Create (in list) SmartForm (modal/drawer), ValidationMessages, SubmitButton
254
316
  - Approve section → StatusTransitionPanel, CommentBox, ApproveRejectButtons
255
317
  - Dashboard section → StatCard, RechartsChart (Bar/Line/Pie/Area), DashboardGrid, FilterBar
256
318
 
@@ -269,8 +331,9 @@ See [references/ui-dashboard-spec.md](../references/ui-dashboard-spec.md) for th
269
331
 
270
332
  Before proceeding to step-03c-compile.md, VERIFY:
271
333
 
272
- 1. **Wireframes displayed and validated** — ALL wireframes were output as visible ASCII art in the conversation AND validated by the client via AskUserQuestion
273
- 2. **Wireframes exist for all sections** in `specification.uiWireframes[]`
334
+ 1. **Wireframes displayed and validated** — ALL wireframes (list AND detail) were output as visible ASCII art in the conversation AND validated by the client via AskUserQuestion
335
+ 2. **Wireframes exist for all sections** in `specification.uiWireframes[]` — INCLUDING a `section: "detail"` wireframe for every module that has a `list` section
336
+ 2b. **Detail page companion check (BLOCKING)** — For EACH section with `code: "list"`, verify there is a matching wireframe with `section: "detail"` AND a section with `code: "detail"` + `navigation: "hidden"` + route containing `:id`. Missing detail page = FAIL.
274
337
  3. **All wireframes have componentMapping** with smarter mapping rules
275
338
  4. **All wireframes have layout** with regions and resourceRef references
276
339
  5. **All resource references** in layout.regions[].components[].resourceRef exist in sections[].resources[]
@@ -165,6 +165,24 @@ ELSE:
165
165
 
166
166
  ---
167
167
 
168
+ ### 9g. Anti-Premature-Completion Guard (MANDATORY)
169
+
170
+ > **CRITICAL — NEVER say "the analysis is complete" or "ready for /ralph-loop" at this point.**
171
+ > Step-03d is the END of SPECIFICATION, NOT the end of the BA workflow.
172
+ > Steps 04a → 04b → 04c (consolidation) + 05a → 05b → 05c (handoff) are STILL REQUIRED.
173
+ > Without handoff, /ralph-loop will generate an INCOMPLETE PRD (no frontend, no tests).
174
+
175
+ **FORBIDDEN phrases in step-03d output:**
176
+ - "L'analyse métier est complète" / "The business analysis is complete"
177
+ - "Prêt pour /ralph-loop" / "Ready for /ralph-loop"
178
+ - "Vous pouvez maintenant lancer /ralph-loop"
179
+ - Any variation suggesting the BA is finished or /ralph-loop can be invoked
180
+
181
+ **REQUIRED phrasing:**
182
+ - "Module {name} spécifié. {Remaining} modules restants." (if more modules)
183
+ - "Tous les modules spécifiés. Passage à la consolidation (étapes 04a-04c)..." (if last module)
184
+ - NEVER mention /ralph-loop — only step-05c (ralph readiness) validates the handoff
185
+
168
186
  ### 10. Module Summary with Roles & Permissions
169
187
 
170
188
  Display comprehensive summary:
@@ -286,8 +304,23 @@ IF currentModuleIndex < moduleOrder.length:
286
304
  Load: steps/step-03a1-setup.md
287
305
 
288
306
  IF currentModuleIndex >= moduleOrder.length:
289
- Display: "═══ Tous les modules spécifiés! Passage à la consolidation... ═══"
307
+ Display: "═══ Tous les modules spécifiés! Passage à la consolidation (04a→04c) puis handoff (05a→05c)... ═══"
308
+ Display: "⚠ NE PAS lancer /ralph-loop — la consolidation et le handoff sont encore nécessaires."
290
309
  ba-writer.updateStatus({feature_id}, "specified")
310
+
311
+ // CHECKPOINT: Save progress BEFORE transition (protects against context exhaustion)
312
+ ba-writer.enrichSection({
313
+ featureId: {feature_id},
314
+ section: "metadata.workflow",
315
+ data: {
316
+ lastCompletedStep: "step-03d-validate",
317
+ allModulesSpecified: true
318
+ }
319
+ })
320
+
321
+ // MANDATORY TRANSITION — DO NOT STOP HERE
322
+ // If context is near exhaustion, the checkpoint above ensures the user
323
+ // can resume with /business-analyse and it will route to step-04a automatically.
291
324
  Load: steps/step-04a-collect.md
292
325
  ```
293
326
 
@@ -304,7 +304,104 @@ Total endpoints = count of specification.apiEndpoints[] across all modules.
304
304
  "✓ Handoff module {i+1}/{N} : {moduleCode} ({fileCount} fichiers, {brCount} BRs mappées)"
305
305
  ```
306
306
 
307
- #### 7b. Master Handoff (after ALL modules written successfully)
307
+ #### 7b. Generate seedDataCore (MANDATORY for master feature.json)
308
+
309
+ > **The seedDataCore provides ralph-loop with the exact navigation, permissions, and translations to seed.**
310
+ > Without seedDataCore, ralph-loop must INVENT this data — leading to inconsistencies.
311
+
312
+ ```
313
+ // Derive seedDataCore from modules[], applicationRoles[], and coverageMatrix[]
314
+
315
+ const seedDataCore = {
316
+ navigationModules: master.modules.map((m, i) => ({
317
+ code: m.code,
318
+ label: m.name || m.code,
319
+ description: m.description,
320
+ icon: null, // set by ralph-loop
321
+ iconType: "lucide",
322
+ route: `/business/${master.metadata.application.toLowerCase()}/${m.code.toLowerCase()}`,
323
+ displayOrder: (i + 1) * 10
324
+ })),
325
+
326
+ navigationSections: master.modules.flatMap(m =>
327
+ (m.anticipatedSections || []).map((s, j) => ({
328
+ moduleCode: m.code,
329
+ code: s.code,
330
+ label: s.description?.split(':')[0] || s.code,
331
+ description: s.description || "",
332
+ route: s.code === "detail" ? null : `/${s.code}`,
333
+ displayOrder: (j + 1) * 10,
334
+ navigation: s.code === "detail" ? "hidden" : "visible"
335
+ }))
336
+ ),
337
+
338
+ navigationResources: master.cadrage.coverageMatrix
339
+ .filter(cm => cm.module && cm.anticipatedResources?.length > 0)
340
+ .flatMap(cm =>
341
+ cm.anticipatedResources.map((r, k) => ({
342
+ moduleCode: cm.module,
343
+ sectionCode: cm.anticipatedSections?.[0] || "list",
344
+ code: r,
345
+ label: r.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase()),
346
+ displayOrder: (k + 1) * 10
347
+ }))
348
+ ),
349
+
350
+ navigationTranslations: master.modules.flatMap(m => {
351
+ const langs = ["fr", "en"]; // minimum required
352
+ return langs.map(lang => ({
353
+ moduleCode: m.code,
354
+ language: lang,
355
+ label: lang === master.metadata.language ? (m.name || m.code) : m.code,
356
+ description: lang === master.metadata.language ? m.description : ""
357
+ }));
358
+ }),
359
+
360
+ permissions: master.cadrage.applicationRoles.flatMap(role =>
361
+ master.modules.map(m => ({
362
+ role: role.role,
363
+ module: m.code,
364
+ pattern: role.permissionPattern.replace('*', `${m.code.toLowerCase()}.*`),
365
+ level: role.level
366
+ }))
367
+ ),
368
+
369
+ rolePermissions: master.cadrage.applicationRoles.map(role => ({
370
+ role: role.role,
371
+ level: role.level,
372
+ permissions: master.modules.map(m => `business.${master.metadata.application.toLowerCase()}.${m.code.toLowerCase()}.${
373
+ role.level === 'admin' ? '*' :
374
+ role.level === 'manager' ? 'read,create,update,validate' :
375
+ role.level === 'contributor' ? 'read,create,update' : 'read'
376
+ }`)
377
+ })),
378
+
379
+ permissionConstants: master.modules.flatMap(m =>
380
+ ['Read', 'Create', 'Update', 'Delete', 'Validate', 'Export'].map(action => ({
381
+ module: m.code,
382
+ action: action,
383
+ constant: `${master.metadata.application}${m.code}${action}`,
384
+ path: `business.${master.metadata.application.toLowerCase()}.${m.code.toLowerCase()}.${action.toLowerCase()}`
385
+ }))
386
+ )
387
+ };
388
+
389
+ ba-writer.enrichSection({
390
+ featureId: {feature_id},
391
+ section: "seedDataCore",
392
+ data: seedDataCore
393
+ })
394
+ ```
395
+
396
+ **POST-CHECK (non-blocking):**
397
+ ```
398
+ IF seedDataCore.navigationModules.length !== master.modules.length:
399
+ WARNING: seedDataCore has ${seedDataCore.navigationModules.length} nav modules but ${master.modules.length} modules exist
400
+ IF seedDataCore.permissions.length === 0:
401
+ WARNING: seedDataCore has 0 permissions — applicationRoles may be missing
402
+ ```
403
+
404
+ #### 7c. Master Handoff (after ALL modules written + seedDataCore generated)
308
405
 
309
406
  ```
310
407
  ba-writer.enrichSection({
@@ -329,7 +426,7 @@ ba-writer.enrichSection({
329
426
  })
330
427
  ```
331
428
 
332
- #### 7c. Final Verification (BLOCKING)
429
+ #### 7d. Final Verification (BLOCKING)
333
430
 
334
431
  ```
335
432
  count = 0
@@ -326,6 +326,37 @@ After writing the HTML file, verify:
326
326
  fi
327
327
  ```
328
328
 
329
+ 7. **WIREFRAME KEY ALIGNMENT** — wireframe keys MUST match module codes exactly
330
+ ```
331
+ FOR each module in FEATURE_DATA.modules:
332
+ moduleCode = module.code (e.g., "GestionTemps")
333
+ IF EMBEDDED_ARTIFACTS.wireframes[moduleCode] is undefined OR empty:
334
+ BLOCKING_ERROR("Wireframe key mismatch: module code '${moduleCode}' not found in EMBEDDED_ARTIFACTS.wireframes")
335
+ BLOCKING_ERROR("Available wireframe keys: ${Object.keys(EMBEDDED_ARTIFACTS.wireframes).join(', ')}")
336
+ → FIX: Rename the wireframe key to match module.code exactly
337
+ ```
338
+ > **Why this matters:** The HTML renders wireframes via `EMBEDDED_ARTIFACTS.wireframes[code]`. If the key doesn't match the module code (e.g., "TimeTracking" vs "GestionTemps"), the wireframes tab shows "Aucune maquette disponible" even though data exists.
339
+
340
+ 8. **MODULE COMPLETENESS** — every module must have spec data AND wireframes in HTML
341
+ ```
342
+ FOR each module in master.modules[]:
343
+ IF FEATURE_DATA.moduleSpecs[module.code] is undefined:
344
+ BLOCKING_ERROR("Module '${module.code}' missing from FEATURE_DATA.moduleSpecs")
345
+ IF EMBEDDED_ARTIFACTS.wireframes[module.code] is undefined:
346
+ BLOCKING_ERROR("Module '${module.code}' missing from EMBEDDED_ARTIFACTS.wireframes")
347
+ IF module.featureJsonPath is null:
348
+ BLOCKING_ERROR("Module '${module.code}' has no per-module feature.json (featureJsonPath is null)")
349
+
350
+ expectedModules = master.modules.map(m => m.code).sort()
351
+ specModules = Object.keys(FEATURE_DATA.moduleSpecs).sort()
352
+ wireframeModules = Object.keys(EMBEDDED_ARTIFACTS.wireframes).sort()
353
+
354
+ IF expectedModules.join(',') !== specModules.join(','):
355
+ BLOCKING_ERROR("Module mismatch: expected [${expectedModules}] but moduleSpecs has [${specModules}]")
356
+ IF expectedModules.join(',') !== wireframeModules.join(','):
357
+ BLOCKING_ERROR("Module mismatch: expected [${expectedModules}] but wireframes has [${wireframeModules}]")
358
+ ```
359
+
329
360
  **IF ANY CHECK FAILS → DO NOT PROCEED. Fix the data mapping and regenerate.**
330
361
 
331
362
  ---
@@ -360,14 +391,16 @@ Effort: {total_days} days ({total_hours} hours)
360
391
  1. Ouvrir ba-interactive.html dans le navigateur
361
392
  2. Partager avec les stakeholders pour validation
362
393
  3. Si retours --> relancer /business-analyse pour une nouvelle itération
363
- 4. Validation de la compatibilité ralph-loop (recommandé):
394
+ 4. Validation qualité ULTRATHINK (automatique):
364
395
 
365
- Continuez à step-05c-ralph-readiness.md pour valider
366
- la complétude et l'intégrité avant développement
396
+ Lancement automatique de step-05c-ralph-readiness.md...
367
397
 
368
398
  5. Une fois validé, lancer le développement:
369
399
 
370
- /ralph-loop -r
400
+ /ralph-loop
401
+
402
+ Note: /ralph-loop -r sert UNIQUEMENT à reprendre une boucle interrompue.
403
+ Après un /business-analyse, toujours utiliser /ralph-loop (sans -r).
371
404
 
372
405
  ═══════════════════════════════════════════════════════════════
373
406
  ```
@@ -376,16 +409,19 @@ Effort: {total_days} days ({total_hours} hours)
376
409
 
377
410
  ## NEXT STEP
378
411
 
379
- **RECOMMENDED:** Load `steps/step-05c-ralph-readiness.md` to run validation gate before /ralph-loop.
412
+ **MANDATORY:** Load `steps/step-05c-ralph-readiness.md` ULTRATHINK quality review & readiness gate.
413
+
414
+ > **This step is NON-NEGOTIABLE.** The BA skill MUST run step-05c before completing.
415
+ > DO NOT skip this step. DO NOT display a "done" message without running step-05c first.
380
416
 
381
417
  This validation ensures:
382
- - All module handoffs are complete
418
+ - ULTRATHINK deep quality review of the entire BA output
419
+ - All module handoffs are complete and content is coherent
383
420
  - PRD files are structurally valid
384
421
  - Cross-module references are resolvable
422
+ - Specification quality meets production standards
385
423
  - No blocking issues before development
386
424
 
387
- User can skip validation and proceed directly to /ralph-loop, but validation is strongly recommended to catch issues early.
388
-
389
425
  ---
390
426
 
391
427
  ## MODE SUPPORT & TROUBLESHOOTING