@atlashub/smartstack-cli 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,179 +139,231 @@ User selects which agent to use in next step.
139
139
 
140
140
  ## 4. Map Specification to Files
141
141
 
142
- ### 4.1 Backend File Mapping
142
+ > **IMPORTANT :** Cette section génère `handoff.filesToCreate` comme un **objet structuré** avec 7 catégories.
143
+ > Chaque fichier est un objet `{path, type, linkedFRs, linkedUCs}`. **PAS de texte libre.**
144
+ > Les chemins doivent utiliser le namespace du projet (lire `.smartstack/config.json.baseNamespace`).
143
145
 
144
- For each entity in specification.entities[], document implementation files:
146
+ ### 4.1 Domain File Mapping
147
+
148
+ For each entity in `specification.entities[]`, create domain files:
145
149
 
146
150
  ```json
147
151
  {
148
- "fileMapping": {
149
- "backend": [
152
+ "filesToCreate": {
153
+ "domain": [
150
154
  {
151
- "entity": "Order",
152
- "files": [
153
- {
154
- "path": "src/Domain/Entities/Order.cs",
155
- "type": "Entity",
156
- "linkedFRs": ["FR-001", "FR-002", "FR-003"]
157
- },
158
- {
159
- "path": "src/Application/Services/OrderService.cs",
160
- "type": "Service",
161
- "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"]
162
- },
163
- {
164
- "path": "src/API/Controllers/OrdersController.cs",
165
- "type": "ApiController",
166
- "endpoints": 6,
167
- "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004", "UC-005", "UC-006"]
168
- },
169
- {
170
- "path": "src/Infrastructure/Repositories/OrderRepository.cs",
171
- "type": "Repository",
172
- "operations": ["GetAll", "GetById", "Create", "Update", "Delete"]
173
- },
174
- {
175
- "path": "src/Infrastructure/Data/Migrations/AddOrderTable.cs",
176
- "type": "Migration",
177
- "tables": ["Order", "OrderLine"]
178
- },
179
- {
180
- "path": "src/Tests/Application/OrderServiceTests.cs",
181
- "type": "UnitTests",
182
- "testCount": 12
183
- },
184
- {
185
- "path": "src/Tests/Integration/OrderApiTests.cs",
186
- "type": "IntegrationTests",
187
- "testCount": 8
188
- }
189
- ]
155
+ "path": "src/Domain/Entities/Order.cs",
156
+ "type": "Entity",
157
+ "linkedFRs": ["FR-001", "FR-002", "FR-003"]
158
+ },
159
+ {
160
+ "path": "src/Domain/Entities/OrderStatus.cs",
161
+ "type": "Enum",
162
+ "linkedFRs": ["FR-001"]
163
+ }
164
+ ]
165
+ }
166
+ }
167
+ ```
168
+
169
+ ### 4.2 Application File Mapping
170
+
171
+ ```json
172
+ {
173
+ "filesToCreate": {
174
+ "application": [
175
+ {
176
+ "path": "src/Application/Services/OrderService.cs",
177
+ "type": "Service",
178
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"],
179
+ "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004"]
180
+ },
181
+ {
182
+ "path": "src/Application/DTOs/OrderDto.cs",
183
+ "type": "DTO",
184
+ "linkedFRs": ["FR-001"]
185
+ }
186
+ ]
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### 4.3 Infrastructure File Mapping
192
+
193
+ ```json
194
+ {
195
+ "filesToCreate": {
196
+ "infrastructure": [
197
+ {
198
+ "path": "src/Infrastructure/Repositories/OrderRepository.cs",
199
+ "type": "Repository",
200
+ "linkedFRs": ["FR-001"]
201
+ },
202
+ {
203
+ "path": "src/Infrastructure/Data/Migrations/AddOrderTable.cs",
204
+ "type": "Migration",
205
+ "linkedFRs": ["FR-001"]
206
+ }
207
+ ]
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### 4.4 API File Mapping
213
+
214
+ ```json
215
+ {
216
+ "filesToCreate": {
217
+ "api": [
218
+ {
219
+ "path": "src/API/Controllers/OrdersController.cs",
220
+ "type": "ApiController",
221
+ "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004", "UC-005", "UC-006"]
190
222
  }
191
223
  ]
192
224
  }
193
225
  }
194
226
  ```
195
227
 
196
- ### 4.2 Frontend File Mapping
228
+ ### 4.5 Frontend File Mapping
197
229
 
198
- For each use case in specification.useCases[], document UI files:
230
+ For each use case in `specification.useCases[]`, create UI files:
199
231
 
200
232
  ```json
201
233
  {
202
- "fileMapping": {
234
+ "filesToCreate": {
203
235
  "frontend": [
204
236
  {
205
- "useCase": "UC-001: List Orders",
206
- "files": [
207
- {
208
- "path": "src/pages/Orders/OrderListPage.tsx",
209
- "type": "Page",
210
- "linkedWireframe": "WF-001"
211
- },
212
- {
213
- "path": "src/components/Orders/OrderListTable.tsx",
214
- "type": "Component",
215
- "linkedFRs": ["FR-001"]
216
- },
217
- {
218
- "path": "src/components/Orders/OrderFilterBar.tsx",
219
- "type": "Component",
220
- "linkedFRs": ["FR-001"]
221
- },
222
- {
223
- "path": "src/services/api/OrdersApiClient.ts",
224
- "type": "ApiClient",
225
- "methods": ["getOrders", "searchOrders", "filterOrders"]
226
- },
227
- {
228
- "path": "src/stores/ordersSlice.ts",
229
- "type": "Redux Slice",
230
- "state": ["orders", "loading", "error", "pagination"]
231
- },
232
- {
233
- "path": "src/tests/pages/OrderListPage.test.tsx",
234
- "type": "ComponentTests",
235
- "testCount": 8
236
- }
237
- ]
237
+ "path": "src/pages/Orders/OrderListPage.tsx",
238
+ "type": "Page",
239
+ "linkedUCs": ["UC-001"],
240
+ "linkedFRs": ["FR-001"]
238
241
  },
239
242
  {
240
- "useCase": "UC-002: Create Order",
241
- "files": [
242
- {
243
- "path": "src/pages/Orders/CreateOrderPage.tsx",
244
- "type": "Page",
245
- "linkedWireframe": "WF-002"
246
- },
247
- {
248
- "path": "src/components/Orders/CreateOrderForm.tsx",
249
- "type": "Component",
250
- "linkedFRs": ["FR-002", "FR-003"]
251
- },
252
- {
253
- "path": "src/hooks/useOrderForm.ts",
254
- "type": "CustomHook",
255
- "linkedValidations": ["Validations for Order fields"]
256
- }
257
- ]
243
+ "path": "src/components/Orders/OrderListTable.tsx",
244
+ "type": "Component",
245
+ "linkedFRs": ["FR-001"]
246
+ },
247
+ {
248
+ "path": "src/components/Orders/CreateOrderForm.tsx",
249
+ "type": "Component",
250
+ "linkedFRs": ["FR-002", "FR-003"]
251
+ },
252
+ {
253
+ "path": "src/services/api/OrdersApiClient.ts",
254
+ "type": "ApiClient",
255
+ "linkedUCs": ["UC-001", "UC-002", "UC-003"]
256
+ },
257
+ {
258
+ "path": "src/stores/ordersSlice.ts",
259
+ "type": "ReduxSlice",
260
+ "linkedFRs": ["FR-001"]
258
261
  }
259
262
  ]
260
263
  }
261
264
  }
262
265
  ```
263
266
 
264
- ### 4.3 SeedData File Mapping
267
+ ### 4.6 SeedData File Mapping
265
268
 
266
- Map 5 mandatory SeedData tables to migration files:
269
+ > **OBLIGATOIRE : 2 catégories de SeedData**
270
+ > 1. **SeedData Core** (5 fichiers obligatoires) : navigation, permissions, rôles — dérivés de `specification.seedDataCore`
271
+ > 2. **SeedData Métier** (N fichiers) : tables de référence (Status, Priority, etc.) — dérivés de `specification.entities` et `specification.navigationHierarchy`
272
+
273
+ #### 4.6.1 SeedData Core (OBLIGATOIRE - 5 fichiers)
274
+
275
+ **Source :** `feature.json.specification.seedDataCore` (généré en step-02)
267
276
 
268
277
  ```json
269
278
  {
270
- "fileMapping": {
279
+ "filesToCreate": {
271
280
  "seedData": [
272
281
  {
273
- "table": "Module_Status",
274
- "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Status.cs",
275
- "rows": [
276
- {
277
- "id": 1,
278
- "code": "DRAFT",
279
- "displayName": "Draft",
280
- "description": "Order created but not submitted"
281
- },
282
- {
283
- "id": 2,
284
- "code": "SUBMITTED",
285
- "displayName": "Submitted for Review",
286
- "description": "Order awaiting manager approval"
287
- },
288
- {
289
- "id": 3,
290
- "code": "APPROVED",
291
- "displayName": "Approved",
292
- "description": "Order approved and ready for fulfillment"
293
- }
294
- ]
282
+ "path": "src/Infrastructure/Data/SeedData/NavigationModuleConfiguration.cs",
283
+ "type": "HasData",
284
+ "category": "core",
285
+ "source": "specification.seedDataCore.navigationModules",
286
+ "linkedFRs": []
295
287
  },
296
288
  {
297
- "table": "Module_Priority",
298
- "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Priority.cs",
299
- "rows": 3
289
+ "path": "src/Infrastructure/Data/SeedData/NavigationTranslationConfiguration.cs",
290
+ "type": "HasData",
291
+ "category": "core",
292
+ "source": "specification.seedDataCore.navigationTranslations",
293
+ "linkedFRs": []
294
+ },
295
+ {
296
+ "path": "src/Infrastructure/Data/SeedData/PermissionConfiguration.cs",
297
+ "type": "HasData",
298
+ "category": "core",
299
+ "source": "specification.seedDataCore.permissions",
300
+ "linkedFRs": []
300
301
  },
301
302
  {
302
- "table": "Module_Category",
303
- "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Category.cs",
304
- "rows": 8
303
+ "path": "src/Infrastructure/Data/SeedData/RolePermissionConfiguration.cs",
304
+ "type": "HasData",
305
+ "category": "core",
306
+ "source": "specification.seedDataCore.rolePermissions",
307
+ "linkedFRs": []
305
308
  },
306
309
  {
307
- "table": "Module_Type",
308
- "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Type.cs",
309
- "rows": 4
310
+ "path": "src/Application/Constants/Permissions.cs",
311
+ "type": "Constants",
312
+ "category": "core",
313
+ "source": "specification.seedDataCore.permissionConstants",
314
+ "linkedFRs": []
315
+ }
316
+ ]
317
+ }
318
+ }
319
+ ```
320
+
321
+ > **CRITIQUE :** Sans ces 5 fichiers, le module sera invisible dans l'application (erreur 403).
322
+ > Le contenu de chaque fichier doit correspondre EXACTEMENT aux données dans `specification.seedDataCore`.
323
+
324
+ #### 4.6.2 SeedData Métier
325
+
326
+ Map mandatory SeedData tables from `specification.navigationHierarchy.seedDataRequired`:
327
+
328
+ ```json
329
+ {
330
+ "filesToCreate": {
331
+ "seedData": [
332
+ {
333
+ "path": "src/Infrastructure/Data/SeedData/OrderStatusConfiguration.cs",
334
+ "type": "HasData",
335
+ "category": "business",
336
+ "source": "specification.navigationHierarchy.seedDataRequired[0]",
337
+ "linkedFRs": ["FR-001"],
338
+ "rows": 5
310
339
  },
311
340
  {
312
- "table": "Module_Department",
313
- "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Department.cs",
314
- "rows": 6
341
+ "path": "src/Infrastructure/Data/SeedData/OrderPriorityConfiguration.cs",
342
+ "type": "HasData",
343
+ "category": "business",
344
+ "linkedFRs": [],
345
+ "rows": 3
346
+ }
347
+ ]
348
+ }
349
+ }
350
+ ```
351
+
352
+ ### 4.7 Tests File Mapping
353
+
354
+ ```json
355
+ {
356
+ "filesToCreate": {
357
+ "tests": [
358
+ {
359
+ "path": "src/Tests/Application/OrderServiceTests.cs",
360
+ "type": "UnitTests",
361
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"]
362
+ },
363
+ {
364
+ "path": "src/Tests/Integration/OrderApiTests.cs",
365
+ "type": "IntegrationTests",
366
+ "linkedUCs": ["UC-001", "UC-002", "UC-003"]
315
367
  }
316
368
  ]
317
369
  }
@@ -483,11 +535,15 @@ For task breakdown:
483
535
 
484
536
  ### 6.1 BR Implementation Mapping
485
537
 
486
- For each business rule, specify where it will be validated:
538
+ > **IMPORTANT :** Générer `handoff.brToCodeMapping[]` (pas `businessRuleMappings`).
539
+ > Dériver depuis `feature.json.analysis.businessRules[]`.
540
+ > Chaque BR doit avoir au minimum 1 point d'implémentation. Format structuré obligatoire.
541
+
542
+ For each business rule in `analysis.businessRules[]`, specify where it will be validated:
487
543
 
488
544
  ```json
489
545
  {
490
- "businessRuleMappings": [
546
+ "brToCodeMapping": [
491
547
  {
492
548
  "ruleId": "BR-001",
493
549
  "title": "Order number must be unique",
@@ -569,9 +625,15 @@ Map validations to code layers:
569
625
 
570
626
  ## 7. Define API Endpoints
571
627
 
628
+ > **RÈGLE ABSOLUE :** COPIER EXACTEMENT les routes depuis `specification.apiEndpoints[]`.
629
+ > Ne PAS réinventer de routes ni changer le préfixe.
630
+ > Le `handoff.apiEndpointSummary` doit être un sous-ensemble de `specification.apiEndpoints` enrichi avec `linkedUC`.
631
+ > Si `specification.apiEndpoints` utilise `/api/freebike/fleetmanagement/...`, le handoff doit utiliser **exactement le même préfixe**.
632
+ > Ne JAMAIS substituer par `/api/v1/...` ou un autre format.
633
+
572
634
  ### 7.1 RESTful Route Mapping
573
635
 
574
- For each use case, define API endpoints:
636
+ **Source :** `specification.apiEndpoints[]` — copier les routes, enrichir avec linkedUC/linkedFR :
575
637
 
576
638
  ```json
577
639
  {
@@ -980,9 +1042,19 @@ src/locales/
980
1042
 
981
1043
  ## 10. Ralph Loop prd.json Generation
982
1044
 
1045
+ > **RÈGLE FONDAMENTALE : Le prd.json est DÉRIVÉ du feature.json, jamais généré indépendamment.**
1046
+ >
1047
+ > Règles de dérivation strictes :
1048
+ > 1. Les entités dans `prd.json.architecture.entities[]` doivent reprendre **EXACTEMENT** les noms et champs de `feature.json.analysis.entities[]`
1049
+ > 2. Les `linkedFRs` et `linkedBRs` dans les tasks doivent utiliser les IDs **existants** dans le feature.json (pas d'invention)
1050
+ > 3. Les chemins de fichiers doivent correspondre à la structure réelle du projet (lire `.smartstack/config.json` pour le `baseNamespace`)
1051
+ > 4. Les permissions doivent reprendre le format **complet** de `specification.permissionMatrix` (ex: `business.freebike.fleetmanagement.vehicles.read`)
1052
+ > 5. Les routes API doivent être **identiques** à `specification.apiEndpoints[].path`
1053
+ > 6. **AUCUNE entité, FR, BR, UC ou route ne doit apparaître dans le prd.json si elle n'existe pas dans le feature.json**
1054
+
983
1055
  ### 10.1 PRD Document Structure
984
1056
 
985
- Generate comprehensive product requirements document:
1057
+ Generate comprehensive product requirements document (**derived from feature.json**) :
986
1058
 
987
1059
  ```json
988
1060
  {
@@ -1080,17 +1152,74 @@ Critical section: Layer-by-layer task breakdown:
1080
1152
  }
1081
1153
  ]
1082
1154
  },
1155
+ {
1156
+ "layerId": "SEEDDATA-CORE",
1157
+ "name": "SeedData Core Layer (OBLIGATOIRE)",
1158
+ "description": "5 mandatory SmartStack core files: navigation, permissions, roles. Source: specification.seedDataCore",
1159
+ "tasks": [
1160
+ {
1161
+ "id": "CORE-001",
1162
+ "title": "Create NavigationModuleConfiguration.cs (HasData)",
1163
+ "description": "Derive from specification.seedDataCore.navigationModules. Creates module + section entries.",
1164
+ "effort": "1h",
1165
+ "dependencies": ["TASK-DOMAIN-001"],
1166
+ "category": "seedDataCore",
1167
+ "linkedFRs": [],
1168
+ "acceptance": "NavigationModuleConfiguration.cs created with HasData() seeding all module/section entries"
1169
+ },
1170
+ {
1171
+ "id": "CORE-002",
1172
+ "title": "Create NavigationTranslationConfiguration.cs (HasData)",
1173
+ "description": "Derive from specification.seedDataCore.navigationTranslations. Creates translations for fr, en, it, de.",
1174
+ "effort": "1h",
1175
+ "dependencies": ["CORE-001"],
1176
+ "category": "seedDataCore",
1177
+ "linkedFRs": [],
1178
+ "acceptance": "NavigationTranslationConfiguration.cs created with HasData() seeding all translations (4 languages)"
1179
+ },
1180
+ {
1181
+ "id": "CORE-003",
1182
+ "title": "Create PermissionConfiguration.cs (HasData)",
1183
+ "description": "Derive from specification.seedDataCore.permissions. Full path format: business.{app}.{module}.{resource}.{action}",
1184
+ "effort": "1h",
1185
+ "dependencies": ["TASK-DOMAIN-001"],
1186
+ "category": "seedDataCore",
1187
+ "linkedFRs": [],
1188
+ "acceptance": "PermissionConfiguration.cs created with HasData() seeding all permissions with full paths"
1189
+ },
1190
+ {
1191
+ "id": "CORE-004",
1192
+ "title": "Create RolePermissionConfiguration.cs (HasData)",
1193
+ "description": "Derive from specification.seedDataCore.rolePermissions. Maps roles to permissions using full paths.",
1194
+ "effort": "1h",
1195
+ "dependencies": ["CORE-003"],
1196
+ "category": "seedDataCore",
1197
+ "linkedFRs": [],
1198
+ "acceptance": "RolePermissionConfiguration.cs created with HasData() seeding role-permission assignments"
1199
+ },
1200
+ {
1201
+ "id": "CORE-005",
1202
+ "title": "Create Permissions.cs constants (Application layer)",
1203
+ "description": "Derive from specification.seedDataCore.permissionConstants. PascalCase const names.",
1204
+ "effort": "0.5h",
1205
+ "dependencies": ["CORE-003"],
1206
+ "category": "seedDataCore",
1207
+ "linkedFRs": [],
1208
+ "acceptance": "Permissions.cs created in Application/Constants with all permission constants"
1209
+ }
1210
+ ]
1211
+ },
1083
1212
  {
1084
1213
  "layerId": "SEEDDATA",
1085
- "name": "SeedData Layer",
1086
- "description": "Lookup tables and reference data",
1214
+ "name": "SeedData Business Layer",
1215
+ "description": "Lookup tables and reference data (Status, Priority, Category, etc.)",
1087
1216
  "tasks": [
1088
1217
  {
1089
1218
  "id": "TASK-SEED-001",
1090
1219
  "title": "Create Order_Status SeedData migration",
1091
1220
  "description": "[From specification.navigationHierarchy.seedDataRequired[0]]",
1092
1221
  "effort": "1h",
1093
- "dependencies": ["TASK-DOMAIN-001"],
1222
+ "dependencies": ["TASK-DOMAIN-001", "CORE-005"],
1094
1223
  "linkedFRs": [],
1095
1224
  "acceptance": "Migration creates Order_Status table with 5 status values seeded"
1096
1225
  }
@@ -1317,7 +1446,29 @@ LAYER BREAKDOWN (28h total effort):
1317
1446
  Completed: [TBD]
1318
1447
  Progress: 0%
1319
1448
 
1320
- [SEEDDATA] SeedData Layer (1h)
1449
+ [SEEDDATA-CORE] SeedData Core Layer (4.5h) — OBLIGATOIRE
1450
+ □ CORE-001: Create NavigationModuleConfiguration.cs (1h)
1451
+ Status: pending
1452
+ Source: specification.seedDataCore.navigationModules
1453
+ Progress: 0%
1454
+ □ CORE-002: Create NavigationTranslationConfiguration.cs (1h)
1455
+ Status: pending
1456
+ Source: specification.seedDataCore.navigationTranslations
1457
+ Progress: 0%
1458
+ □ CORE-003: Create PermissionConfiguration.cs (1h)
1459
+ Status: pending
1460
+ Source: specification.seedDataCore.permissions
1461
+ Progress: 0%
1462
+ □ CORE-004: Create RolePermissionConfiguration.cs (1h)
1463
+ Status: pending
1464
+ Source: specification.seedDataCore.rolePermissions
1465
+ Progress: 0%
1466
+ □ CORE-005: Create Permissions.cs constants (0.5h)
1467
+ Status: pending
1468
+ Source: specification.seedDataCore.permissionConstants
1469
+ Progress: 0%
1470
+
1471
+ [SEEDDATA] SeedData Business Layer (1h) — depends on CORE-005
1321
1472
  □ TASK-SEED-001: Create Order_Status migration (1h)
1322
1473
  Status: pending
1323
1474
  Assigned: [TBD]
@@ -1411,25 +1562,25 @@ LAYER BREAKDOWN (28h total effort):
1411
1562
  ═════════════════════════════════════════════════════════════════
1412
1563
  SUMMARY
1413
1564
  ═════════════════════════════════════════════════════════════════
1414
- Total Tasks: 15
1415
- Total Effort: 28 hours
1565
+ Total Tasks: 20 (5 CORE + 15 business)
1566
+ Total Effort: 32.5 hours
1416
1567
  Completed: 0 (0%)
1417
1568
  In Progress: 0 (0%)
1418
- Pending: 15 (100%)
1569
+ Pending: 20 (100%)
1419
1570
  Blocked: 0 (0%)
1420
1571
 
1421
1572
  Dependencies:
1422
- Domain → SeedData → Application → Infrastructure
1423
-
1424
-
1425
- API ←─────────── Frontend
1426
- ↓ ↓
1427
- i18n & Tests ← ─────┘
1428
-
1429
- Validation
1430
-
1431
- Critical Path: Domain → SeedData → App → Infra → API → Tests (18h)
1432
- Parallel Path: Frontend (6h) can start after API definition
1573
+ Domain → SeedData-CORESeedData → Application → Infrastructure
1574
+
1575
+
1576
+ API ←─────────── Frontend
1577
+ ↓ ↓
1578
+ i18n & Tests ← ─────┘
1579
+
1580
+ Validation
1581
+
1582
+ Critical Path: Domain → CORE → SeedData → App → Infra → API → Tests
1583
+ Parallel Path: Frontend can start after API definition
1433
1584
 
1434
1585
  ═════════════════════════════════════════════════════════════════
1435
1586
  NOTES
@@ -1523,17 +1674,69 @@ Remove step-06 from final choice:
1523
1674
 
1524
1675
  1. **Verify validation passed** (status: "approved")
1525
1676
  2. **Explore existing patterns** (check for code generators)
1526
- 3. **Map to files** (document implementation locations)
1527
- 4. **Generate implementation instructions** (task breakdown)
1528
- 5. **Map BRs to code** (validation points)
1529
- 6. **Define API endpoints** (RESTful routes)
1530
- 7. **Plan tests** (coverage strategy)
1531
- 8. **Plan i18n** (translation keys)
1532
- 9. **Generate prd.json** (comprehensive requirements)
1533
- 10. **Initialize progress.txt** (task tracker)
1534
- 11. **Present user choices** (next agent selection)
1535
-
1536
- ### 13.2 Output Summary
1677
+ 3. **Calculate complexity** (simple/medium/complex)
1678
+ 4. **Map to files** (document implementation locations — structured `filesToCreate`)
1679
+ 5. **Generate implementation instructions** (task breakdown including CORE-001→CORE-005)
1680
+ 6. **Map BRs to code** (`brToCodeMapping` — validation points)
1681
+ 7. **Copy API endpoints** (from `specification.apiEndpoints` — EXACT same routes)
1682
+ 8. **Plan tests** (coverage strategy)
1683
+ 9. **Plan i18n** (translation keys)
1684
+ 10. **Generate prd.json** (DERIVED from feature.json — strict alignment)
1685
+ 11. **Initialize progress.txt** (task tracker with [SEEDDATA-CORE] section)
1686
+ 12. **Update changelog** (step-04 entry)
1687
+ 13. **Present user choices** (next agent selection)
1688
+
1689
+ ### 13.2 Calculate Complexity
1690
+
1691
+ **OBLIGATOIRE :** Calculer et écrire `handoff.complexity` dans feature.json :
1692
+
1693
+ | Critère | Simple | Medium | Complex |
1694
+ |---------|--------|--------|---------|
1695
+ | Entities | ≤3 | ≤6 | >6 |
1696
+ | Use Cases | ≤5 | ≤12 | >12 |
1697
+ | Business Rules | ≤10 | ≤20 | >20 |
1698
+
1699
+ ```json
1700
+ {
1701
+ "handoff": {
1702
+ "complexity": "medium",
1703
+ "complexityDetails": {
1704
+ "entities": 4,
1705
+ "useCases": 6,
1706
+ "businessRules": 5,
1707
+ "calculated": "medium (≤6 entities, ≤12 UCs, ≤20 BRs)"
1708
+ }
1709
+ }
1710
+ }
1711
+ ```
1712
+
1713
+ La complexité la plus élevée parmi les 3 critères détermine le niveau global.
1714
+
1715
+ ### 13.3 Update Changelog
1716
+
1717
+ **OBLIGATOIRE :** Ajouter une entrée changelog pour step-04 via `ba-writer` :
1718
+
1719
+ ```json
1720
+ {
1721
+ "changelog": [
1722
+ {
1723
+ "step": "step-04-handoff",
1724
+ "timestamp": "2025-02-01T11:00:00Z",
1725
+ "changes": [
1726
+ "Complexity: medium",
1727
+ "Files to create: X (Y core + Z business)",
1728
+ "BR mappings: X rules mapped",
1729
+ "API endpoints: X routes (from specification)",
1730
+ "prd.json: X tasks across Y layers",
1731
+ "progress.txt initialized",
1732
+ "User choice: [Feature Full / Ralph Loop / End BA]"
1733
+ ]
1734
+ }
1735
+ ]
1736
+ }
1737
+ ```
1738
+
1739
+ ### 13.4 Output Summary
1537
1740
 
1538
1741
  Display final summary:
1539
1742
 
@@ -1544,28 +1747,30 @@ Display final summary:
1544
1747
 
1545
1748
  Module: Orders
1546
1749
  Status: handed-off
1750
+ Complexity: medium
1547
1751
  Specification: 11 sections complete
1548
1752
  Validation: approved
1549
1753
  Implementation: Ready to code
1550
1754
 
1551
1755
  Generated Files:
1552
1756
  ✓ docs/feature.json (specification + validation + handoff)
1553
- ✓ .ralph/prd.json (v2.0.0 with 15 tasks)
1757
+ ✓ .ralph/prd.json (v2.0.0 with 20 tasks)
1554
1758
  ✓ .ralph/progress.txt (progress tracker)
1555
1759
 
1556
1760
  Statistics:
1557
1761
  - Use cases: 6 (UC-001 → UC-006)
1558
1762
  - Requirements: 12 FRs
1559
1763
  - Business rules: 5 BRs (mapped to code)
1560
- - API endpoints: 6 REST routes
1764
+ - API endpoints: 6 REST routes (from specification)
1561
1765
  - Components: 8 frontend components
1562
1766
  - Tests: 20 test cases (unit + integration + E2E)
1563
1767
  - i18n keys: 16 translation keys
1564
- - Implementation: 15 tasks across 9 layers
1565
- - Total effort: 28 hours
1768
+ - CORE tasks: 5 (navigation, permissions, roles)
1769
+ - Implementation: 20 tasks across 10 layers
1770
+ - Complexity: medium
1566
1771
 
1567
1772
  Dependencies:
1568
- ✓ Domain → SeedData → Application → Infrastructure → API → Frontend
1773
+ ✓ Domain → SeedData-CORESeedData → Application → Infrastructure → API → Frontend
1569
1774
  ✓ Tests & i18n run in parallel
1570
1775
  ✓ Validation confirms all FRs/BRs covered
1571
1776
 
@@ -1578,13 +1783,17 @@ Next Step: Choose development approach (Feature Full / Ralph Loop / Manual)
1578
1783
 
1579
1784
  ## OUTPUT
1580
1785
 
1786
+ > **INTERDIT : Ne générer AUCUN fichier JSON supplémentaire** (specification.json, analysis.json, handoff.json, etc.).
1787
+ > Le **feature.json** est le SEUL livrable JSON. Le prd.json et progress.txt sont les seuls fichiers supplémentaires autorisés.
1788
+ > Un fichier specification.json séparé crée une **double source de vérité** et sera rejeté par la validation.
1789
+
1581
1790
  This step enriches **feature.json** with:
1582
- - **handoff** section containing file mappings, implementation instructions, BR mappings, API endpoints, test plans, and i18n keys
1791
+ - **handoff** section containing: `complexity`, `filesToCreate` (structured object with 7 categories), `brToCodeMapping`, `apiEndpointSummary`, test plans, and i18n keys
1583
1792
  - **Status:** "handed-off"
1584
1793
 
1585
1794
  Also generates:
1586
- - **.ralph/prd.json** - Comprehensive product requirements (v2.0.0 schema)
1587
- - **.ralph/progress.txt** - Task progress tracker with 15 implementation tasks
1795
+ - **.ralph/prd.json** - Comprehensive product requirements (v2.0.0 schema, DERIVED from feature.json)
1796
+ - **.ralph/progress.txt** - Task progress tracker with 20 implementation tasks (5 CORE + 15 business)
1588
1797
 
1589
1798
  **Standard mode:** Full handoff with all implementation details.
1590
1799
  **Micro mode:** Simplified handoff with minimal tasks, auto-suggest Feature Full.