@atlashub/smartstack-cli 4.74.0 → 4.76.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 (121) hide show
  1. package/dist/index.js +152 -31
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +14 -3
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/ba-reader.md +17 -15
  7. package/templates/agents/ba-writer.md +49 -51
  8. package/templates/skills/apex/SKILL.md +2 -2
  9. package/templates/skills/apex/_shared.md +1 -1
  10. package/templates/skills/apex/references/checks/backend-checks.sh +21 -7
  11. package/templates/skills/apex/references/checks/frontend-checks.sh +26 -0
  12. package/templates/skills/apex/references/checks/infrastructure-checks.sh +47 -10
  13. package/templates/skills/apex/references/checks/seed-checks.sh +47 -7
  14. package/templates/skills/apex/references/core-seed-data.md +20 -18
  15. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +3 -0
  16. package/templates/skills/apex/references/post-checks.md +23 -3
  17. package/templates/skills/apex/references/smartstack-api.md +4 -4
  18. package/templates/skills/apex/references/smartstack-frontend.md +54 -8
  19. package/templates/skills/apex/references/smartstack-layers.md +6 -6
  20. package/templates/skills/apex/steps/step-00-init.md +75 -1
  21. package/templates/skills/apex/steps/step-03-execute.md +16 -4
  22. package/templates/skills/apex/steps/step-03b-layer1-seed.md +65 -6
  23. package/templates/skills/apex/steps/step-03c-layer2-backend.md +50 -5
  24. package/templates/skills/apex/steps/step-03d-layer3-frontend.md +226 -4
  25. package/templates/skills/apex/steps/step-04-examine.md +163 -0
  26. package/templates/skills/apex-verify/SKILL.md +110 -0
  27. package/templates/skills/apex-verify/references/audit-rules.md +50 -0
  28. package/templates/skills/apex-verify/steps/step-00-init.md +119 -0
  29. package/templates/skills/apex-verify/steps/step-01-nav-audit.md +92 -0
  30. package/templates/skills/apex-verify/steps/step-02-crud-audit.md +127 -0
  31. package/templates/skills/apex-verify/steps/step-03-perm-audit.md +119 -0
  32. package/templates/skills/apex-verify/steps/step-04-route-audit.md +98 -0
  33. package/templates/skills/apex-verify/steps/step-05-report.md +110 -0
  34. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +3 -0
  35. package/templates/skills/application/templates-frontend.md +2 -2
  36. package/templates/skills/business-analyse/SKILL.md +17 -3
  37. package/templates/skills/business-analyse/_shared.md +64 -0
  38. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +34 -26
  39. package/templates/skills/business-analyse/questionnaire/01-context.md +13 -9
  40. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +20 -27
  41. package/templates/skills/business-analyse/questionnaire.md +86 -9
  42. package/templates/skills/business-analyse/references/03-json-schemas.md +221 -0
  43. package/templates/skills/business-analyse/references/03-post-check-validation.md +208 -0
  44. package/templates/skills/business-analyse/references/03-smartstack-entity-guards.md +32 -0
  45. package/templates/skills/business-analyse/references/04-cross-module-validation.md +95 -0
  46. package/templates/skills/business-analyse/references/04-file-allocation.md +162 -0
  47. package/templates/skills/business-analyse/references/04-naming-audit-checks.md +174 -0
  48. package/templates/skills/business-analyse/references/04-semantic-validation-matrix.md +118 -0
  49. package/templates/skills/business-analyse/references/canonical-json-formats.md +7 -3
  50. package/templates/skills/business-analyse/references/domain-research-playbook.md +234 -0
  51. package/templates/skills/business-analyse/references/entity-sourcing-presentation.md +166 -0
  52. package/templates/skills/business-analyse/references/init-resume-logic.md +70 -0
  53. package/templates/skills/business-analyse/references/module-completeness-challenge.md +174 -0
  54. package/templates/skills/business-analyse/references/multi-app-detection.md +149 -0
  55. package/templates/skills/business-analyse/references/portal-classification.md +52 -0
  56. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  57. package/templates/skills/business-analyse/references/validation-checklist.md +35 -6
  58. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +50 -6
  59. package/templates/skills/business-analyse/steps/step-00-init.md +22 -190
  60. package/templates/skills/business-analyse/steps/step-01-cadrage.md +365 -269
  61. package/templates/skills/business-analyse/steps/step-02-structure.md +98 -20
  62. package/templates/skills/business-analyse/steps/step-03-specify.md +810 -229
  63. package/templates/skills/business-analyse/steps/step-04-consolidate.md +509 -278
  64. package/templates/skills/business-analyse-design/SKILL.md +10 -0
  65. package/templates/skills/business-analyse-design/references/screens-post-check.md +221 -0
  66. package/templates/skills/business-analyse-design/references/screens-type-mapping.md +138 -0
  67. package/templates/skills/business-analyse-design/references/smartcomponents-templates.md +225 -0
  68. package/templates/skills/{business-analyse → business-analyse-design}/references/spec-auto-inference.md +117 -117
  69. package/templates/skills/business-analyse-design/steps/step-01-screens.md +36 -162
  70. package/templates/skills/business-analyse-design/steps/step-02-wireframes.md +8 -7
  71. package/templates/skills/business-analyse-design/steps/step-03-navigation.md +89 -42
  72. package/templates/skills/business-analyse-develop/references/compact-loop.md +9 -0
  73. package/templates/skills/business-analyse-develop/references/handoff-quality-gate.md +132 -0
  74. package/templates/skills/business-analyse-develop/references/prd-v3-transformation.md +326 -0
  75. package/templates/skills/business-analyse-develop/references/report-reconciliation.md +140 -0
  76. package/templates/skills/business-analyse-develop/references/report-template.md +142 -0
  77. package/templates/skills/business-analyse-develop/steps/step-01-task.md +5 -177
  78. package/templates/skills/business-analyse-develop/steps/step-02-execute.md +17 -4
  79. package/templates/skills/business-analyse-develop/steps/step-03-commit.md +6 -2
  80. package/templates/skills/business-analyse-develop/steps/step-04-check.md +6 -0
  81. package/templates/skills/business-analyse-develop/steps/step-05-report.md +3 -269
  82. package/templates/skills/business-analyse-handoff/SKILL.md +10 -0
  83. package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +211 -0
  84. package/templates/skills/business-analyse-handoff/references/context-isolation-pattern.md +47 -0
  85. package/templates/skills/business-analyse-handoff/references/handoff-file-inventory.md +49 -0
  86. package/templates/skills/business-analyse-handoff/references/handoff-global-validation.md +142 -0
  87. package/templates/skills/business-analyse-handoff/references/prd-validation-checks.md +125 -0
  88. package/templates/skills/business-analyse-handoff/references/project-index-update.md +98 -0
  89. package/templates/skills/business-analyse-handoff/steps/step-01-transform.md +9 -160
  90. package/templates/skills/business-analyse-handoff/steps/step-02-export.md +10 -99
  91. package/templates/skills/business-analyse-html/SKILL.md +10 -0
  92. package/templates/skills/business-analyse-html/html/ba-interactive.html +504 -97
  93. package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +79 -2
  94. package/templates/skills/business-analyse-html/html/src/scripts/02-navigation.js +6 -46
  95. package/templates/skills/business-analyse-html/html/src/scripts/05-render-specs.js +80 -11
  96. package/templates/skills/business-analyse-html/html/src/scripts/06-render-consolidation.js +2 -2
  97. package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +94 -36
  98. package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +162 -0
  99. package/templates/skills/business-analyse-html/html/src/styles/10-diagrams.css +73 -0
  100. package/templates/skills/business-analyse-html/html/src/template.html +2 -0
  101. package/templates/skills/business-analyse-html/references/02-embedded-artifacts-building.md +144 -0
  102. package/templates/skills/business-analyse-html/references/02-feature-data-building.md +143 -0
  103. package/templates/skills/business-analyse-html/references/02-mapping-tables.md +442 -0
  104. package/templates/skills/business-analyse-html/references/02-normalization-helpers.md +139 -0
  105. package/templates/skills/business-analyse-html/references/02-screen-format-detection.md +283 -0
  106. package/templates/skills/business-analyse-html/references/02-self-check-validation.md +199 -0
  107. package/templates/skills/business-analyse-html/references/data-build.md +24 -1
  108. package/templates/skills/business-analyse-html/references/data-mapping.md +119 -17
  109. package/templates/skills/business-analyse-html/steps/step-02-build-data.md +18 -555
  110. package/templates/skills/business-analyse-html/steps/step-04-verify.md +92 -3
  111. package/templates/skills/business-analyse-quick/SKILL.md +807 -0
  112. package/templates/skills/{sketch → business-analyse-quick}/references/domain-heuristics.md +59 -3
  113. package/templates/skills/business-analyse-quick/references/prd-schema.md +268 -0
  114. package/templates/skills/business-analyse-review/SKILL.md +10 -0
  115. package/templates/skills/business-analyse-review/references/review-data-mapping.md +6 -0
  116. package/templates/skills/business-analyse-status/SKILL.md +8 -0
  117. package/templates/skills/dev-start/SKILL.md +143 -307
  118. package/templates/skills/efcore/SKILL.md +13 -0
  119. package/templates/skills/sketch/SKILL.md +15 -153
  120. package/templates/skills/ui-components/SKILL.md +1 -1
  121. package/templates/skills/ui-components/patterns/data-table.md +1 -1
@@ -123,61 +123,42 @@ IF docs/**/*.md files found:
123
123
  - Pre-identify integration points: new feature may depend on or extend existing modules
124
124
  - NEVER re-specify what's already handed-off (status = "handed-off") — reference it instead
125
125
 
126
- ### 2d. Domain Research (WebSearch — BEFORE engaging the client)
126
+ ### 2d. Domain Research (WebSearch — MANDATORY BLOCKING)
127
127
 
128
- > **Ground the analysis in real-world patterns. This prevents greenfield mistakes
129
- > (e.g., putting firstName on Employee instead of linking to User).**
130
- > This step takes 30-60 seconds and dramatically improves entity design quality.
128
+ > **Load** `references/domain-research-playbook.md` for search strategy, query templates, and extraction format.
129
+ > **MANDATORY BLOCKING.** Web research is the #1 quality factor. An analysis without research is a 2/10.
130
+ > Do NOT rely on "built-in domain expertise" real-world research catches what the LLM misses.
131
131
 
132
- **WHEN to search:** ALWAYS for the main business domain. Skip only if the domain is purely SmartStack-internal (e.g., config, admin tools).
133
-
134
- **HOW to search:** Use WebSearch tool with targeted queries based on the detected domain.
132
+ **Execute Level 1 research from the playbook:**
135
133
 
136
134
  ```
137
- 1. DOMAIN MODEL SEARCH
138
- Query: "{detected_domain} data model best practices" (e.g., "HR management data model best practices")
139
- Extract: standard entities, common relationships, industry patterns
140
- Store key findings in {domain_research}.dataModel
135
+ IF workflow_mode = "project" (multi-app):
136
+ For EACH candidateApplication in config.candidateApplications:
137
+ 1. WebSearch 1a: "{app_type} application modules features complete list"
138
+ 2. WebSearch 1b: "best {app_type} software features comparison"
139
+ 3. WebSearch 1c: "{app_type} data model entities relationships"
140
+ → Store in {domain_research}.applications[{app_code}]
141
141
 
142
- 2. ENTITY PATTERN SEARCH (for the 2-3 most complex detected entities)
143
- Query: "{entity_name} entity design pattern ERP" (e.g., "employee entity design pattern ERP")
144
- Extract: standard attributes, versioning patterns, common pitfalls
145
- Store in {domain_research}.entityPatterns[entity_name]
142
+ ELSE (single-app):
143
+ 1. WebSearch 1a: "{app_type} application modules features complete list"
144
+ 2. WebSearch 1b: "best {app_type} software features comparison"
145
+ 3. WebSearch 1c: "{app_type} data model entities relationships"
146
+ → Store in {domain_research}
146
147
 
147
- 3. WORKFLOW SEARCH (if the domain involves approval/validation flows)
148
- Query: "{domain} approval workflow pattern" (e.g., "timesheet approval workflow pattern")
149
- Extract: standard states, transition rules, multi-level approval
150
- → Store in {domain_research}.workflows
148
+ IF applicable domain (Billing, HR, Finance):
149
+ Execute Level 3 regulatory research from playbook
150
+ Store in {domain_research}.regulatory[]
151
151
  ```
152
152
 
153
- **WHAT to extract (ULTRATHINK — internal only):**
154
- ```yaml
155
- domain_research:
156
- domain: "{detected domain e.g., HR, CRM, Billing}"
157
- dataModel:
158
- standardEntities: ["Entity1", "Entity2"] # what the industry considers standard
159
- commonRelationships: ["Entity1 Entity2"] # typical FK patterns
160
- antiPatterns: ["storing salary directly on employee"] # mistakes to avoid
161
- entityPatterns:
162
- Employee:
163
- standardAttributes: ["code", "userId", "departmentId", "hireDate", "status"]
164
- versionedData: ["salary → separate table with effectiveDate"]
165
- personPattern: "link to User via FK, never duplicate personal info"
166
- Invoice:
167
- standardAttributes: ["number", "clientId", "issueDate", "dueDate", "status"]
168
- calculatedFields: ["subtotal", "taxAmount", "total"]
169
- workflowStates: ["Draft", "Sent", "Paid", "Overdue", "Cancelled"]
170
- workflows:
171
- timesheetApproval: "Draft → Submitted → ManagerApproved → ClientApproved"
172
- invoiceLifecycle: "Draft → Validated → Sent → Paid"
173
- ```
174
-
175
- > **CRITICAL:** This research is INTERNAL context. Do NOT show raw search results to the client.
176
- > Use the findings to:
177
- > - Improve pre-analysis quality (detect shadow zones the client won't mention)
178
- > - Ground entity architecture decisions in Phase 4d-bis
179
- > - Inform proactive suggestions in Phase 4 (ANTICIPATION)
180
- > - Prevent common anti-patterns during step-03 entity specification
153
+ **FALLBACK (WebSearch unavailable):**
154
+ ```
155
+ IF WebSearch tool is not available or fails:
156
+ → Display WARNING: "WebSearch indisponible. Qualite d'analyse degradee (max 4/10)."
157
+ → AskUserQuestion: "Continuer sans recherche web ? (Non recommande)"
158
+ IF user confirms: proceed with {domain_research}.source = "built-in-only"
159
+ Load references/module-completeness-challenge.md as fallback
160
+ IF user declines: STOP
161
+ ```
181
162
 
182
163
  ### 2b. Silent Pre-Analysis (ULTRATHINK — no output to client)
183
164
 
@@ -196,19 +177,43 @@ Analyze `{feature_description}` AND `{domain_research}` silently:
196
177
  4. **Prepare challenge questions** — specific to this brief, not generic
197
178
  5. **Pre-identify anticipated sections and resources** per detected module
198
179
 
180
+ 6. **MODULE COMPLETENESS CROSS-CHECK** (CRITICAL — requires domain research from 2d):
181
+ For EACH application:
182
+ - Compare detected modules vs `{domain_research}.applications[app].standardModules`
183
+ - For EACH **CORE** module absent → add to `shadow_zones` with `priority: "HIGH"`
184
+ - For EACH **STANDARD** module absent → add to `shadow_zones` with `priority: "MEDIUM"`
185
+ Example: User says "Facturation avec factures".
186
+ Research reveals CORE modules: [Factures, Avoirs, Paiements].
187
+ → `shadow_zones += [{topic: "Avoirs/Credit Notes", priority: "HIGH", why: "Module CORE manquant — legalement requis pour corriger une facture"}]`
188
+
189
+ 7. **BUSINESS PROCESS MAPPING** (MANDATORY for multi-app):
190
+ Before decomposing into modules, map the end-to-end business processes:
191
+ - From `{domain_research}` and `{feature_description}`, identify cross-app processes:
192
+ - "Cycle commercial: Prospect → Client → Opportunite → Devis → Facture → Paiement"
193
+ - "Cycle RH: Embauche → Fiche employe → Absences → Documents"
194
+ - "Cycle projet: Devis accepte → Projet → Affectation → Saisie heures → Validation → Facturation"
195
+ - For EACH process step, check if a module covers it. Flag uncovered steps.
196
+ Store in `{_preAnalysis.businessProcesses}`
197
+
199
198
  Store in `{pre_analysis}` — Write pre_analysis to cadrage.json as a `_preAnalysis` field (transient — removed on cadrage completion). This ensures the data survives context compaction:
200
199
  ```yaml
201
200
  _preAnalysis:
202
201
  problem_type: "new_tool|replace|automate|centralize"
203
202
  detected_modules: [{name, description, detected_sections}]
204
- shadow_zones: [{topic, why_it_matters, challenge_question}]
203
+ shadow_zones: [{topic, why_it_matters, challenge_question, priority}]
205
204
  anticipated_suggestions: [{suggestion, justification, module}]
206
205
  domain_research: # from Phase 2d web search
207
206
  domain: "{detected domain}"
208
- standardEntities: [...]
209
- antiPatterns: [...]
210
- entityPatterns: {entity: {standardAttributes, versionedData, personPattern}}
211
- workflows: {name: "state1 → state2 → state3"}
207
+ applications: # Level 1 research per app
208
+ {app_code}:
209
+ standardModules: [{name, classification, description, standardSections}]
210
+ competitiveInsights: [{product, keyFeatures}]
211
+ dataModel: {entities, relationships, antiPatterns}
212
+ regulatory: [] # Level 3 if applicable
213
+ businessProcesses: # from step 7 above
214
+ - name: "Cycle commercial"
215
+ apps: ["Crm", "Facturation"]
216
+ steps: [{name, module, covered: true|false}]
212
217
  ```
213
218
 
214
219
  ---
@@ -273,6 +278,77 @@ options:
273
278
 
274
279
  ---
275
280
 
281
+ ### 3b. Challenge Against Industry Standards (MANDATORY — BEFORE scope lock)
282
+
283
+ > **Use domain research to challenge scope completeness BEFORE locking.**
284
+ > This is what distinguishes a 2/10 analysis from a 9/10 analysis.
285
+
286
+ 1. From `{domain_research}.applications`, build a completeness comparison:
287
+
288
+ Display as markdown (direct text, NOT inside AskUserQuestion):
289
+
290
+ ```
291
+ ## {language == "fr" ? "Analyse competitive" : "Competitive Analysis"}
292
+
293
+ {language == "fr"
294
+ ? "Pour chaque application, j'ai recherche ce que proposent les solutions du marche :"
295
+ : "For each application, I researched what market solutions offer:"}
296
+
297
+ | Application | Vos modules | Modules standard industrie | Ecart |
298
+ |-------------|------------|---------------------------|-------|
299
+ | {app} | {user_modules} | {research_standard_modules} | {missing_CORE + missing_STANDARD} |
300
+
301
+ {language == "fr" ? "**Modules CORE manquants** (standard dans toute solution de ce type) :" : "**Missing CORE modules:**"}
302
+ {for each missing CORE module:}
303
+ - **{module_name}** : {description} — {why it matters for this project}
304
+
305
+ {language == "fr" ? "**Modules STANDARD manquants** (presents dans la majorite des solutions) :" : "**Missing STANDARD modules:**"}
306
+ {for each missing STANDARD module:}
307
+ - **{module_name}** : {description}
308
+ ```
309
+
310
+ 2. AskUserQuestion (multiSelect: true):
311
+ ```
312
+ question: "{language == 'fr'
313
+ ? 'Quels modules manquants souhaitez-vous ajouter ? Les modules CORE sont fortement recommandes.'
314
+ : 'Which missing modules would you like to add? CORE modules are strongly recommended.'}"
315
+ header: "{language == 'fr' ? 'Completude des applications' : 'Application completeness'}"
316
+ multiSelect: true
317
+ options:
318
+ - For each missing CORE module: label: "{name} (CORE — fortement recommande)", description: "{why}"
319
+ - For each missing STANDARD module: label: "{name} (STANDARD — recommande)", description: "{why}"
320
+ - label: "{language == 'fr' ? 'Aucun — perimetre initial' : 'None — keep initial scope'}"
321
+ description: "{language == 'fr' ? 'Garder uniquement les modules initiaux' : 'Keep only initial modules'}"
322
+ ```
323
+
324
+ 3. IF user adds modules → update `{pre_analysis}.detected_modules` and `candidateApplications`
325
+ 4. IF user excludes CORE modules → document exclusion reason in `cadrage.globalScope.outOfScope`
326
+
327
+ ---
328
+
329
+ ## SCOPE LOCK (MANDATORY — after validated reformulation + competitive challenge)
330
+
331
+ > **The modules and applications identified in the validated reformulation are the LOCKED SCOPE.**
332
+
333
+ +==============================================================================+
334
+ | SCOPE LOCK RULES — Applied from this point forward |
335
+ +==============================================================================+
336
+ | |
337
+ | 1. The NUMBER of applications is LOCKED (confirmed in step-00 Step 3b). |
338
+ | Phase 4d-bis (Entity Sourcing) CANNOT create new applications. |
339
+ | |
340
+ | 2. Phase 4d-bis CAN recommend entities as `config_list` or |
341
+ | `in_app_section` — but CANNOT recommend `new_module` or |
342
+ | `new_application` without EXPLICIT AskUserQuestion confirmation. |
343
+ | |
344
+ | 3. Portal detection (4b-bis) creates ONE "Portal" module with sections, |
345
+ | NOT multiple MyX modules. |
346
+ | |
347
+ | 4. Any scope expansion beyond the reformulation = AskUserQuestion. |
348
+ | Silent scope expansion is FORBIDDEN. |
349
+ | |
350
+ +==============================================================================+
351
+
276
352
  ## PHASE 3: APPROFONDISSEMENT (Challenge & Deepen)
277
353
 
278
354
  ### 4. Targeted Questionnaires
@@ -282,12 +358,30 @@ options:
282
358
  > Apply elicitation techniques from `_shared.md` after each batch.
283
359
  > The goal is a CONVERSATION, not an interrogation.
284
360
 
285
- #### 4a. Business Context (ALWAYS — from `questionnaire/01-context.md`)
361
+ #### 4a. Batch 1Contexte & Vision (from `questionnaire/01-context.md`)
286
362
 
287
363
  > Load the full questionnaire reference for elicitation guides and alert signals.
288
- > The questionnaire contains 3 targeted questions: Q1.1 (business process), Q1.4 (friction points), Q1.8 (vision).
364
+ > **Principe analyste expert :** Poser les questions necessaires pour une couverture metier complete.
365
+ > Proposer proactivement les modules et regles que le client n'a pas mentionnes.
366
+ > Challenger chaque zone d'ombre. L'auto-deduction est un COMPLEMENT, jamais un SUBSTITUT aux questions critiques.
367
+
368
+ **Questions a poser (1 batch via AskUserQuestion) :**
369
+ - Q1.1 (OBLIGATOIRE) : processus metier
370
+ - Q1.8 (OBLIGATOIRE) : vision cible
371
+ - Q1.4 (CONDITIONNEL) : frictions — poser UNIQUEMENT si `_preAnalysis.problem_type IN ("replace", "automate")`
372
+
373
+ ```
374
+ IF _preAnalysis.problem_type IN ("new_tool", "centralize"):
375
+ → Skip Q1.4
376
+ → Auto-remplir: cadrage.asIs = "Aucun outil existant — nouveau système"
377
+ → Ask Q1.1 + Q1.8 in 1 batch (2 questions)
378
+ ELSE:
379
+ → Ask Q1.1 + Q1.4 + Q1.8 in 1 batch (3 questions)
380
+ ```
289
381
 
290
- Ask all 3 questions in 1 batch via AskUserQuestion.
382
+ **Aussi dans ce batch :** Detection utilisateurs externes (avancee depuis ex-4b-bis) :
383
+ - Ajouter la question : "Des utilisateurs externes (clients, fournisseurs, partenaires) accederont-ils au systeme ?"
384
+ - Cette reponse active `_portalDetected` DES LE DEBUT pour adapter les questions stakeholders en consequence.
291
385
 
292
386
  Apply ULTRATHINK after the batch:
293
387
  - If answer is vague → probe deeper using the elicitation guide from 01-context.md
@@ -295,74 +389,62 @@ Apply ULTRATHINK after the batch:
295
389
  - If answer is superficial → apply Technique 2 (chain of whys)
296
390
  - If answer is excellent → record and move on
297
391
 
298
- #### 4b. Stakeholders (ALWAYS — from `questionnaire/02-stakeholders-scope.md`)
392
+ #### 4b. Batch 2Utilisateurs & Acces (from `questionnaire/02-stakeholders-scope.md`)
299
393
 
300
- > The questionnaire contains 10 targeted questions covering profiles, tasks, access levels, scope, and user journey.
394
+ > **5 questions obligatoires** couvrant profils, taches et niveaux d'acces.
395
+ > **Regle : 2 questions max par AskUserQuestion** — ne jamais submerger l'utilisateur.
301
396
 
302
- **Mandatory minimum:** Q2.1 (users), Q2.5 (tasks per profile), Q2.9-Q2.11 (access levels).
303
-
304
- Ask in 1-2 batches. After each batch:
397
+ **Batch 2a** (Q2.1 + Q2.5) : Profils et taches.
398
+ Ask via AskUserQuestion (2 questions).
305
399
  - If only 1 user type mentioned → probe: "Who else interacts? Managers? Admins? External users?"
306
- - If "no restrictions" → probe: "Are there sensitive data (salary, contracts, personal info) that should be restricted to specific roles?"
307
400
  - If tasks are generic → ask for a concrete scenario: "Walk me through a typical day"
308
401
 
309
- #### 4b-bis. Détection Portail Client (ULTRATHINK après batch stakeholders)
310
-
311
- Analyser les réponses stakeholders pour signaux d'utilisateurs externes :
402
+ **Batch 2b** (Q2.9 + Q2.10) : Restrictions d'acces et droits de modification.
403
+ Ask via AskUserQuestion (2 questions).
404
+ - If "no restrictions" probe: "Are there sensitive data (salary, contracts, personal info) that should be restricted to specific roles?"
312
405
 
313
- ```
314
- EXTERNAL_SIGNALS = ["client", "customer", "fournisseur", "supplier", "partenaire",
315
- "partner", "portail", "portal", "externe", "external", "tiers", "third-party",
316
- "organisation cliente"]
317
- ```
406
+ **Batch 2c** (Q2.11) : Actions sensibles (suppression, validation, export).
407
+ Ask via AskUserQuestion (1 question).
318
408
 
319
- > **SmartStack gère nativement les utilisateurs externes :**
320
- > - **Person Extension Pattern** : User Employee, Contact, Customer via `UserId` FK
321
- > - **Organisation Extension** : OrganisationClient, Supplier via `OrganisationId` FK
322
- > - **Multi-tenant** : portail et interne déployés sur des tenants séparés automatiquement
409
+ Apply ULTRATHINK after EACH batch:
410
+ - If answer is vagueprobe deeper using the elicitation guide
411
+ - If answer is solution-orientedapply Technique 1 (reformulate as need)
412
+ - If answer is superficial apply Technique 2 (chain of whys)
413
+ - If answer is excellent → record and move on
323
414
 
324
- SI un profil stakeholder match EXTERNAL_SIGNALS :
325
- → Stocker dans `{pre_analysis}`: `_portalDetected: true`
326
- → **Auto-classifier** chaque stakeholder détecté : `audience: "internal" | "external" | "shared"`
327
- → **Auto-déduire** `_portalMode` :
415
+ #### 4b-bis. Résolution Portail Client (ULTRATHINK — après batch 2)
328
416
 
329
- | Stakeholders détectés | `_portalMode` |
330
- |----------------------|---------------|
331
- | Internes + Externes | `"dual"` |
332
- | Uniquement externes | `"portal-only"` |
333
- | Uniquement internes | `"internal-only"` |
417
+ > **Load** `references/portal-classification.md` for external signal detection, classification rules, and portal mode resolution.
334
418
 
335
- **Informer le client** (statement, PAS de question) :
419
+ Execute portal classification following the reference. Store result in `_portalMode`.
336
420
 
337
- ```
338
- "{language == 'fr'
339
- ? 'J\'ai détecté des utilisateurs externes ({profiles}). SmartStack déploiera automatiquement un portail dédié ({_portalMode}) avec isolation multi-tenant. Les extensions Person/Organisation gèrent nativement la séparation des profils internes et externes.'
340
- : 'I detected external users ({profiles}). SmartStack will automatically deploy a dedicated portal ({_portalMode}) with multi-tenant isolation. Person/Organisation extensions natively handle the separation of internal and external profiles.'}"
341
- ```
421
+ #### 4c. Batch 3 — Perimetre & Limites (from `questionnaire/02-stakeholders-scope.md`)
342
422
 
343
- SI aucun profil ne match EXTERNAL_SIGNALS `_portalMode = "internal-only"` (défaut silencieux, rien à informer).
423
+ > **Objectif :** Borner le perimetre exclusions explicites + integrations/imports si pertinent.
424
+ > Les fonctionnalites IN-SCOPE sont couvertes par la reformulation (phase 2) et ne necessitent plus de question explicite.
425
+ > Le parcours utilisateur (ex-Q2.16-Q2.18) est desormais capture en step-03 lors de la specification des use cases.
344
426
 
345
- #### 4c. Functional Scope (ALWAYS from `questionnaire/02-stakeholders-scope.md`)
427
+ **Questions a poser (1 batch via AskUserQuestion) :**
428
+ - Q2.15 (OBLIGATOIRE) : exclusions
429
+ - Q2.19 (CONDITIONNEL) : integrations — poser uniquement si le brief mentionne un systeme externe
430
+ - Q2.20 (CONDITIONNEL) : import donnees — poser uniquement si le brief mentionne migration/import
346
431
 
347
- **Mandatory minimum:** Q2.13 (in-scope), Q2.15 (exclusions), Q2.16 (main journey).
432
+ ```
433
+ IF brief mentions external system OR integration:
434
+ → Ask Q2.15 + Q2.19 + Q2.20 in 1 batch
435
+ ELIF brief mentions import OR migration:
436
+ → Ask Q2.15 + Q2.20 in 1 batch
437
+ ELSE:
438
+ → Ask Q2.15 only
439
+ → Auto-remplir: cadrage.externalIntegrations = [], cadrage.dataImport = null
440
+ ```
348
441
 
349
- Ask in 1-2 batches. After each batch:
442
+ After the batch:
350
443
  - If no exclusions → probe: "What should this system explicitly NOT do?"
351
- - If journey is too simple → detail: "What happens when something goes wrong? When someone cancels?"
352
-
353
- > **MANDATORY Error Path Challenge (run for EVERY project after the main journey is described):**
354
- >
355
- > Ask via AskUserQuestion (1 batch, 2-3 questions):
356
- > - "Si l'action principale échoue (erreur serveur, données invalides, timeout), que doit-il se passer ?"
357
- > - "Qui est notifié en cas d'erreur ? L'utilisateur ? Un administrateur ? Via quel canal ?"
358
- > - "L'état doit-il être annulé (rollback) ou conservé partiellement ?"
359
- >
360
- > Record answers in `cadrage.errorFlows[]`:
361
- > ```json
362
- > { "scenario": "...", "trigger": "...", "notification": "...", "recovery": "rollback|partial|manual" }
363
- > ```
364
- >
365
- > These error flows become **Business Rules** in step-03 (BR-WF category: workflow/guard conditions).
444
+
445
+ > **Error Path Challenge :** Deplace vers step-03 — les scenarios d'erreur sont captures par module
446
+ > lors de la specification des use cases (alternativeScenarios, errorScenarios).
447
+ > En step-01, les erreurs globales sont couvertes par les suggestions (phase 4 — Anticipation).
366
448
 
367
449
  #### 4d. Challenge Implicit Assumptions (CRITICAL)
368
450
 
@@ -386,182 +468,108 @@ Ask challenge questions via AskUserQuestion (1-2 batches of max 4).
386
468
 
387
469
  For EACH referenced entity/concept detected during phases 2-4 that is NOT already covered by an identified module:
388
470
 
389
- ##### PHASE 1 ULTRATHINK: Silent Architecture Analysis (NO output to client)
471
+ > **Load** `references/entity-sourcing-presentation.md` for the 4-phase entity sourcing flow:
472
+ > PHASE 1 (ULTRATHINK analysis), PHASE 2 (display to client), PHASE 3 (AskUserQuestion), PHASE 4 (process answer).
390
473
 
391
- > **The AI reasons about the entity BEFORE presenting options. This is internal thinking only.**
474
+ Execute ALL 4 phases from the reference for EACH referenced entity detected.
392
475
 
393
- ```
394
- ULTRATHINK — Entity Architecture Analysis for {entity_name}:
476
+ #### 4e. Conditional Deep-Dives
395
477
 
396
- 1. DOMAIN COHERENCE (from decision tree in reference)
397
- - Application domain: {app_description}
398
- - Entity fit: CORE | SUPPORT | PERIPHERAL
399
- - Justification: {1 sentence — why this entity is/isn't core to the app}
400
- - Example: "Projets" in a time management app = CORE (without projects, time entries have no target)
401
- - Example: "Codes d'imputation" in a time management app = SUPPORT (useful for accounting, but not central)
478
+ Based on brief analysis, load additional materials if relevant:
402
479
 
403
- 2. ENTITY SCORING (5 criteria, 0-3 each — from scoring grid in reference)
404
- - Lifecycle: {score}/3 — {brief justification}
405
- - Actors: {score}/3 {brief justification}
406
- - Relations: {score}/3 {brief justification}
407
- - Volume: {score}/3 {brief justification}
408
- - Autonomy: {score}/3 {brief justification}
409
- - TOTAL: {total}/15 → {classification: config_list | in_app | light_module | full_module}
480
+ | Condition | Questionnaire |
481
+ |-----------|---------------|
482
+ | Security or compliance mentioned | `questionnaire/03-data-ui.md` (security section) |
483
+ | External system integration | `questionnaire/05-cross-module.md` (integration section) |
484
+ | Performance requirements | Additional probing on non-functional needs |
485
+ | Technical constraints | Additional probing on platform constraints |
410
486
 
411
- 3. PRE-CLASSIFICATION CHECK (from entity patterns in reference)
412
- - Does {entity_name} match a known pattern? → {yes: which one | no: use scoring}
413
- - Override needed? → {yes: why | no}
487
+ ---
414
488
 
415
- 4. RECOMMENDATION
416
- - Option: {config_list | in_app_section | new_module | external_system}
417
- - Confidence: HIGH | MEDIUM | LOW
418
- - Reasoning: {1-2 sentences}
419
- - Risk if wrong choice: {what goes wrong if user picks a different option}
489
+ ## PHASE 4: ANTICIPATION (Suggest Unexpressed Needs)
420
490
 
421
- 5. IF recommendation = new_module PRE-BUILD ARCHITECTURE
422
- - Module code: {PascalCase}
423
- - Section `list`: {main entity grid + create action + navigation to detail}
424
- - Detail page tabs: [{tab_name: content}] (accessible by clicking a row in list)
425
- - Additional sections: [{code: justification}] (ONLY functional sections: dashboard, approve, import, rapport...)
426
- - Dependencies: [{which modules reference/are referenced by this entity}]
427
- - Topological position: layer {N} (foundation if no dependencies)
428
- ```
491
+ ### 4f. Detection des besoins structurants (MANDATORY BEFORE suggestions)
429
492
 
430
- ##### PHASE 2 Present Analysis & Recommendation to Client
493
+ > **Auto-deduire les besoins structurants depuis le domain research et confirmer en 1 seule question.**
494
+ > Ces choix impactent la structure du systeme et doivent etre captures AVANT la specification.
431
495
 
432
- **BEFORE the AskUserQuestion, display the analysis as markdown:**
496
+ **ULTRATHINK Detection des besoins structurants :**
433
497
 
434
498
  ```
435
- ### {language == "fr" ? "Analyse" : "Analysis"} : {entity_plural}
499
+ 1. HISTORIQUE DES MODIFICATIONS
500
+ → Analyse: {domain_research} — le domaine necessite-t-il de tracer qui a modifie quoi et quand ?
501
+ → Default: OUI pour les entites principales, NON pour les tables de reference
502
+ → Exemples: Employes (OUI), AbsenceType (NON)
436
503
 
437
- {language == "fr"
438
- ? "Les **{entity_plural}** sont référencés par {parent_module} ({relationship_description})."
439
- : "**{entity_plural}** are referenced by {parent_module} ({relationship_description})."}
504
+ 2. DONNEES HIERARCHIQUES (parent-enfant)
505
+ Analyse: existe-t-il des structures arborescentes ? (departements → sous-departements, categories → sous-categories)
506
+ → Default: NON sauf si explicitement detecte
440
507
 
441
- {language == "fr" ? "**Mon analyse :**" : "**My analysis:**"}
442
- - {language == "fr" ? "Cohérence domaine" : "Domain coherence"} : **{CORE|SUPPORT|PERIPHERAL}** — {justification}
443
- - {language == "fr" ? "Score de complexité" : "Complexity score"} : **{score}/15** ({classification})
444
- - {language == "fr" ? "Recommandation" : "Recommendation"} : **{recommended_option}** — {reasoning}
445
- ```
446
-
447
- **IF recommendation = new_module AND confidence >= MEDIUM, ALSO display:**
508
+ 3. SUPPRESSION RECUPERABLE
509
+ Analyse: les donnees supprimees doivent-elles pouvoir etre restaurees ?
510
+ Default: OUI pour les entites metier, NON pour les tables de liaison
448
511
 
512
+ 4. CYCLE DE VIE (etats et transitions)
513
+ → Analyse: quelles entites passent par des etats successifs ?
514
+ → Lister: [{entity, states: ["Brouillon", "Actif", ...], transitions: ["Brouillon→Actif", ...]}]
449
515
  ```
450
- {language == "fr" ? "**Architecture proposée :**" : "**Proposed architecture:**"}
451
-
452
- | {language == "fr" ? "Niveau" : "Level"} | {language == "fr" ? "Valeur" : "Value"} | {language == "fr" ? "Justification" : "Rationale"} |
453
- |--------|--------|---------------|
454
- | Application | `{app_code}` | {app_name} |
455
- | Module | `{ModuleCode}` | {language == "fr" ? "{pourquoi ce découpage}" : "{why this decomposition}"} |
456
516
 
457
- | Section | {language == "fr" ? "Justification" : "Rationale"} | Resources |
458
- |---------|---------------|-----------|
459
- | `list` | {language == "fr" ? "Page principale : grille, création, navigation vers détail" : "Main page: grid, create action, navigate to detail"} | {entity}-grid, {entity}-filters, {entity}-form |
460
- | {additional_section} | {justification} | {resources} |
517
+ **Presenter en 1 AskUserQuestion :**
461
518
 
462
- {language == "fr"
463
- ? "**Page détail** (onglets accessibles depuis la liste) :"
464
- : "**Detail page** (tabs accessible from list):"}
519
+ ```
520
+ question: "{language == 'fr'
521
+ ? 'Voici les besoins structurants que j\'ai déduits pour votre domaine. Confirmez-vous ?'
522
+ : 'Here are the structural needs I deduced for your domain. Do you confirm?'}"
523
+ header: "{language == 'fr' ? 'Besoins structurants' : 'Structural needs'}"
524
+
525
+ Display as markdown BEFORE the question:
526
+ | Besoin | Détection | Données concernées |
527
+ |--------|----------|--------------------|
528
+ | Historique des modifications | {OUI/NON} | {liste entites} |
529
+ | Données hiérarchiques | {OUI/NON} | {liste entites si OUI} |
530
+ | Suppression récupérable | {OUI/NON} | {liste entites} |
531
+ | Cycle de vie | {OUI/NON} | {entite: [etats]} |
465
532
 
466
- | {language == "fr" ? "Onglet" : "Tab"} | {language == "fr" ? "Contenu" : "Content"} |
467
- |--------|---------|
468
- | {language == "fr" ? "Informations" : "Information"} | {language == "fr" ? "Fiche principale" : "Main record"} |
469
- | {tab_name} | {tab_content} |
533
+ options:
534
+ - label: "{language == 'fr' ? 'Oui, c\'est correct' : 'Yes, correct'}"
535
+ - label: "{language == 'fr' ? ajuster' : 'Needs adjustment'}"
536
+ description: "{language == 'fr' ? 'Certains points sont à modifier' : 'Some points need modification'}"
537
+ ```
470
538
 
471
- {language == "fr"
472
- ? "**Impact :** {ModuleName} deviendra une dépendance de {parent_module} (couche {N} du graphe)."
473
- : "**Impact:** {ModuleName} will become a dependency of {parent_module} (layer {N} in the graph)."}
539
+ Store confirmed patterns in `cadrage.smartStackPatterns`:
540
+ ```json
541
+ {
542
+ "auditTrail": { "enabled": true, "entities": ["Employee", "Invoice"] },
543
+ "hierarchy": { "enabled": false, "entities": [] },
544
+ "softDelete": { "enabled": true, "entities": ["Employee", "Client", "Invoice"] },
545
+ "workflowStates": [
546
+ { "entity": "Invoice", "states": ["Draft", "Sent", "Paid", "Overdue"], "transitions": [...] }
547
+ ]
548
+ }
474
549
  ```
475
550
 
476
- ##### PHASE 3 Ask with Recommended Option First
551
+ ### 4g. Evolution et risques de donnees (MANDATORY)
552
+
553
+ > **Anticiper les changements futurs et les risques de qualite de donnees.**
477
554
 
478
- **Order the options with the recommendation FIRST, marked "(Recommandé)" / "(Recommended)":**
555
+ Ask via AskUserQuestion (2 questions max) :
479
556
 
480
557
  ```
481
558
  question: "{language == 'fr'
482
- ? 'Comment souhaitez-vous gérer les {entity_plural} ?'
483
- : 'How do you want to manage {entity_plural}?'}"
484
- header: "{entity_name}"
485
- options:
486
- (ORDER: recommended option FIRST, then the 3 remaining options in logical order)
487
-
488
- IF recommendation = new_module:
489
- - label: "{language == 'fr' ? 'Nouveau module dédié (Recommandé)' : 'New dedicated module (Recommended)'}"
490
- description: "{language == 'fr'
491
- ? 'Module {ModuleCode} avec page liste, détail par onglets, permissions dédiées'
492
- : '{ModuleCode} module with list page, tabbed detail, dedicated permissions'}"
493
- - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
494
- description: "..."
495
- - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
496
- description: "..."
497
- - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
498
- description: "..."
499
-
500
- IF recommendation = config_list:
501
- - label: "{language == 'fr' ? 'Liste simple en config (Recommandé)' : 'Simple config list (Recommended)'}"
502
- description: "{language == 'fr'
503
- ? 'Table de référence administrable, pas de module dédié'
504
- : 'Admin-managed reference table, no dedicated module'}"
505
- - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
506
- description: "..."
507
- - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
508
- description: "..."
509
- - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
510
- description: "..."
511
-
512
- IF recommendation = in_app_section:
513
- - label: "{language == 'fr' ? 'Géré dans l\'app (Recommandé)' : 'Managed in app (Recommended)'}"
514
- description: "{language == 'fr'
515
- ? 'Accessible via un onglet dans la page détail de {parent_module}'
516
- : 'Accessible via a tab in {parent_module} detail page'}"
517
- - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
518
- description: "..."
519
- - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
520
- description: "..."
521
- - label: "{language == 'fr' ? 'Système externe' : 'External system'}"
522
- description: "..."
523
-
524
- IF recommendation = external_system:
525
- - label: "{language == 'fr' ? 'Système externe (Recommandé)' : 'External system (Recommended)'}"
526
- description: "{language == 'fr'
527
- ? 'Les {entity_plural} viennent d\'un autre système (import ou API)'
528
- : '{entity_plural} come from another system (import or API)'}"
529
- - label: "{language == 'fr' ? 'Nouveau module dédié' : 'New dedicated module'}"
530
- description: "..."
531
- - label: "{language == 'fr' ? 'Géré dans l\'app' : 'Managed in app'}"
532
- description: "..."
533
- - label: "{language == 'fr' ? 'Liste simple en config' : 'Simple config list'}"
534
- description: "..."
535
-
536
- IF confidence = LOW (no clear recommendation):
537
- (all 4 options in neutral order, NO "(Recommandé)" tag)
538
- ```
539
-
540
- ##### PHASE 4 — Process Answer
541
-
542
- | Choice | Action |
543
- |--------|--------|
544
- | **Géré dans l'app** | Entity becomes a sub-entity of the parent module. Add as a **tab in the detail page** of the referencing module. Note in coverageMatrix with `parentModule` field. |
545
- | **Nouveau module dédié** | **Add new module to `{pre_analysis}.detected_modules[]`** with the proposed architecture (sections, detail tabs, dependencies). Add to `coverageMatrix` as inScope. The `list` section is ALWAYS the main section. Additional sections ONLY for distinct functional sections (dashboard, approve, import...). `create` and `edit` are ACTIONS within `list` and detail pages, NEVER standalone sections. |
546
- | **Système externe** | Flag for integration specification. Add to `coverageMatrix` as integration. Load questionnaire materials on integrations if not already covered. |
547
- | **Liste simple en config** | Entity becomes a lookup/reference table (no dedicated module, no section). Note in coverageMatrix as config data. |
548
-
549
- > **CRITICAL:** The intelligence of this step is in the ULTRATHINK analysis. The AI must REASON about domain coherence, score the entity, and recommend — not just present 4 neutral options. The client can always override the recommendation, but they should benefit from expert architectural guidance.
550
-
551
- #### 4e. Conditional Deep-Dives
552
-
553
- Based on brief analysis, load additional materials if relevant:
554
-
555
- | Condition | Questionnaire |
556
- |-----------|---------------|
557
- | Security or compliance mentioned | `questionnaire/03-data-ui.md` (security section) |
558
- | External system integration | `questionnaire/05-cross-module.md` (integration section) |
559
- | Performance requirements | Additional probing on non-functional needs |
560
- | Technical constraints | Additional probing on platform constraints |
559
+ ? 'Qu\'est-ce qui risque de changer dans votre activité dans les 6 prochains mois ? Dans 1 an ? (nouveaux utilisateurs, réglementations, croissance des volumes...)'
560
+ : 'What is likely to change in your business in the next 6 months? 1 year? (new users, regulations, volume growth...)'}"
561
+ header: "{language == 'fr' ? 'Évolution prévisible' : 'Expected evolution'}"
562
+ ```
561
563
 
562
- ---
564
+ Then ask:
565
+ ```
566
+ question: "{language == 'fr'
567
+ ? 'Que se passe-t-il si une donnée est saisie incorrectement ou manquante ? Quels sont les risques métier ?'
568
+ : 'What happens if data is entered incorrectly or is missing? What are the business risks?'}"
569
+ header: "{language == 'fr' ? 'Risques de données' : 'Data risks'}"
570
+ ```
563
571
 
564
- ## PHASE 4: ANTICIPATION (Suggest Unexpressed Needs)
572
+ Store answers in `cadrage.anticipatedEvolution` and `cadrage.dataRisks`.
565
573
 
566
574
  ### 5. Proactive Suggestions
567
575
 
@@ -611,6 +619,51 @@ options:
611
619
 
612
620
  ---
613
621
 
622
+ ## PHASE 4b: BUSINESS PROCESS MAPPING (MANDATORY for multi-app)
623
+
624
+ > **Map the end-to-end business processes BEFORE bounding scope.**
625
+ > Business processes reveal cross-app dependencies and missing modules.
626
+ > A process step without a covering module = a GAP in the application.
627
+
628
+ 1. From `{domain_research}` and cadrage answers, identify the main business processes:
629
+
630
+ Display as markdown:
631
+ ```
632
+ ### {language == "fr" ? "Processus metier identifies" : "Identified business processes"}
633
+
634
+ | # | Processus | Applications concernees | Flux |
635
+ |---|-----------|----------------------|------|
636
+ | 1 | {process_name} | {app1} → {app2} | {step1} → {step2} → ... → {stepN} |
637
+ ```
638
+
639
+ 2. For EACH process, check that every step has a corresponding module:
640
+
641
+ ```
642
+ For each step in process:
643
+ IF no module covers this step:
644
+ FLAG as gap: "{process_name} step '{step_name}' has no covering module"
645
+
646
+ Display flagged gaps:
647
+ "�� Etapes non couvertes :"
648
+ - {process} : "{step}" — pas de module correspondant
649
+ ```
650
+
651
+ 3. AskUserQuestion:
652
+ ```
653
+ question: "{language == 'fr'
654
+ ? 'Voici les processus metier identifies. Des etapes ne sont pas couvertes par vos modules. Souhaitez-vous les couvrir ?'
655
+ : 'Here are the identified business processes. Some steps are not covered by your modules. Would you like to cover them?'}"
656
+ header: "{language == 'fr' ? 'Processus metier' : 'Business processes'}"
657
+ options:
658
+ - label: "{language == 'fr' ? 'Oui, ajouter les modules manquants' : 'Yes, add missing modules'}"
659
+ - label: "{language == 'fr' ? 'Exclure ces etapes du perimetre' : 'Exclude these steps from scope'}"
660
+ - label: "{language == 'fr' ? 'Revoir les processus' : 'Review the processes'}"
661
+ ```
662
+
663
+ 4. Store confirmed processes in `cadrage._preAnalysis.businessProcesses`
664
+
665
+ ---
666
+
614
667
  ## PHASE 5: PERIMETRE (Bound Scope)
615
668
 
616
669
  ### 6. Application Roles Definition
@@ -643,10 +696,10 @@ options:
643
696
  description: "{language == 'fr' ? 'Modifier le nombre ou les permissions des rôles' : 'Modify number or permissions of roles'}"
644
697
  ```
645
698
 
646
- ### 6b. Table Prefix Definition (MANDATORY)
699
+ ### 6b. Identifiant court de l'application (MANDATORY)
647
700
 
648
- > **Every business application MUST define a table prefix.**
649
- > This prefix identifies which application a database table belongs to (e.g., `rh_Employees`, `fi_Invoices`).
701
+ > **Chaque application metier a besoin d'un identifiant court** (2-5 lettres) pour distinguer ses donnees
702
+ > dans le systeme. Cet identifiant sera utilise en interne pour le nommage.
650
703
 
651
704
  **Process:**
652
705
 
@@ -658,19 +711,19 @@ options:
658
711
 
659
712
  ```
660
713
  {language == "fr"
661
- ? "### Préfixe de table\n\nToutes les tables de cette application en base de données porteront un préfixe pour identifier leur appartenance.\n\nPréfixe suggéré : **`{suggested_prefix}`**\n\nExemple : `{suggested_prefix}Employees`, `{suggested_prefix}Contracts`"
662
- : "### Table Prefix\n\nAll database tables for this application will carry a prefix to identify their ownership.\n\nSuggested prefix: **`{suggested_prefix}`**\n\nExample: `{suggested_prefix}Employees`, `{suggested_prefix}Contracts`"}
714
+ ? "### Identifiant de l'application\n\nPour distinguer les données de votre application dans le système, un identifiant court est nécessaire.\n\nIdentifiant suggéré : **`{suggested_prefix}`**"
715
+ : "### Application identifier\n\nTo distinguish your application's data in the system, a short identifier is needed.\n\nSuggested identifier: **`{suggested_prefix}`**"}
663
716
  ```
664
717
 
665
718
  3. Ask via AskUserQuestion:
666
719
  ```
667
- question: "{language == 'fr' ? 'Ce préfixe de table vous convient-il ?' : 'Does this table prefix work for you?'}"
668
- header: "Préfixe"
720
+ question: "{language == 'fr' ? 'Cet identifiant court vous convient-il ?' : 'Does this short identifier work for you?'}"
721
+ header: "{language == 'fr' ? 'Identifiant' : 'Identifier'}"
669
722
  options:
670
723
  - label: "{language == 'fr' ? 'Oui, parfait' : 'Yes, perfect'}"
671
- description: "{language == 'fr' ? 'Utiliser le préfixe suggéré' : 'Use the suggested prefix'}"
724
+ description: "{language == 'fr' ? 'Utiliser l\'identifiant suggéré' : 'Use the suggested identifier'}"
672
725
  - label: "{language == 'fr' ? 'Personnaliser' : 'Customize'}"
673
- description: "{language == 'fr' ? 'Choisir un autre préfixe (2-5 lettres minuscules + _)' : 'Choose a different prefix (2-5 lowercase letters + _)'}"
726
+ description: "{language == 'fr' ? 'Choisir un autre identifiant (2-5 lettres)' : 'Choose a different identifier (2-5 letters)'}"
674
727
  ```
675
728
 
676
729
  4. IF "Customize" → ask for custom prefix via AskUserQuestion (open-ended "Other" option)
@@ -737,6 +790,34 @@ BEFORE transitioning to step-02:
737
790
 
738
791
  7. Iterate until the client confirms
739
792
 
793
+ ### 7b. Validation de completude (MANDATORY — apres confirmation de la matrice)
794
+
795
+ > **Jouer l'avocat du diable avant de clore le cadrage.**
796
+
797
+ Ask via AskUserQuestion (1 question avec options) :
798
+ ```
799
+ question: "{language == 'fr'
800
+ ? 'Avant de passer à la phase suivante, quelques vérifications :'
801
+ : 'Before moving to the next phase, a few checks:'}"
802
+ header: "{language == 'fr' ? 'Complétude du périmètre' : 'Scope completeness'}"
803
+ ```
804
+
805
+ Display as markdown BEFORE the question:
806
+ ```
807
+ {language == "fr"
808
+ ? "### Vérifications finales\n\n1. **Remplacement** — Ce système remplace-t-il complètement l'outil ou processus actuel ? Ou cohabitera-t-il avec l'existant ?\n2. **Tâches manuelles** — Reste-t-il des tâches aujourd'hui faites sur Excel, papier ou email qui ne sont pas couvertes ?\n3. **Utilisateurs rares** — Y a-t-il des utilisateurs occasionnels ou des cas d'usage peu fréquents mais réels qui ne sont pas couverts ?"
809
+ : "### Final checks\n\n1. **Replacement** — Does this system fully replace the current tool or process? Or will it coexist?\n2. **Manual tasks** — Are there tasks currently done in Excel, on paper, or by email that are not covered?\n3. **Edge users** — Are there occasional users or infrequent but real use cases that are not covered?"}
810
+ ```
811
+
812
+ ```
813
+ options:
814
+ - label: "{language == 'fr' ? 'Tout est couvert' : 'Everything is covered'}"
815
+ - label: "{language == 'fr' ? 'Il manque des éléments' : 'Some elements are missing'}"
816
+ description: "{language == 'fr' ? 'Préciser les manques' : 'Specify what is missing'}"
817
+ ```
818
+
819
+ IF "Il manque des éléments" → iterate: collect missing items, update coverageMatrix and globalScope.
820
+
740
821
  ---
741
822
 
742
823
  ## WRITE & SUMMARY
@@ -758,13 +839,28 @@ ba-writer.enrichSection({
758
839
  problem: {from Phase 3, section 4a — Q1.1 answer or refined problem},
759
840
  asIs: {from Phase 3, section 4a — Q1.4 answer},
760
841
  toBe: {from Phase 3, section 4a — Q1.8 answer},
761
- stakeholders: [{from Phase 3, section 4b — each with audience: "internal"|"external"|"shared" if portalMode is "dual"}],
842
+ stakeholders: [
843
+ // Shape: {name, role, type: "internal"|"external",
844
+ // audience: "internal"|"external"|"shared" (if portalMode="dual"),
845
+ // tasks: [], involvement?: "daily"|"weekly"|"monthly",
846
+ // frequency?: string, painPoints?: []}
847
+ // 'involvement', 'frequency', 'painPoints' are OPTIONAL — include when known
848
+ {from Phase 3, section 4b}
849
+ ],
762
850
  globalScope: {
763
- inScope: [{from Phase 3, section 4c + Phase 4 accepted suggestions + coverage matrix}],
764
- outOfScope: [{from Phase 3, section 4c — Q2.15 exclusions}]
851
+ inScope: [
852
+ // Shape: {feature, priority: "must"|"should"|"could", module, app?}
853
+ {from Phase 3, section 4c + Phase 4 accepted suggestions + coverage matrix}
854
+ ],
855
+ outOfScope: [
856
+ // Shape: {feature, reason}
857
+ {from Phase 3, section 4c — Q2.15 exclusions}
858
+ ]
765
859
  },
766
860
  applicationRoles: [{from Phase 5, section 6}],
767
- errorFlows: [{from Phase 3, section 4c}],
861
+ smartStackPatterns: {from Phase 4, section 4f — confirmed patterns},
862
+ anticipatedEvolution: "{from Phase 4, section 4g — changes in 6mo/1yr}",
863
+ dataRisks: "{from Phase 4, section 4g — business risks if data is incorrect/missing}",
768
864
  coverageMatrix: [{from Phase 5, section 7 — with anticipatedSections and anticipatedResources}],
769
865
  codebaseContext: "{string summary of codebase findings}"
770
866
  }