@atlashub/smartstack-cli 4.18.0 → 4.20.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 (164) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +318 -415
  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 +706 -85
  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 +32 -6
  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/07-render-handoff.js +1 -1
  51. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  52. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  53. package/templates/skills/business-analyse/html/src/template.html +1 -1
  54. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  55. package/templates/skills/business-analyse/questionnaire/01-context.md +11 -157
  56. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +101 -0
  57. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +92 -0
  58. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +6 -0
  59. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  60. package/templates/skills/business-analyse/questionnaire.md +22 -280
  61. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  62. package/templates/skills/business-analyse/react/components.md +4 -4
  63. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  64. package/templates/skills/business-analyse/react/schema.md +14 -14
  65. package/templates/skills/business-analyse/references/acceptance-criteria.md +21 -21
  66. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  67. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  68. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +5 -5
  69. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  70. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  71. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  72. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  73. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  74. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  75. package/templates/skills/business-analyse/references/robustness-checks.md +36 -36
  76. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  77. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  78. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  79. package/templates/skills/business-analyse/references/validation-checklist.md +3 -3
  80. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  81. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  82. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  83. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  84. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  85. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  87. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  88. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  89. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -4
  90. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  91. package/templates/skills/business-analyse/steps/step-01-cadrage.md +50 -216
  92. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  93. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  94. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  95. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  96. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  97. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  98. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  99. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  100. package/templates/skills/business-analyse/templates-react.md +2 -2
  101. package/templates/skills/derive-prd/SKILL.md +92 -0
  102. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  103. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  104. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  105. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  106. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  107. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -263
  108. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  109. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  110. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  111. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  112. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  113. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  114. package/templates/skills/documentation/SKILL.md +7 -0
  115. package/templates/skills/ralph-loop/SKILL.md +2 -1
  116. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  117. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  118. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  119. package/templates/skills/business-analyse/_architecture.md +0 -124
  120. package/templates/skills/business-analyse/_elicitation.md +0 -206
  121. package/templates/skills/business-analyse/_module-loop.md +0 -115
  122. package/templates/skills/business-analyse/_rules.md +0 -142
  123. package/templates/skills/business-analyse/_suggestions.md +0 -34
  124. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  125. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  126. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  127. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  128. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  129. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  130. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  131. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  132. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  133. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  134. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  135. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  136. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  137. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  138. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  139. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  140. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  141. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  142. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  143. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  144. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  145. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  146. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  147. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  148. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  149. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  150. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  151. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  152. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  153. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  154. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  155. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  156. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  157. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  158. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  159. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  160. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  161. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  162. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  163. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  164. 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-01b-applications.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-01b-applications.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
@@ -98,7 +81,7 @@ 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)
101
- Agent 4: Scan existing BA documentation (Glob: docs/**/business-analyse/**/feature.json)
84
+ Agent 4: Scan existing BA documentation (Glob: docs/**/business-analyse/**/index.json)
102
85
  → For each found file: read metadata.application, metadata.module, status, modules[].code
103
86
  → Also scan: docs/**/*.md (ERD, guides, specs)
104
87
 
@@ -111,7 +94,7 @@ Merge findings into {codebase_context}
111
94
  > This prevents re-specifying what already exists and surfaces integration constraints early.
112
95
 
113
96
  ```
114
- IF Agent 4 found existing feature.json files:
97
+ IF Agent 4 found existing index.json files:
115
98
  For each file found:
116
99
  → Extract: application, modules[], entities[], status, version
117
100
  → Store as {existing_ba_context}: list of existing applications with their modules and key entities
@@ -123,16 +106,14 @@ IF docs/**/*.md files found:
123
106
  → Store relevant findings in {codebase_context}
124
107
  ```
125
108
 
126
- **Use in pre-analysis (§2b):**
109
+ **Use in pre-analysis:**
127
110
  - Cross-reference detected modules against `{existing_ba_context}` — flag modules that already exist
128
111
  - Pre-identify integration points: new feature may depend on or extend existing modules
129
112
  - NEVER re-specify what's already handed-off (status = "handed-off") — reference it instead
130
113
 
131
114
  ### 2b. Silent Pre-Analysis (ULTRATHINK — no output to client)
132
115
 
133
- > **The AI prepares the conversation before speaking.** This is NOT output — it's internal reasoning.
134
-
135
- Load: [references/cadrage-pre-analysis.md](../references/cadrage-pre-analysis.md)
116
+ > **The AI prepares the conversation before speaking. This is NOT output — it's internal reasoning.**
136
117
 
137
118
  Analyze `{feature_description}` silently:
138
119
 
@@ -146,7 +127,7 @@ Analyze `{feature_description}` silently:
146
127
  4. **Prepare challenge questions** — specific to this brief, not generic
147
128
  5. **Pre-identify anticipated sections and resources** per detected module
148
129
 
149
- 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):
150
131
  ```yaml
151
132
  pre_analysis:
152
133
  problem_type: "new_tool|replace|automate|centralize"
@@ -222,36 +203,36 @@ options:
222
203
 
223
204
  > **Principle: Do NOT ask ALL questions from ALL questionnaires.**
224
205
  > Select the RELEVANT questions based on the pre-analysis and detected shadow zones.
225
- > Apply elicitation techniques from `_elicitation.md` after each batch.
206
+ > Apply elicitation techniques from `_shared.md` after each batch.
226
207
  > The goal is a CONVERSATION, not an interrogation.
227
208
 
228
209
  #### 4a. Business Context (ALWAYS — from `questionnaire/01-context.md`)
229
210
 
230
211
  > Load the full questionnaire reference for elicitation guides and alert signals.
212
+ > The questionnaire contains 3 targeted questions: Q1.1 (business process), Q1.4 (friction points), Q1.8 (vision).
231
213
 
232
- Select the most relevant questions from Q1.1-Q1.12.
233
- **Mandatory minimum:** Q1.1 (problem), Q1.4 (current tools), Q1.8 (vision), Q1.11 (trigger).
214
+ Ask all 3 questions in 1 batch via AskUserQuestion.
234
215
 
235
- Ask in 1-2 batches via AskUserQuestion (max 4 questions per batch).
236
-
237
- Apply ULTRATHINK after each batch:
216
+ Apply ULTRATHINK after the batch:
238
217
  - If answer is vague → probe deeper using the elicitation guide from 01-context.md
239
218
  - If answer is solution-oriented → apply Technique 1 (reformulate as need)
240
219
  - If answer is superficial → apply Technique 2 (chain of whys)
241
220
  - If answer is excellent → record and move on
242
221
 
243
- #### 4b. Stakeholders (ALWAYS — from `questionnaire/02-stakeholders.md`)
222
+ #### 4b. Stakeholders (ALWAYS — from `questionnaire/02-stakeholders-scope.md`)
223
+
224
+ > The questionnaire contains 10 targeted questions covering profiles, tasks, access levels, scope, and user journey.
244
225
 
245
- **Mandatory minimum:** Q2.1 (users), Q2.5 (tasks per profile), Q2.9 (access levels).
226
+ **Mandatory minimum:** Q2.1 (users), Q2.5 (tasks per profile), Q2.9-Q2.11 (access levels).
246
227
 
247
228
  Ask in 1-2 batches. After each batch:
248
229
  - If only 1 user type mentioned → probe: "Who else interacts? Managers? Admins? External users?"
249
230
  - If "everyone sees everything" → challenge: "Even interns? Contractors? Salary data?"
250
231
  - If tasks are generic → ask for a concrete scenario: "Walk me through a typical day"
251
232
 
252
- #### 4c. Functional Scope (ALWAYS — from `questionnaire/03-scope.md`)
233
+ #### 4c. Functional Scope (ALWAYS — from `questionnaire/02-stakeholders-scope.md`)
253
234
 
254
- **Mandatory minimum:** Q3.2 (must-have), Q3.4 (exclusions), Q3.5 (main journey).
235
+ **Mandatory minimum:** Q2.13 (must-have), Q2.15 (exclusions), Q2.16 (main journey).
255
236
 
256
237
  Ask in 1-2 batches. After each batch:
257
238
  - If everything is "must-have" → **BLOCKING**: apply MoSCoW prioritization question
@@ -270,16 +251,15 @@ Ask in 1-2 batches. After each batch:
270
251
  > { "scenario": "...", "trigger": "...", "notification": "...", "recovery": "rollback|partial|manual" }
271
252
  > ```
272
253
  >
273
- > These error flows become **Business Rules** in step-03a2 (BR-WF category: workflow/guard conditions).
274
-
254
+ > These error flows become **Business Rules** in step-03 (BR-WF category: workflow/guard conditions).
255
+ >
275
256
  > **BLOCKING RULE — MoSCoW DISTRIBUTION:**
276
257
  > If the client classifies ALL features as "must-have", you MUST challenge this BEFORE proceeding.
277
- > **Reference:** Load `references/cadrage-challenge-patterns.md` § "MoSCoW Prioritization Template" for the exact question format.
278
258
  > If client moves items → update categories. If client confirms ALL mustHave → accept but log in changelog.
279
259
 
280
260
  #### 4d. Challenge Implicit Assumptions (CRITICAL)
281
261
 
282
- > **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.**
283
263
 
284
264
  Apply elicitation techniques to challenge what the client considers "obvious".
285
265
  This is what separates a deep analysis from a shallow one.
@@ -456,58 +436,21 @@ options:
456
436
  |--------|--------|
457
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. |
458
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. |
459
- | **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. |
460
440
  | **Liste simple en config** | Entity becomes a lookup/reference table (no dedicated module, no section). Note in coverageMatrix as config data. |
461
441
 
462
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.
463
443
 
464
- #### 4e. Risks & Success Criteria (ALWAYS — from `questionnaire/14-risk-assumptions.md` and `questionnaire/15-success-metrics.md`)
465
-
466
- Select the most pertinent questions:
467
- - **14-risk-assumptions.md:** Q14.1 (identified risks), Q14.4 (unvalidated assumptions)
468
- - **15-success-metrics.md:** Q15.1 (success definition), Q15.4 (measurable objectives)
469
-
470
- Ask in 1 batch via AskUserQuestion.
471
-
472
- #### 4f. Conditional Deep-Dives
473
-
474
- Based on brief analysis, load additional categories if relevant:
475
-
476
- | Condition | Category | Questionnaire |
477
- |-----------|----------|---------------|
478
- | Security or compliance mentioned | 06 | `questionnaire/06-security.md` |
479
- | External system integration | 05 | `questionnaire/05-integrations.md` |
480
- | Performance requirements | 08 | `questionnaire/08-performance.md` |
481
- | Technical constraints | 09 | `questionnaire/09-constraints.md` |
482
-
483
- > **Categories 04 (data), 07 (UI), 11 (lifecycle), 12 (migration), 13 (cross-module) are per-module and loaded in step-03.**
484
-
485
- #### 4g. Documentation Needs (ALWAYS — from `questionnaire/10-documentation.md`)
444
+ #### 4e. Conditional Deep-Dives
486
445
 
487
- > **Every application requires documentation decisions made upfront, not as an afterthought.**
488
- > Load `questionnaire/10-documentation.md` unconditionally — 7 questions, mandatory minimum 2 (Q10.1 + Q10.2).
446
+ Based on brief analysis, load additional materials if relevant:
489
447
 
490
- Ask in 1 batch via AskUserQuestion (max 3 questions):
491
- - Q10.1: Will users need documentation (guide, FAQ, in-app tooltips)?
492
- - Q10.2: Is technical documentation required (API docs, ERD, developer guide)?
493
- - Q10.3: Who is responsible for maintaining documentation after delivery?
494
-
495
- After the batch:
496
- - If "Non" to Q10.1 AND Q10.2 → probe: "Pas même les docs API ou un guide d'accueil pour les nouveaux utilisateurs ?"
497
- - If "Oui" without detail → ask format: "Tooltips intégrés ? Guide PDF ? Wiki ? Portail dédié ?"
498
- - 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 ?"
499
-
500
- **Store in `cadrage.documentation`:**
501
- ```json
502
- {
503
- "userDocumentation": { "needed": true, "format": "tooltips|guide|wiki|pdf|portal", "audience": "..." },
504
- "technicalDocumentation": { "needed": true, "format": "swagger|erd|developer-guide", "generated": true },
505
- "owner": "who maintains it",
506
- "skill": "/documentation — runs after /ralph-loop"
507
- }
508
- ```
509
-
510
- This feeds directly into handoff step-05a category `documentation` in `filesToCreate`.
448
+ | Condition | Questionnaire |
449
+ |-----------|---------------|
450
+ | Security or compliance mentioned | `questionnaire/03-data-ui.md` (security section) |
451
+ | External system integration | `questionnaire/05-cross-module.md` (integration section) |
452
+ | Performance requirements | Additional probing on non-functional needs |
453
+ | Technical constraints | Additional probing on platform constraints |
511
454
 
512
455
  ---
513
456
 
@@ -520,7 +463,7 @@ This feeds directly into handoff step-05a category `documentation` in `filesToCr
520
463
 
521
464
  **Process:**
522
465
 
523
- 1. Load: `patterns/suggestion-catalog.md`
466
+ 1. Load pattern guidance from `_shared.md`
524
467
  2. Match suggestion patterns against the project context (domain, modules, features)
525
468
  3. Add implicit needs for this type of system that weren't mentioned
526
469
 
@@ -559,21 +502,6 @@ options:
559
502
 
560
503
  6. Accepted suggestions enrich `coverageMatrix` and `globalScope`.
561
504
 
562
- ### 5b. Cross-Application Shared Module Detection (PROJECT MODE ONLY)
563
-
564
- > **When `workflow_mode = "project"`, analyze candidate applications for shared modules.**
565
- > A module that appears in 2+ applications should be extracted as a dedicated transversal application.
566
-
567
- **This section is SKIPPED if `workflow_mode !== "project"`.**
568
-
569
- **Reference:** Load `references/cadrage-shared-modules.md` for detection algorithm, extraction logic, and question template.
570
-
571
- The detection process:
572
- 1. Build module inventory per candidate application
573
- 2. Detect modules appearing in 2+ applications
574
- 3. Propose extraction to user with the template from the reference
575
- 4. IF "Yes" → Extract and update `candidate_applications` in the project feature.json
576
-
577
505
  ---
578
506
 
579
507
  ## PHASE 5: PERIMETRE (Bound Scope)
@@ -608,9 +536,6 @@ options:
608
536
  description: "{language == 'fr' ? 'Modifier le nombre ou les permissions des rôles' : 'Modify number or permissions of roles'}"
609
537
  ```
610
538
 
611
- IF single-module mode:
612
- Same role definition but inferred from stakeholders
613
-
614
539
  ### 6b. Table Prefix Definition (MANDATORY)
615
540
 
616
541
  > **Every business application MUST define a table prefix.**
@@ -652,8 +577,6 @@ options:
652
577
 
653
578
  ### 7. Coverage Matrix with Sections & Resources (MANDATORY)
654
579
 
655
- > **Reference:** Load `references/cadrage-coverage-matrix.md` for complete coverage matrix building and validation rules.
656
-
657
580
  **ENRICHMENT:** The coverage matrix now includes anticipated sections (Level 4) and resources (Level 5).
658
581
  This gives downstream steps (step-02, step-03) a concrete starting point.
659
582
 
@@ -699,49 +622,36 @@ BEFORE transitioning to step-02:
699
622
 
700
623
  7. Iterate until the client confirms
701
624
 
702
- **The reference file includes:**
703
- - Section rule clarification (list, detail, create, edit, dashboard, etc.)
704
- - Priority distribution POST-CHECK (BLOCKING)
705
- - Cross-cutting coverage POST-CHECK (WARNING)
706
-
707
625
  ---
708
626
 
709
627
  ## WRITE & SUMMARY
710
628
 
711
629
  ### 8. Write Cadrage to Feature.json
712
630
 
713
- Use ba-writer to enrich master feature.json. **Follow the STRUCTURE CARDS exactly.**
714
-
715
- See [references/cadrage-structure-cards.md](../references/cadrage-structure-cards.md) for exact JSON formats of: `stakeholders[]`, `applicationRoles[]`, `risks[]`, `acceptanceCriteria[]`, `coverageMatrix[]`, `codebaseContext`.
631
+ Use ba-writer with granular JSON approach. Write to `cadrage.json` section:
716
632
 
717
633
  ```
718
- ba-writer.enrichSection({
719
- featureId: {feature_id},
720
- section: "metadata",
721
- data: {
722
- tablePrefix: "{from Phase 5, section 6b — validated prefix, e.g., rh_}"
723
- }
724
- })
725
-
726
634
  ba-writer.enrichSection({
727
635
  featureId: {feature_id},
728
636
  section: "cadrage",
637
+ subsection: "cadrage.json",
729
638
  data: {
639
+ metadata: {
640
+ tablePrefix: "{from Phase 5, section 6b — validated prefix, e.g., rh_}"
641
+ },
730
642
  problem: {from Phase 3, section 4a — Q1.1 answer or refined problem},
731
643
  asIs: {from Phase 3, section 4a — Q1.4 answer},
732
644
  toBe: {from Phase 3, section 4a — Q1.8 answer},
733
- trigger: {from Phase 3, section 4a — Q1.11 answer},
734
- stakeholders: [{from Phase 3, section 4b — use STRUCTURE CARD format}],
645
+ stakeholders: [{from Phase 3, section 4b}],
735
646
  globalScope: {
736
647
  mustHave: [{from Phase 3, section 4c + Phase 4 accepted suggestions}],
737
648
  shouldHave: [{from coverage matrix}],
738
649
  couldHave: [{from coverage matrix}],
739
- outOfScope: [{from Phase 3, section 4c — Q3.4 exclusions}]
650
+ outOfScope: [{from Phase 3, section 4c — Q2.15 exclusions}]
740
651
  },
741
- applicationRoles: [{from Phase 5, section 6 — use STRUCTURE CARD format}],
742
- risks: [{from Phase 3, section 4e — use STRUCTURE CARD format}],
743
- acceptanceCriteria: [{from Phase 3, section 4euse STRUCTURE CARD format}],
744
- coverageMatrix: [{from Phase 5, section 7 — use STRUCTURE CARD format with anticipatedSections and anticipatedResources}],
652
+ applicationRoles: [{from Phase 5, section 6}],
653
+ errorFlows: [{from Phase 3, section 4c}],
654
+ coverageMatrix: [{from Phase 5, section 7with anticipatedSections and anticipatedResources}],
745
655
  codebaseContext: "{string summary of codebase findings}"
746
656
  }
747
657
  })
@@ -749,82 +659,7 @@ ba-writer.enrichSection({
749
659
  ba-writer.updateStatus({feature_id}, "framed")
750
660
  ```
751
661
 
752
- ### 9. Multi-Application Detection
753
-
754
- > **Analyze whether the project spans multiple independent applications.**
755
- > **SKIP this section entirely if `workflow_mode = "project"`** — multi-app was already detected in step-00
756
- > and cross-app analysis was done in section 5b above.
757
-
758
- **IF `workflow_mode === "project"`:**
759
- → SKIP section 9 entirely. Candidate applications are already identified and enriched.
760
- → Write cadrage data to project-level feature.json:
761
- ```
762
- ba-writer.enrichSection({
763
- projectId: {project_id},
764
- section: "cadrage",
765
- data: {cadrage data collected in phases 1-5 above}
766
- })
767
- ```
768
- → Continue to section 10 (summary).
769
-
770
- **IF `workflow_mode === "application"` (single-app mode):**
771
-
772
- After coverage matrix is validated, check if the identified functional domains suggest multiple applications:
773
-
774
- **Detection triggers (ANY of these = suggest multi-app):**
775
- - Coverage matrix entries reference different application scopes (administration, support, myspace, etc.)
776
- - User mentioned "multiple applications", "several apps", "cross-platform"
777
- - Functional domains form clearly independent applications with separate user bases
778
- - Stakeholders only interact with specific domains (not shared across all)
779
-
780
- **IF detection triggers matched:**
781
-
782
- Display analysis as markdown:
783
- ```
784
- {language == "fr"
785
- ? "### Analyse multi-application\n\nD'après mon analyse, ce projet couvre plusieurs domaines fonctionnels qui pourraient former des applications indépendantes :\n\n"
786
- : "### Multi-Application Analysis\n\nBased on my analysis, this project spans multiple functional domains that could form independent applications:\n\n"}
787
-
788
- | Domain | Suggested Application | Key Modules |
789
- |--------|----------------------|-------------|
790
- {for each identified domain: domain name | PascalCase name | top modules}
791
- ```
792
-
793
- Ask via AskUserQuestion:
794
- ```
795
- question: "{language == 'fr' ? 'Ce projet constitue-t-il une seule application ou plusieurs applications distinctes ?' : 'Is this a single application or multiple independent applications?'}"
796
- header: "Architecture"
797
- options:
798
- - label: "{language == 'fr' ? 'Application unique' : 'Single application'}"
799
- description: "{language == 'fr' ? 'Tous les domaines forment une seule application avec plusieurs modules' : 'All domains form one application with multiple modules'}"
800
- - label: "{language == 'fr' ? 'Applications multiples' : 'Multiple applications'}"
801
- 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)'}"
802
- ```
803
-
804
- **IF "Multiple applications":**
805
- 1. Create project-level feature.json:
806
- ```
807
- ba-writer.createProjectFeature({
808
- metadata: {
809
- projectName: {project_name derived from feature_description},
810
- language: {language},
811
- featureDescription: {feature_description},
812
- candidateApplications: [{detected candidates}]
813
- },
814
- cadrage: {cadrage data already collected in this step}
815
- })
816
- ```
817
- 2. Set `workflow_mode = "project"` and `project_id = PROJ-NNN`
818
- 3. Load `questionnaire/00b-project.md` for additional project-level questions
819
- 4. Continue to section 10 and then step-01b
820
-
821
- **IF "Single application":**
822
- → Continue to step 10 (display summary) and step-02 as usual.
823
-
824
- **IF no detection triggers matched:**
825
- → Skip this section entirely — continue to step 10 (display summary).
826
-
827
- ### 10. Display Summary
662
+ ### 9. Display Summary
828
663
 
829
664
  ```
830
665
  ## Cadrage Complete - {feature_id}
@@ -834,7 +669,6 @@ ba-writer.createProjectFeature({
834
669
  | Stakeholders | {count} |
835
670
  | Must-have scope items | {count} |
836
671
  | Application roles | {count} |
837
- | Risks identified | {count} |
838
672
  | Suggestions accepted | {count} |
839
673
  | Anticipated sections | {total across all modules} |
840
674
 
@@ -845,13 +679,13 @@ ba-writer.createProjectFeature({
845
679
  {top 3-5 must-have items with their anticipated sections}
846
680
 
847
681
  ### Next Step
848
- → Module decomposition (step-02-decomposition.md)
682
+ → Module structure analysis (step-02-structure.md)
849
683
  ```
850
684
 
851
685
  ---
852
686
 
853
687
  ## NEXT STEP
854
688
 
855
- Load: `./step-01b-applications.md`
689
+ Load: `./step-02-structure.md`
856
690
 
857
- > step-01b handles both single-app (lightweight identity confirmation) and multi-app (full application decomposition).
691
+ > 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