@atlashub/smartstack-cli 1.5.1 → 1.5.2

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 (147) hide show
  1. package/.documentation/css/styles.css +2168 -2168
  2. package/.documentation/js/app.js +794 -794
  3. package/config/default-config.json +86 -86
  4. package/config/settings.json +53 -53
  5. package/config/settings.local.example.json +16 -16
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -1
  8. package/package.json +88 -88
  9. package/templates/agents/action.md +36 -36
  10. package/templates/agents/efcore/conflicts.md +84 -84
  11. package/templates/agents/efcore/db-deploy.md +51 -51
  12. package/templates/agents/efcore/db-reset.md +59 -59
  13. package/templates/agents/efcore/db-seed.md +56 -56
  14. package/templates/agents/efcore/db-status.md +64 -64
  15. package/templates/agents/efcore/migration.md +85 -85
  16. package/templates/agents/efcore/rebase-snapshot.md +62 -62
  17. package/templates/agents/efcore/scan.md +90 -90
  18. package/templates/agents/efcore/squash.md +67 -67
  19. package/templates/agents/explore-codebase.md +65 -65
  20. package/templates/agents/explore-docs.md +97 -97
  21. package/templates/agents/fix-grammar.md +49 -49
  22. package/templates/agents/gitflow/abort.md +45 -45
  23. package/templates/agents/gitflow/cleanup.md +85 -85
  24. package/templates/agents/gitflow/commit.md +40 -40
  25. package/templates/agents/gitflow/exec.md +48 -48
  26. package/templates/agents/gitflow/finish.md +92 -92
  27. package/templates/agents/gitflow/init.md +139 -139
  28. package/templates/agents/gitflow/merge.md +62 -62
  29. package/templates/agents/gitflow/plan.md +42 -42
  30. package/templates/agents/gitflow/pr.md +78 -78
  31. package/templates/agents/gitflow/review.md +49 -49
  32. package/templates/agents/gitflow/start.md +61 -61
  33. package/templates/agents/gitflow/status.md +32 -32
  34. package/templates/agents/snipper.md +36 -36
  35. package/templates/agents/websearch.md +46 -46
  36. package/templates/commands/_resources/formatting-guide.md +124 -124
  37. package/templates/commands/ai-prompt.md +315 -315
  38. package/templates/commands/apex/1-analyze.md +100 -100
  39. package/templates/commands/apex/2-plan.md +145 -145
  40. package/templates/commands/apex/3-execute.md +171 -171
  41. package/templates/commands/apex/4-examine.md +116 -116
  42. package/templates/commands/apex/5-tasks.md +209 -209
  43. package/templates/commands/apex.md +76 -76
  44. package/templates/commands/application/create.md +362 -362
  45. package/templates/commands/application/templates-backend.md +463 -463
  46. package/templates/commands/application/templates-frontend.md +517 -517
  47. package/templates/commands/application/templates-i18n.md +478 -478
  48. package/templates/commands/application/templates-seed.md +362 -362
  49. package/templates/commands/application.md +303 -303
  50. package/templates/commands/business-analyse/0-orchestrate.md +640 -640
  51. package/templates/commands/business-analyse/1-init.md +269 -269
  52. package/templates/commands/business-analyse/2-discover.md +520 -520
  53. package/templates/commands/business-analyse/3-analyse.md +408 -408
  54. package/templates/commands/business-analyse/4-specify.md +598 -598
  55. package/templates/commands/business-analyse/5-validate.md +326 -326
  56. package/templates/commands/business-analyse/6-handoff.md +746 -746
  57. package/templates/commands/business-analyse/7-doc-html.md +602 -602
  58. package/templates/commands/business-analyse/bug.md +325 -325
  59. package/templates/commands/business-analyse/change-request.md +368 -368
  60. package/templates/commands/business-analyse/hotfix.md +200 -200
  61. package/templates/commands/business-analyse.md +640 -640
  62. package/templates/commands/controller/create.md +216 -216
  63. package/templates/commands/controller/postman-templates.md +528 -528
  64. package/templates/commands/controller/templates.md +600 -600
  65. package/templates/commands/controller.md +337 -337
  66. package/templates/commands/create/agent.md +138 -138
  67. package/templates/commands/create/command.md +166 -166
  68. package/templates/commands/create/hook.md +234 -234
  69. package/templates/commands/create/plugin.md +329 -329
  70. package/templates/commands/create/project.md +507 -507
  71. package/templates/commands/create/skill.md +199 -199
  72. package/templates/commands/create.md +220 -220
  73. package/templates/commands/debug.md +95 -95
  74. package/templates/commands/documentation/module.md +202 -202
  75. package/templates/commands/documentation/templates.md +432 -432
  76. package/templates/commands/documentation.md +190 -190
  77. package/templates/commands/efcore/_env-check.md +153 -153
  78. package/templates/commands/efcore/conflicts.md +186 -186
  79. package/templates/commands/efcore/db-deploy.md +193 -193
  80. package/templates/commands/efcore/db-reset.md +426 -426
  81. package/templates/commands/efcore/db-seed.md +326 -326
  82. package/templates/commands/efcore/db-status.md +226 -226
  83. package/templates/commands/efcore/migration.md +400 -400
  84. package/templates/commands/efcore/rebase-snapshot.md +264 -264
  85. package/templates/commands/efcore/scan.md +198 -198
  86. package/templates/commands/efcore/squash.md +298 -298
  87. package/templates/commands/efcore.md +224 -224
  88. package/templates/commands/epct.md +69 -69
  89. package/templates/commands/explain.md +186 -186
  90. package/templates/commands/explore.md +45 -45
  91. package/templates/commands/feature-full.md +267 -267
  92. package/templates/commands/gitflow/1-init.md +1038 -1038
  93. package/templates/commands/gitflow/10-start.md +768 -768
  94. package/templates/commands/gitflow/11-finish.md +457 -457
  95. package/templates/commands/gitflow/12-cleanup.md +276 -276
  96. package/templates/commands/gitflow/13-sync.md +216 -216
  97. package/templates/commands/gitflow/14-rebase.md +251 -251
  98. package/templates/commands/gitflow/2-status.md +277 -277
  99. package/templates/commands/gitflow/3-commit.md +344 -344
  100. package/templates/commands/gitflow/4-plan.md +145 -145
  101. package/templates/commands/gitflow/5-exec.md +147 -147
  102. package/templates/commands/gitflow/6-abort.md +344 -344
  103. package/templates/commands/gitflow/7-pull-request.md +453 -355
  104. package/templates/commands/gitflow/8-review.md +240 -176
  105. package/templates/commands/gitflow/9-merge.md +451 -365
  106. package/templates/commands/gitflow.md +128 -128
  107. package/templates/commands/implement.md +663 -663
  108. package/templates/commands/init.md +567 -567
  109. package/templates/commands/mcp-integration.md +330 -330
  110. package/templates/commands/notification.md +129 -129
  111. package/templates/commands/oneshot.md +57 -57
  112. package/templates/commands/quick-search.md +72 -72
  113. package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
  114. package/templates/commands/ralph-loop/help.md +126 -126
  115. package/templates/commands/ralph-loop/ralph-loop.md +18 -18
  116. package/templates/commands/review.md +106 -106
  117. package/templates/commands/utils/test-web-config.md +160 -160
  118. package/templates/commands/utils/test-web.md +151 -151
  119. package/templates/commands/validate.md +233 -233
  120. package/templates/commands/workflow.md +193 -193
  121. package/templates/gitflow/config.json +138 -138
  122. package/templates/hooks/ef-migration-check.md +139 -139
  123. package/templates/hooks/hooks.json +25 -25
  124. package/templates/hooks/stop-hook.sh +177 -177
  125. package/templates/skills/ai-prompt/SKILL.md +778 -778
  126. package/templates/skills/application/SKILL.md +563 -563
  127. package/templates/skills/application/templates-backend.md +450 -450
  128. package/templates/skills/application/templates-frontend.md +531 -531
  129. package/templates/skills/application/templates-i18n.md +520 -520
  130. package/templates/skills/application/templates-seed.md +647 -647
  131. package/templates/skills/business-analyse/SKILL.md +191 -191
  132. package/templates/skills/business-analyse/questionnaire.md +283 -283
  133. package/templates/skills/business-analyse/templates-frd.md +477 -477
  134. package/templates/skills/business-analyse/templates-react.md +580 -580
  135. package/templates/skills/controller/SKILL.md +240 -240
  136. package/templates/skills/controller/postman-templates.md +614 -614
  137. package/templates/skills/controller/templates.md +1468 -1468
  138. package/templates/skills/documentation/SKILL.md +133 -133
  139. package/templates/skills/documentation/templates.md +476 -476
  140. package/templates/skills/feature-full/SKILL.md +838 -838
  141. package/templates/skills/notification/SKILL.md +555 -555
  142. package/templates/skills/ui-components/SKILL.md +870 -870
  143. package/templates/skills/workflow/SKILL.md +582 -582
  144. package/templates/test-web/api-health.json +38 -38
  145. package/templates/test-web/minimal.json +19 -19
  146. package/templates/test-web/npm-package.json +46 -46
  147. package/templates/test-web/seo-check.json +54 -54
@@ -1,598 +1,598 @@
1
- ---
2
- description: Phase 4 - Functional specifications FRD (ULTRATHINK)
3
- agent: ba-specify
4
- model: sonnet
5
- ---
6
-
7
- # Phase 4: Spécifications Fonctionnelles - FRD
8
-
9
- > **Modèle:** Sonnet (spécifications détaillées)
10
- > **Coût estimé:** ~$0.18
11
- > **Input:** 2-business-requirements.md
12
- > **Output:** 3-functional-specification.md (FRD)
13
-
14
- ---
15
-
16
- ## OBJECTIF
17
-
18
- ```
19
- ╔══════════════════════════════════════════════════════════════════════════════╗
20
- ║ TRANSFORMER LE BRD EN SPÉCIFICATIONS IMPLÉMENTABLES ║
21
- ╠══════════════════════════════════════════════════════════════════════════════╣
22
- ║ ║
23
- ║ Le FRD définit COMMENT le système doit se comporter: ║
24
- ║ ║
25
- ║ • Cas d'utilisation détaillés (UC-XXX) ║
26
- ║ • Exigences fonctionnelles (FR-XXX) ║
27
- ║ • Wireframes d'interface ║
28
- ║ • Permissions granulaires ║
29
- ║ • Scénarios Gherkin pour tests ║
30
- ║ ║
31
- ║ RÈGLE: Assez détaillé pour qu'un développeur puisse implémenter ║
32
- ║ sans poser de questions. ║
33
- ║ ║
34
- ╚══════════════════════════════════════════════════════════════════════════════╝
35
- ```
36
-
37
- ---
38
-
39
- ## STEP 1: Charger le BRD
40
-
41
- ```bash
42
- FEATURE_ID=$1
43
- FEATURE_DIR=$(find .business-analyse -type d -name "${FEATURE_ID}*" | head -1)
44
- BRD_FILE="$FEATURE_DIR/2-business-requirements.md"
45
-
46
- if [ ! -f "$BRD_FILE" ]; then
47
- echo "❌ ERREUR: 2-business-requirements.md non trouvé"
48
- echo " Lancez d'abord: /business-analyse:3-analyse $FEATURE_ID"
49
- exit 1
50
- fi
51
-
52
- # Extraire application et module
53
- APPLICATION=$(echo $FEATURE_DIR | grep -oP 'business/\K[^/]+')
54
- MODULE=$(echo $FEATURE_DIR | grep -oP 'modules/\K[^/]+')
55
- PERMISSION_BASE="business.$APPLICATION.$MODULE"
56
- ```
57
-
58
- ---
59
-
60
- ## STEP 2: Scanner les patterns UI existants
61
-
62
- ```bash
63
- # Scanner les pages existantes pour cohérence UI
64
- EXISTING_PAGES=$(find web/smartstack-web/src/pages -name "*.tsx" | head -20)
65
-
66
- # Extraire les patterns de composants utilisés
67
- COMPONENT_PATTERNS=$(grep -h "import.*from.*components" $EXISTING_PAGES 2>/dev/null | sort -u)
68
-
69
- echo "Patterns UI existants identifiés"
70
- ```
71
-
72
- ---
73
-
74
- ## STEP 3: Génération du FRD
75
-
76
- ```bash
77
- FRD_FILE="$FEATURE_DIR/3-functional-specification.md"
78
- ```
79
-
80
- ### Template 3-functional-specification.md
81
-
82
- ```markdown
83
- # FRD - {FEATURE_ID} {Feature Name}
84
-
85
- > **Module:** business/{application}/{module}
86
- > **Version:** 1.0
87
- > **Basé sur:** 2-business-requirements.md v1.0
88
- > **Permission base:** business.{application}.{module}.*
89
- > **Standard:** IEEE 830
90
-
91
- ---
92
-
93
- ## 1. Vue d'ensemble
94
-
95
- ### 1.1 Objectif fonctionnel
96
-
97
- {Description de ce que le système doit faire, du point de vue utilisateur}
98
-
99
- ### 1.2 Acteurs
100
-
101
- | Acteur | Description | Permissions requises |
102
- |--------|-------------|---------------------|
103
- | Admin | Administrateur avec tous les droits | `{module}.*` |
104
- | Manager | Gestionnaire du module | `{module}.read`, `{module}.create`, `{module}.update` |
105
- | User | Utilisateur standard | `{module}.read` |
106
- | ReadOnly | Consultation seule | `{module}.read` |
107
-
108
- ### 1.3 Préconditions globales
109
-
110
- - Utilisateur authentifié
111
- - Permission `business.{application}.{module}.read` au minimum
112
- - Module activé dans la configuration tenant
113
-
114
- ---
115
-
116
- ## 2. Cas d'utilisation
117
-
118
- ### UC-001: {Nom du cas d'utilisation principal}
119
-
120
- | Attribut | Valeur |
121
- |----------|--------|
122
- | **ID** | UC-001 |
123
- | **Nom** | {Nom descriptif} |
124
- | **Acteur principal** | {Rôle} |
125
- | **Préconditions** | {conditions requises avant exécution} |
126
- | **Postconditions** | {état du système après exécution} |
127
- | **Permission** | `business.{app}.{module}.{action}` |
128
- | **Fréquence** | {Daily/Weekly/Monthly} |
129
- | **Criticité** | {High/Medium/Low} |
130
-
131
- **Scénario principal:**
132
-
133
- | # | Acteur | Système |
134
- |---|--------|---------|
135
- | 1 | {L'utilisateur fait...} | |
136
- | 2 | | {Le système répond...} |
137
- | 3 | {L'utilisateur fait...} | |
138
- | 4 | | {Le système répond...} |
139
- | 5 | | {Le système confirme avec message} |
140
-
141
- **Scénarios alternatifs:**
142
-
143
- | # | Condition | Étapes alternatives |
144
- |---|-----------|---------------------|
145
- | 3a | {Si condition X} | 3a.1 {action}, 3a.2 {action} |
146
- | 4a | {Si condition Y} | 4a.1 {action} |
147
-
148
- **Scénarios d'erreur:**
149
-
150
- | # | Erreur | Message | Action système |
151
- |---|--------|---------|----------------|
152
- | E1 | {description erreur} | `{module}.errors.{code}` | {comportement} |
153
- | E2 | Validation échouée | `{module}.errors.validation` | Afficher erreurs |
154
- | E3 | Permission refusée | `common.errors.forbidden` | Rediriger login |
155
-
156
- ---
157
-
158
- ## 3. Exigences fonctionnelles
159
-
160
- | ID | Exigence | UC lié | BR lié | Priorité |
161
- |----|----------|--------|--------|----------|
162
- | FR-001 | Le système DOIT {action} | UC-001 | BR-001 | Must |
163
- | FR-002 | Le système DOIT {action} | UC-001 | BR-002 | Must |
164
- | FR-003 | Le système DEVRAIT {action} | UC-002 | - | Should |
165
-
166
- ### 3.1 Détail FR-001: {Nom}
167
-
168
- **Énoncé:**
169
- Le système DOIT {description précise de l'exigence fonctionnelle}
170
-
171
- **Critères d'acceptation:**
172
- - [ ] {Critère mesurable et vérifiable 1}
173
- - [ ] {Critère mesurable et vérifiable 2}
174
- - [ ] {Critère mesurable et vérifiable 3}
175
-
176
- **Règles associées:** BR-001, BR-002
177
-
178
- **Scénario de test:**
179
- ```gherkin
180
- Scenario: FR-001 - {description}
181
- Given {contexte initial}
182
- When {action utilisateur}
183
- Then {résultat attendu}
184
- And {vérification supplémentaire}
185
- ```
186
-
187
- ---
188
-
189
- ## 4. Interface utilisateur
190
-
191
- ### 4.1 Navigation
192
-
193
- **Chemin d'accès:** Business > {Application} > {Module}
194
-
195
- **URL:** `/business/{application}/{module}`
196
-
197
- ### 4.2 Wireframe - Liste principale
198
-
199
- ```
200
- ┌─────────────────────────────────────────────────────────────────────────────┐
201
- │ [Logo] Business / {App} / {Module} [User ▼] [☰] │
202
- ├─────────────────────────────────────────────────────────────────────────────┤
203
- │ │
204
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
205
- │ │ {Module Name} [+ Nouveau] │ │
206
- │ │ {Description courte du module} │ │
207
- │ └─────────────────────────────────────────────────────────────────────┘ │
208
- │ │
209
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
210
- │ │ FILTRES │ │
211
- │ │ [Statut ▼] [Date du ▼] [Date au ▼] [Recherche... ] [Filtrer] │ │
212
- │ └─────────────────────────────────────────────────────────────────────┘ │
213
- │ │
214
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
215
- │ │ TABLEAU │ │
216
- │ │ ┌────────┬────────────┬────────────┬──────────┬─────────────────┐ │ │
217
- │ │ │ □ │ {Col 1} │ {Col 2} │ {Col 3} │ Actions │ │ │
218
- │ │ ├────────┼────────────┼────────────┼──────────┼─────────────────┤ │ │
219
- │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
220
- │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
221
- │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
222
- │ │ └────────┴────────────┴────────────┴──────────┴─────────────────┘ │ │
223
- │ │ │ │
224
- │ │ Affichage 1-10 sur 125 [< Précédent] [Suivant >]│ │
225
- │ └─────────────────────────────────────────────────────────────────────┘ │
226
- │ │
227
- └─────────────────────────────────────────────────────────────────────────────┘
228
- ```
229
-
230
- ### 4.3 Description des éléments UI
231
-
232
- | Élément | Type | Comportement | Permission | Clé i18n |
233
- |---------|------|--------------|------------|----------|
234
- | [+ Nouveau] | Button primary | Ouvre modal création | `.create` | `{module}.actions.create` |
235
- | [👁] | Icon button | Ouvre page détail | `.read` | `common.actions.view` |
236
- | [✏] | Icon button | Ouvre modal édition | `.update` | `common.actions.edit` |
237
- | [🗑] | Icon button | Confirmation + suppression | `.delete` | `common.actions.delete` |
238
- | Checkbox | Checkbox | Sélection multiple | `.read` | - |
239
- | Filtres | Select/Input | Filtre la liste | `.read` | `{module}.filters.*` |
240
-
241
- ### 4.4 Wireframe - Modal création/édition
242
-
243
- ```
244
- ┌─────────────────────────────────────────────────────────────┐
245
- │ {Créer | Modifier} {EntityName} [X] │
246
- ├─────────────────────────────────────────────────────────────┤
247
- │ │
248
- │ {Champ 1} * │
249
- │ ┌─────────────────────────────────────────────────────┐ │
250
- │ │ │ │
251
- │ └─────────────────────────────────────────────────────┘ │
252
- │ {Message d'aide} │
253
- │ │
254
- │ {Champ 2} * │
255
- │ ┌─────────────────────────────────────────────────────┐ │
256
- │ │ [▼] │ │
257
- │ └─────────────────────────────────────────────────────┘ │
258
- │ │
259
- │ {Champ 3} │
260
- │ ┌─────────────────────────────────────────────────────┐ │
261
- │ │ │ │
262
- │ │ │ │
263
- │ │ │ │
264
- │ └─────────────────────────────────────────────────────┘ │
265
- │ │
266
- ├─────────────────────────────────────────────────────────────┤
267
- │ [Annuler] [Enregistrer] │
268
- └─────────────────────────────────────────────────────────────┘
269
- ```
270
-
271
- ### 4.5 Champs du formulaire
272
-
273
- | Champ | Type | Obligatoire | Validation | Clé i18n |
274
- |-------|------|-------------|------------|----------|
275
- | {champ1} | Text input | Oui | Max 100 chars | `{module}.fields.{champ1}` |
276
- | {champ2} | Select | Oui | Liste prédéfinie | `{module}.fields.{champ2}` |
277
- | {champ3} | Textarea | Non | Max 500 chars | `{module}.fields.{champ3}` |
278
-
279
- ---
280
-
281
- ## 5. Validation et messages
282
-
283
- ### 5.1 Règles de validation
284
-
285
- | Champ | Règle | Message erreur (clé i18n) |
286
- |-------|-------|---------------------------|
287
- | {champ} | Requis | `{module}.validation.{champ}Required` |
288
- | {champ} | Format email | `{module}.validation.{champ}InvalidEmail` |
289
- | {champ} | Min 3 caractères | `{module}.validation.{champ}MinLength` |
290
-
291
- ### 5.2 Messages système
292
-
293
- | Code | Type | Clé i18n | Quand affiché |
294
- |------|------|----------|---------------|
295
- | MSG-001 | Success | `{module}.messages.created` | Après création |
296
- | MSG-002 | Success | `{module}.messages.updated` | Après modification |
297
- | MSG-003 | Success | `{module}.messages.deleted` | Après suppression |
298
- | MSG-004 | Error | `{module}.errors.notFound` | Entité non trouvée |
299
- | MSG-005 | Error | `{module}.errors.duplicate` | Doublon détecté |
300
-
301
- ---
302
-
303
- ## 6. Permissions détaillées
304
-
305
- ### 6.1 Permission paths
306
-
307
- | Permission | Description |
308
- |------------|-------------|
309
- | `business.{app}.{module}.read` | Voir la liste et les détails |
310
- | `business.{app}.{module}.create` | Créer une nouvelle entrée |
311
- | `business.{app}.{module}.update` | Modifier une entrée existante |
312
- | `business.{app}.{module}.delete` | Supprimer une entrée |
313
-
314
- ### 6.2 Matrice Rôle-Permission
315
-
316
- | Permission | SuperAdmin | Admin | Manager | User | ReadOnly |
317
- |------------|------------|-------|---------|------|----------|
318
- | `.read` | ✅ | ✅ | ✅ | ✅ | ✅ |
319
- | `.create` | ✅ | ✅ | ✅ | ❌ | ❌ |
320
- | `.update` | ✅ | ✅ | ✅ | ❌ | ❌ |
321
- | `.delete` | ✅ | ✅ | ❌ | ❌ | ❌ |
322
-
323
- ### 6.3 Mapping Endpoint-Permission
324
-
325
- | Endpoint | Méthode | Permission requise | Response si refusé |
326
- |----------|---------|-------------------|-------------------|
327
- | `/api/business/{module}` | GET | `.read` | 403 Forbidden |
328
- | `/api/business/{module}` | POST | `.create` | 403 Forbidden |
329
- | `/api/business/{module}/{id}` | GET | `.read` | 403 Forbidden |
330
- | `/api/business/{module}/{id}` | PUT | `.update` | 403 Forbidden |
331
- | `/api/business/{module}/{id}` | DELETE | `.delete` | 403 Forbidden |
332
-
333
- ### 6.4 Visibilité UI par permission
334
-
335
- | Élément | Permission requise | Si absent |
336
- |---------|-------------------|-----------|
337
- | Bouton [+ Nouveau] | `.create` | Caché |
338
- | Bouton [✏] | `.update` | Caché |
339
- | Bouton [🗑] | `.delete` | Caché |
340
- | Lien vers détail | `.read` | Désactivé |
341
-
342
- ---
343
-
344
- ## 7. Scénarios Gherkin
345
-
346
- ```gherkin
347
- Feature: {FEATURE_ID} - {Feature Name}
348
-
349
- Background:
350
- Given the system is running
351
- And the module "{module}" is enabled
352
-
353
- # ===== PERMISSIONS =====
354
-
355
- @permission @403
356
- Scenario: User without permission cannot access module
357
- Given I am logged in as "noperm@test.com" with role "NoPerm"
358
- When I send GET to "/api/business/{module}"
359
- Then the response status should be 403
360
- And the response should contain "Permission denied"
361
-
362
- @permission @403
363
- Scenario: ReadOnly user cannot create
364
- Given I am logged in as "readonly@test.com" with role "ReadOnly"
365
- And I have permission "business.{app}.{module}.read"
366
- When I send POST to "/api/business/{module}" with:
367
- | field1 | value1 |
368
- Then the response status should be 403
369
-
370
- # ===== CRUD OPERATIONS =====
371
-
372
- @happy-path @create
373
- Scenario: Admin creates new {entity}
374
- Given I am logged in as "admin@test.com" with role "Admin"
375
- And I have permission "business.{app}.{module}.create"
376
- When I send POST to "/api/business/{module}" with:
377
- | field1 | Test Value |
378
- | field2 | Option A |
379
- Then the response status should be 201
380
- And the response should contain "id"
381
- And the response header "Location" should match "/api/business/{module}/[a-f0-9-]+"
382
-
383
- @happy-path @read
384
- Scenario: User views {entity} list
385
- Given I am logged in as "user@test.com" with role "User"
386
- And I have permission "business.{app}.{module}.read"
387
- And there are 5 {entities} in the database
388
- When I send GET to "/api/business/{module}"
389
- Then the response status should be 200
390
- And the response should contain "items"
391
- And the response should contain "totalCount"
392
-
393
- @happy-path @update
394
- Scenario: Manager updates {entity}
395
- Given I am logged in as "manager@test.com" with role "Manager"
396
- And I have permission "business.{app}.{module}.update"
397
- And there is a {entity} with id "test-id"
398
- When I send PUT to "/api/business/{module}/test-id" with:
399
- | field1 | Updated Value |
400
- Then the response status should be 200
401
- And the response field "field1" should be "Updated Value"
402
-
403
- @happy-path @delete
404
- Scenario: Admin deletes {entity}
405
- Given I am logged in as "admin@test.com" with role "Admin"
406
- And I have permission "business.{app}.{module}.delete"
407
- And there is a {entity} with id "test-id"
408
- When I send DELETE to "/api/business/{module}/test-id"
409
- Then the response status should be 204
410
- And the {entity} "test-id" should not exist
411
-
412
- # ===== VALIDATION =====
413
-
414
- @validation @400
415
- Scenario: Create fails with missing required field
416
- Given I am logged in as "admin@test.com" with role "Admin"
417
- And I have permission "business.{app}.{module}.create"
418
- When I send POST to "/api/business/{module}" with:
419
- | field2 | Option A |
420
- Then the response status should be 400
421
- And the response should contain "field1"
422
- And the response should contain "required"
423
-
424
- # ===== BUSINESS RULES =====
425
-
426
- @business-rule @BR-001
427
- Scenario: BR-001 - {Business rule description}
428
- Given I am logged in as "admin@test.com" with role "Admin"
429
- And {precondition for business rule}
430
- When {action that triggers business rule}
431
- Then {expected outcome per BR-001}
432
- ```
433
-
434
- ---
435
-
436
- ## 8. API Specification
437
-
438
- ### 8.1 GET /api/business/{module}
439
-
440
- **Description:** Récupère la liste paginée des {entities}
441
-
442
- **Query Parameters:**
443
-
444
- | Param | Type | Requis | Default | Description |
445
- |-------|------|--------|---------|-------------|
446
- | page | int | Non | 1 | Numéro de page |
447
- | pageSize | int | Non | 10 | Éléments par page (max 100) |
448
- | sortBy | string | Non | createdAt | Champ de tri |
449
- | sortOrder | string | Non | desc | asc ou desc |
450
- | search | string | Non | - | Recherche textuelle |
451
- | status | string | Non | - | Filtre par statut |
452
-
453
- **Response 200:**
454
- ```json
455
- {
456
- "items": [
457
- {
458
- "id": "guid",
459
- "field1": "value",
460
- "field2": "value",
461
- "status": "active",
462
- "createdAt": "2024-01-01T00:00:00Z",
463
- "updatedAt": "2024-01-01T00:00:00Z"
464
- }
465
- ],
466
- "totalCount": 125,
467
- "page": 1,
468
- "pageSize": 10,
469
- "totalPages": 13
470
- }
471
- ```
472
-
473
- ### 8.2 POST /api/business/{module}
474
-
475
- **Description:** Crée une nouvelle {entity}
476
-
477
- **Request Body:**
478
- ```json
479
- {
480
- "field1": "string (required, max 100)",
481
- "field2": "string (required, enum: [A, B, C])",
482
- "field3": "string (optional, max 500)"
483
- }
484
- ```
485
-
486
- **Response 201:**
487
- ```json
488
- {
489
- "id": "guid",
490
- "field1": "value",
491
- "field2": "value",
492
- "field3": "value",
493
- "status": "active",
494
- "createdAt": "2024-01-01T00:00:00Z"
495
- }
496
- ```
497
-
498
- **Response Headers:**
499
- - `Location: /api/business/{module}/{id}`
500
-
501
- ---
502
-
503
- ## 9. Intégrations SmartStack ⭐
504
-
505
- > **Importé depuis 1-discovery.md Section 7**
506
-
507
- ### 9.1 Notifications
508
-
509
- | Requis | Événements | Destinataires | Type notification |
510
- |--------|------------|---------------|-------------------|
511
- | {oui/non} | {entity.created, entity.updated, ...} | {créateur, assigné, rôle} | {info, warning, success} |
512
-
513
- **Spécification:**
514
- - NotificationType à créer: `{Entity}Created`, `{Entity}Updated`, etc.
515
- - Service à modifier: `{Entity}Service.cs`
516
- - Hook frontend: `use{Module}Notifications.ts`
517
-
518
- ### 9.2 Workflows & Emails
519
-
520
- | Requis | Trigger | Steps | Templates email |
521
- |--------|---------|-------|-----------------|
522
- | {oui/non} | `{entity}.{event}` | {SendEmail, Wait, Condition} | {template-codes} |
523
-
524
- **Spécification:**
525
- - Trigger à créer: `{entity}.{event}`
526
- - Workflow: `{workflow-code}`
527
- - Variables: `entityId`, `entityName`, `userEmail`, etc.
528
-
529
- ### 9.3 Assistance IA
530
-
531
- | Requis | Fonction | Entrée | Sortie | Schema |
532
- |--------|----------|--------|--------|--------|
533
- | {oui/non} | {génération/classification/suggestion} | {données contexte} | {format attendu} | {JSON schema si applicable} |
534
-
535
- **Spécification:**
536
- - Prompt à créer: `{prompt-code}`
537
- - Blocks: {system, context, query}
538
- - OutputSchema: {schema JSON si structuré}
539
-
540
- ### 9.4 Skills à utiliser
541
-
542
- | Intégration | Skill | Quand |
543
- |-------------|-------|-------|
544
- | Notifications | `/notification add` | Après création des services backend |
545
- | Workflows | `/workflow create` | Après définition des triggers |
546
- | IA | `/ai-prompt create` | Lors de l'implémentation du service |
547
-
548
- ---
549
-
550
- ## 10. Prochaines étapes
551
-
552
- - [ ] Valider ce FRD avec le sponsor
553
- - [ ] Lancer validation: `/business-analyse:5-validate {FEATURE_ID}`
554
-
555
- ---
556
-
557
- ## Historique des versions
558
-
559
- | Version | Date | Auteur | Modifications |
560
- |---------|------|--------|---------------|
561
- | 1.0 | {date} | BA (Sonnet) | Création initiale |
562
- ```
563
-
564
- ---
565
-
566
- ## STEP 4: Résumé
567
-
568
- ```
569
- ================================================================================
570
- SPÉCIFICATIONS COMPLÈTES - {FEATURE_ID}
571
- ================================================================================
572
-
573
- DOCUMENT GÉNÉRÉ: {FEATURE_DIR}/3-functional-specification.md
574
- MODÈLE UTILISÉ: Sonnet
575
- BASÉ SUR: 2-business-requirements.md v1.0
576
-
577
- CONTENU:
578
- Cas d'utilisation: {N} (UC-001 à UC-XXX)
579
- Exigences fonct.: {N} (FR-001 à FR-XXX)
580
- Wireframes: {N} écrans
581
- Permissions: {N} définies
582
- Scénarios Gherkin: {N} scénarios
583
- Intégrations: {N} (Notifications/Workflows/IA)
584
-
585
- ================================================================================
586
- PROCHAINE ÉTAPE
587
- ================================================================================
588
-
589
- Lancez la validation utilisateur:
590
-
591
- /business-analyse:5-validate {FEATURE_ID}
592
-
593
- ⚠️ La validation est OBLIGATOIRE avant de générer le handoff!
594
-
595
- ================================================================================
596
-
597
- Contact support: support@atlshub.ch
598
- ```
1
+ ---
2
+ description: Phase 4 - Functional specifications FRD (ULTRATHINK)
3
+ agent: ba-specify
4
+ model: sonnet
5
+ ---
6
+
7
+ # Phase 4: Spécifications Fonctionnelles - FRD
8
+
9
+ > **Modèle:** Sonnet (spécifications détaillées)
10
+ > **Coût estimé:** ~$0.18
11
+ > **Input:** 2-business-requirements.md
12
+ > **Output:** 3-functional-specification.md (FRD)
13
+
14
+ ---
15
+
16
+ ## OBJECTIF
17
+
18
+ ```
19
+ ╔══════════════════════════════════════════════════════════════════════════════╗
20
+ ║ TRANSFORMER LE BRD EN SPÉCIFICATIONS IMPLÉMENTABLES ║
21
+ ╠══════════════════════════════════════════════════════════════════════════════╣
22
+ ║ ║
23
+ ║ Le FRD définit COMMENT le système doit se comporter: ║
24
+ ║ ║
25
+ ║ • Cas d'utilisation détaillés (UC-XXX) ║
26
+ ║ • Exigences fonctionnelles (FR-XXX) ║
27
+ ║ • Wireframes d'interface ║
28
+ ║ • Permissions granulaires ║
29
+ ║ • Scénarios Gherkin pour tests ║
30
+ ║ ║
31
+ ║ RÈGLE: Assez détaillé pour qu'un développeur puisse implémenter ║
32
+ ║ sans poser de questions. ║
33
+ ║ ║
34
+ ╚══════════════════════════════════════════════════════════════════════════════╝
35
+ ```
36
+
37
+ ---
38
+
39
+ ## STEP 1: Charger le BRD
40
+
41
+ ```bash
42
+ FEATURE_ID=$1
43
+ FEATURE_DIR=$(find .business-analyse -type d -name "${FEATURE_ID}*" | head -1)
44
+ BRD_FILE="$FEATURE_DIR/2-business-requirements.md"
45
+
46
+ if [ ! -f "$BRD_FILE" ]; then
47
+ echo "❌ ERREUR: 2-business-requirements.md non trouvé"
48
+ echo " Lancez d'abord: /business-analyse:3-analyse $FEATURE_ID"
49
+ exit 1
50
+ fi
51
+
52
+ # Extraire application et module
53
+ APPLICATION=$(echo $FEATURE_DIR | grep -oP 'business/\K[^/]+')
54
+ MODULE=$(echo $FEATURE_DIR | grep -oP 'modules/\K[^/]+')
55
+ PERMISSION_BASE="business.$APPLICATION.$MODULE"
56
+ ```
57
+
58
+ ---
59
+
60
+ ## STEP 2: Scanner les patterns UI existants
61
+
62
+ ```bash
63
+ # Scanner les pages existantes pour cohérence UI
64
+ EXISTING_PAGES=$(find web/smartstack-web/src/pages -name "*.tsx" | head -20)
65
+
66
+ # Extraire les patterns de composants utilisés
67
+ COMPONENT_PATTERNS=$(grep -h "import.*from.*components" $EXISTING_PAGES 2>/dev/null | sort -u)
68
+
69
+ echo "Patterns UI existants identifiés"
70
+ ```
71
+
72
+ ---
73
+
74
+ ## STEP 3: Génération du FRD
75
+
76
+ ```bash
77
+ FRD_FILE="$FEATURE_DIR/3-functional-specification.md"
78
+ ```
79
+
80
+ ### Template 3-functional-specification.md
81
+
82
+ ```markdown
83
+ # FRD - {FEATURE_ID} {Feature Name}
84
+
85
+ > **Module:** business/{application}/{module}
86
+ > **Version:** 1.0
87
+ > **Basé sur:** 2-business-requirements.md v1.0
88
+ > **Permission base:** business.{application}.{module}.*
89
+ > **Standard:** IEEE 830
90
+
91
+ ---
92
+
93
+ ## 1. Vue d'ensemble
94
+
95
+ ### 1.1 Objectif fonctionnel
96
+
97
+ {Description de ce que le système doit faire, du point de vue utilisateur}
98
+
99
+ ### 1.2 Acteurs
100
+
101
+ | Acteur | Description | Permissions requises |
102
+ |--------|-------------|---------------------|
103
+ | Admin | Administrateur avec tous les droits | `{module}.*` |
104
+ | Manager | Gestionnaire du module | `{module}.read`, `{module}.create`, `{module}.update` |
105
+ | User | Utilisateur standard | `{module}.read` |
106
+ | ReadOnly | Consultation seule | `{module}.read` |
107
+
108
+ ### 1.3 Préconditions globales
109
+
110
+ - Utilisateur authentifié
111
+ - Permission `business.{application}.{module}.read` au minimum
112
+ - Module activé dans la configuration tenant
113
+
114
+ ---
115
+
116
+ ## 2. Cas d'utilisation
117
+
118
+ ### UC-001: {Nom du cas d'utilisation principal}
119
+
120
+ | Attribut | Valeur |
121
+ |----------|--------|
122
+ | **ID** | UC-001 |
123
+ | **Nom** | {Nom descriptif} |
124
+ | **Acteur principal** | {Rôle} |
125
+ | **Préconditions** | {conditions requises avant exécution} |
126
+ | **Postconditions** | {état du système après exécution} |
127
+ | **Permission** | `business.{app}.{module}.{action}` |
128
+ | **Fréquence** | {Daily/Weekly/Monthly} |
129
+ | **Criticité** | {High/Medium/Low} |
130
+
131
+ **Scénario principal:**
132
+
133
+ | # | Acteur | Système |
134
+ |---|--------|---------|
135
+ | 1 | {L'utilisateur fait...} | |
136
+ | 2 | | {Le système répond...} |
137
+ | 3 | {L'utilisateur fait...} | |
138
+ | 4 | | {Le système répond...} |
139
+ | 5 | | {Le système confirme avec message} |
140
+
141
+ **Scénarios alternatifs:**
142
+
143
+ | # | Condition | Étapes alternatives |
144
+ |---|-----------|---------------------|
145
+ | 3a | {Si condition X} | 3a.1 {action}, 3a.2 {action} |
146
+ | 4a | {Si condition Y} | 4a.1 {action} |
147
+
148
+ **Scénarios d'erreur:**
149
+
150
+ | # | Erreur | Message | Action système |
151
+ |---|--------|---------|----------------|
152
+ | E1 | {description erreur} | `{module}.errors.{code}` | {comportement} |
153
+ | E2 | Validation échouée | `{module}.errors.validation` | Afficher erreurs |
154
+ | E3 | Permission refusée | `common.errors.forbidden` | Rediriger login |
155
+
156
+ ---
157
+
158
+ ## 3. Exigences fonctionnelles
159
+
160
+ | ID | Exigence | UC lié | BR lié | Priorité |
161
+ |----|----------|--------|--------|----------|
162
+ | FR-001 | Le système DOIT {action} | UC-001 | BR-001 | Must |
163
+ | FR-002 | Le système DOIT {action} | UC-001 | BR-002 | Must |
164
+ | FR-003 | Le système DEVRAIT {action} | UC-002 | - | Should |
165
+
166
+ ### 3.1 Détail FR-001: {Nom}
167
+
168
+ **Énoncé:**
169
+ Le système DOIT {description précise de l'exigence fonctionnelle}
170
+
171
+ **Critères d'acceptation:**
172
+ - [ ] {Critère mesurable et vérifiable 1}
173
+ - [ ] {Critère mesurable et vérifiable 2}
174
+ - [ ] {Critère mesurable et vérifiable 3}
175
+
176
+ **Règles associées:** BR-001, BR-002
177
+
178
+ **Scénario de test:**
179
+ ```gherkin
180
+ Scenario: FR-001 - {description}
181
+ Given {contexte initial}
182
+ When {action utilisateur}
183
+ Then {résultat attendu}
184
+ And {vérification supplémentaire}
185
+ ```
186
+
187
+ ---
188
+
189
+ ## 4. Interface utilisateur
190
+
191
+ ### 4.1 Navigation
192
+
193
+ **Chemin d'accès:** Business > {Application} > {Module}
194
+
195
+ **URL:** `/business/{application}/{module}`
196
+
197
+ ### 4.2 Wireframe - Liste principale
198
+
199
+ ```
200
+ ┌─────────────────────────────────────────────────────────────────────────────┐
201
+ │ [Logo] Business / {App} / {Module} [User ▼] [☰] │
202
+ ├─────────────────────────────────────────────────────────────────────────────┤
203
+ │ │
204
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
205
+ │ │ {Module Name} [+ Nouveau] │ │
206
+ │ │ {Description courte du module} │ │
207
+ │ └─────────────────────────────────────────────────────────────────────┘ │
208
+ │ │
209
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
210
+ │ │ FILTRES │ │
211
+ │ │ [Statut ▼] [Date du ▼] [Date au ▼] [Recherche... ] [Filtrer] │ │
212
+ │ └─────────────────────────────────────────────────────────────────────┘ │
213
+ │ │
214
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
215
+ │ │ TABLEAU │ │
216
+ │ │ ┌────────┬────────────┬────────────┬──────────┬─────────────────┐ │ │
217
+ │ │ │ □ │ {Col 1} │ {Col 2} │ {Col 3} │ Actions │ │ │
218
+ │ │ ├────────┼────────────┼────────────┼──────────┼─────────────────┤ │ │
219
+ │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
220
+ │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
221
+ │ │ │ □ │ {data} │ {data} │ {badge} │ [👁] [✏] [🗑] │ │ │
222
+ │ │ └────────┴────────────┴────────────┴──────────┴─────────────────┘ │ │
223
+ │ │ │ │
224
+ │ │ Affichage 1-10 sur 125 [< Précédent] [Suivant >]│ │
225
+ │ └─────────────────────────────────────────────────────────────────────┘ │
226
+ │ │
227
+ └─────────────────────────────────────────────────────────────────────────────┘
228
+ ```
229
+
230
+ ### 4.3 Description des éléments UI
231
+
232
+ | Élément | Type | Comportement | Permission | Clé i18n |
233
+ |---------|------|--------------|------------|----------|
234
+ | [+ Nouveau] | Button primary | Ouvre modal création | `.create` | `{module}.actions.create` |
235
+ | [👁] | Icon button | Ouvre page détail | `.read` | `common.actions.view` |
236
+ | [✏] | Icon button | Ouvre modal édition | `.update` | `common.actions.edit` |
237
+ | [🗑] | Icon button | Confirmation + suppression | `.delete` | `common.actions.delete` |
238
+ | Checkbox | Checkbox | Sélection multiple | `.read` | - |
239
+ | Filtres | Select/Input | Filtre la liste | `.read` | `{module}.filters.*` |
240
+
241
+ ### 4.4 Wireframe - Modal création/édition
242
+
243
+ ```
244
+ ┌─────────────────────────────────────────────────────────────┐
245
+ │ {Créer | Modifier} {EntityName} [X] │
246
+ ├─────────────────────────────────────────────────────────────┤
247
+ │ │
248
+ │ {Champ 1} * │
249
+ │ ┌─────────────────────────────────────────────────────┐ │
250
+ │ │ │ │
251
+ │ └─────────────────────────────────────────────────────┘ │
252
+ │ {Message d'aide} │
253
+ │ │
254
+ │ {Champ 2} * │
255
+ │ ┌─────────────────────────────────────────────────────┐ │
256
+ │ │ [▼] │ │
257
+ │ └─────────────────────────────────────────────────────┘ │
258
+ │ │
259
+ │ {Champ 3} │
260
+ │ ┌─────────────────────────────────────────────────────┐ │
261
+ │ │ │ │
262
+ │ │ │ │
263
+ │ │ │ │
264
+ │ └─────────────────────────────────────────────────────┘ │
265
+ │ │
266
+ ├─────────────────────────────────────────────────────────────┤
267
+ │ [Annuler] [Enregistrer] │
268
+ └─────────────────────────────────────────────────────────────┘
269
+ ```
270
+
271
+ ### 4.5 Champs du formulaire
272
+
273
+ | Champ | Type | Obligatoire | Validation | Clé i18n |
274
+ |-------|------|-------------|------------|----------|
275
+ | {champ1} | Text input | Oui | Max 100 chars | `{module}.fields.{champ1}` |
276
+ | {champ2} | Select | Oui | Liste prédéfinie | `{module}.fields.{champ2}` |
277
+ | {champ3} | Textarea | Non | Max 500 chars | `{module}.fields.{champ3}` |
278
+
279
+ ---
280
+
281
+ ## 5. Validation et messages
282
+
283
+ ### 5.1 Règles de validation
284
+
285
+ | Champ | Règle | Message erreur (clé i18n) |
286
+ |-------|-------|---------------------------|
287
+ | {champ} | Requis | `{module}.validation.{champ}Required` |
288
+ | {champ} | Format email | `{module}.validation.{champ}InvalidEmail` |
289
+ | {champ} | Min 3 caractères | `{module}.validation.{champ}MinLength` |
290
+
291
+ ### 5.2 Messages système
292
+
293
+ | Code | Type | Clé i18n | Quand affiché |
294
+ |------|------|----------|---------------|
295
+ | MSG-001 | Success | `{module}.messages.created` | Après création |
296
+ | MSG-002 | Success | `{module}.messages.updated` | Après modification |
297
+ | MSG-003 | Success | `{module}.messages.deleted` | Après suppression |
298
+ | MSG-004 | Error | `{module}.errors.notFound` | Entité non trouvée |
299
+ | MSG-005 | Error | `{module}.errors.duplicate` | Doublon détecté |
300
+
301
+ ---
302
+
303
+ ## 6. Permissions détaillées
304
+
305
+ ### 6.1 Permission paths
306
+
307
+ | Permission | Description |
308
+ |------------|-------------|
309
+ | `business.{app}.{module}.read` | Voir la liste et les détails |
310
+ | `business.{app}.{module}.create` | Créer une nouvelle entrée |
311
+ | `business.{app}.{module}.update` | Modifier une entrée existante |
312
+ | `business.{app}.{module}.delete` | Supprimer une entrée |
313
+
314
+ ### 6.2 Matrice Rôle-Permission
315
+
316
+ | Permission | SuperAdmin | Admin | Manager | User | ReadOnly |
317
+ |------------|------------|-------|---------|------|----------|
318
+ | `.read` | ✅ | ✅ | ✅ | ✅ | ✅ |
319
+ | `.create` | ✅ | ✅ | ✅ | ❌ | ❌ |
320
+ | `.update` | ✅ | ✅ | ✅ | ❌ | ❌ |
321
+ | `.delete` | ✅ | ✅ | ❌ | ❌ | ❌ |
322
+
323
+ ### 6.3 Mapping Endpoint-Permission
324
+
325
+ | Endpoint | Méthode | Permission requise | Response si refusé |
326
+ |----------|---------|-------------------|-------------------|
327
+ | `/api/business/{module}` | GET | `.read` | 403 Forbidden |
328
+ | `/api/business/{module}` | POST | `.create` | 403 Forbidden |
329
+ | `/api/business/{module}/{id}` | GET | `.read` | 403 Forbidden |
330
+ | `/api/business/{module}/{id}` | PUT | `.update` | 403 Forbidden |
331
+ | `/api/business/{module}/{id}` | DELETE | `.delete` | 403 Forbidden |
332
+
333
+ ### 6.4 Visibilité UI par permission
334
+
335
+ | Élément | Permission requise | Si absent |
336
+ |---------|-------------------|-----------|
337
+ | Bouton [+ Nouveau] | `.create` | Caché |
338
+ | Bouton [✏] | `.update` | Caché |
339
+ | Bouton [🗑] | `.delete` | Caché |
340
+ | Lien vers détail | `.read` | Désactivé |
341
+
342
+ ---
343
+
344
+ ## 7. Scénarios Gherkin
345
+
346
+ ```gherkin
347
+ Feature: {FEATURE_ID} - {Feature Name}
348
+
349
+ Background:
350
+ Given the system is running
351
+ And the module "{module}" is enabled
352
+
353
+ # ===== PERMISSIONS =====
354
+
355
+ @permission @403
356
+ Scenario: User without permission cannot access module
357
+ Given I am logged in as "noperm@test.com" with role "NoPerm"
358
+ When I send GET to "/api/business/{module}"
359
+ Then the response status should be 403
360
+ And the response should contain "Permission denied"
361
+
362
+ @permission @403
363
+ Scenario: ReadOnly user cannot create
364
+ Given I am logged in as "readonly@test.com" with role "ReadOnly"
365
+ And I have permission "business.{app}.{module}.read"
366
+ When I send POST to "/api/business/{module}" with:
367
+ | field1 | value1 |
368
+ Then the response status should be 403
369
+
370
+ # ===== CRUD OPERATIONS =====
371
+
372
+ @happy-path @create
373
+ Scenario: Admin creates new {entity}
374
+ Given I am logged in as "admin@test.com" with role "Admin"
375
+ And I have permission "business.{app}.{module}.create"
376
+ When I send POST to "/api/business/{module}" with:
377
+ | field1 | Test Value |
378
+ | field2 | Option A |
379
+ Then the response status should be 201
380
+ And the response should contain "id"
381
+ And the response header "Location" should match "/api/business/{module}/[a-f0-9-]+"
382
+
383
+ @happy-path @read
384
+ Scenario: User views {entity} list
385
+ Given I am logged in as "user@test.com" with role "User"
386
+ And I have permission "business.{app}.{module}.read"
387
+ And there are 5 {entities} in the database
388
+ When I send GET to "/api/business/{module}"
389
+ Then the response status should be 200
390
+ And the response should contain "items"
391
+ And the response should contain "totalCount"
392
+
393
+ @happy-path @update
394
+ Scenario: Manager updates {entity}
395
+ Given I am logged in as "manager@test.com" with role "Manager"
396
+ And I have permission "business.{app}.{module}.update"
397
+ And there is a {entity} with id "test-id"
398
+ When I send PUT to "/api/business/{module}/test-id" with:
399
+ | field1 | Updated Value |
400
+ Then the response status should be 200
401
+ And the response field "field1" should be "Updated Value"
402
+
403
+ @happy-path @delete
404
+ Scenario: Admin deletes {entity}
405
+ Given I am logged in as "admin@test.com" with role "Admin"
406
+ And I have permission "business.{app}.{module}.delete"
407
+ And there is a {entity} with id "test-id"
408
+ When I send DELETE to "/api/business/{module}/test-id"
409
+ Then the response status should be 204
410
+ And the {entity} "test-id" should not exist
411
+
412
+ # ===== VALIDATION =====
413
+
414
+ @validation @400
415
+ Scenario: Create fails with missing required field
416
+ Given I am logged in as "admin@test.com" with role "Admin"
417
+ And I have permission "business.{app}.{module}.create"
418
+ When I send POST to "/api/business/{module}" with:
419
+ | field2 | Option A |
420
+ Then the response status should be 400
421
+ And the response should contain "field1"
422
+ And the response should contain "required"
423
+
424
+ # ===== BUSINESS RULES =====
425
+
426
+ @business-rule @BR-001
427
+ Scenario: BR-001 - {Business rule description}
428
+ Given I am logged in as "admin@test.com" with role "Admin"
429
+ And {precondition for business rule}
430
+ When {action that triggers business rule}
431
+ Then {expected outcome per BR-001}
432
+ ```
433
+
434
+ ---
435
+
436
+ ## 8. API Specification
437
+
438
+ ### 8.1 GET /api/business/{module}
439
+
440
+ **Description:** Récupère la liste paginée des {entities}
441
+
442
+ **Query Parameters:**
443
+
444
+ | Param | Type | Requis | Default | Description |
445
+ |-------|------|--------|---------|-------------|
446
+ | page | int | Non | 1 | Numéro de page |
447
+ | pageSize | int | Non | 10 | Éléments par page (max 100) |
448
+ | sortBy | string | Non | createdAt | Champ de tri |
449
+ | sortOrder | string | Non | desc | asc ou desc |
450
+ | search | string | Non | - | Recherche textuelle |
451
+ | status | string | Non | - | Filtre par statut |
452
+
453
+ **Response 200:**
454
+ ```json
455
+ {
456
+ "items": [
457
+ {
458
+ "id": "guid",
459
+ "field1": "value",
460
+ "field2": "value",
461
+ "status": "active",
462
+ "createdAt": "2024-01-01T00:00:00Z",
463
+ "updatedAt": "2024-01-01T00:00:00Z"
464
+ }
465
+ ],
466
+ "totalCount": 125,
467
+ "page": 1,
468
+ "pageSize": 10,
469
+ "totalPages": 13
470
+ }
471
+ ```
472
+
473
+ ### 8.2 POST /api/business/{module}
474
+
475
+ **Description:** Crée une nouvelle {entity}
476
+
477
+ **Request Body:**
478
+ ```json
479
+ {
480
+ "field1": "string (required, max 100)",
481
+ "field2": "string (required, enum: [A, B, C])",
482
+ "field3": "string (optional, max 500)"
483
+ }
484
+ ```
485
+
486
+ **Response 201:**
487
+ ```json
488
+ {
489
+ "id": "guid",
490
+ "field1": "value",
491
+ "field2": "value",
492
+ "field3": "value",
493
+ "status": "active",
494
+ "createdAt": "2024-01-01T00:00:00Z"
495
+ }
496
+ ```
497
+
498
+ **Response Headers:**
499
+ - `Location: /api/business/{module}/{id}`
500
+
501
+ ---
502
+
503
+ ## 9. Intégrations SmartStack ⭐
504
+
505
+ > **Importé depuis 1-discovery.md Section 7**
506
+
507
+ ### 9.1 Notifications
508
+
509
+ | Requis | Événements | Destinataires | Type notification |
510
+ |--------|------------|---------------|-------------------|
511
+ | {oui/non} | {entity.created, entity.updated, ...} | {créateur, assigné, rôle} | {info, warning, success} |
512
+
513
+ **Spécification:**
514
+ - NotificationType à créer: `{Entity}Created`, `{Entity}Updated`, etc.
515
+ - Service à modifier: `{Entity}Service.cs`
516
+ - Hook frontend: `use{Module}Notifications.ts`
517
+
518
+ ### 9.2 Workflows & Emails
519
+
520
+ | Requis | Trigger | Steps | Templates email |
521
+ |--------|---------|-------|-----------------|
522
+ | {oui/non} | `{entity}.{event}` | {SendEmail, Wait, Condition} | {template-codes} |
523
+
524
+ **Spécification:**
525
+ - Trigger à créer: `{entity}.{event}`
526
+ - Workflow: `{workflow-code}`
527
+ - Variables: `entityId`, `entityName`, `userEmail`, etc.
528
+
529
+ ### 9.3 Assistance IA
530
+
531
+ | Requis | Fonction | Entrée | Sortie | Schema |
532
+ |--------|----------|--------|--------|--------|
533
+ | {oui/non} | {génération/classification/suggestion} | {données contexte} | {format attendu} | {JSON schema si applicable} |
534
+
535
+ **Spécification:**
536
+ - Prompt à créer: `{prompt-code}`
537
+ - Blocks: {system, context, query}
538
+ - OutputSchema: {schema JSON si structuré}
539
+
540
+ ### 9.4 Skills à utiliser
541
+
542
+ | Intégration | Skill | Quand |
543
+ |-------------|-------|-------|
544
+ | Notifications | `/notification add` | Après création des services backend |
545
+ | Workflows | `/workflow create` | Après définition des triggers |
546
+ | IA | `/ai-prompt create` | Lors de l'implémentation du service |
547
+
548
+ ---
549
+
550
+ ## 10. Prochaines étapes
551
+
552
+ - [ ] Valider ce FRD avec le sponsor
553
+ - [ ] Lancer validation: `/business-analyse:5-validate {FEATURE_ID}`
554
+
555
+ ---
556
+
557
+ ## Historique des versions
558
+
559
+ | Version | Date | Auteur | Modifications |
560
+ |---------|------|--------|---------------|
561
+ | 1.0 | {date} | BA (Sonnet) | Création initiale |
562
+ ```
563
+
564
+ ---
565
+
566
+ ## STEP 4: Résumé
567
+
568
+ ```
569
+ ================================================================================
570
+ SPÉCIFICATIONS COMPLÈTES - {FEATURE_ID}
571
+ ================================================================================
572
+
573
+ DOCUMENT GÉNÉRÉ: {FEATURE_DIR}/3-functional-specification.md
574
+ MODÈLE UTILISÉ: Sonnet
575
+ BASÉ SUR: 2-business-requirements.md v1.0
576
+
577
+ CONTENU:
578
+ Cas d'utilisation: {N} (UC-001 à UC-XXX)
579
+ Exigences fonct.: {N} (FR-001 à FR-XXX)
580
+ Wireframes: {N} écrans
581
+ Permissions: {N} définies
582
+ Scénarios Gherkin: {N} scénarios
583
+ Intégrations: {N} (Notifications/Workflows/IA)
584
+
585
+ ================================================================================
586
+ PROCHAINE ÉTAPE
587
+ ================================================================================
588
+
589
+ Lancez la validation utilisateur:
590
+
591
+ /business-analyse:5-validate {FEATURE_ID}
592
+
593
+ ⚠️ La validation est OBLIGATOIRE avant de générer le handoff!
594
+
595
+ ================================================================================
596
+
597
+ Contact support: support@atlshub.ch
598
+ ```