@atlashub/smartstack-cli 3.37.0 → 3.39.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 (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
@@ -73,9 +73,8 @@ Reference their entities for FK relationships:
73
73
  ## Project Context
74
74
 
75
75
  - Language: {language}
76
- - Context: business
77
76
  - Docs directory: {docsDir}
78
- - Master feature.json: docs/business/{appName}/business-analyse/v{version}/feature.json
77
+ - Master feature.json: docs/{appName}/business-analyse/v{version}/feature.json
79
78
 
80
79
  ## Execution Steps
81
80
 
@@ -351,7 +350,7 @@ NEVER use bare IDs (UC-001, BR-VAL-001) — always prefixed.
351
350
  - [ ] All sections have at least 1 resource
352
351
  - [ ] All sections have a wireframe (+ create/edit wireframes for data-centric sections)
353
352
  - [ ] seedDataCore has all 7 arrays with content
354
- - [ ] Permissions follow {context}.{app}.{module}.{entity}.{action} pattern
353
+ - [ ] Permissions follow {app}.{module}.{entity}.{action} pattern
355
354
  - [ ] i18n has all keys in **4 languages (fr, en, it, de)** — not just fr/en
356
355
  - [ ] At least 2 actors, 2 use cases, 4 functional requirements
357
356
  - [ ] Gherkin scenarios are arrays (not objects)
@@ -0,0 +1,190 @@
1
+ # Semantic Validation Checks for Analysis
2
+
3
+ Complete reference for step-04b semantic validation, permission coherence, and complexity assessment.
4
+
5
+ ## Semantic Validation Checks (13 checks total)
6
+
7
+ Execute for EACH module feature.json:
8
+
9
+ | # | Check | Rule | Severity |
10
+ |---|-------|------|----------|
11
+ | 1 | Permission orpheline | Every permissionMatrix.permissions[].path is used by at least one useCases[].permission | WARNING |
12
+ | 2 | UC sans FR | Every useCases[].id is referenced by at least one functionalRequirements[].linkedUseCases[] | WARNING |
13
+ | 3 | Entity sans endpoint | Every entities[].name has at least one endpoint in apiEndpoints[] | WARNING |
14
+ | 4 | UC sans scenario | Every useCases[].mainScenario has at least 2 steps | WARNING |
15
+ | 5 | Role sans permissions | Every applicationRole has at least one entry in roleAssignments[] | WARNING |
16
+ | 6 | Navigation sans traduction | Every navigation.entries[].code has translations in 4 languages in seedDataCore.navigationTranslations[] | ERROR |
17
+ | 7 | LifeCycle terminal | Every lifeCycles[].states[] has at least one state with isTerminal: true | WARNING |
18
+ | 8 | Schema conformity | No custom fields outside defined schema (no KPIDefinitions, ChartConfigurations, etc.) | ERROR |
19
+ | 9 | Wireframe coverage | Every navigation section has a corresponding uiWireframes[].screen | ERROR |
20
+ | 10 | Doublon entity | No entity with same name in two different modules (unless shared via dependencyGraph) | ERROR |
21
+ | 11 | Permission fantome | Every action used in applicationRoles pattern (read, create, update, delete, assign, export, approve) MUST exist as a permission path in permissionMatrix.permissions[].action for at least one module | ERROR |
22
+ | 12 | Dashboard coverage | If cadrage mentions dashboard for a module OR navigation includes "dashboard" section, then specification.dashboards[] MUST NOT be empty | WARNING |
23
+ | 13 | Permission-UC alignment | Every permission.action (except "read" and wildcard "*") MUST have at least one UC where that permission is referenced in useCases[].permission | WARNING |
24
+
25
+ ## Result Storage Format
26
+
27
+ ```json
28
+ {
29
+ "check": "permission-orpheline",
30
+ "module": "RepairManagement",
31
+ "status": "PASS|WARNING|ERROR",
32
+ "details": "Permission freebike.repairmanagement.export not referenced by any UC",
33
+ "autoFixed": false
34
+ }
35
+ ```
36
+
37
+ ## Blocking Rules
38
+
39
+ - 0 ERROR → PASS
40
+ - ≥1 ERROR → BLOCK (fix before handoff, ask user for each)
41
+ - WARNING only → PASS with user notification
42
+
43
+ ## Complexity Calculation
44
+
45
+ For each module in feature.json.modules[], calculate:
46
+
47
+ ```json
48
+ {
49
+ "complexity": "simple|medium|complex",
50
+ "complexityDetails": {
51
+ "entities": {count},
52
+ "useCases": {count},
53
+ "businessRules": {count},
54
+ "calculated": "{level} (≤X entities, ≤Y UCs, ≤Z BRs)"
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Criteria
60
+
61
+ | Criteria | Simple | Medium | Complex |
62
+ |----------|--------|--------|---------|
63
+ | Entities | ≤3 | ≤6 | >6 |
64
+ | Use Cases | ≤5 | ≤12 | >12 |
65
+ | Business Rules | ≤10 | ≤20 | >20 |
66
+
67
+ **Global complexity** = highest complexity across all modules.
68
+
69
+ ## Permission Coherence Checks
70
+
71
+ ### 3a. Role Consistency
72
+
73
+ Verify all modules use the applicationRoles defined in cadrage:
74
+ ```
75
+ FOR each module in completedModules:
76
+ FOR each role in module.specification.permissionMatrix.roles:
77
+ IF role NOT IN cadrage.applicationRoles → ERROR
78
+ ```
79
+
80
+ ### 3b. Permission Path Format
81
+
82
+ Verify all permission paths follow one of these patterns:
83
+ - Module-level: `{app}.{module}.{action}` (3 segments)
84
+ - Section-level: `{app}.{module}.{section}.{action}` (4 segments)
85
+
86
+ Check for:
87
+ - Inconsistent app prefix → ERROR
88
+ - Missing module segment → ERROR
89
+ - Fewer than 3 segments (shortcut paths) → ERROR
90
+ - More than 4 segments → ERROR
91
+
92
+ ### 3c. Role Hierarchy Coherence
93
+
94
+ Verify the role hierarchy is respected across all modules:
95
+ ```
96
+ Admin ⊃ Manager ⊃ Contributor ⊃ Viewer
97
+
98
+ FOR each module:
99
+ IF Admin has fewer permissions than Manager → ERROR
100
+ IF Manager has fewer permissions than Contributor → ERROR
101
+ IF Contributor has fewer permissions than Viewer → ERROR
102
+ ```
103
+
104
+ ### 3d. Permission Conflicts
105
+
106
+ Detect conflicting permission assignments:
107
+ ```json
108
+ {
109
+ "conflicts": [
110
+ {
111
+ "role": "Manager",
112
+ "module1": "Orders",
113
+ "permission1": "sales.orders.approve",
114
+ "module2": "Invoices",
115
+ "permission2": "sales.invoices.approve",
116
+ "issue": "Manager can approve orders but not invoices - is this intentional?"
117
+ }
118
+ ]
119
+ }
120
+ ```
121
+
122
+ ### 3e. Permission-Role Coherence Across Modules (WARNING)
123
+
124
+ For each role defined in `cadrage.applicationRoles`, verify the permission PATTERN is consistent across ALL modules:
125
+
126
+ ```javascript
127
+ // Build role-to-actions matrix per module
128
+ const roleActions = {};
129
+ for (const module of completedModules) {
130
+ const pm = module.specification.permissionMatrix;
131
+ for (const ra of pm.roleAssignments || []) {
132
+ const key = ra.role;
133
+ if (!roleActions[key]) roleActions[key] = {};
134
+ roleActions[key][module.code] = ra.permissions.map(p => p.split('.').pop()); // extract action
135
+ }
136
+ }
137
+
138
+ // Detect inconsistencies: role has action X in module A but not in module B
139
+ for (const [role, modules] of Object.entries(roleActions)) {
140
+ const allActions = new Set(Object.values(modules).flat());
141
+ for (const [mod, actions] of Object.entries(modules)) {
142
+ for (const action of allActions) {
143
+ if (!actions.includes(action)) {
144
+ // Role has this action in other modules but NOT in this one
145
+ const otherMods = Object.entries(modules).filter(([m, a]) => a.includes(action)).map(([m]) => m);
146
+ console.warn(`WARNING: permission-role-coherence: ${role} has "${action}" in [${otherMods.join(', ')}] but NOT in ${mod}`);
147
+ }
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ Store as semantic check with severity WARNING (not ERROR — some permission differences may be intentional).
154
+
155
+ ## Global Risk Assessment Metrics
156
+
157
+ | Risk | Metric | Threshold | Status |
158
+ |------|--------|-----------|--------|
159
+ | Total entities | {sum across modules} | ≤20 | PASS/WARNING |
160
+ | Total BRs | {sum across modules} | ≤50 | PASS/WARNING |
161
+ | Cross-module dependencies | {edge count} | ≤10 | PASS/WARNING |
162
+ | Shared entities | {count} | ≤5 | PASS/WARNING |
163
+ | E2E flow length | {max steps} | ≤8 | PASS/WARNING |
164
+ | Permission paths | {total} | ≤100 | PASS/WARNING |
165
+
166
+ ## E2E Flow Template
167
+
168
+ ```json
169
+ {
170
+ "name": "Order to Invoice",
171
+ "steps": [
172
+ { "module": "Customers", "action": "Customer exists", "permission": "customers.read" },
173
+ { "module": "Products", "action": "Products selected", "permission": "products.read" },
174
+ { "module": "Orders", "action": "Order created", "permission": "orders.create" },
175
+ { "module": "Orders", "action": "Order approved", "permission": "orders.approve" },
176
+ { "module": "Invoices", "action": "Invoice generated", "permission": "invoices.create" },
177
+ { "module": "Invoices", "action": "Invoice sent", "permission": "invoices.update" }
178
+ ],
179
+ "actors": ["Contributor (create)", "Manager (approve)"],
180
+ "data": "Customer → Order → OrderLines (Products) → Invoice → InvoiceLines"
181
+ }
182
+ ```
183
+
184
+ ## Single-Module Mode Simplifications
185
+
186
+ When only 1 module:
187
+ 1. Skip permission coherence check (only one module)
188
+ 2. Skip E2E flows (single module)
189
+ 3. Execute semantic validation (still required)
190
+ 4. Auto-approve global risks (no cross-module complexity)
@@ -47,7 +47,7 @@ Cache creation input tokens: 857 (0.8% of total)
47
47
 
48
48
  **Files:**
49
49
  ```
50
- docs/business/{app}/business-analyse/schemas/
50
+ docs/{app}/business-analyse/schemas/
51
51
  ├── feature-schema.json (~8KB)
52
52
  ├── application-schema.json (~6KB)
53
53
  ├── sections/
@@ -76,7 +76,7 @@ Total: ~42KB, 9 files
76
76
  **Implementation:**
77
77
  ```javascript
78
78
  // Step-00 initialization
79
- const schemaFiles = glob("docs/business/{app}/business-analyse/schemas/**/*.json");
79
+ const schemaFiles = glob("docs/{app}/business-analyse/schemas/**/*.json");
80
80
  for (const file of schemaFiles) {
81
81
  read(file); // Pre-load into cache
82
82
  }
@@ -0,0 +1,41 @@
1
+ # Cadrage Challenge Patterns
2
+
3
+ Reference material for identifying and challenging implicit assumptions in business requirements analysis.
4
+
5
+ ## Challenge Question Examples by Domain Pattern
6
+
7
+ | Brief statement | Implicit assumption | Challenge question |
8
+ |----------------|--------------------|--------------------|
9
+ | "Entities are 1:1 extensions of X" | Cardinality is always 1:1 | "Can a user be linked to multiple employee records (temp contracts, part-time multi-position)? Can an employee NOT have a user account?" |
10
+ | "Entry split into activity and absence" | Binary decomposition is sufficient | "What granularity? Day, half-day, hour? Are activities linked to projects or clients? Are there other entry types (training, travel, on-call)?" |
11
+ | "A reports section" | Reports are a simple addition | "Which reports exactly? For whom? How often? PDF/Excel export? Real-time dashboards? Aggregated or detailed?" |
12
+ | "Module X manages Y" | The scope of "manages" is clear | "What does 'manage' mean concretely? Create, read, update, delete? Approve? Archive? Import/export?" |
13
+
14
+ ## Elicitation Techniques
15
+
16
+ **Technique 3 (Concrete Scenario):** "Walk me through a typical day of [role] using this module"
17
+
18
+ **Technique 4 (Absence Test):** "If [feature] didn't exist, how would you handle it?"
19
+
20
+ **Technique 8 (Impact Escalation):** "With 50 records this works, but with 500? 5000? Does the process stay the same?"
21
+
22
+ ## MoSCoW Prioritization Template
23
+
24
+ When client classifies ALL features as "must-have", apply this blocking challenge:
25
+
26
+ ```
27
+ question: "{language == 'fr'
28
+ ? 'Toutes les fonctionnalités sont marquées indispensables. Si vous ne pouviez livrer que 60% du périmètre en v1, lesquelles pourraient attendre la v2 ?'
29
+ : 'All features are marked must-have. If you could only deliver 60% of scope in v1, which ones could wait for v2?'}"
30
+ header: "Priorisation"
31
+ multiSelect: true
32
+ options:
33
+ - label: "{feature_1}"
34
+ description: "{language == 'fr' ? 'Pourrait passer en Important (v1.x)' : 'Could move to Important (v1.x)'}"
35
+ - label: "{feature_2}"
36
+ description: "{language == 'fr' ? 'Pourrait passer en Optionnel (v2)' : 'Could move to Optional (v2)'}"
37
+ - label: "{language == 'fr' ? 'Tout est vraiment indispensable' : 'Everything is truly must-have'}"
38
+ description: "{language == 'fr' ? 'Je confirme que toutes les fonctionnalités sont critiques pour la v1' : 'I confirm all features are critical for v1'}"
39
+ ```
40
+
41
+ If client moves items → update categories. If client confirms ALL mustHave → accept but log in changelog.
@@ -0,0 +1,74 @@
1
+ # Coverage Matrix with Sections & Resources
2
+
3
+ Reference for building and validating the coverage matrix that maps requirements to modules, sections, and resources.
4
+
5
+ ## Section Rule (CRITICAL)
6
+
7
+ Sections are functional zones (list, dashboard, approve, import, rapport...).
8
+ - `create` and `edit` are SEPARATE PAGES with their own URL routes (`/create` and `/:id/edit`)
9
+ - `detail` is a page with tabs accessible by clicking a row in `list`, NOT a standalone section
10
+
11
+ ## Coverage Matrix Template
12
+
13
+ Print a markdown table with columns: **Fonctionnalité | Priorité | Module | Section | Resources clés | Onglets détail**
14
+
15
+ ### Example
16
+
17
+ ```
18
+ | Fonctionnalité | Priorité | Module | Section | Resources clés | Onglets détail |
19
+ |---|---|---|---|---|---|
20
+ | Gestion des employés | mustHave | Employees | list | employee-grid, employee-filters, employee-form | Infos, Contrats, Documents |
21
+ | Suivi des activités | mustHave | TimeTracking | list | activity-grid, activity-filters, activity-form | Infos, Imputations |
22
+ | Saisie d'absences | mustHave | TimeTracking | list | absence-grid, absence-form, absence-calendar | Infos, Justificatifs |
23
+ | Rapports temps | shouldHave | TimeTracking | dashboard | time-kpi-cards, time-summary-chart | — |
24
+ | Validation absences | shouldHave | TimeTracking | approve | approval-queue, status-timeline | — |
25
+ | Export PDF/Excel | couldHave | TimeTracking | rapport | export-panel | — |
26
+ | Intégration paie | outOfScope | — | — | — | — |
27
+ ```
28
+
29
+ ## Priority Distribution POST-CHECK (BLOCKING)
30
+
31
+ ```javascript
32
+ coverageItems = cadrage.coverageMatrix[]
33
+ mustHaveCount = coverageItems.filter(i => i.category === "mustHave").length
34
+ shouldHaveCount = coverageItems.filter(i => i.category === "shouldHave").length
35
+ couldHaveCount = coverageItems.filter(i => i.category === "couldHave").length
36
+ outOfScopeCount = coverageItems.filter(i => i.category === "outOfScope").length
37
+
38
+ IF shouldHaveCount === 0 AND couldHaveCount === 0 AND outOfScopeCount === 0:
39
+ → FAIL: ALL {mustHaveCount} items are mustHave — no distribution.
40
+ → ACTION: Return to Phase 3 section 4c and apply MoSCoW question.
41
+ → DO NOT write cadrage until at least shouldHave OR outOfScope has ≥ 1 item.
42
+ → EXCEPTION: If client explicitly confirmed "tout est indispensable" during
43
+ Phase 3 section 4c, accept but ADD a changelog entry:
44
+ "Client confirmed all {N} features as mustHave after MoSCoW challenge"
45
+ ```
46
+
47
+ ## Cross-Cutting Coverage POST-CHECK (WARNING)
48
+
49
+ ```javascript
50
+ FOR each item in coverageMatrix WHERE item.module === null:
51
+ IF item.category === "mustHave":
52
+ → WARNING: "{item.item}" is mustHave but has no assigned module.
53
+ → Ensure it is covered by infrastructure or a cross-cutting concern.
54
+ → Add a note explaining HOW it will be implemented (e.g., "handled by platform notification service").
55
+ IF item.anticipatedSections.length === 0 AND item.category !== "outOfScope":
56
+ → WARNING: "{item.item}" has no anticipated sections — will it be implemented?
57
+ ```
58
+
59
+ ## Building Coverage Matrix from Feature Analysis
60
+
61
+ For EACH distinct feature/requirement identified during phases 2-4:
62
+
63
+ 1. Create an entry in `cadrage.coverageMatrix[]`
64
+ 2. Assign it to mustHave, shouldHave, couldHave, or outOfScope
65
+ 3. Assign the module that will cover it (or null if cross-cutting)
66
+ 4. **List anticipated sections** (Level 4) — ONLY functional zones
67
+ 5. **List anticipated resources** (Level 5) for each section
68
+ 6. **List detail page tabs** — for entities accessible via click from `list`
69
+
70
+ ### Validation
71
+
72
+ - Every line of the original prompt must map to at least one coverageMatrix entry.
73
+ - If a feature is in mustHave → it MUST have at least one anticipated section.
74
+ - Accepted suggestions from Phase 4 must appear in the matrix.
@@ -0,0 +1,69 @@
1
+ # Cross-Application Shared Module Detection
2
+
3
+ Reference for detecting and extracting shared modules when `workflow_mode = "project"`.
4
+
5
+ ## Detection Algorithm
6
+
7
+ Build module inventory per candidate application:
8
+
9
+ ```javascript
10
+ // From candidateApplications (step-00) + enriched by cadrage phases 1-4
11
+ const modulesByApp = {};
12
+ for (const app of candidate_applications) {
13
+ modulesByApp[app.name] = app.modules; // e.g., { "RH": ["Employes", "Conges", "Temps"], "Projet": ["Projets", "Temps"] }
14
+ }
15
+ ```
16
+
17
+ Detect modules appearing in 2+ applications:
18
+
19
+ ```javascript
20
+ const allModules = Object.values(modulesByApp).flat();
21
+ const moduleCounts = {};
22
+ for (const mod of allModules) {
23
+ const normalized = normalizeModuleName(mod); // "Temps", "Saisie du temps", "Time Tracking" → same concept
24
+ moduleCounts[normalized] = (moduleCounts[normalized] || 0) + 1;
25
+ }
26
+ const sharedModules = Object.entries(moduleCounts)
27
+ .filter(([_, count]) => count >= 2)
28
+ .map(([name, count]) => ({ name, appearsIn: count, applications: findAppsContaining(name) }));
29
+ ```
30
+
31
+ ## Extraction Logic
32
+
33
+ If shared modules found, propose extraction:
34
+
35
+ ```javascript
36
+ for (const shared of sharedModules) {
37
+ // Create new candidate application
38
+ candidate_applications.push({
39
+ name: shared.name,
40
+ description: `Application transversale pour ${shared.name}`,
41
+ modules: [shared.name],
42
+ context: "business",
43
+ isTransversal: true,
44
+ consumedBy: shared.applications
45
+ });
46
+
47
+ // Remove the shared module from original applications
48
+ for (const appName of shared.applications) {
49
+ const app = candidate_applications.find(a => a.name === appName);
50
+ app.modules = app.modules.filter(m => normalizeModuleName(m) !== shared.name);
51
+ app.dependencies = app.dependencies || [];
52
+ app.dependencies.push({ target: shared.name, type: "data-dependency" });
53
+ }
54
+ }
55
+ ```
56
+
57
+ Update `candidate_applications` in the project feature.json.
58
+
59
+ ## Question Template
60
+
61
+ ```
62
+ question: "{language == 'fr' ? 'Souhaitez-vous extraire les modules partagés en application(s) dédiée(s) ?' : 'Do you want to extract shared modules as dedicated application(s)?'}"
63
+ header: "Extraction"
64
+ options:
65
+ - label: "{language == 'fr' ? 'Oui, extraire' : 'Yes, extract'}"
66
+ description: "{language == 'fr' ? 'Créer {sharedModules.length} application(s) transversale(s) supplémentaire(s)' : 'Create {sharedModules.length} additional cross-cutting application(s)'}"
67
+ - label: "{language == 'fr' ? 'Non, garder en l\'état' : 'No, keep as-is'}"
68
+ description: "{language == 'fr' ? 'Chaque application garde sa propre version du module' : 'Each application keeps its own version of the module'}"
69
+ ```
@@ -25,7 +25,7 @@
25
25
  "role": "{App} Admin",
26
26
  "description": "Full access to all modules",
27
27
  "level": "admin",
28
- "permissionPattern": "business.{app}.*"
28
+ "permissionPattern": "{app}.*"
29
29
  }
30
30
  ```
31
31
  **MANDATORY fields:** `role`, `level`, `permissionPattern`