@atlashub/smartstack-cli 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.documentation/cli-commands.html +1 -1
  2. package/.documentation/init.html +1 -1
  3. package/.documentation/installation.html +1 -1
  4. package/dist/index.js +2 -2
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/templates/agents/ba-reader.md +114 -9
  8. package/templates/agents/ba-writer.md +108 -27
  9. package/templates/agents/mcp-healthcheck.md +1 -1
  10. package/templates/ralph/README.md +1 -1
  11. package/templates/ralph/ralph.config.yaml +1 -1
  12. package/templates/skills/_shared.md +60 -0
  13. package/templates/skills/application/steps/step-00-init.md +32 -8
  14. package/templates/skills/business-analyse/SKILL.md +65 -42
  15. package/templates/skills/business-analyse/_shared.md +161 -51
  16. package/templates/skills/business-analyse/questionnaire/00-application.md +166 -0
  17. package/templates/skills/business-analyse/questionnaire.md +63 -19
  18. package/templates/skills/business-analyse/react/application-viewer.md +242 -0
  19. package/templates/skills/business-analyse/react/components.md +60 -8
  20. package/templates/skills/business-analyse/react/schema.md +238 -7
  21. package/templates/skills/business-analyse/schemas/application-schema.json +389 -0
  22. package/templates/skills/business-analyse/schemas/feature-schema.json +74 -3
  23. package/templates/skills/business-analyse/steps/step-00-init.md +110 -44
  24. package/templates/skills/business-analyse/steps/step-01-cadrage.md +259 -0
  25. package/templates/skills/business-analyse/steps/step-02-decomposition.md +282 -0
  26. package/templates/skills/business-analyse/steps/step-03-specify.md +489 -0
  27. package/templates/skills/business-analyse/steps/step-04-consolidation.md +336 -0
  28. package/templates/skills/business-analyse/steps/step-05-handoff.md +1119 -0
  29. package/templates/skills/mcp/SKILL.md +2 -2
  30. package/templates/skills/business-analyse/steps/step-01-analyse.md +0 -523
  31. package/templates/skills/business-analyse/steps/step-02-specify.md +0 -899
  32. package/templates/skills/business-analyse/steps/step-03-validate.md +0 -1009
  33. package/templates/skills/business-analyse/steps/step-04-handoff.md +0 -1802
@@ -1,1009 +0,0 @@
1
- # Step 03: Validation
2
-
3
- > **Version:** 3.0.0
4
- > **Name:** step-03-validate
5
- > **Next step:** steps/step-04-handoff.md
6
- > **Purpose:** Validate specification completeness, consistency, and SmartStack conventions. Approve or reject with revision options.
7
- > **Input:** feature.json (specification section populated)
8
- > **Output:** feature.json.validation enriched + status: "approved" or "specified" (if rejected)
9
-
10
- ---
11
-
12
- ## 1. Introduction
13
-
14
- This step **quality-gates** the specification before handoff to development. You will:
15
-
16
- 1. **Check completeness** - All specification sections present and non-empty
17
- 2. **Verify consistency** - Use cases, FRs, and business rules cross-reference correctly
18
- 3. **Validate SmartStack conventions** - Naming, structure, RBAC, SeedData patterns
19
- 4. **Assess risks** - Identify ambiguities, dependencies, scope creep
20
- 5. **Make approval decision** - Approve (→ handoff) or reject (→ revision)
21
- 6. **Handle rejections** - Auto-revise, manual fix, or force-accept
22
-
23
- ---
24
-
25
- ## 2. Mode Support
26
-
27
- ### Standard Mode
28
- Execute all validation checks in full detail. Require user confirmation for approval.
29
-
30
- ### Micro Mode
31
- IF use_case = micro:
32
- - Auto-validate structural completeness only (no human confirmation required)
33
- - Skip complex consistency checks (cross-module, audit, archival)
34
- - Auto-approve if basic structure valid
35
- - Mark as "approved" without user interaction
36
-
37
- ### Delta Mode
38
- IF use_case = refactoring:
39
- - Validate only **affected** sections (marked with `delta: true`)
40
- - Skip validation of unchanged sections
41
- - Approve if delta sections are consistent with existing data
42
-
43
- ---
44
-
45
- ## 2. Completeness Checklist
46
-
47
- ### 2.1 Specification Sections Present
48
-
49
- Verify all required sections exist in feature.json.specification:
50
-
51
- | Section | Required | Status |
52
- |---------|----------|--------|
53
- | **actors** | ✓ | 4+ roles defined |
54
- | **useCases** | ✓ | ≥2 UCs (List, Create minimum) |
55
- | **functionalRequirements** | ✓ | ≥4 FRs linked to BRs |
56
- | **permissionMatrix** | ✓ | ≥1 resource × 4 actors |
57
- | **entities** | ✓ | ≥1 entity with fields |
58
- | **navigationHierarchy** | ✓ | Menu structure defined |
59
- | **wireframes** | ✓ | ≥2 wireframes (List, Create) |
60
- | **gherkinScenarios** | ✓ | ≥2 scenarios per major UC |
61
- | **validations** | ✓ | ≥1 field validation rule |
62
- | **messages** | ✓ | ≥4 business messages (success, error, warning) |
63
- | **lifeCycles** | ✓ | ≥1 entity with state machine |
64
- | **crossModuleDependencies** | ◐ | If module integrates with others |
65
- | **auditingPolicy** | ◐ | If sensitive data tracked |
66
- | **archivalPolicy** | ◐ | If long-term data retention required |
67
-
68
- **Micro mode:** Minimum set only (actors, UCs, FRs, permissionMatrix, entities, wireframes, gherkin, validations, messages).
69
-
70
- ### 2.2 Element Counts
71
-
72
- For standard mode, typical ranges:
73
-
74
- | Element | Typical Range | Minimum | Check |
75
- |---------|---------------|---------|-------|
76
- | Actors | 2-6 | 2 (User, Admin minimum) | Count ≥ 2 ✓ |
77
- | Use Cases | 4-12 | 2 | Count ≥ 2 ✓ |
78
- | Functional Req | 8-20 | 4 | Count ≥ 4 ✓ |
79
- | Entities | 1-8 | 1 | Count ≥ 1 ✓ |
80
- | Permissions | 3-12 | 3 | Count ≥ 3 ✓ |
81
- | Validations | 5-20 | 5 | Count ≥ 5 ✓ |
82
- | Messages | 4-20 | 4 | Count ≥ 4 ✓ |
83
- | Gherkin Scenarios | 4-30 | 4 | Count ≥ 4 ✓ |
84
- | State transitions | 2-10 | 2 | Count ≥ 2 ✓ |
85
-
86
- **Micro mode:** Reduce minimums by 50% (e.g., 1 UC, 2 FRs, 2 scenarios).
87
-
88
- ### 2.3 Mandatory SeedData Presence
89
-
90
- Validate 5 mandatory SeedData tables defined in navigationHierarchy:
91
-
92
- ```json
93
- {
94
- "seedDataRequired": [
95
- {
96
- "table": "Module_Status",
97
- "rows": 5,
98
- "status": "FOUND" ✓
99
- },
100
- {
101
- "table": "Module_Priority",
102
- "rows": 3,
103
- "status": "FOUND" ✓
104
- },
105
- {
106
- "table": "Module_Category",
107
- "rows": 8,
108
- "status": "FOUND" ✓
109
- },
110
- {
111
- "table": "Module_Type",
112
- "rows": 4,
113
- "status": "FOUND" ✓
114
- },
115
- {
116
- "table": "Module_Department",
117
- "rows": 6,
118
- "status": "FOUND" ✓
119
- }
120
- ]
121
- }
122
- ```
123
-
124
- **Issue:** Missing SeedData table → validation ERROR, must specify before approval.
125
-
126
- ### 2.4 SeedData Core Presence (BLOQUANT)
127
-
128
- > **CRITIQUE :** Cette validation est BLOQUANTE. Si `specification.seedDataCore` est absent ou incomplet, la validation DOIT echouer avec une ERREUR (pas un warning). Sans ces fichiers, le module sera invisible et toutes les API retourneront 403.
129
-
130
- Verifier la presence et le contenu de `specification.seedDataCore` :
131
-
132
- ```json
133
- {
134
- "seedDataCoreChecks": [
135
- {
136
- "section": "navigationModules",
137
- "minimum": 1,
138
- "status": "PASS|FAIL",
139
- "description": "Au moins 1 entree de navigation module"
140
- },
141
- {
142
- "section": "navigationTranslations",
143
- "minimum": 1,
144
- "status": "PASS|FAIL",
145
- "description": "Au moins 1 traduction par module"
146
- },
147
- {
148
- "section": "permissions",
149
- "minimum": 3,
150
- "status": "PASS|FAIL",
151
- "description": "Au moins 3 permissions (Read, Create, Update minimum)"
152
- },
153
- {
154
- "section": "rolePermissions",
155
- "minimum": 2,
156
- "status": "PASS|FAIL",
157
- "description": "Au moins 2 associations role-permission (Admin + 1 autre role)"
158
- },
159
- {
160
- "section": "permissionConstants",
161
- "minimum": 3,
162
- "status": "PASS|FAIL",
163
- "description": "Au moins 3 constantes compile-time"
164
- }
165
- ]
166
- }
167
- ```
168
-
169
- **Regles :**
170
- - Chaque `rolePermissions[].permissionPath` DOIT exister dans `permissions[].path` → ERREUR sinon
171
- - Chaque `permissions[].path` DOIT utiliser le format complet `business.{app}.{module}.{resource}.{action}` → ERREUR sinon
172
- - Les `permissionConstants[].path` DOIVENT correspondre a `permissions[].path` → ERREUR sinon
173
-
174
- **Issue:** Section seedDataCore absente ou incomplete → validation ERREUR BLOQUANTE, retour a step-02.
175
-
176
- ---
177
-
178
- ## 3. Consistency Checks
179
-
180
- ### 3.1 Use Case ↔ Functional Requirement Mapping
181
-
182
- **Rule:** Every UC should have ≥1 linked FR.
183
-
184
- Check each use case:
185
-
186
- ```json
187
- {
188
- "checks": [
189
- {
190
- "check": "UC-001 has linked FRs",
191
- "useCaseId": "UC-001",
192
- "linkedFRs": ["FR-001", "FR-002"],
193
- "status": "PASS" ✓
194
- },
195
- {
196
- "check": "UC-002 has linked FRs",
197
- "useCaseId": "UC-002",
198
- "linkedFRs": ["FR-003"],
199
- "status": "PASS" ✓
200
- },
201
- {
202
- "check": "UC-005 has linked FRs",
203
- "useCaseId": "UC-005",
204
- "linkedFRs": [],
205
- "status": "FAIL" ✗ → "UC-005 orphaned: no FRs linked"
206
- }
207
- ]
208
- }
209
- ```
210
-
211
- **Resolution:**
212
- - ✓ PASS: UC has ≥1 FR
213
- - ✗ FAIL: Add FRs or remove UC
214
-
215
- ### 3.2 Functional Requirement ↔ Business Rule Mapping
216
-
217
- **Rule:** Every FR should have ≥1 linked BR (from analysis section).
218
-
219
- Check each FR:
220
-
221
- ```json
222
- {
223
- "checks": [
224
- {
225
- "check": "FR-001 has linked BRs",
226
- "frId": "FR-001",
227
- "linkedRules": ["BR-001", "BR-003"],
228
- "status": "PASS" ✓
229
- },
230
- {
231
- "check": "FR-004 has linked BRs",
232
- "frId": "FR-004",
233
- "linkedRules": [],
234
- "status": "WARNING" ⚠ → "FR-004: Consider linking to a BR"
235
- }
236
- ]
237
- }
238
- ```
239
-
240
- **Resolution:**
241
- - ✓ PASS: FR has ≥1 BR
242
- - ⚠ WARNING: FR is implementation-detail (may be OK)
243
-
244
- ### 3.3 Business Rule ↔ Use Case Mapping
245
-
246
- **Rule:** Every BR used in specification should exist in analysis.
247
-
248
- Cross-check all BR references:
249
-
250
- ```json
251
- {
252
- "checks": [
253
- {
254
- "check": "All BR references valid",
255
- "referencedBRs": ["BR-001", "BR-003", "BR-005"],
256
- "definedBRs": ["BR-001", "BR-002", "BR-003", "BR-004", "BR-005"],
257
- "missing": [],
258
- "status": "PASS" ✓
259
- },
260
- {
261
- "check": "All BR references valid",
262
- "referencedBRs": ["BR-001", "BR-008"],
263
- "definedBRs": ["BR-001", "BR-002", "BR-003"],
264
- "missing": ["BR-008"],
265
- "status": "FAIL" ✗ → "BR-008 not defined in analysis"
266
- }
267
- ]
268
- }
269
- ```
270
-
271
- **Resolution:**
272
- - ✓ PASS: All referenced BRs exist
273
- - ✗ FAIL: Remove orphaned BR references or add to analysis
274
-
275
- ### 3.4 Actor ↔ Permission Matrix Mapping
276
-
277
- **Rule:** Every actor should appear in permission matrix.
278
-
279
- ```json
280
- {
281
- "checks": [
282
- {
283
- "check": "All actors covered in permission matrix",
284
- "actors": ["Admin", "Manager", "User", "Guest"],
285
- "inMatrix": ["Admin", "Manager", "User", "Guest"],
286
- "missing": [],
287
- "status": "PASS" ✓
288
- },
289
- {
290
- "check": "All actors covered in permission matrix",
291
- "actors": ["Admin", "Manager", "User", "Guest", "External"],
292
- "inMatrix": ["Admin", "Manager", "User"],
293
- "missing": ["Guest", "External"],
294
- "status": "FAIL" ✗ → "2 actors not in permission matrix"
295
- }
296
- ]
297
- }
298
- ```
299
-
300
- **Resolution:**
301
- - ✓ PASS: All actors have permissions
302
- - ✗ FAIL: Add missing actors to matrix or remove from actor list
303
-
304
- ### 3.5 Entity ↔ Permission Resource Mapping
305
-
306
- **Rule:** Every entity in entities[] should have a resource in permissionMatrix.
307
-
308
- ```json
309
- {
310
- "checks": [
311
- {
312
- "check": "All entities have permissions",
313
- "entities": ["Order", "Customer", "Product"],
314
- "permissionResources": ["Order", "Customer", "Product"],
315
- "missing": [],
316
- "status": "PASS" ✓
317
- },
318
- {
319
- "check": "All entities have permissions",
320
- "entities": ["Order", "Customer", "OrderLine"],
321
- "permissionResources": ["Order", "Customer"],
322
- "missing": ["OrderLine"],
323
- "status": "WARNING" ⚠ → "OrderLine has no permissions (may be child entity)"
324
- }
325
- ]
326
- }
327
- ```
328
-
329
- **Resolution:**
330
- - ✓ PASS: All entities have permissions
331
- - ⚠ WARNING: Child entities may not need separate permissions
332
-
333
- ### 3.6 Gherkin ↔ Use Case Coverage
334
-
335
- **Rule:** Every major UC should have ≥2 Gherkin scenarios.
336
-
337
- ```json
338
- {
339
- "checks": [
340
- {
341
- "check": "UC-001 has Gherkin coverage",
342
- "useCaseId": "UC-001",
343
- "scenarios": 3,
344
- "status": "PASS" ✓
345
- },
346
- {
347
- "check": "UC-003 has Gherkin coverage",
348
- "useCaseId": "UC-003",
349
- "scenarios": 0,
350
- "status": "FAIL" ✗ → "UC-003: No Gherkin scenarios"
351
- }
352
- ]
353
- }
354
- ```
355
-
356
- **Resolution:**
357
- - ✓ PASS: UC has ≥2 scenarios
358
- - ✗ FAIL: Add Gherkin scenarios or remove UC
359
-
360
- ### 3.7 API Routes Format Consistency
361
-
362
- **Rule:** All routes in `specification.apiEndpoints[].path` MUST use the same prefix format. No mixing of `/api/freebike/...`, `/api/v1/...`, and `/api/...` in the same specification.
363
-
364
- ```json
365
- {
366
- "checks": [
367
- {
368
- "check": "API route prefix consistency",
369
- "prefixes": ["/api/freebike/"],
370
- "inconsistent": [],
371
- "status": "PASS"
372
- },
373
- {
374
- "check": "API route prefix consistency",
375
- "prefixes": ["/api/freebike/", "/api/v1/"],
376
- "inconsistent": ["GET /api/v1/vehicles conflicts with POST /api/freebike/vehicles"],
377
- "status": "FAIL"
378
- }
379
- ]
380
- }
381
- ```
382
-
383
- **Resolution:**
384
- - ✓ PASS: All routes use the same prefix
385
- - ✗ FAIL: Harmonize all routes to use a single prefix pattern
386
-
387
- ### 3.8 Permission Format Consistency
388
-
389
- **Rule:** All permissions in `permissionMatrix.roleAssignments[].permissions[]` MUST use full path format matching `permissionMatrix.permissions[].path`. No shortcuts (e.g., `vehicles.read` instead of `business.freebike.fleetmanagement.vehicles.read`).
390
-
391
- ```json
392
- {
393
- "checks": [
394
- {
395
- "check": "Permission path format in roleAssignments",
396
- "fullPaths": 15,
397
- "shortcuts": 0,
398
- "status": "PASS"
399
- },
400
- {
401
- "check": "Permission path format in roleAssignments",
402
- "fullPaths": 5,
403
- "shortcuts": 10,
404
- "inconsistentExamples": ["vehicles.read should be business.freebike.fleetmanagement.vehicles.read"],
405
- "status": "FAIL"
406
- }
407
- ]
408
- }
409
- ```
410
-
411
- **Exception:** Le wildcard `business.{app}.{module}.*` est accepte pour le role Admin.
412
-
413
- **Resolution:**
414
- - ✓ PASS: All roleAssignment permissions use full paths
415
- - ✗ FAIL: Replace shortcuts with full paths from permissionMatrix.permissions[].path
416
-
417
- ---
418
-
419
- ## 4. SmartStack Convention Validation
420
-
421
- ### 4.1 Naming Conventions
422
-
423
- | Element | Pattern | Check |
424
- |---------|---------|-------|
425
- | **Actor** | PascalCase | "Admin", "Manager" ✓ |
426
- | **Use Case** | UC-NNN | "UC-001", "UC-042" ✓ |
427
- | **Functional Req** | FR-NNN | "FR-001", "FR-025" ✓ |
428
- | **Business Rule** | BR-NNN | References to BR-* ✓ |
429
- | **Entity** | PascalCase | "Order", "Customer" ✓ |
430
- | **Field** | camelCase | "orderNumber", "createdDate" ✓ |
431
- | **SeedData Table** | Module_Name | "Order_Status", "Customer_Type" ✓ |
432
- | **State** | PascalCase | "Draft", "Approved" ✓ |
433
- | **Permission** | PascalCase | "Read", "Create", "Update", "Delete" ✓ |
434
-
435
- **Validation:**
436
- ```json
437
- {
438
- "checks": [
439
- {
440
- "element": "Actors",
441
- "rule": "PascalCase",
442
- "actual": ["Admin", "Manager", "User", "Guest"],
443
- "status": "PASS" ✓
444
- },
445
- {
446
- "element": "Use Cases",
447
- "rule": "UC-NNN format",
448
- "actual": ["UC-001", "UC-002", "UC-003", "UC-004"],
449
- "status": "PASS" ✓
450
- },
451
- {
452
- "element": "Functional Requirements",
453
- "rule": "FR-NNN format",
454
- "actual": ["FR-001", "fr-002", "FR-003"],
455
- "status": "FAIL" ✗ → "fr-002 should be FR-002"
456
- }
457
- ]
458
- }
459
- ```
460
-
461
- ### 4.2 RBAC Pattern Validation
462
-
463
- **Rule:** Permission matrix should follow principle of least privilege.
464
-
465
- Check role escalation:
466
-
467
- | Role | Read | Create | Update | Delete | Approve |
468
- |------|------|--------|--------|--------|---------|
469
- | **Guest** | ✓ | ✗ | ✗ | ✗ | ✗ |
470
- | **User** | ✓ | ✓ | ✓ | ✗ | ✗ |
471
- | **Manager** | ✓ | ✓ | ✓ | ✗ | ✓ |
472
- | **Admin** | ✓ | ✓ | ✓ | ✓ | ✓ |
473
-
474
- **Validation:**
475
- ```json
476
- {
477
- "check": "RBAC least privilege",
478
- "issues": [
479
- {
480
- "resource": "Order",
481
- "issue": "User can Delete (should be Manager minimum)",
482
- "severity": "ERROR" ✗
483
- },
484
- {
485
- "resource": "Customer",
486
- "issue": "Guest cannot Read (critical data exposure)",
487
- "severity": "ERROR" ✗
488
- }
489
- ]
490
- }
491
- ```
492
-
493
- ### 4.3 Entity Structure Validation
494
-
495
- **Rule:** Entities must have primary key, timestamps, ownership.
496
-
497
- ```json
498
- {
499
- "checks": [
500
- {
501
- "entity": "Order",
502
- "fields": ["id", "orderNumber", "orderDate", "createdBy", "createdDate"],
503
- "hasPrimaryKey": true,
504
- "hasTimestamps": true,
505
- "hasOwnership": true,
506
- "status": "PASS" ✓
507
- },
508
- {
509
- "entity": "OrderLine",
510
- "fields": ["orderId", "lineNumber", "quantity"],
511
- "hasPrimaryKey": false,
512
- "hasTimestamps": false,
513
- "hasOwnership": false,
514
- "status": "FAIL" ✗ → "Missing primary key, timestamps"
515
- }
516
- ]
517
- }
518
- ```
519
-
520
- ### 4.4 State Machine Validation
521
-
522
- **Rule:** Each state should have exit transitions; terminal states have none.
523
-
524
- ```json
525
- {
526
- "checks": [
527
- {
528
- "entity": "Order",
529
- "state": "Draft",
530
- "hasTransitions": true,
531
- "status": "PASS" ✓
532
- },
533
- {
534
- "entity": "Order",
535
- "state": "Cancelled",
536
- "isTerminal": true,
537
- "hasTransitions": false,
538
- "status": "PASS" ✓
539
- },
540
- {
541
- "entity": "Order",
542
- "state": "Processing",
543
- "hasTransitions": false,
544
- "isTerminal": false,
545
- "status": "WARNING" ⚠ → "Non-terminal state with no exit transitions (deadlock?)"
546
- }
547
- ]
548
- }
549
- ```
550
-
551
- ### 4.5 Orphan File Detection
552
-
553
- **Rule:** The feature.json is the SINGLE source of truth. No separate JSON files should exist.
554
-
555
- ```
556
- CHECK orphan files:
557
- - specification.json exists in output directory → WARNING ⚠
558
- "Double source of vérité détectée : specification.json est un fichier orphelin.
559
- Toute la spécification doit être dans feature.json.specification.
560
- SUPPRIMER specification.json et vérifier que feature.json.specification est complet."
561
- - analysis.json exists in output directory → WARNING ⚠
562
- "Fichier analysis.json orphelin détecté. L'analyse doit être dans feature.json.analysis."
563
- ```
564
-
565
- **Action :** Si un fichier orphelin est détecté, ajouter un WARNING dans `validation.warnings[]` et recommander la suppression.
566
-
567
- ---
568
-
569
- ## 5. Risk Assessment
570
-
571
- ### 5.1 Scope Creep Detection
572
-
573
- Check for excessive complexity:
574
-
575
- ```json
576
- {
577
- "riskAssessments": [
578
- {
579
- "risk": "Scope Creep",
580
- "indicators": [
581
- {
582
- "metric": "Use case count",
583
- "value": 8,
584
- "threshold": 12,
585
- "status": "ACCEPTABLE" ✓
586
- },
587
- {
588
- "metric": "Functional requirement count",
589
- "value": 28,
590
- "threshold": 20,
591
- "status": "WARNING" ⚠ → "Above typical for single iteration"
592
- }
593
- ]
594
- }
595
- ]
596
- }
597
- ```
598
-
599
- ### 5.2 Missing Validation Rules
600
-
601
- Check for fields without validation:
602
-
603
- ```json
604
- {
605
- "riskAssessments": [
606
- {
607
- "risk": "Unvalidated Fields",
608
- "fields": [
609
- {
610
- "name": "OrderNumber",
611
- "hasValidation": true,
612
- "status": "PASS" ✓
613
- },
614
- {
615
- "name": "Notes",
616
- "hasValidation": false,
617
- "status": "WARNING" ⚠ → "Consider max length, SQL injection protection"
618
- }
619
- ]
620
- }
621
- ]
622
- }
623
- ```
624
-
625
- ### 5.3 Ambiguous Use Cases
626
-
627
- Detect UCs that lack clarity:
628
-
629
- ```json
630
- {
631
- "riskAssessments": [
632
- {
633
- "risk": "Ambiguous Use Cases",
634
- "useCases": [
635
- {
636
- "id": "UC-001",
637
- "clarity": "clear",
638
- "status": "PASS" ✓
639
- },
640
- {
641
- "id": "UC-005",
642
- "clarity": "vague",
643
- "reason": "Main flow not specific; unclear error handling",
644
- "status": "WARNING" ⚠
645
- }
646
- ]
647
- }
648
- ]
649
- }
650
- ```
651
-
652
- ### 5.4 Dependency Complexity
653
-
654
- Check for excessive cross-module dependencies:
655
-
656
- ```json
657
- {
658
- "riskAssessments": [
659
- {
660
- "risk": "Dependency Coupling",
661
- "dependencies": 2,
662
- "threshold": 5,
663
- "status": "ACCEPTABLE" ✓
664
- }
665
- ]
666
- }
667
- ```
668
-
669
- ### 5.5 Security & Compliance Gaps
670
-
671
- Check for missing audit/archival:
672
-
673
- ```json
674
- {
675
- "riskAssessments": [
676
- {
677
- "risk": "Security & Compliance",
678
- "checks": [
679
- {
680
- "check": "Sensitive data (PII) has auditing",
681
- "hasAuditingPolicy": true,
682
- "status": "PASS" ✓
683
- },
684
- {
685
- "check": "Long-term data has archival policy",
686
- "hasArchivalPolicy": true,
687
- "status": "PASS" ✓
688
- },
689
- {
690
- "check": "All state transitions logged",
691
- "status": "PASS" ✓
692
- }
693
- ]
694
- }
695
- ]
696
- }
697
- ```
698
-
699
- ---
700
-
701
- ## 6. Approval Decision Logic
702
-
703
- ### 6.1 Decision Tree
704
-
705
- ```
706
- ┌─ Completeness Check
707
- │ ├─ FAIL → Reject: "Incomplete specification"
708
- │ └─ PASS → Continue
709
- ├─ Consistency Check
710
- │ ├─ ERROR found → Reject: "Inconsistent cross-references"
711
- │ ├─ WARNING found → Continue (review)
712
- │ └─ PASS → Continue
713
- ├─ Convention Check
714
- │ ├─ ERROR found → Reject: "Convention violations"
715
- │ └─ PASS → Continue
716
- ├─ Risk Assessment
717
- │ ├─ CRITICAL risk → Reject: "High-risk specification"
718
- │ ├─ HIGH risk → Require confirmation
719
- │ └─ ACCEPTABLE → Continue
720
- └─ Final Decision
721
- ├─ User confirms → APPROVED ✓ (status: "approved")
722
- └─ User rejects → REJECTED ✗ (status: "specified", mark for revision)
723
- ```
724
-
725
- ### 6.2 Approval Criteria (Standard Mode)
726
-
727
- **AUTO-APPROVE if:**
728
- - Completeness: PASS
729
- - Consistency: PASS or WARNING only
730
- - Conventions: PASS
731
- - Risks: ACCEPTABLE or HIGH (with user confirmation)
732
-
733
- **AUTO-REJECT if:**
734
- - Completeness: FAIL
735
- - Consistency: ERROR
736
- - Conventions: ERROR
737
- - Risks: CRITICAL
738
-
739
- ### 6.3 Approval Criteria (Micro Mode)
740
-
741
- **AUTO-APPROVE if:**
742
- - Completeness: Minimum set present (actors, UCs, FRs, matrix, entities, wireframes, gherkin, validations, messages)
743
- - Consistency: No cross-reference errors
744
- - Naming: Follows conventions (UC-*, FR-*, PascalCase)
745
-
746
- No user interaction required.
747
-
748
- ### 6.4 Approval Criteria (Delta Mode)
749
-
750
- **AUTO-APPROVE if:**
751
- - Affected sections (delta: true) are complete
752
- - Cross-references within delta sections consistent
753
- - No conflicts with existing sections
754
-
755
- ---
756
-
757
- ## 7. Handling Rejections
758
-
759
- ### 7.1 Rejection Reasons & Options
760
-
761
- When specification is REJECTED, offer user choices:
762
-
763
- ```json
764
- {
765
- "rejection": {
766
- "reason": "Inconsistent cross-references",
767
- "errors": [
768
- "UC-005: No linked FRs",
769
- "FR-004: Links to undefined BR-008"
770
- ],
771
- "options": [
772
- {
773
- "id": 1,
774
- "action": "auto-revise",
775
- "description": "Fix obvious issues automatically (remove orphaned UCs, skip FRs)"
776
- },
777
- {
778
- "id": 2,
779
- "action": "manual-revise",
780
- "description": "Return to step-02 to revise specification manually"
781
- },
782
- {
783
- "id": 3,
784
- "action": "force-approve",
785
- "description": "Override validation and approve anyway (risky)"
786
- }
787
- ]
788
- }
789
- }
790
- ```
791
-
792
- ### 7.2 Auto-Revise Strategy
793
-
794
- When user chooses auto-revise:
795
-
796
- 1. **Remove orphaned UCs** - UCs with no linked FRs
797
- 2. **Remove orphaned FRs** - FRs with no linked BRs (optional warning)
798
- 3. **Fix naming** - Convert "fr-002" → "FR-002"
799
- 4. **Remove invalid BR references** - Delete references to undefined BRs
800
- 5. **Add missing permissions** - For any new actors discovered
801
- 6. **Revalidate** - Run validation again
802
-
803
- Example:
804
- ```json
805
- {
806
- "autoRevise": {
807
- "removedElements": [
808
- {
809
- "type": "useCase",
810
- "id": "UC-005",
811
- "reason": "No linked FRs"
812
- },
813
- {
814
- "type": "businessRuleReference",
815
- "location": "FR-004.linkedRules",
816
- "value": "BR-008",
817
- "reason": "BR-008 not defined in analysis"
818
- }
819
- ],
820
- "fixedElements": [
821
- {
822
- "type": "functionalRequirement",
823
- "id": "fr-002",
824
- "from": "fr-002",
825
- "to": "FR-002"
826
- }
827
- ],
828
- "result": "Revalidating..."
829
- }
830
- }
831
- ```
832
-
833
- ### 7.3 Manual Revision (Return to Step-02)
834
-
835
- If user chooses manual revision:
836
-
837
- 1. Provide list of errors to fix
838
- 2. Return to step-02-specify.md with context
839
- 3. User revises specification
840
- 4. Return to step-03 for re-validation
841
- 5. Loop until approved
842
-
843
- ### 7.4 Force-Approve (Override)
844
-
845
- If user chooses force-approve:
846
-
847
- 1. Mark status as "approved" despite errors
848
- 2. Add validation warning to feature.json.validation
849
- 3. Escalate errors to development team
850
- 4. Proceed to handoff
851
- 5. **WARNING:** Development may encounter issues
852
-
853
- ```json
854
- {
855
- "validation": {
856
- "status": "approved",
857
- "approvalMode": "force",
858
- "overriddenErrors": [
859
- {
860
- "type": "consistency",
861
- "message": "UC-005: No linked FRs"
862
- },
863
- {
864
- "type": "convention",
865
- "message": "fr-002: Should be FR-002"
866
- }
867
- ],
868
- "approvedBy": "User override",
869
- "approvedAt": "2025-02-01T10:30:00Z"
870
- }
871
- }
872
- ```
873
-
874
- ---
875
-
876
- ## 8. Execution Workflow
877
-
878
- ### 8.1 Validation Sequence
879
-
880
- 1. **Load specification** from feature.json via `ba-reader`
881
- 2. **Run completeness checks** - Verify all sections present
882
- 3. **Run consistency checks** - Cross-reference validation
883
- 4. **Run convention checks** - Naming, RBAC, structure
884
- 5. **Run risk assessment** - Scope, security, dependencies
885
- 6. **Compile report** - Summarize findings
886
- 7. **Make decision** - Auto-approve, require confirmation, or auto-reject
887
- 8. **Handle result** - Approve, reject with revision options, or force-approve
888
-
889
- ### 8.2 User Interaction (Standard Mode)
890
-
891
- After all checks:
892
-
893
- ```
894
- Validation Report
895
- ═══════════════════════════════════════════════════════════
896
-
897
- ✓ Completeness: PASS (all 9 sections present)
898
- ✓ Consistency: PASS (all cross-references valid)
899
- ✓ Conventions: PASS (naming, RBAC, structure OK)
900
- ⚠ Risk Assessment: HIGH RISK
901
- - Functional requirement count: 28 (above 20 threshold)
902
- - Consider breaking into multiple iterations
903
-
904
- ═══════════════════════════════════════════════════════════
905
-
906
- Decision: Specification can be APPROVED
907
-
908
- Action: [ Approve & Continue ] [ Revise ] [ Override ]
909
- ```
910
-
911
- ### 8.3 Output for Micro Mode
912
-
913
- No user interaction needed:
914
-
915
- ```
916
- Validation Report (Micro Mode - Auto)
917
- ═══════════════════════════════════════════════════════════
918
-
919
- ✓ Structure: PASS (actors, UCs, FRs, matrix, entities, wireframes, gherkin, validations, messages)
920
- ✓ Cross-references: PASS (UC→FR, FR→BR, Actor→Matrix)
921
- ✓ Naming: PASS (UC-*, FR-*, PascalCase)
922
-
923
- Status: AUTO-APPROVED
924
- ═══════════════════════════════════════════════════════════
925
-
926
- Proceeding to handoff...
927
- ```
928
-
929
- ---
930
-
931
- ## 9. Output & Status Update
932
-
933
- ### 9.1 Write Validation Section
934
-
935
- Use `ba-writer.updateValidation()` to write:
936
-
937
- ```json
938
- {
939
- "validation": {
940
- "validatedAt": "2025-02-01T10:30:00Z",
941
- "completenessChecks": [...],
942
- "consistencyChecks": [...],
943
- "conventionChecks": [...],
944
- "riskAssessments": [...],
945
- "decision": {
946
- "approved": true,
947
- "reason": "Specification complete, consistent, and follows SmartStack conventions",
948
- "approvalMode": "standard",
949
- "approvedBy": "user_email@company.com",
950
- "approvedAt": "2025-02-01T10:35:00Z"
951
- }
952
- }
953
- }
954
- ```
955
-
956
- ### 9.2 Update Status
957
-
958
- Use `ba-writer.updateStatus("approved")` to mark validation complete.
959
-
960
- (Or keep status as "specified" if rejected.)
961
-
962
- ### 9.3 Update Changelog
963
-
964
- **OBLIGATOIRE :** Ajouter une entrée changelog pour step-03 via `ba-writer` :
965
-
966
- ```json
967
- {
968
- "changelog": [
969
- {
970
- "step": "step-03-validate",
971
- "timestamp": "2025-02-01T10:35:00Z",
972
- "changes": [
973
- "Validation complétude : X/Y sections présentes",
974
- "Validation cohérence : X cross-references vérifiées",
975
- "Validation conventions : nommage, RBAC, structure",
976
- "Évaluation risques : NIVEAU (détails)",
977
- "Décision : APPROVED/REJECTED (mode: standard/micro/force)"
978
- ],
979
- "warnings": ["Liste des warnings éventuels"],
980
- "decision": "approved"
981
- }
982
- ]
983
- }
984
- ```
985
-
986
- ### 9.4 User Confirmation (Standard Mode)
987
-
988
- ```
989
- ✓ Validation complete - APPROVED
990
-
991
- Completeness: 9/9 sections present
992
- Consistency: 28 cross-references valid
993
- Conventions: All naming and RBAC patterns followed
994
- Risks: Assessed (HIGH: scope count, mitigated in planning)
995
-
996
- Next step: Handoff (step-04-handoff.md)
997
- ```
998
-
999
- ---
1000
-
1001
- ## OUTPUT
1002
-
1003
- This step enriches **feature.json** with:
1004
- - **validation** section containing validation checks, risk assessment, and approval decision
1005
- - **Status:** "approved" (if validation passes) or "specified" (if rejected, awaiting revision)
1006
-
1007
- **Standard mode:** User confirms before approval.
1008
- **Micro mode:** Auto-validates and auto-approves structural completeness.
1009
- **Delta mode:** Validates only affected sections, preserves existing data.