@atlashub/smartstack-cli 4.17.1 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +321 -413
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +703 -82
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +31 -5
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  51. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  52. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  53. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +142 -0
  54. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +94 -0
  55. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +150 -0
  56. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  57. package/templates/skills/business-analyse/questionnaire.md +23 -280
  58. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  59. package/templates/skills/business-analyse/react/components.md +4 -4
  60. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  61. package/templates/skills/business-analyse/react/schema.md +14 -14
  62. package/templates/skills/business-analyse/references/acceptance-criteria.md +25 -25
  63. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  64. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +7 -7
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +14 -12
  67. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  68. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  69. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  70. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  71. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  72. package/templates/skills/business-analyse/references/robustness-checks.md +36 -33
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  76. package/templates/skills/business-analyse/references/validation-checklist.md +9 -6
  77. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  78. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  79. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  80. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  81. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  82. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  83. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  84. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  85. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -3
  87. package/templates/skills/business-analyse/steps/step-00-init.md +93 -134
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +136 -172
  89. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  90. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  91. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  92. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  93. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  94. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  95. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  96. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  97. package/templates/skills/business-analyse/templates-react.md +2 -2
  98. package/templates/skills/derive-prd/SKILL.md +92 -0
  99. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  100. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  101. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  102. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  103. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  104. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -258
  105. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  106. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  107. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  108. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  109. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  110. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  111. package/templates/skills/ralph-loop/SKILL.md +10 -4
  112. package/templates/skills/ralph-loop/references/category-completeness.md +20 -4
  113. package/templates/skills/ralph-loop/references/compact-loop.md +80 -48
  114. package/templates/skills/ralph-loop/references/init-resume-recovery.md +4 -2
  115. package/templates/skills/ralph-loop/references/parallel-execution.md +27 -27
  116. package/templates/skills/ralph-loop/steps/step-00-init.md +19 -9
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +12 -4
  118. package/templates/skills/ralph-loop/steps/step-02-execute.md +9 -4
  119. package/templates/skills/ralph-loop/steps/step-03-commit.md +1 -1
  120. package/templates/skills/ralph-loop/steps/step-04-check.md +5 -21
  121. package/templates/skills/ralph-loop/steps/step-05-report.md +6 -1
  122. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  123. package/templates/skills/business-analyse/_architecture.md +0 -124
  124. package/templates/skills/business-analyse/_elicitation.md +0 -206
  125. package/templates/skills/business-analyse/_module-loop.md +0 -115
  126. package/templates/skills/business-analyse/_suggestions.md +0 -34
  127. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  128. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  129. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  130. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  131. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  132. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  134. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  135. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  136. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  137. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -43
  138. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  139. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  140. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  141. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  142. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  143. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -362
  144. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  145. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  146. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  147. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  148. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  149. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  150. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  151. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1022
  152. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  153. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  154. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  155. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  156. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -506
  157. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -301
  158. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -425
  159. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -611
  160. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -783
  161. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  162. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  163. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  164. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  165. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -840
  166. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  167. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -2,10 +2,10 @@
2
2
  name: step-01-cadrage
3
3
  description: Application/module framing - listen, reformulate, challenge, anticipate, bound scope
4
4
  model: opus
5
- next_step: steps/step-02-decomposition.md
5
+ next_step: steps/step-02-structure.md
6
6
  ---
7
7
 
8
- > **Context files:** `_shared.md` | `_elicitation.md` | `_architecture.md` | `_suggestions.md`
8
+ > **Context files:** `_shared.md`
9
9
  > **Reference (4d-bis):** `references/entity-architecture-decision.md` — Entity scoring, domain coherence, section patterns
10
10
 
11
11
  # Step 1: Cadrage (Framing)
@@ -13,11 +13,11 @@ next_step: steps/step-02-decomposition.md
13
13
  ## MANDATORY EXECUTION RULES
14
14
 
15
15
  - ALWAYS use ULTRATHINK mode for this step
16
- - ALWAYS apply the Elicitation Techniques from `_elicitation.md`
16
+ - ALWAYS apply the Elicitation Techniques from `_shared.md`
17
17
  - NEVER accept vague answers — probe deeper
18
18
  - NEVER define entities or business rules here — that's per-module in step-03
19
19
  - ALL questions via AskUserQuestion tool (NEVER as text dumps)
20
- - ALL communication in `{language}` (from feature.json.metadata.language)
20
+ - ALL communication in `{language}` (from index.json metadata.language)
21
21
  - **NEVER skip the reformulation phase** — it is the foundation of good analysis
22
22
  - **NEVER auto-infer cadrage data without client validation** — every key decision is confirmed
23
23
 
@@ -41,36 +41,19 @@ Phase 5: PERIMETRE → Bound scope with roles, coverage matrix (sections
41
41
 
42
42
  ---
43
43
 
44
- ## PROJECT vs APPLICATION MODE
45
-
46
- > **When `workflow_mode = "project"` (detected in step-00 from prompt structure):**
47
- > The cadrage operates at the **PROJECT level**, not at a single application level.
48
- > - Phase 1-3: Gather requirements for the ENTIRE project (all applications combined)
49
- > - Phase 4: ANTICIPATION analyzes cross-application shared modules and suggests extracting them as dedicated applications
50
- > - Phase 5: Coverage matrix maps requirements to APPLICATIONS first, then modules within each application
51
- > - `candidate_applications` from step-00 are used as starting structure (can be modified during cadrage)
52
- >
53
- > **When `workflow_mode = "application"` (single-app):**
54
- > The cadrage operates at the application level as before.
55
-
56
44
  ## PHASE 1: ECOUTE (Listen)
57
45
 
58
46
  ### 1. Read Current State
59
47
 
60
48
  ```
61
- IF workflow_mode === "project":
62
- ba-reader.findProjectFeature({project_id})
63
- → Read metadata: projectName, language, candidateApplications
64
- → Read cadrage section (if resuming)
65
- ELSE:
66
- ba-reader.findFeature({feature_id})
67
- → Read metadata: application, language, workflow.mode, useCase
68
- → Read cadrage section (if resuming)
49
+ ba-reader.findFeature({feature_id})
50
+ → Read metadata: application, language, workflow.mode, useCase
51
+ → Read cadrage section (if resuming)
69
52
  ```
70
53
 
71
54
  IF cadrage already completed (status = "framed"):
72
55
  Display: "Cadrage already completed. Loading next step."
73
- Load: steps/step-02-decomposition.md
56
+ Load: steps/step-02-structure.md
74
57
  STOP
75
58
 
76
59
  ### 2. Codebase Pre-Research
@@ -92,21 +75,45 @@ IF mcp_available:
92
75
  Store findings in {codebase_context}
93
76
  ```
94
77
 
95
- **Phase 2b: Parallel Codebase Agents**
78
+ **Phase 2b: Parallel Codebase + Docs Agents**
96
79
  ```
97
- Launch 3 agents in parallel:
80
+ Launch 4 agents in parallel:
98
81
  Agent 1: Search for existing domain entities (Glob: **/Domain/**/*.cs)
99
82
  Agent 2: Search for existing services/integrations (Grep: IService, IRepository)
100
83
  Agent 3: Search for existing page patterns (Glob: **/pages/**/*.tsx)
84
+ Agent 4: Scan existing BA documentation (Glob: docs/**/business-analyse/**/index.json)
85
+ → For each found file: read metadata.application, metadata.module, status, modules[].code
86
+ → Also scan: docs/**/*.md (ERD, guides, specs)
101
87
 
102
88
  Merge findings into {codebase_context}
103
89
  ```
104
90
 
105
- ### 2b. Silent Pre-Analysis (ULTRATHINK — no output to client)
91
+ **Phase 2c: Existing Documentation Context**
106
92
 
107
- > **The AI prepares the conversation before speaking.** This is NOT output — it's internal reasoning.
93
+ > **Load existing BAs and documentation BEFORE engaging the client.**
94
+ > This prevents re-specifying what already exists and surfaces integration constraints early.
108
95
 
109
- Load: [references/cadrage-pre-analysis.md](../references/cadrage-pre-analysis.md)
96
+ ```
97
+ IF Agent 4 found existing index.json files:
98
+ For each file found:
99
+ → Extract: application, modules[], entities[], status, version
100
+ → Store as {existing_ba_context}: list of existing applications with their modules and key entities
101
+ Display (silent — internal context only, not shown to client):
102
+ "Found {count} existing BA(s): {app names} — {total modules} modules already specified"
103
+
104
+ IF docs/**/*.md files found:
105
+ → Scan for ERD diagrams, API specs, architecture decisions
106
+ → Store relevant findings in {codebase_context}
107
+ ```
108
+
109
+ **Use in pre-analysis:**
110
+ - Cross-reference detected modules against `{existing_ba_context}` — flag modules that already exist
111
+ - Pre-identify integration points: new feature may depend on or extend existing modules
112
+ - NEVER re-specify what's already handed-off (status = "handed-off") — reference it instead
113
+
114
+ ### 2b. Silent Pre-Analysis (ULTRATHINK — no output to client)
115
+
116
+ > **The AI prepares the conversation before speaking. This is NOT output — it's internal reasoning.**
110
117
 
111
118
  Analyze `{feature_description}` silently:
112
119
 
@@ -120,7 +127,7 @@ Analyze `{feature_description}` silently:
120
127
  4. **Prepare challenge questions** — specific to this brief, not generic
121
128
  5. **Pre-identify anticipated sections and resources** per detected module
122
129
 
123
- Store in `{pre_analysis}` (internal use only, NOT written to feature.json):
130
+ Store in `{pre_analysis}` (internal use only, NOT written to index.json):
124
131
  ```yaml
125
132
  pre_analysis:
126
133
  problem_type: "new_tool|replace|automate|centralize"
@@ -196,7 +203,7 @@ options:
196
203
 
197
204
  > **Principle: Do NOT ask ALL questions from ALL questionnaires.**
198
205
  > Select the RELEVANT questions based on the pre-analysis and detected shadow zones.
199
- > Apply elicitation techniques from `_elicitation.md` after each batch.
206
+ > Apply elicitation techniques from `_shared.md` after each batch.
200
207
  > The goal is a CONVERSATION, not an interrogation.
201
208
 
202
209
  #### 4a. Business Context (ALWAYS — from `questionnaire/01-context.md`)
@@ -214,7 +221,7 @@ Apply ULTRATHINK after each batch:
214
221
  - If answer is superficial → apply Technique 2 (chain of whys)
215
222
  - If answer is excellent → record and move on
216
223
 
217
- #### 4b. Stakeholders (ALWAYS — from `questionnaire/02-stakeholders.md`)
224
+ #### 4b. Stakeholders (ALWAYS — from `questionnaire/02-stakeholders-scope.md`)
218
225
 
219
226
  **Mandatory minimum:** Q2.1 (users), Q2.5 (tasks per profile), Q2.9 (access levels).
220
227
 
@@ -223,7 +230,7 @@ Ask in 1-2 batches. After each batch:
223
230
  - If "everyone sees everything" → challenge: "Even interns? Contractors? Salary data?"
224
231
  - If tasks are generic → ask for a concrete scenario: "Walk me through a typical day"
225
232
 
226
- #### 4c. Functional Scope (ALWAYS — from `questionnaire/03-scope.md`)
233
+ #### 4c. Functional Scope (ALWAYS — from `questionnaire/02-stakeholders-scope.md`)
227
234
 
228
235
  **Mandatory minimum:** Q3.2 (must-have), Q3.4 (exclusions), Q3.5 (main journey).
229
236
 
@@ -232,14 +239,27 @@ Ask in 1-2 batches. After each batch:
232
239
  - If no exclusions → probe: "What should this system explicitly NOT do?"
233
240
  - If journey is too simple → detail: "What happens when something goes wrong? When someone cancels?"
234
241
 
242
+ > **MANDATORY Error Path Challenge (run for EVERY project after the main journey is described):**
243
+ >
244
+ > Ask via AskUserQuestion (1 batch, 2-3 questions):
245
+ > - "Si l'action principale échoue (erreur serveur, données invalides, timeout), que doit-il se passer ?"
246
+ > - "Qui est notifié en cas d'erreur ? L'utilisateur ? Un administrateur ? Via quel canal ?"
247
+ > - "L'état doit-il être annulé (rollback) ou conservé partiellement ?"
248
+ >
249
+ > Record answers in `cadrage.errorFlows[]`:
250
+ > ```json
251
+ > { "scenario": "...", "trigger": "...", "notification": "...", "recovery": "rollback|partial|manual" }
252
+ > ```
253
+ >
254
+ > These error flows become **Business Rules** in step-03 (BR-WF category: workflow/guard conditions).
255
+ >
235
256
  > **BLOCKING RULE — MoSCoW DISTRIBUTION:**
236
257
  > If the client classifies ALL features as "must-have", you MUST challenge this BEFORE proceeding.
237
- > **Reference:** Load `references/cadrage-challenge-patterns.md` § "MoSCoW Prioritization Template" for the exact question format.
238
258
  > If client moves items → update categories. If client confirms ALL mustHave → accept but log in changelog.
239
259
 
240
260
  #### 4d. Challenge Implicit Assumptions (CRITICAL)
241
261
 
242
- > **Reference:** Load `references/cadrage-challenge-patterns.md` for domain-specific patterns and elicitation techniques.
262
+ > **Load reference material from `_shared.md` for domain-specific patterns and elicitation techniques.**
243
263
 
244
264
  Apply elicitation techniques to challenge what the client considers "obvious".
245
265
  This is what separates a deep analysis from a shallow one.
@@ -416,32 +436,56 @@ options:
416
436
  |--------|--------|
417
437
  | **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. |
418
438
  | **Nouveau module dédié** | **Add new module to `{pre_analysis}.detected_modules[]`** with the proposed architecture (sections, detail tabs, dependencies). Add to `coverageMatrix` as mustHave. The `list` section is ALWAYS the main section. Additional sections ONLY for distinct functional zones (dashboard, approve, import...). `create` and `edit` are ACTIONS within `list` and detail pages, NEVER standalone sections. |
419
- | **Système externe** | Flag for integration specification. Add to `coverageMatrix` as integration. Load `questionnaire/05-integrations.md` if not already loaded. |
439
+ | **Système externe** | Flag for integration specification. Add to `coverageMatrix` as integration. Load questionnaire materials on integrations if not already covered. |
420
440
  | **Liste simple en config** | Entity becomes a lookup/reference table (no dedicated module, no section). Note in coverageMatrix as config data. |
421
441
 
422
442
  > **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.
423
443
 
424
- #### 4e. Risks & Success Criteria (ALWAYS — from `questionnaire/14-risk-assumptions.md` and `questionnaire/15-success-metrics.md`)
444
+ #### 4e. Risks & Success Criteria (ALWAYS — from `questionnaire/04-risks-metrics.md`)
425
445
 
426
446
  Select the most pertinent questions:
427
- - **14-risk-assumptions.md:** Q14.1 (identified risks), Q14.4 (unvalidated assumptions)
428
- - **15-success-metrics.md:** Q15.1 (success definition), Q15.4 (measurable objectives)
447
+ - **04-risks-metrics.md:** Risk identification, assumptions validation
448
+ - **04-risks-metrics.md:** Success definition, measurable objectives
429
449
 
430
450
  Ask in 1 batch via AskUserQuestion.
431
451
 
432
452
  #### 4f. Conditional Deep-Dives
433
453
 
434
- Based on brief analysis, load additional categories if relevant:
454
+ Based on brief analysis, load additional materials if relevant:
455
+
456
+ | Condition | Questionnaire |
457
+ |-----------|---------------|
458
+ | Security or compliance mentioned | `questionnaire/03-data-ui.md` (security section) |
459
+ | External system integration | `questionnaire/05-cross-module.md` (integration section) |
460
+ | Performance requirements | Additional probing on non-functional needs |
461
+ | Technical constraints | Additional probing on platform constraints |
462
+
463
+ #### 4g. Documentation Needs (ALWAYS — from `questionnaire/03-data-ui.md`)
435
464
 
436
- | Condition | Category | Questionnaire |
437
- |-----------|----------|---------------|
438
- | Security or compliance mentioned | 06 | `questionnaire/06-security.md` |
439
- | External system integration | 05 | `questionnaire/05-integrations.md` |
440
- | Performance requirements | 08 | `questionnaire/08-performance.md` |
441
- | Technical constraints | 09 | `questionnaire/09-constraints.md` |
442
- | Documentation needs | 10 | `questionnaire/10-documentation.md` |
465
+ > **Every application requires documentation decisions made upfront, not as an afterthought.**
466
+ > Load relevant documentation section from questionnaire/03-data-ui.md
443
467
 
444
- > **Categories 04 (data), 07 (UI), 11 (lifecycle), 12 (migration), 13 (cross-module) are per-module and loaded in step-03.**
468
+ Ask in 1 batch via AskUserQuestion (max 3 questions):
469
+ - Will users need documentation (guide, FAQ, in-app tooltips)?
470
+ - Is technical documentation required (API docs, ERD, developer guide)?
471
+ - Who is responsible for maintaining documentation after delivery?
472
+
473
+ After the batch:
474
+ - If "Non" to both → probe: "Pas même les docs API ou un guide d'accueil pour les nouveaux utilisateurs ?"
475
+ - If "Oui" without detail → ask format: "Tooltips intégrés ? Guide PDF ? Wiki ? Portail dédié ?"
476
+ - If "La doc se fera après" → challenge: "La documentation est planifiée maintenant et générée par `/documentation` après `/ralph-loop`. Quel niveau souhaitez-vous ?"
477
+
478
+ **Store in `cadrage.documentation`:**
479
+ ```json
480
+ {
481
+ "userDocumentation": { "needed": true, "format": "tooltips|guide|wiki|pdf|portal", "audience": "..." },
482
+ "technicalDocumentation": { "needed": true, "format": "swagger|erd|developer-guide", "generated": true },
483
+ "owner": "who maintains it",
484
+ "skill": "/documentation — runs after /ralph-loop"
485
+ }
486
+ ```
487
+
488
+ This feeds directly into handoff step-05 category `documentation` in `filesToCreate`.
445
489
 
446
490
  ---
447
491
 
@@ -454,7 +498,7 @@ Based on brief analysis, load additional categories if relevant:
454
498
 
455
499
  **Process:**
456
500
 
457
- 1. Load: `patterns/suggestion-catalog.md`
501
+ 1. Load pattern guidance from `_shared.md`
458
502
  2. Match suggestion patterns against the project context (domain, modules, features)
459
503
  3. Add implicit needs for this type of system that weren't mentioned
460
504
 
@@ -493,21 +537,6 @@ options:
493
537
 
494
538
  6. Accepted suggestions enrich `coverageMatrix` and `globalScope`.
495
539
 
496
- ### 5b. Cross-Application Shared Module Detection (PROJECT MODE ONLY)
497
-
498
- > **When `workflow_mode = "project"`, analyze candidate applications for shared modules.**
499
- > A module that appears in 2+ applications should be extracted as a dedicated transversal application.
500
-
501
- **This section is SKIPPED if `workflow_mode !== "project"`.**
502
-
503
- **Reference:** Load `references/cadrage-shared-modules.md` for detection algorithm, extraction logic, and question template.
504
-
505
- The detection process:
506
- 1. Build module inventory per candidate application
507
- 2. Detect modules appearing in 2+ applications
508
- 3. Propose extraction to user with the template from the reference
509
- 4. IF "Yes" → Extract and update `candidate_applications` in the project feature.json
510
-
511
540
  ---
512
541
 
513
542
  ## PHASE 5: PERIMETRE (Bound Scope)
@@ -542,9 +571,6 @@ options:
542
571
  description: "{language == 'fr' ? 'Modifier le nombre ou les permissions des rôles' : 'Modify number or permissions of roles'}"
543
572
  ```
544
573
 
545
- IF single-module mode:
546
- Same role definition but inferred from stakeholders
547
-
548
574
  ### 6b. Table Prefix Definition (MANDATORY)
549
575
 
550
576
  > **Every business application MUST define a table prefix.**
@@ -586,8 +612,6 @@ options:
586
612
 
587
613
  ### 7. Coverage Matrix with Sections & Resources (MANDATORY)
588
614
 
589
- > **Reference:** Load `references/cadrage-coverage-matrix.md` for complete coverage matrix building and validation rules.
590
-
591
615
  **ENRICHMENT:** The coverage matrix now includes anticipated sections (Level 4) and resources (Level 5).
592
616
  This gives downstream steps (step-02, step-03) a concrete starting point.
593
617
 
@@ -603,16 +627,35 @@ BEFORE transitioning to step-02:
603
627
  - List anticipated resources (Level 5) for each section
604
628
  - List detail page tabs — for entities accessible via click from `list`
605
629
 
606
- 4. **OUTPUT the matrix as text** (do NOT put it inside AskUserQuestion it won't render)
630
+ 4. **RECONCILIATION CHECK (MANDATORYBLOCKING):**
631
+
632
+ > **Every explicitly requested item MUST appear in the coverage matrix.**
633
+ > This check prevents silent omissions — if the user asked for 5 modules, all 5 must be tracked.
634
+
635
+ ```
636
+ // Extract all explicit requests from the original prompt
637
+ requestedItems = extract_explicit_items({feature_description})
638
+ // Include: modules mentioned by name, features listed, applications named
639
+
640
+ // Verify each requested item has a coverage matrix entry
641
+ uncoveredItems = requestedItems.filter(item =>
642
+ !coverageMatrix.some(entry => fuzzyMatch(entry.feature, item))
643
+ )
644
+
645
+ IF uncoveredItems.length > 0:
646
+ BLOCKING: "The following requested items have no coverage matrix entry:
647
+ {uncoveredItems.map(i => '- ' + i).join('\n')}
648
+ Add them to the coverage matrix before proceeding."
649
+
650
+ ELSE:
651
+ Display: "✓ Coverage reconciliation: all {requestedItems.length} requested items mapped"
652
+ ```
607
653
 
608
- 5. **THEN** (after the table is displayed) ask via AskUserQuestion for confirmation
654
+ 5. **OUTPUT the matrix as text** (do NOT put it inside AskUserQuestion it won't render)
609
655
 
610
- 6. Iterate until the client confirms
656
+ 6. **THEN** (after the table is displayed) ask via AskUserQuestion for confirmation
611
657
 
612
- **The reference file includes:**
613
- - Section rule clarification (list, detail, create, edit, dashboard, etc.)
614
- - Priority distribution POST-CHECK (BLOCKING)
615
- - Cross-cutting coverage POST-CHECK (WARNING)
658
+ 7. Iterate until the client confirms
616
659
 
617
660
  ---
618
661
 
@@ -620,38 +663,34 @@ BEFORE transitioning to step-02:
620
663
 
621
664
  ### 8. Write Cadrage to Feature.json
622
665
 
623
- Use ba-writer to enrich master feature.json. **Follow the STRUCTURE CARDS exactly.**
624
-
625
- See [references/cadrage-structure-cards.md](../references/cadrage-structure-cards.md) for exact JSON formats of: `stakeholders[]`, `applicationRoles[]`, `risks[]`, `acceptanceCriteria[]`, `coverageMatrix[]`, `codebaseContext`.
666
+ Use ba-writer with granular JSON approach. Write to `cadrage.json` section:
626
667
 
627
668
  ```
628
- ba-writer.enrichSection({
629
- featureId: {feature_id},
630
- section: "metadata",
631
- data: {
632
- tablePrefix: "{from Phase 5, section 6b — validated prefix, e.g., rh_}"
633
- }
634
- })
635
-
636
669
  ba-writer.enrichSection({
637
670
  featureId: {feature_id},
638
671
  section: "cadrage",
672
+ subsection: "cadrage.json",
639
673
  data: {
674
+ metadata: {
675
+ tablePrefix: "{from Phase 5, section 6b — validated prefix, e.g., rh_}"
676
+ },
640
677
  problem: {from Phase 3, section 4a — Q1.1 answer or refined problem},
641
678
  asIs: {from Phase 3, section 4a — Q1.4 answer},
642
679
  toBe: {from Phase 3, section 4a — Q1.8 answer},
643
680
  trigger: {from Phase 3, section 4a — Q1.11 answer},
644
- stakeholders: [{from Phase 3, section 4b — use STRUCTURE CARD format}],
681
+ stakeholders: [{from Phase 3, section 4b}],
645
682
  globalScope: {
646
683
  mustHave: [{from Phase 3, section 4c + Phase 4 accepted suggestions}],
647
684
  shouldHave: [{from coverage matrix}],
648
685
  couldHave: [{from coverage matrix}],
649
686
  outOfScope: [{from Phase 3, section 4c — Q3.4 exclusions}]
650
687
  },
651
- applicationRoles: [{from Phase 5, section 6 — use STRUCTURE CARD format}],
652
- risks: [{from Phase 3, section 4e — use STRUCTURE CARD format}],
653
- acceptanceCriteria: [{from Phase 3, section 4e — use STRUCTURE CARD format}],
654
- coverageMatrix: [{from Phase 5, section 7 — use STRUCTURE CARD format with anticipatedSections and anticipatedResources}],
688
+ applicationRoles: [{from Phase 5, section 6}],
689
+ errorFlows: [{from Phase 3, section 4c}],
690
+ risks: [{from Phase 3, section 4e}],
691
+ acceptanceCriteria: [{from Phase 3, section 4e}],
692
+ coverageMatrix: [{from Phase 5, section 7 — with anticipatedSections and anticipatedResources}],
693
+ documentation: {from Phase 3, section 4g},
655
694
  codebaseContext: "{string summary of codebase findings}"
656
695
  }
657
696
  })
@@ -659,82 +698,7 @@ ba-writer.enrichSection({
659
698
  ba-writer.updateStatus({feature_id}, "framed")
660
699
  ```
661
700
 
662
- ### 9. Multi-Application Detection
663
-
664
- > **Analyze whether the project spans multiple independent applications.**
665
- > **SKIP this section entirely if `workflow_mode = "project"`** — multi-app was already detected in step-00
666
- > and cross-app analysis was done in section 5b above.
667
-
668
- **IF `workflow_mode === "project"`:**
669
- → SKIP section 9 entirely. Candidate applications are already identified and enriched.
670
- → Write cadrage data to project-level feature.json:
671
- ```
672
- ba-writer.enrichSection({
673
- projectId: {project_id},
674
- section: "cadrage",
675
- data: {cadrage data collected in phases 1-5 above}
676
- })
677
- ```
678
- → Continue to section 10 (summary).
679
-
680
- **IF `workflow_mode === "application"` (single-app mode):**
681
-
682
- After coverage matrix is validated, check if the identified functional domains suggest multiple applications:
683
-
684
- **Detection triggers (ANY of these = suggest multi-app):**
685
- - Coverage matrix entries reference different application scopes (administration, support, myspace, etc.)
686
- - User mentioned "multiple applications", "several apps", "cross-platform"
687
- - Functional domains form clearly independent applications with separate user bases
688
- - Stakeholders only interact with specific domains (not shared across all)
689
-
690
- **IF detection triggers matched:**
691
-
692
- Display analysis as markdown:
693
- ```
694
- {language == "fr"
695
- ? "### Analyse multi-application\n\nD'après mon analyse, ce projet couvre plusieurs domaines fonctionnels qui pourraient former des applications indépendantes :\n\n"
696
- : "### Multi-Application Analysis\n\nBased on my analysis, this project spans multiple functional domains that could form independent applications:\n\n"}
697
-
698
- | Domain | Suggested Application | Key Modules |
699
- |--------|----------------------|-------------|
700
- {for each identified domain: domain name | PascalCase name | top modules}
701
- ```
702
-
703
- Ask via AskUserQuestion:
704
- ```
705
- question: "{language == 'fr' ? 'Ce projet constitue-t-il une seule application ou plusieurs applications distinctes ?' : 'Is this a single application or multiple independent applications?'}"
706
- header: "Architecture"
707
- options:
708
- - label: "{language == 'fr' ? 'Application unique' : 'Single application'}"
709
- description: "{language == 'fr' ? 'Tous les domaines forment une seule application avec plusieurs modules' : 'All domains form one application with multiple modules'}"
710
- - label: "{language == 'fr' ? 'Applications multiples' : 'Multiple applications'}"
711
- description: "{language == 'fr' ? 'Chaque domaine est une application indépendante (navigation, rôles et préfixe de table séparés)' : 'Each domain is an independent application (separate navigation, roles, and table prefix)'}"
712
- ```
713
-
714
- **IF "Multiple applications":**
715
- 1. Create project-level feature.json:
716
- ```
717
- ba-writer.createProjectFeature({
718
- metadata: {
719
- projectName: {project_name derived from feature_description},
720
- language: {language},
721
- featureDescription: {feature_description},
722
- candidateApplications: [{detected candidates}]
723
- },
724
- cadrage: {cadrage data already collected in this step}
725
- })
726
- ```
727
- 2. Set `workflow_mode = "project"` and `project_id = PROJ-NNN`
728
- 3. Load `questionnaire/00b-project.md` for additional project-level questions
729
- 4. Continue to section 10 and then step-01b
730
-
731
- **IF "Single application":**
732
- → Continue to step 10 (display summary) and step-02 as usual.
733
-
734
- **IF no detection triggers matched:**
735
- → Skip this section entirely — continue to step 10 (display summary).
736
-
737
- ### 10. Display Summary
701
+ ### 9. Display Summary
738
702
 
739
703
  ```
740
704
  ## Cadrage Complete - {feature_id}
@@ -755,13 +719,13 @@ ba-writer.createProjectFeature({
755
719
  {top 3-5 must-have items with their anticipated sections}
756
720
 
757
721
  ### Next Step
758
- → Module decomposition (step-02-decomposition.md)
722
+ → Module structure analysis (step-02-structure.md)
759
723
  ```
760
724
 
761
725
  ---
762
726
 
763
727
  ## NEXT STEP
764
728
 
765
- Load: `./step-01b-applications.md`
729
+ Load: `./step-02-structure.md`
766
730
 
767
- > step-01b handles both single-app (lightweight identity confirmation) and multi-app (full application decomposition).
731
+ > step-02 handles module structure analysis and entity/section definition.
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: step-02-structure
3
+ description: Identify and challenge hierarchy - App > Module > Section > Resource
4
+ model: opus
5
+ next_step: steps/step-03-specify.md
6
+ ---
7
+
8
+ # Step 02 — Structure (Identify & Challenge)
9
+
10
+ ## Objective
11
+
12
+ Identify the complete hierarchy **Application > Module > Section > Resource** from the cadrage data, then CHALLENGE each element to ensure nothing is missing or superfluous.
13
+
14
+ ## Prerequisites
15
+
16
+ - Step 01 (cadrage) completed
17
+ - `cadrage.json` available with context, stakeholders, scope, risks
18
+
19
+ ## Input
20
+
21
+ Load via ba-reader:
22
+ - `cadrage.json` — framing data from step 01
23
+
24
+ ## Process
25
+
26
+ ### 1. Application Detection
27
+
28
+ Analyze the cadrage scope to determine if this is single-app or multi-app:
29
+
30
+ **Single-app indicators:**
31
+ - All scope items relate to one domain
32
+ - Single set of stakeholders
33
+ - No mention of separate systems
34
+
35
+ **Multi-app indicators:**
36
+ - Scope items spanning distinct domains (e.g., HR + CRM + Accounting)
37
+ - Different stakeholder groups per domain
38
+ - Mentions of separate applications or systems
39
+
40
+ If multi-app:
41
+ ```
42
+ For each application:
43
+ - Code (PascalCase)
44
+ - Name (display name)
45
+ - Route (URL prefix)
46
+ - Icon (optional)
47
+ - Description
48
+ ```
49
+
50
+ If single-app: derive application from project context.
51
+
52
+ ### 2. Module Identification
53
+
54
+ For each application, identify functional modules:
55
+
56
+ ```
57
+ For each module:
58
+ - Code (PascalCase)
59
+ - Name (display name)
60
+ - ApplicationCode (parent app)
61
+ - Description
62
+ - FeatureType (data-centric | workflow | reporting | integration | full-module)
63
+ - Priority (must | should | could)
64
+ - Entities (preliminary list)
65
+ ```
66
+
67
+ ### 3. Section & Resource Anticipation
68
+
69
+ For each module, anticipate the navigation structure:
70
+
71
+ ```
72
+ For each section:
73
+ - code (kebab-case, e.g., "list", "detail", "dashboard")
74
+ - label (display name)
75
+ - resources: [
76
+ { code, type (SmartTable|SmartForm|SmartCard|SmartKanban|SmartDashboard|SmartFilter), label }
77
+ ]
78
+ ```
79
+
80
+ Common patterns:
81
+ - **Data-centric module**: list (SmartTable) + detail (SmartForm)
82
+ - **Workflow module**: list + detail + kanban (SmartKanban)
83
+ - **Reporting module**: dashboard (SmartDashboard) + detail
84
+ - **Full module**: list + detail + dashboard
85
+
86
+ ### 4. Dependency Graph
87
+
88
+ Map dependencies between modules:
89
+ ```
90
+ For each dependency:
91
+ - from: module code
92
+ - to: module code (depends on)
93
+ - description: nature of dependency
94
+ ```
95
+
96
+ ### 5. CHALLENGE Phase
97
+
98
+ For EACH identified element, ask yourself:
99
+
100
+ **Applications:**
101
+ - Is this really a separate application or should it be a module?
102
+ - Are there shared users between applications?
103
+
104
+ **Modules:**
105
+ - Is this module too large? Should it be split?
106
+ - Is this module too small? Should it merge with another?
107
+ - Does every scope item have at least one module covering it?
108
+ - Are there scope items NOT covered by any module?
109
+
110
+ **Sections:**
111
+ - Does this module need a dashboard?
112
+ - Is the list/detail pattern sufficient or are there other views?
113
+ - Are there workflow steps that need dedicated sections?
114
+
115
+ **Resources:**
116
+ - Is SmartTable the right component for this list?
117
+ - Does the form need tabs?
118
+ - Are there missing filter components?
119
+
120
+ ### 6. Present to User
121
+
122
+ Display the complete hierarchy for validation:
123
+
124
+ ```
125
+ [App: HumanResources]
126
+ ├── [Module: Employees] (must)
127
+ │ ├── list → SmartTable (employees-grid)
128
+ │ └── detail → SmartForm (employee-form)
129
+ ├── [Module: Absences] (must)
130
+ │ ├── list → SmartTable (absences-grid)
131
+ │ ├── detail → SmartForm (absence-form)
132
+ │ └── calendar → SmartKanban (absences-calendar)
133
+ └── [Module: Reports] (should)
134
+ └── dashboard → SmartDashboard (hr-dashboard)
135
+ ```
136
+
137
+ Ask: "Does this structure match your vision? Any missing modules, sections, or resources?"
138
+
139
+ ## Output
140
+
141
+ Write via ba-writer:
142
+ 1. **Application index** (`docs/{app}/business-analyse/v1.0/index.json`) with modules list
143
+ 2. **Module registrations** in application index
144
+ 3. **Each module's anticipated sections** as `anticipatedSections` in module data
145
+
146
+ ### Data written
147
+
148
+ ```json
149
+ {
150
+ "applications": [
151
+ { "code": "HumanResources", "name": "Ressources Humaines", "route": "/hr", "modules": ["Employees", "Absences"] }
152
+ ],
153
+ "modules": [
154
+ {
155
+ "code": "Employees",
156
+ "applicationCode": "HumanResources",
157
+ "name": "Employes",
158
+ "featureType": "data-centric",
159
+ "priority": "must",
160
+ "entities": ["Employee", "Contract"],
161
+ "anticipatedSections": [
162
+ { "code": "list", "label": "Liste", "resources": [{ "code": "employees-grid", "type": "SmartTable" }] },
163
+ { "code": "detail", "label": "Fiche", "resources": [{ "code": "employee-form", "type": "SmartForm" }] }
164
+ ]
165
+ }
166
+ ],
167
+ "dependencies": [
168
+ { "from": "Absences", "to": "Employees", "description": "Une absence reference un employe" }
169
+ ]
170
+ }
171
+ ```
172
+
173
+ ## Transition
174
+
175
+ → Step 03 (specify) — Sequential module specification