@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,746 +1,746 @@
1
- ---
2
- description: Phase 6 - Development prompt generation (ULTRATHINK)
3
- agent: ba-handoff
4
- model: opus
5
- ---
6
-
7
- # Phase 6: Handoff Développement
8
-
9
- > **Modèle:** OPUS (génération prompt one-shot, zéro ambiguïté)
10
- > **Coût estimé:** ~$0.35 (one-shot) / ~$1.00-2.50 (avec ralph-loop)
11
- > **Prérequis:** validation.json avec status "APPROVED"
12
-
13
- ---
14
-
15
- ## RALPH-LOOP INTEGRATION (OPTIONNEL)
16
-
17
- ```
18
- ╔══════════════════════════════════════════════════════════════════════════════╗
19
- ║ UTILISATION AVEC RALPH-LOOP POUR GARANTIE DE COMPLÉTUDE ║
20
- ╠══════════════════════════════════════════════════════════════════════════════╣
21
- ║ ║
22
- ║ /ralph-loop "/business-analyse:6-handoff FEAT-XXX" ║
23
- ║ --completion-promise "COMPLETE" --max-iterations 10 ║
24
- ║ ║
25
- ║ FICHIERS RALPH (créés automatiquement): ║
26
- ║ ├── prd.json → Sections du handoff avec statut ║
27
- ║ └── progress.txt → Mémoire des sections générées ║
28
- ║ ║
29
- ║ PROCESSUS PAR ITERATION: ║
30
- ║ 1. Lire prd.json → Trouver prochaine section "passes": false ║
31
- ║ 2. Lire progress.txt → Voir sections déjà générées ║
32
- ║ 3. Générer UNE section du handoff ║
33
- ║ 4. Mettre à jour 4-development-handoff.md ║
34
- ║ 5. Mettre à jour prd.json → "passes": true ║
35
- ║ 6. Ajouter résumé section à progress.txt ║
36
- ║ 7. Si TOUTES sections "passes": true → <promise>COMPLETE</promise> ║
37
- ║ ║
38
- ║ SIGNAL DE FIN: <promise>COMPLETE</promise> ║
39
- ║ ║
40
- ╚══════════════════════════════════════════════════════════════════════════════╝
41
- ```
42
-
43
- ### Structure prd.json pour Handoff
44
-
45
- ```json
46
- {
47
- "feature_id": "FEAT-XXX",
48
- "phase": "handoff",
49
- "userStories": [
50
- { "id": "1", "title": "Section 1: Header et Contexte", "passes": false },
51
- { "id": "2", "title": "Section 2: Entités Domain", "passes": false },
52
- { "id": "3", "title": "Section 3: Configuration EF Core", "passes": false },
53
- { "id": "4", "title": "Section 4: Commands/Queries Application", "passes": false },
54
- { "id": "5", "title": "Section 5: Endpoints API avec permissions", "passes": false },
55
- { "id": "6", "title": "Section 6: Service API Frontend", "passes": false },
56
- { "id": "7", "title": "Section 7: Pages Frontend", "passes": false },
57
- { "id": "8", "title": "Section 8: i18n (4 langues)", "passes": false },
58
- { "id": "9", "title": "Section 9: Intégrations SmartStack", "passes": false },
59
- { "id": "10", "title": "Section 10: Checklist validation", "passes": false },
60
- { "id": "11", "title": "Validation: aucun TBD/? restant", "passes": false }
61
- ]
62
- }
63
- ```
64
-
65
- ---
66
-
67
- ## OBJECTIF
68
-
69
- ```
70
- ╔══════════════════════════════════════════════════════════════════════════════╗
71
- ║ GÉNÉRER UN PROMPT AUTONOME POUR IMPLÉMENTATION ONE-SHOT ║
72
- ╠══════════════════════════════════════════════════════════════════════════════╣
73
- ║ ║
74
- ║ Le handoff est un document AUTONOME qui permet au développeur Claude ║
75
- ║ d'implémenter la feature SANS poser de questions. ║
76
- ║ ║
77
- ║ EXIGENCES: ║
78
- ║ • Zéro ambiguïté sur les spécifications ║
79
- ║ • Instructions EXPLORE pour découvrir les patterns existants ║
80
- ║ • Checklist complète de validation ║
81
- ║ • Permissions explicites avec paths complets ║
82
- ║ ║
83
- ║ USAGE: /implement {FEATURE_ID} ║
84
- ║ ║
85
- ╚══════════════════════════════════════════════════════════════════════════════╝
86
- ```
87
-
88
- ---
89
-
90
- ## STEP 1: Vérifier la validation
91
-
92
- ```bash
93
- FEATURE_ID=$1
94
- FEATURE_DIR=$(find .business-analyse -type d -name "${FEATURE_ID}*" | head -1)
95
- VALIDATION_FILE="$FEATURE_DIR/validation.json"
96
-
97
- if [ ! -f "$VALIDATION_FILE" ]; then
98
- echo "❌ ERREUR: validation.json non trouvé"
99
- echo " Lancez d'abord: /business-analyse:5-validate $FEATURE_ID"
100
- exit 1
101
- fi
102
-
103
- # Vérifier le status
104
- STATUS=$(grep -oP '"status":\s*"\K[^"]+' "$VALIDATION_FILE")
105
-
106
- if [ "$STATUS" != "APPROVED" ]; then
107
- echo "❌ ERREUR: Validation non approuvée (status: $STATUS)"
108
- echo " Les spécifications doivent être validées avant le handoff."
109
- exit 1
110
- fi
111
-
112
- echo "✅ Validation approuvée - Génération du handoff..."
113
- ```
114
-
115
- ---
116
-
117
- ## STEP 2: Charger tous les documents
118
-
119
- ```bash
120
- DISCOVERY=$(cat "$FEATURE_DIR/1-discovery.md")
121
- BRD=$(cat "$FEATURE_DIR/2-business-requirements.md")
122
- FRD=$(cat "$FEATURE_DIR/3-functional-specification.md")
123
-
124
- # Extraire les informations clés
125
- APPLICATION=$(echo $FEATURE_DIR | grep -oP 'business/\K[^/]+')
126
- MODULE=$(echo $FEATURE_DIR | grep -oP 'modules/\K[^/]+')
127
- FEATURE_NAME=$(echo $FEATURE_DIR | grep -oP 'FEAT-\d+-\K.*')
128
- ```
129
-
130
- ---
131
-
132
- ## STEP 3: Génération du handoff
133
-
134
- ```bash
135
- HANDOFF_FILE="$FEATURE_DIR/4-development-handoff.md"
136
- ```
137
-
138
- ### Template 4-development-handoff.md
139
-
140
- ```markdown
141
- # Development Handoff - {FEATURE_ID} {Feature Name}
142
-
143
- > **Module:** business/{application}/{module}
144
- > **Version:** 1.0 (locked)
145
- > **Specs validées:** FRD v1.0
146
- > **Implémentation:** `/implement {FEATURE_ID}`
147
-
148
- ---
149
-
150
- ## INSTRUCTIONS DÉVELOPPEUR CLAUDE
151
-
152
- Ce document est un **prompt autonome** pour Claude Code.
153
- Exécutez la commande suivante pour implémenter cette feature:
154
-
155
- ```bash
156
- /implement {FEATURE_ID}
157
- ```
158
-
159
- **Options disponibles:**
160
- - `--phase=1` : Backend seulement (Domain + Application + Infrastructure)
161
- - `--phase=2` : Frontend seulement (Pages + Services + i18n)
162
- - `--phase=3` : Tests seulement (Unit + Integration + Postman)
163
- - `--phase=4` : Documentation HTML seulement
164
-
165
- ---
166
-
167
- ## 1. CONTEXTE RAPIDE
168
-
169
- | Attribut | Valeur |
170
- |----------|--------|
171
- | Feature ID | {FEATURE_ID} |
172
- | Module | business/{application}/{module} |
173
- | Permission base | `business.{application}.{module}` |
174
- | Complexité | {Simple/Moyenne/Complexe} |
175
- | Entités | {N} à créer |
176
- | Endpoints | {N} à implémenter |
177
- | Pages | {N} à créer |
178
-
179
- ---
180
-
181
- ## 2. [EXPLORE] DÉCOUVERTE DES PATTERNS
182
-
183
- **AVANT de coder, explorer ces fichiers pour comprendre les patterns existants:**
184
-
185
- ### 2.1 Backend - Patterns à suivre
186
-
187
- ```
188
- DOMAIN:
189
- → src/SmartStack.Domain/Entities/
190
- Explorer: Structure des entités existantes, BaseEntity, interfaces
191
- Pattern: Propriétés, méthodes métier, validations
192
-
193
- → src/SmartStack.Domain/Constants/
194
- Explorer: Permissions.cs pour voir le format des constantes
195
- Pattern: public static class {Module} { public const string View = "..."; }
196
-
197
- APPLICATION:
198
- → src/SmartStack.Application/Features/
199
- Explorer: Structure CQRS (Commands/Queries/Handlers)
200
- Pattern: Un dossier par feature, DTOs séparés
201
-
202
- → src/SmartStack.Application/Common/
203
- Explorer: Interfaces, comportements, validators
204
- Pattern: IRepository, IUnitOfWork, FluentValidation
205
-
206
- INFRASTRUCTURE:
207
- → src/SmartStack.Infrastructure/Persistence/Configurations/
208
- Explorer: EntityTypeConfiguration existantes
209
- Pattern: HasData pour seed, relations, indexes
210
-
211
- → src/SmartStack.Infrastructure/Persistence/Configurations/Authorization/
212
- Explorer: PermissionConfiguration.cs pour seed permissions
213
- Pattern: HasData avec GUID aléatoires
214
-
215
- API:
216
- → src/SmartStack.Api/Controllers/
217
- Explorer: Structure des controllers Business area
218
- Pattern: [RequirePermission], [ProducesResponseType], routes
219
-
220
- → src/SmartStack.Api/Areas/Business/
221
- Explorer: Controllers existants dans l'area Business
222
- ```
223
-
224
- ### 2.2 Frontend - Patterns à suivre
225
-
226
- ```
227
- PAGES:
228
- → web/smartstack-web/src/pages/business/
229
- Explorer: Structure des pages existantes
230
- Pattern: Liste + Détail + Modal, hooks customs
231
-
232
- → web/smartstack-web/src/pages/admin/
233
- Explorer: RolesPage, UsersPage pour patterns CRUD
234
- Pattern: DataTable, filtres, modals
235
-
236
- COMPOSANTS:
237
- → web/smartstack-web/src/components/
238
- Explorer: Composants réutilisables
239
- Pattern: Button, Modal, DataTable, Form
240
-
241
- SERVICES:
242
- → web/smartstack-web/src/services/api/
243
- Explorer: Services API existants
244
- Pattern: apiClient, endpoints, types
245
-
246
- I18N:
247
- → web/smartstack-web/src/i18n/locales/fr/
248
- Explorer: Structure des fichiers de traduction
249
- Pattern: Clés hiérarchiques, pluriels
250
-
251
- HOOKS:
252
- → web/smartstack-web/src/hooks/
253
- Explorer: Hooks customs existants
254
- Pattern: useApi, usePermission, useToast
255
- ```
256
-
257
- ---
258
-
259
- ## 3. ENTITÉ(S) À CRÉER
260
-
261
- ### 3.1 {EntityName}
262
-
263
- **Description:** {description métier de l'entité}
264
-
265
- **Attributs:**
266
-
267
- | Attribut | Description métier | Obligatoire | Validation | Règle BR |
268
- |----------|-------------------|-------------|------------|----------|
269
- | Id | Identifiant unique | Oui | GUID aléatoire | - |
270
- | {attr1} | {description} | Oui | {règle} | BR-001 |
271
- | {attr2} | {description} | Non | {règle} | - |
272
- | {attr3} | {description} | Oui | {règle} | BR-002 |
273
- | Status | État de l'entité | Oui | Enum | - |
274
- | CreatedAt | Date création | Oui | Auto | - |
275
- | CreatedBy | Créateur | Oui | Auto (current user) | - |
276
- | UpdatedAt | Date modification | Non | Auto | - |
277
- | UpdatedBy | Modificateur | Non | Auto (current user) | - |
278
-
279
- **Relations:**
280
-
281
- | Relation | Type | Entité cible | Navigation |
282
- |----------|------|--------------|------------|
283
- | {rel1} | 1:N | {Entity} | Collection |
284
- | {rel2} | N:1 | {Entity} | Reference |
285
-
286
- **Status Enum:**
287
-
288
- | Valeur | Description | Transitions possibles |
289
- |--------|-------------|----------------------|
290
- | Draft | Brouillon | → Active |
291
- | Active | Actif | → Inactive, Archived |
292
- | Inactive | Désactivé | → Active, Archived |
293
- | Archived | Archivé | (terminal) |
294
-
295
- ---
296
-
297
- ## 4. PERMISSIONS À IMPLÉMENTER
298
-
299
- ### 4.1 Constantes (Permissions.cs)
300
-
301
- **Ajouter dans `src/SmartStack.Application/Common/Constants/Permissions.cs`:**
302
-
303
- ```
304
- Emplacement: public static class Business > public static class {Module}
305
-
306
- Paths à créer:
307
- • business.{application}.{module}.read
308
- • business.{application}.{module}.create
309
- • business.{application}.{module}.update
310
- • business.{application}.{module}.delete
311
- ```
312
-
313
- ### 4.2 Seed EF Core (PermissionConfiguration.cs)
314
-
315
- **Ajouter dans `PermissionConfiguration.cs` avec HasData:**
316
-
317
- | Permission Path | Description | ModuleId |
318
- |-----------------|-------------|----------|
319
- | `business.{app}.{module}.read` | View {module} data | {moduleId} |
320
- | `business.{app}.{module}.create` | Create {module} entries | {moduleId} |
321
- | `business.{app}.{module}.update` | Modify {module} entries | {moduleId} |
322
- | `business.{app}.{module}.delete` | Delete {module} entries | {moduleId} |
323
-
324
- **⚠️ IMPORTANT:** Utiliser des GUIDs ALÉATOIRES (pas de patterns prévisibles)
325
-
326
- ### 4.3 Matrice Rôle-Permission
327
-
328
- | Permission | SuperAdmin | Admin | Manager | User | ReadOnly |
329
- |------------|------------|-------|---------|------|----------|
330
- | `.read` | ✅ | ✅ | ✅ | ✅ | ✅ |
331
- | `.create` | ✅ | ✅ | ✅ | ❌ | ❌ |
332
- | `.update` | ✅ | ✅ | ✅ | ❌ | ❌ |
333
- | `.delete` | ✅ | ✅ | ❌ | ❌ | ❌ |
334
-
335
- ---
336
-
337
- ## 5. ENDPOINTS API
338
-
339
- | Endpoint | Méthode | Permission | Body | Response |
340
- |----------|---------|------------|------|----------|
341
- | `/api/business/{module}` | GET | `.read` | Query params | 200: Liste paginée |
342
- | `/api/business/{module}` | POST | `.create` | CreateDto | 201: Entité créée |
343
- | `/api/business/{module}/{id}` | GET | `.read` | - | 200: Entité |
344
- | `/api/business/{module}/{id}` | PUT | `.update` | UpdateDto | 200: Entité modifiée |
345
- | `/api/business/{module}/{id}` | DELETE | `.delete` | - | 204: No Content |
346
- | `/api/business/{module}/{id}/activate` | PATCH | `.update` | - | 204: Activé |
347
- | `/api/business/{module}/{id}/deactivate` | PATCH | `.update` | - | 204: Désactivé |
348
-
349
- ### 5.1 Query Parameters (GET liste)
350
-
351
- | Param | Type | Default | Description |
352
- |-------|------|---------|-------------|
353
- | page | int | 1 | Numéro de page |
354
- | pageSize | int | 10 | Items par page (max 100) |
355
- | sortBy | string | createdAt | Champ de tri |
356
- | sortOrder | string | desc | asc/desc |
357
- | search | string | - | Recherche textuelle |
358
- | status | string | - | Filtre par status |
359
-
360
- ### 5.2 CreateDto
361
-
362
- | Champ | Type | Requis | Validation |
363
- |-------|------|--------|------------|
364
- | {field1} | string | Oui | MaxLength(100) |
365
- | {field2} | string | Oui | Enum values |
366
- | {field3} | string | Non | MaxLength(500) |
367
-
368
- ### 5.3 UpdateDto
369
-
370
- Identique à CreateDto.
371
-
372
- ### 5.4 ResponseDto
373
-
374
- | Champ | Type | Description |
375
- |-------|------|-------------|
376
- | id | Guid | Identifiant |
377
- | {field1} | string | {description} |
378
- | {field2} | string | {description} |
379
- | status | string | Status actuel |
380
- | createdAt | DateTime | Date création |
381
- | updatedAt | DateTime? | Date modification |
382
-
383
- ---
384
-
385
- ## 6. RÈGLES MÉTIER À IMPLÉMENTER
386
-
387
- | BR-ID | Règle | Où implémenter |
388
- |-------|-------|----------------|
389
- | BR-001 | {règle} | Domain Entity / Validator |
390
- | BR-002 | {règle} | Command Handler |
391
- | BR-003 | {règle} | Domain Service |
392
-
393
- ### 6.1 Détail BR-001
394
-
395
- **Règle:** {description complète}
396
-
397
- **Implémentation:**
398
- ```
399
- SI {condition}
400
- ALORS {action}
401
- SINON {erreur avec message}
402
- ```
403
-
404
- **Message d'erreur:** `{module}.errors.br001Violation`
405
-
406
- ---
407
-
408
- ## 7. PAGES FRONTEND
409
-
410
- ### 7.1 Liste ({Module}Page.tsx)
411
-
412
- **Route:** `/business/{application}/{module}`
413
-
414
- **Composants requis:**
415
- - Header avec titre + bouton Nouveau
416
- - Filtres (status, recherche, dates)
417
- - DataTable avec pagination
418
- - Actions par ligne (view, edit, delete)
419
- - Modal création/édition
420
-
421
- **Permissions UI:**
422
- - Bouton Nouveau: visible si `.create`
423
- - Bouton Edit: visible si `.update`
424
- - Bouton Delete: visible si `.delete`
425
-
426
- ### 7.2 Détail ({Module}DetailPage.tsx)
427
-
428
- **Route:** `/business/{application}/{module}/:id`
429
-
430
- **Composants:**
431
- - Breadcrumb
432
- - Card informations principales
433
- - Actions (edit, delete, activate/deactivate)
434
- - Historique des modifications (si audit)
435
-
436
- ---
437
-
438
- ## 8. INTERNATIONALISATION (i18n)
439
-
440
- **Fichiers à créer/modifier:**
441
-
442
- | Fichier | Clés à ajouter |
443
- |---------|----------------|
444
- | `fr/{module}.json` | Toutes les clés |
445
- | `en/{module}.json` | Toutes les clés |
446
- | `it/{module}.json` | Toutes les clés |
447
- | `de/{module}.json` | Toutes les clés |
448
-
449
- **Structure des clés:**
450
-
451
- ```json
452
- {
453
- "{module}": {
454
- "title": "{Module Name}",
455
- "subtitle": "{Description}",
456
- "fields": {
457
- "{field1}": "{Label}",
458
- "{field2}": "{Label}"
459
- },
460
- "actions": {
461
- "create": "Nouveau",
462
- "edit": "Modifier",
463
- "delete": "Supprimer"
464
- },
465
- "messages": {
466
- "created": "{Entity} créé avec succès",
467
- "updated": "{Entity} modifié avec succès",
468
- "deleted": "{Entity} supprimé avec succès"
469
- },
470
- "errors": {
471
- "notFound": "{Entity} non trouvé",
472
- "validation": "Données invalides"
473
- }
474
- }
475
- }
476
- ```
477
-
478
- ---
479
-
480
- ## 9. INTÉGRATIONS SMARTSTACK ⭐
481
-
482
- > **Importé depuis FRD Section 9 - Skills à exécuter automatiquement**
483
-
484
- ### 9.1 Notifications (si requis)
485
-
486
- | Événement | NotificationType | Destinataire | Message |
487
- |-----------|------------------|--------------|---------|
488
- | {Entity}Created | `{Entity}Created` | Créateur | `{module}.notifications.created` |
489
- | {Entity}Updated | `{Entity}Updated` | Assigné | `{module}.notifications.updated` |
490
- | {Entity}Assigned | `{Entity}Assigned` | Nouvel assigné | `{module}.notifications.assigned` |
491
-
492
- **Skill:** `/notification add`
493
- **Service à modifier:** `{Entity}Service.cs`
494
-
495
- **Template intégration:**
496
- ```csharp
497
- await _notificationService.SendNotificationAsync(
498
- userId: {destinataire}.Id,
499
- type: NotificationType.{Entity}Created,
500
- title: _localizer["{module}.notifications.created.title"],
501
- message: _localizer["{module}.notifications.created.message", entity.Name],
502
- relatedEntityType: nameof({Entity}),
503
- relatedEntityId: entity.Id,
504
- actionUrl: $"/{module}/{entity.Id}",
505
- cancellationToken: ct);
506
- ```
507
-
508
- ### 9.2 Workflows (si requis)
509
-
510
- | Workflow Code | Trigger | Steps | Variables |
511
- |---------------|---------|-------|-----------|
512
- | `{workflow-code}` | `{entity}.created` | SendEmail, Wait | entityId, entityName, userEmail |
513
-
514
- **Skill:** `/workflow create`
515
-
516
- **Template déclenchement:**
517
- ```csharp
518
- await _workflowService.TriggerAsync(
519
- "{entity}.created",
520
- new Dictionary<string, object>
521
- {
522
- ["entityId"] = entity.Id,
523
- ["entityName"] = entity.Name,
524
- ["userEmail"] = _currentUser.Email
525
- },
526
- language: _currentUser.Language ?? "fr",
527
- cancellationToken: ct);
528
- ```
529
-
530
- ### 9.3 Assistance IA (si requis)
531
-
532
- | Prompt Code | Fonction | Input | Output | Schema |
533
- |-------------|----------|-------|--------|--------|
534
- | `{prompt-code}` | {génération/classification} | {context} | {format} | {schema} |
535
-
536
- **Skill:** `/ai-prompt create`
537
-
538
- **Template intégration:**
539
- ```csharp
540
- var result = await _aiCompletionService.CompleteAsync<{OutputType}>(
541
- "{prompt-code}",
542
- new Dictionary<string, object>
543
- {
544
- ["context"] = context,
545
- ["entity"] = entity
546
- },
547
- cancellationToken: ct);
548
- ```
549
-
550
- ### 9.4 Résumé des Skills à exécuter
551
-
552
- | Intégration | Requis | Skill | Moment d'exécution |
553
- |-------------|--------|-------|-------------------|
554
- | Notifications | {oui/non} | `/notification add` | Après service backend |
555
- | Workflows | {oui/non} | `/workflow create` | Après triggers définis |
556
- | IA | {oui/non} | `/ai-prompt create` | Pendant service backend |
557
-
558
- **⚠️ IMPORTANT:** Ces skills sont exécutés automatiquement par `/implement` si requis=oui.
559
-
560
- ---
561
-
562
- ## 10. TESTS REQUIS
563
-
564
- ### 10.1 Tests unitaires
565
-
566
- - [ ] Entity validation rules
567
- - [ ] Command validators (FluentValidation)
568
- - [ ] Business rules in handlers
569
-
570
- ### 10.2 Tests d'intégration
571
-
572
- - [ ] GET /api/business/{module} - 200 OK
573
- - [ ] GET /api/business/{module}/{id} - 200 OK
574
- - [ ] GET /api/business/{module}/{id} - 404 Not Found
575
- - [ ] POST /api/business/{module} - 201 Created
576
- - [ ] POST /api/business/{module} - 400 Bad Request (validation)
577
- - [ ] PUT /api/business/{module}/{id} - 200 OK
578
- - [ ] DELETE /api/business/{module}/{id} - 204 No Content
579
-
580
- ### 10.3 Tests de permission
581
-
582
- - [ ] GET sans permission - 403 Forbidden
583
- - [ ] POST avec ReadOnly - 403 Forbidden
584
- - [ ] DELETE avec User - 403 Forbidden
585
-
586
- ### 10.4 Collection Postman
587
-
588
- Générer automatiquement avec `/controller:create`
589
-
590
- ---
591
-
592
- ## 11. CHECKLIST POST-IMPLÉMENTATION
593
-
594
- ### Backend
595
-
596
- - [ ] Entity créée dans Domain
597
- - [ ] Configuration EF Core créée
598
- - [ ] Migration EF Core créée (`/efcore:migration`)
599
- - [ ] Commands/Queries créés dans Application
600
- - [ ] Validators FluentValidation créés
601
- - [ ] Controller créé dans Api/Areas/Business
602
- - [ ] Permissions ajoutées dans Permissions.cs
603
- - [ ] Permissions seedées dans PermissionConfiguration.cs
604
- - [ ] Build backend OK
605
-
606
- ### Frontend
607
-
608
- - [ ] Page liste créée
609
- - [ ] Page détail créée (si applicable)
610
- - [ ] Service API créé
611
- - [ ] i18n complet (4 langues)
612
- - [ ] Routes ajoutées dans App.tsx
613
- - [ ] Build frontend OK
614
-
615
- ### Tests
616
-
617
- - [ ] Tests unitaires passent
618
- - [ ] Tests intégration passent
619
- - [ ] Collection Postman créée
620
-
621
- ### Documentation
622
-
623
- - [ ] `/business-analyse:7-doc-html {FEATURE_ID}` exécuté
624
-
625
- ### Intégrations SmartStack
626
-
627
- - [ ] Notifications ajoutées (si requis)
628
- - [ ] Workflows créés (si requis)
629
- - [ ] Prompts IA créés (si requis)
630
- - [ ] Hooks frontend SignalR (si notifications)
631
-
632
- ---
633
-
634
- ## 12. COMMANDE D'IMPLÉMENTATION
635
-
636
- ```bash
637
- # Implémentation complète
638
- /implement {FEATURE_ID}
639
-
640
- # Par phase
641
- /implement {FEATURE_ID} --phase=1 # Backend
642
- /implement {FEATURE_ID} --phase=2 # Frontend
643
- /implement {FEATURE_ID} --phase=3 # Tests
644
- /implement {FEATURE_ID} --phase=4 # Documentation HTML
645
- ```
646
-
647
- ---
648
-
649
- ## Historique des versions
650
-
651
- | Version | Date | Auteur | Modifications |
652
- |---------|------|--------|---------------|
653
- | 1.0 | {date} | BA (Opus) | Création initiale (locked) |
654
- ```
655
-
656
- ---
657
-
658
- ## STEP 4: Verrouillage des documents
659
-
660
- ```bash
661
- # Marquer les documents comme verrouillés
662
- for doc in "1-discovery.md" "2-business-requirements.md" "3-functional-specification.md"; do
663
- if [ -f "$FEATURE_DIR/$doc" ]; then
664
- # Ajouter un header de verrouillage
665
- sed -i "1s/^/<!-- LOCKED: v1.0 - Validated $(date -I) -->\n/" "$FEATURE_DIR/$doc"
666
- fi
667
- done
668
- ```
669
-
670
- ---
671
-
672
- ## STEP 5: Vérification de complétude (RALPH-LOOP)
673
-
674
- Avant de terminer, vérifier que TOUS les critères sont remplis:
675
-
676
- ```
677
- CHECKLIST COMPLÉTUDE HANDOFF:
678
- □ Section 1 (Contexte) - Feature ID, Module, Complexité renseignés
679
- □ Section 2 (Explore) - Tous les patterns backend/frontend listés
680
- □ Section 3 (Entités) - Toutes les entités du FRD avec attributs complets
681
- □ Section 4 (Permissions) - Paths explicites, matrice rôles complète
682
- □ Section 5 (Endpoints) - Tous les UC couverts, DTOs définis
683
- □ Section 6 (Règles métier) - Tous les BR référencés avec implémentation
684
- □ Section 7 (Pages) - Routes, composants, permissions UI
685
- □ Section 8 (i18n) - Structure clés pour 4 langues
686
- □ Section 9 (Intégrations) - Notifications/Workflows/IA spécifiés (oui/non)
687
- □ Section 10 (Tests) - Checklist unitaires + intégration
688
- □ Section 11 (Checklist) - Tous les items listés (incluant intégrations)
689
- □ Section 12 (Commande) - /implement documenté
690
- □ Aucun marqueur "TBD", "?", "{...}" restant dans le document
691
- ```
692
-
693
- ---
694
-
695
- ## STEP 6: Résumé
696
-
697
- **SI TOUS LES CRITÈRES SONT REMPLIS:**
698
-
699
- ```
700
- ================================================================================
701
- HANDOFF GÉNÉRÉ - {FEATURE_ID}
702
- ================================================================================
703
-
704
- DOCUMENT: {FEATURE_DIR}/4-development-handoff.md
705
- MODÈLE UTILISÉ: Opus avec ULTRATHINK
706
- STATUS: Prêt pour implémentation
707
-
708
- CONTENU:
709
- • Instructions EXPLORE complètes
710
- • {N} entité(s) spécifiée(s)
711
- • {N} endpoint(s) API
712
- • {N} permission(s) définies
713
- • {N} page(s) frontend
714
- • {N} intégration(s) SmartStack (Notif/Workflow/IA)
715
- • Checklist de 25+ points
716
-
717
- DOCUMENTS VERROUILLÉS:
718
- ✓ 1-discovery.md v1.0
719
- ✓ 2-business-requirements.md v1.0
720
- ✓ 3-functional-specification.md v1.0
721
- ✓ 4-development-handoff.md v1.0
722
-
723
- ================================================================================
724
- PROCHAINE ÉTAPE
725
- ================================================================================
726
-
727
- Lancez l'implémentation:
728
-
729
- /implement {FEATURE_ID}
730
-
731
- Ou avec ralph-loop pour one-shot complet:
732
-
733
- /ralph-loop "/implement {FEATURE_ID}" \
734
- --completion-promise "FEATURE_COMPLETE" \
735
- --max-iterations 25
736
-
737
- ================================================================================
738
-
739
- <promise>COMPLETE</promise>
740
-
741
- Contact support: support@atlshub.ch
742
- ```
743
-
744
- **SI DES CRITÈRES MANQUENT:**
745
-
746
- Ne pas afficher le signal de complétion. Compléter les sections manquantes en relisant les documents source (Discovery, BRD, FRD).
1
+ ---
2
+ description: Phase 6 - Development prompt generation (ULTRATHINK)
3
+ agent: ba-handoff
4
+ model: opus
5
+ ---
6
+
7
+ # Phase 6: Handoff Développement
8
+
9
+ > **Modèle:** OPUS (génération prompt one-shot, zéro ambiguïté)
10
+ > **Coût estimé:** ~$0.35 (one-shot) / ~$1.00-2.50 (avec ralph-loop)
11
+ > **Prérequis:** validation.json avec status "APPROVED"
12
+
13
+ ---
14
+
15
+ ## RALPH-LOOP INTEGRATION (OPTIONNEL)
16
+
17
+ ```
18
+ ╔══════════════════════════════════════════════════════════════════════════════╗
19
+ ║ UTILISATION AVEC RALPH-LOOP POUR GARANTIE DE COMPLÉTUDE ║
20
+ ╠══════════════════════════════════════════════════════════════════════════════╣
21
+ ║ ║
22
+ ║ /ralph-loop "/business-analyse:6-handoff FEAT-XXX" ║
23
+ ║ --completion-promise "COMPLETE" --max-iterations 10 ║
24
+ ║ ║
25
+ ║ FICHIERS RALPH (créés automatiquement): ║
26
+ ║ ├── prd.json → Sections du handoff avec statut ║
27
+ ║ └── progress.txt → Mémoire des sections générées ║
28
+ ║ ║
29
+ ║ PROCESSUS PAR ITERATION: ║
30
+ ║ 1. Lire prd.json → Trouver prochaine section "passes": false ║
31
+ ║ 2. Lire progress.txt → Voir sections déjà générées ║
32
+ ║ 3. Générer UNE section du handoff ║
33
+ ║ 4. Mettre à jour 4-development-handoff.md ║
34
+ ║ 5. Mettre à jour prd.json → "passes": true ║
35
+ ║ 6. Ajouter résumé section à progress.txt ║
36
+ ║ 7. Si TOUTES sections "passes": true → <promise>COMPLETE</promise> ║
37
+ ║ ║
38
+ ║ SIGNAL DE FIN: <promise>COMPLETE</promise> ║
39
+ ║ ║
40
+ ╚══════════════════════════════════════════════════════════════════════════════╝
41
+ ```
42
+
43
+ ### Structure prd.json pour Handoff
44
+
45
+ ```json
46
+ {
47
+ "feature_id": "FEAT-XXX",
48
+ "phase": "handoff",
49
+ "userStories": [
50
+ { "id": "1", "title": "Section 1: Header et Contexte", "passes": false },
51
+ { "id": "2", "title": "Section 2: Entités Domain", "passes": false },
52
+ { "id": "3", "title": "Section 3: Configuration EF Core", "passes": false },
53
+ { "id": "4", "title": "Section 4: Commands/Queries Application", "passes": false },
54
+ { "id": "5", "title": "Section 5: Endpoints API avec permissions", "passes": false },
55
+ { "id": "6", "title": "Section 6: Service API Frontend", "passes": false },
56
+ { "id": "7", "title": "Section 7: Pages Frontend", "passes": false },
57
+ { "id": "8", "title": "Section 8: i18n (4 langues)", "passes": false },
58
+ { "id": "9", "title": "Section 9: Intégrations SmartStack", "passes": false },
59
+ { "id": "10", "title": "Section 10: Checklist validation", "passes": false },
60
+ { "id": "11", "title": "Validation: aucun TBD/? restant", "passes": false }
61
+ ]
62
+ }
63
+ ```
64
+
65
+ ---
66
+
67
+ ## OBJECTIF
68
+
69
+ ```
70
+ ╔══════════════════════════════════════════════════════════════════════════════╗
71
+ ║ GÉNÉRER UN PROMPT AUTONOME POUR IMPLÉMENTATION ONE-SHOT ║
72
+ ╠══════════════════════════════════════════════════════════════════════════════╣
73
+ ║ ║
74
+ ║ Le handoff est un document AUTONOME qui permet au développeur Claude ║
75
+ ║ d'implémenter la feature SANS poser de questions. ║
76
+ ║ ║
77
+ ║ EXIGENCES: ║
78
+ ║ • Zéro ambiguïté sur les spécifications ║
79
+ ║ • Instructions EXPLORE pour découvrir les patterns existants ║
80
+ ║ • Checklist complète de validation ║
81
+ ║ • Permissions explicites avec paths complets ║
82
+ ║ ║
83
+ ║ USAGE: /implement {FEATURE_ID} ║
84
+ ║ ║
85
+ ╚══════════════════════════════════════════════════════════════════════════════╝
86
+ ```
87
+
88
+ ---
89
+
90
+ ## STEP 1: Vérifier la validation
91
+
92
+ ```bash
93
+ FEATURE_ID=$1
94
+ FEATURE_DIR=$(find .business-analyse -type d -name "${FEATURE_ID}*" | head -1)
95
+ VALIDATION_FILE="$FEATURE_DIR/validation.json"
96
+
97
+ if [ ! -f "$VALIDATION_FILE" ]; then
98
+ echo "❌ ERREUR: validation.json non trouvé"
99
+ echo " Lancez d'abord: /business-analyse:5-validate $FEATURE_ID"
100
+ exit 1
101
+ fi
102
+
103
+ # Vérifier le status
104
+ STATUS=$(grep -oP '"status":\s*"\K[^"]+' "$VALIDATION_FILE")
105
+
106
+ if [ "$STATUS" != "APPROVED" ]; then
107
+ echo "❌ ERREUR: Validation non approuvée (status: $STATUS)"
108
+ echo " Les spécifications doivent être validées avant le handoff."
109
+ exit 1
110
+ fi
111
+
112
+ echo "✅ Validation approuvée - Génération du handoff..."
113
+ ```
114
+
115
+ ---
116
+
117
+ ## STEP 2: Charger tous les documents
118
+
119
+ ```bash
120
+ DISCOVERY=$(cat "$FEATURE_DIR/1-discovery.md")
121
+ BRD=$(cat "$FEATURE_DIR/2-business-requirements.md")
122
+ FRD=$(cat "$FEATURE_DIR/3-functional-specification.md")
123
+
124
+ # Extraire les informations clés
125
+ APPLICATION=$(echo $FEATURE_DIR | grep -oP 'business/\K[^/]+')
126
+ MODULE=$(echo $FEATURE_DIR | grep -oP 'modules/\K[^/]+')
127
+ FEATURE_NAME=$(echo $FEATURE_DIR | grep -oP 'FEAT-\d+-\K.*')
128
+ ```
129
+
130
+ ---
131
+
132
+ ## STEP 3: Génération du handoff
133
+
134
+ ```bash
135
+ HANDOFF_FILE="$FEATURE_DIR/4-development-handoff.md"
136
+ ```
137
+
138
+ ### Template 4-development-handoff.md
139
+
140
+ ```markdown
141
+ # Development Handoff - {FEATURE_ID} {Feature Name}
142
+
143
+ > **Module:** business/{application}/{module}
144
+ > **Version:** 1.0 (locked)
145
+ > **Specs validées:** FRD v1.0
146
+ > **Implémentation:** `/implement {FEATURE_ID}`
147
+
148
+ ---
149
+
150
+ ## INSTRUCTIONS DÉVELOPPEUR CLAUDE
151
+
152
+ Ce document est un **prompt autonome** pour Claude Code.
153
+ Exécutez la commande suivante pour implémenter cette feature:
154
+
155
+ ```bash
156
+ /implement {FEATURE_ID}
157
+ ```
158
+
159
+ **Options disponibles:**
160
+ - `--phase=1` : Backend seulement (Domain + Application + Infrastructure)
161
+ - `--phase=2` : Frontend seulement (Pages + Services + i18n)
162
+ - `--phase=3` : Tests seulement (Unit + Integration + Postman)
163
+ - `--phase=4` : Documentation HTML seulement
164
+
165
+ ---
166
+
167
+ ## 1. CONTEXTE RAPIDE
168
+
169
+ | Attribut | Valeur |
170
+ |----------|--------|
171
+ | Feature ID | {FEATURE_ID} |
172
+ | Module | business/{application}/{module} |
173
+ | Permission base | `business.{application}.{module}` |
174
+ | Complexité | {Simple/Moyenne/Complexe} |
175
+ | Entités | {N} à créer |
176
+ | Endpoints | {N} à implémenter |
177
+ | Pages | {N} à créer |
178
+
179
+ ---
180
+
181
+ ## 2. [EXPLORE] DÉCOUVERTE DES PATTERNS
182
+
183
+ **AVANT de coder, explorer ces fichiers pour comprendre les patterns existants:**
184
+
185
+ ### 2.1 Backend - Patterns à suivre
186
+
187
+ ```
188
+ DOMAIN:
189
+ → src/SmartStack.Domain/Entities/
190
+ Explorer: Structure des entités existantes, BaseEntity, interfaces
191
+ Pattern: Propriétés, méthodes métier, validations
192
+
193
+ → src/SmartStack.Domain/Constants/
194
+ Explorer: Permissions.cs pour voir le format des constantes
195
+ Pattern: public static class {Module} { public const string View = "..."; }
196
+
197
+ APPLICATION:
198
+ → src/SmartStack.Application/Features/
199
+ Explorer: Structure CQRS (Commands/Queries/Handlers)
200
+ Pattern: Un dossier par feature, DTOs séparés
201
+
202
+ → src/SmartStack.Application/Common/
203
+ Explorer: Interfaces, comportements, validators
204
+ Pattern: IRepository, IUnitOfWork, FluentValidation
205
+
206
+ INFRASTRUCTURE:
207
+ → src/SmartStack.Infrastructure/Persistence/Configurations/
208
+ Explorer: EntityTypeConfiguration existantes
209
+ Pattern: HasData pour seed, relations, indexes
210
+
211
+ → src/SmartStack.Infrastructure/Persistence/Configurations/Authorization/
212
+ Explorer: PermissionConfiguration.cs pour seed permissions
213
+ Pattern: HasData avec GUID aléatoires
214
+
215
+ API:
216
+ → src/SmartStack.Api/Controllers/
217
+ Explorer: Structure des controllers Business area
218
+ Pattern: [RequirePermission], [ProducesResponseType], routes
219
+
220
+ → src/SmartStack.Api/Areas/Business/
221
+ Explorer: Controllers existants dans l'area Business
222
+ ```
223
+
224
+ ### 2.2 Frontend - Patterns à suivre
225
+
226
+ ```
227
+ PAGES:
228
+ → web/smartstack-web/src/pages/business/
229
+ Explorer: Structure des pages existantes
230
+ Pattern: Liste + Détail + Modal, hooks customs
231
+
232
+ → web/smartstack-web/src/pages/admin/
233
+ Explorer: RolesPage, UsersPage pour patterns CRUD
234
+ Pattern: DataTable, filtres, modals
235
+
236
+ COMPOSANTS:
237
+ → web/smartstack-web/src/components/
238
+ Explorer: Composants réutilisables
239
+ Pattern: Button, Modal, DataTable, Form
240
+
241
+ SERVICES:
242
+ → web/smartstack-web/src/services/api/
243
+ Explorer: Services API existants
244
+ Pattern: apiClient, endpoints, types
245
+
246
+ I18N:
247
+ → web/smartstack-web/src/i18n/locales/fr/
248
+ Explorer: Structure des fichiers de traduction
249
+ Pattern: Clés hiérarchiques, pluriels
250
+
251
+ HOOKS:
252
+ → web/smartstack-web/src/hooks/
253
+ Explorer: Hooks customs existants
254
+ Pattern: useApi, usePermission, useToast
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 3. ENTITÉ(S) À CRÉER
260
+
261
+ ### 3.1 {EntityName}
262
+
263
+ **Description:** {description métier de l'entité}
264
+
265
+ **Attributs:**
266
+
267
+ | Attribut | Description métier | Obligatoire | Validation | Règle BR |
268
+ |----------|-------------------|-------------|------------|----------|
269
+ | Id | Identifiant unique | Oui | GUID aléatoire | - |
270
+ | {attr1} | {description} | Oui | {règle} | BR-001 |
271
+ | {attr2} | {description} | Non | {règle} | - |
272
+ | {attr3} | {description} | Oui | {règle} | BR-002 |
273
+ | Status | État de l'entité | Oui | Enum | - |
274
+ | CreatedAt | Date création | Oui | Auto | - |
275
+ | CreatedBy | Créateur | Oui | Auto (current user) | - |
276
+ | UpdatedAt | Date modification | Non | Auto | - |
277
+ | UpdatedBy | Modificateur | Non | Auto (current user) | - |
278
+
279
+ **Relations:**
280
+
281
+ | Relation | Type | Entité cible | Navigation |
282
+ |----------|------|--------------|------------|
283
+ | {rel1} | 1:N | {Entity} | Collection |
284
+ | {rel2} | N:1 | {Entity} | Reference |
285
+
286
+ **Status Enum:**
287
+
288
+ | Valeur | Description | Transitions possibles |
289
+ |--------|-------------|----------------------|
290
+ | Draft | Brouillon | → Active |
291
+ | Active | Actif | → Inactive, Archived |
292
+ | Inactive | Désactivé | → Active, Archived |
293
+ | Archived | Archivé | (terminal) |
294
+
295
+ ---
296
+
297
+ ## 4. PERMISSIONS À IMPLÉMENTER
298
+
299
+ ### 4.1 Constantes (Permissions.cs)
300
+
301
+ **Ajouter dans `src/SmartStack.Application/Common/Constants/Permissions.cs`:**
302
+
303
+ ```
304
+ Emplacement: public static class Business > public static class {Module}
305
+
306
+ Paths à créer:
307
+ • business.{application}.{module}.read
308
+ • business.{application}.{module}.create
309
+ • business.{application}.{module}.update
310
+ • business.{application}.{module}.delete
311
+ ```
312
+
313
+ ### 4.2 Seed EF Core (PermissionConfiguration.cs)
314
+
315
+ **Ajouter dans `PermissionConfiguration.cs` avec HasData:**
316
+
317
+ | Permission Path | Description | ModuleId |
318
+ |-----------------|-------------|----------|
319
+ | `business.{app}.{module}.read` | View {module} data | {moduleId} |
320
+ | `business.{app}.{module}.create` | Create {module} entries | {moduleId} |
321
+ | `business.{app}.{module}.update` | Modify {module} entries | {moduleId} |
322
+ | `business.{app}.{module}.delete` | Delete {module} entries | {moduleId} |
323
+
324
+ **⚠️ IMPORTANT:** Utiliser des GUIDs ALÉATOIRES (pas de patterns prévisibles)
325
+
326
+ ### 4.3 Matrice Rôle-Permission
327
+
328
+ | Permission | SuperAdmin | Admin | Manager | User | ReadOnly |
329
+ |------------|------------|-------|---------|------|----------|
330
+ | `.read` | ✅ | ✅ | ✅ | ✅ | ✅ |
331
+ | `.create` | ✅ | ✅ | ✅ | ❌ | ❌ |
332
+ | `.update` | ✅ | ✅ | ✅ | ❌ | ❌ |
333
+ | `.delete` | ✅ | ✅ | ❌ | ❌ | ❌ |
334
+
335
+ ---
336
+
337
+ ## 5. ENDPOINTS API
338
+
339
+ | Endpoint | Méthode | Permission | Body | Response |
340
+ |----------|---------|------------|------|----------|
341
+ | `/api/business/{module}` | GET | `.read` | Query params | 200: Liste paginée |
342
+ | `/api/business/{module}` | POST | `.create` | CreateDto | 201: Entité créée |
343
+ | `/api/business/{module}/{id}` | GET | `.read` | - | 200: Entité |
344
+ | `/api/business/{module}/{id}` | PUT | `.update` | UpdateDto | 200: Entité modifiée |
345
+ | `/api/business/{module}/{id}` | DELETE | `.delete` | - | 204: No Content |
346
+ | `/api/business/{module}/{id}/activate` | PATCH | `.update` | - | 204: Activé |
347
+ | `/api/business/{module}/{id}/deactivate` | PATCH | `.update` | - | 204: Désactivé |
348
+
349
+ ### 5.1 Query Parameters (GET liste)
350
+
351
+ | Param | Type | Default | Description |
352
+ |-------|------|---------|-------------|
353
+ | page | int | 1 | Numéro de page |
354
+ | pageSize | int | 10 | Items par page (max 100) |
355
+ | sortBy | string | createdAt | Champ de tri |
356
+ | sortOrder | string | desc | asc/desc |
357
+ | search | string | - | Recherche textuelle |
358
+ | status | string | - | Filtre par status |
359
+
360
+ ### 5.2 CreateDto
361
+
362
+ | Champ | Type | Requis | Validation |
363
+ |-------|------|--------|------------|
364
+ | {field1} | string | Oui | MaxLength(100) |
365
+ | {field2} | string | Oui | Enum values |
366
+ | {field3} | string | Non | MaxLength(500) |
367
+
368
+ ### 5.3 UpdateDto
369
+
370
+ Identique à CreateDto.
371
+
372
+ ### 5.4 ResponseDto
373
+
374
+ | Champ | Type | Description |
375
+ |-------|------|-------------|
376
+ | id | Guid | Identifiant |
377
+ | {field1} | string | {description} |
378
+ | {field2} | string | {description} |
379
+ | status | string | Status actuel |
380
+ | createdAt | DateTime | Date création |
381
+ | updatedAt | DateTime? | Date modification |
382
+
383
+ ---
384
+
385
+ ## 6. RÈGLES MÉTIER À IMPLÉMENTER
386
+
387
+ | BR-ID | Règle | Où implémenter |
388
+ |-------|-------|----------------|
389
+ | BR-001 | {règle} | Domain Entity / Validator |
390
+ | BR-002 | {règle} | Command Handler |
391
+ | BR-003 | {règle} | Domain Service |
392
+
393
+ ### 6.1 Détail BR-001
394
+
395
+ **Règle:** {description complète}
396
+
397
+ **Implémentation:**
398
+ ```
399
+ SI {condition}
400
+ ALORS {action}
401
+ SINON {erreur avec message}
402
+ ```
403
+
404
+ **Message d'erreur:** `{module}.errors.br001Violation`
405
+
406
+ ---
407
+
408
+ ## 7. PAGES FRONTEND
409
+
410
+ ### 7.1 Liste ({Module}Page.tsx)
411
+
412
+ **Route:** `/business/{application}/{module}`
413
+
414
+ **Composants requis:**
415
+ - Header avec titre + bouton Nouveau
416
+ - Filtres (status, recherche, dates)
417
+ - DataTable avec pagination
418
+ - Actions par ligne (view, edit, delete)
419
+ - Modal création/édition
420
+
421
+ **Permissions UI:**
422
+ - Bouton Nouveau: visible si `.create`
423
+ - Bouton Edit: visible si `.update`
424
+ - Bouton Delete: visible si `.delete`
425
+
426
+ ### 7.2 Détail ({Module}DetailPage.tsx)
427
+
428
+ **Route:** `/business/{application}/{module}/:id`
429
+
430
+ **Composants:**
431
+ - Breadcrumb
432
+ - Card informations principales
433
+ - Actions (edit, delete, activate/deactivate)
434
+ - Historique des modifications (si audit)
435
+
436
+ ---
437
+
438
+ ## 8. INTERNATIONALISATION (i18n)
439
+
440
+ **Fichiers à créer/modifier:**
441
+
442
+ | Fichier | Clés à ajouter |
443
+ |---------|----------------|
444
+ | `fr/{module}.json` | Toutes les clés |
445
+ | `en/{module}.json` | Toutes les clés |
446
+ | `it/{module}.json` | Toutes les clés |
447
+ | `de/{module}.json` | Toutes les clés |
448
+
449
+ **Structure des clés:**
450
+
451
+ ```json
452
+ {
453
+ "{module}": {
454
+ "title": "{Module Name}",
455
+ "subtitle": "{Description}",
456
+ "fields": {
457
+ "{field1}": "{Label}",
458
+ "{field2}": "{Label}"
459
+ },
460
+ "actions": {
461
+ "create": "Nouveau",
462
+ "edit": "Modifier",
463
+ "delete": "Supprimer"
464
+ },
465
+ "messages": {
466
+ "created": "{Entity} créé avec succès",
467
+ "updated": "{Entity} modifié avec succès",
468
+ "deleted": "{Entity} supprimé avec succès"
469
+ },
470
+ "errors": {
471
+ "notFound": "{Entity} non trouvé",
472
+ "validation": "Données invalides"
473
+ }
474
+ }
475
+ }
476
+ ```
477
+
478
+ ---
479
+
480
+ ## 9. INTÉGRATIONS SMARTSTACK ⭐
481
+
482
+ > **Importé depuis FRD Section 9 - Skills à exécuter automatiquement**
483
+
484
+ ### 9.1 Notifications (si requis)
485
+
486
+ | Événement | NotificationType | Destinataire | Message |
487
+ |-----------|------------------|--------------|---------|
488
+ | {Entity}Created | `{Entity}Created` | Créateur | `{module}.notifications.created` |
489
+ | {Entity}Updated | `{Entity}Updated` | Assigné | `{module}.notifications.updated` |
490
+ | {Entity}Assigned | `{Entity}Assigned` | Nouvel assigné | `{module}.notifications.assigned` |
491
+
492
+ **Skill:** `/notification add`
493
+ **Service à modifier:** `{Entity}Service.cs`
494
+
495
+ **Template intégration:**
496
+ ```csharp
497
+ await _notificationService.SendNotificationAsync(
498
+ userId: {destinataire}.Id,
499
+ type: NotificationType.{Entity}Created,
500
+ title: _localizer["{module}.notifications.created.title"],
501
+ message: _localizer["{module}.notifications.created.message", entity.Name],
502
+ relatedEntityType: nameof({Entity}),
503
+ relatedEntityId: entity.Id,
504
+ actionUrl: $"/{module}/{entity.Id}",
505
+ cancellationToken: ct);
506
+ ```
507
+
508
+ ### 9.2 Workflows (si requis)
509
+
510
+ | Workflow Code | Trigger | Steps | Variables |
511
+ |---------------|---------|-------|-----------|
512
+ | `{workflow-code}` | `{entity}.created` | SendEmail, Wait | entityId, entityName, userEmail |
513
+
514
+ **Skill:** `/workflow create`
515
+
516
+ **Template déclenchement:**
517
+ ```csharp
518
+ await _workflowService.TriggerAsync(
519
+ "{entity}.created",
520
+ new Dictionary<string, object>
521
+ {
522
+ ["entityId"] = entity.Id,
523
+ ["entityName"] = entity.Name,
524
+ ["userEmail"] = _currentUser.Email
525
+ },
526
+ language: _currentUser.Language ?? "fr",
527
+ cancellationToken: ct);
528
+ ```
529
+
530
+ ### 9.3 Assistance IA (si requis)
531
+
532
+ | Prompt Code | Fonction | Input | Output | Schema |
533
+ |-------------|----------|-------|--------|--------|
534
+ | `{prompt-code}` | {génération/classification} | {context} | {format} | {schema} |
535
+
536
+ **Skill:** `/ai-prompt create`
537
+
538
+ **Template intégration:**
539
+ ```csharp
540
+ var result = await _aiCompletionService.CompleteAsync<{OutputType}>(
541
+ "{prompt-code}",
542
+ new Dictionary<string, object>
543
+ {
544
+ ["context"] = context,
545
+ ["entity"] = entity
546
+ },
547
+ cancellationToken: ct);
548
+ ```
549
+
550
+ ### 9.4 Résumé des Skills à exécuter
551
+
552
+ | Intégration | Requis | Skill | Moment d'exécution |
553
+ |-------------|--------|-------|-------------------|
554
+ | Notifications | {oui/non} | `/notification add` | Après service backend |
555
+ | Workflows | {oui/non} | `/workflow create` | Après triggers définis |
556
+ | IA | {oui/non} | `/ai-prompt create` | Pendant service backend |
557
+
558
+ **⚠️ IMPORTANT:** Ces skills sont exécutés automatiquement par `/implement` si requis=oui.
559
+
560
+ ---
561
+
562
+ ## 10. TESTS REQUIS
563
+
564
+ ### 10.1 Tests unitaires
565
+
566
+ - [ ] Entity validation rules
567
+ - [ ] Command validators (FluentValidation)
568
+ - [ ] Business rules in handlers
569
+
570
+ ### 10.2 Tests d'intégration
571
+
572
+ - [ ] GET /api/business/{module} - 200 OK
573
+ - [ ] GET /api/business/{module}/{id} - 200 OK
574
+ - [ ] GET /api/business/{module}/{id} - 404 Not Found
575
+ - [ ] POST /api/business/{module} - 201 Created
576
+ - [ ] POST /api/business/{module} - 400 Bad Request (validation)
577
+ - [ ] PUT /api/business/{module}/{id} - 200 OK
578
+ - [ ] DELETE /api/business/{module}/{id} - 204 No Content
579
+
580
+ ### 10.3 Tests de permission
581
+
582
+ - [ ] GET sans permission - 403 Forbidden
583
+ - [ ] POST avec ReadOnly - 403 Forbidden
584
+ - [ ] DELETE avec User - 403 Forbidden
585
+
586
+ ### 10.4 Collection Postman
587
+
588
+ Générer automatiquement avec `/controller:create`
589
+
590
+ ---
591
+
592
+ ## 11. CHECKLIST POST-IMPLÉMENTATION
593
+
594
+ ### Backend
595
+
596
+ - [ ] Entity créée dans Domain
597
+ - [ ] Configuration EF Core créée
598
+ - [ ] Migration EF Core créée (`/efcore:migration`)
599
+ - [ ] Commands/Queries créés dans Application
600
+ - [ ] Validators FluentValidation créés
601
+ - [ ] Controller créé dans Api/Areas/Business
602
+ - [ ] Permissions ajoutées dans Permissions.cs
603
+ - [ ] Permissions seedées dans PermissionConfiguration.cs
604
+ - [ ] Build backend OK
605
+
606
+ ### Frontend
607
+
608
+ - [ ] Page liste créée
609
+ - [ ] Page détail créée (si applicable)
610
+ - [ ] Service API créé
611
+ - [ ] i18n complet (4 langues)
612
+ - [ ] Routes ajoutées dans App.tsx
613
+ - [ ] Build frontend OK
614
+
615
+ ### Tests
616
+
617
+ - [ ] Tests unitaires passent
618
+ - [ ] Tests intégration passent
619
+ - [ ] Collection Postman créée
620
+
621
+ ### Documentation
622
+
623
+ - [ ] `/business-analyse:7-doc-html {FEATURE_ID}` exécuté
624
+
625
+ ### Intégrations SmartStack
626
+
627
+ - [ ] Notifications ajoutées (si requis)
628
+ - [ ] Workflows créés (si requis)
629
+ - [ ] Prompts IA créés (si requis)
630
+ - [ ] Hooks frontend SignalR (si notifications)
631
+
632
+ ---
633
+
634
+ ## 12. COMMANDE D'IMPLÉMENTATION
635
+
636
+ ```bash
637
+ # Implémentation complète
638
+ /implement {FEATURE_ID}
639
+
640
+ # Par phase
641
+ /implement {FEATURE_ID} --phase=1 # Backend
642
+ /implement {FEATURE_ID} --phase=2 # Frontend
643
+ /implement {FEATURE_ID} --phase=3 # Tests
644
+ /implement {FEATURE_ID} --phase=4 # Documentation HTML
645
+ ```
646
+
647
+ ---
648
+
649
+ ## Historique des versions
650
+
651
+ | Version | Date | Auteur | Modifications |
652
+ |---------|------|--------|---------------|
653
+ | 1.0 | {date} | BA (Opus) | Création initiale (locked) |
654
+ ```
655
+
656
+ ---
657
+
658
+ ## STEP 4: Verrouillage des documents
659
+
660
+ ```bash
661
+ # Marquer les documents comme verrouillés
662
+ for doc in "1-discovery.md" "2-business-requirements.md" "3-functional-specification.md"; do
663
+ if [ -f "$FEATURE_DIR/$doc" ]; then
664
+ # Ajouter un header de verrouillage
665
+ sed -i "1s/^/<!-- LOCKED: v1.0 - Validated $(date -I) -->\n/" "$FEATURE_DIR/$doc"
666
+ fi
667
+ done
668
+ ```
669
+
670
+ ---
671
+
672
+ ## STEP 5: Vérification de complétude (RALPH-LOOP)
673
+
674
+ Avant de terminer, vérifier que TOUS les critères sont remplis:
675
+
676
+ ```
677
+ CHECKLIST COMPLÉTUDE HANDOFF:
678
+ □ Section 1 (Contexte) - Feature ID, Module, Complexité renseignés
679
+ □ Section 2 (Explore) - Tous les patterns backend/frontend listés
680
+ □ Section 3 (Entités) - Toutes les entités du FRD avec attributs complets
681
+ □ Section 4 (Permissions) - Paths explicites, matrice rôles complète
682
+ □ Section 5 (Endpoints) - Tous les UC couverts, DTOs définis
683
+ □ Section 6 (Règles métier) - Tous les BR référencés avec implémentation
684
+ □ Section 7 (Pages) - Routes, composants, permissions UI
685
+ □ Section 8 (i18n) - Structure clés pour 4 langues
686
+ □ Section 9 (Intégrations) - Notifications/Workflows/IA spécifiés (oui/non)
687
+ □ Section 10 (Tests) - Checklist unitaires + intégration
688
+ □ Section 11 (Checklist) - Tous les items listés (incluant intégrations)
689
+ □ Section 12 (Commande) - /implement documenté
690
+ □ Aucun marqueur "TBD", "?", "{...}" restant dans le document
691
+ ```
692
+
693
+ ---
694
+
695
+ ## STEP 6: Résumé
696
+
697
+ **SI TOUS LES CRITÈRES SONT REMPLIS:**
698
+
699
+ ```
700
+ ================================================================================
701
+ HANDOFF GÉNÉRÉ - {FEATURE_ID}
702
+ ================================================================================
703
+
704
+ DOCUMENT: {FEATURE_DIR}/4-development-handoff.md
705
+ MODÈLE UTILISÉ: Opus avec ULTRATHINK
706
+ STATUS: Prêt pour implémentation
707
+
708
+ CONTENU:
709
+ • Instructions EXPLORE complètes
710
+ • {N} entité(s) spécifiée(s)
711
+ • {N} endpoint(s) API
712
+ • {N} permission(s) définies
713
+ • {N} page(s) frontend
714
+ • {N} intégration(s) SmartStack (Notif/Workflow/IA)
715
+ • Checklist de 25+ points
716
+
717
+ DOCUMENTS VERROUILLÉS:
718
+ ✓ 1-discovery.md v1.0
719
+ ✓ 2-business-requirements.md v1.0
720
+ ✓ 3-functional-specification.md v1.0
721
+ ✓ 4-development-handoff.md v1.0
722
+
723
+ ================================================================================
724
+ PROCHAINE ÉTAPE
725
+ ================================================================================
726
+
727
+ Lancez l'implémentation:
728
+
729
+ /implement {FEATURE_ID}
730
+
731
+ Ou avec ralph-loop pour one-shot complet:
732
+
733
+ /ralph-loop "/implement {FEATURE_ID}" \
734
+ --completion-promise "FEATURE_COMPLETE" \
735
+ --max-iterations 25
736
+
737
+ ================================================================================
738
+
739
+ <promise>COMPLETE</promise>
740
+
741
+ Contact support: support@atlshub.ch
742
+ ```
743
+
744
+ **SI DES CRITÈRES MANQUENT:**
745
+
746
+ Ne pas afficher le signal de complétion. Compléter les sections manquantes en relisant les documents source (Discovery, BRD, FRD).