@atlashub/smartstack-cli 2.2.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 (37) hide show
  1. package/.documentation/business-analyse.html +1503 -1058
  2. package/.documentation/cli-commands.html +1 -1
  3. package/.documentation/init.html +1 -1
  4. package/.documentation/installation.html +1 -1
  5. package/dist/index.js +76 -47
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -7
  8. package/templates/agents/ba-reader.md +114 -9
  9. package/templates/agents/ba-writer.md +108 -27
  10. package/templates/agents/mcp-healthcheck.md +1 -1
  11. package/templates/ralph/README.md +1 -1
  12. package/templates/ralph/ralph.config.yaml +1 -1
  13. package/templates/skills/_shared.md +60 -0
  14. package/templates/skills/application/steps/step-00-init.md +32 -8
  15. package/templates/skills/business-analyse/SKILL.md +65 -42
  16. package/templates/skills/business-analyse/_shared.md +161 -51
  17. package/templates/skills/business-analyse/questionnaire/00-application.md +166 -0
  18. package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
  19. package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
  20. package/templates/skills/business-analyse/questionnaire.md +63 -19
  21. package/templates/skills/business-analyse/react/application-viewer.md +242 -0
  22. package/templates/skills/business-analyse/react/components.md +60 -8
  23. package/templates/skills/business-analyse/react/schema.md +413 -34
  24. package/templates/skills/business-analyse/schemas/application-schema.json +389 -0
  25. package/templates/skills/business-analyse/schemas/feature-schema.json +287 -46
  26. package/templates/skills/business-analyse/steps/step-00-init.md +110 -44
  27. package/templates/skills/business-analyse/steps/step-01-cadrage.md +259 -0
  28. package/templates/skills/business-analyse/steps/step-02-decomposition.md +282 -0
  29. package/templates/skills/business-analyse/steps/step-03-specify.md +489 -0
  30. package/templates/skills/business-analyse/steps/step-04-consolidation.md +336 -0
  31. package/templates/skills/business-analyse/steps/step-05-handoff.md +1119 -0
  32. package/templates/skills/business-analyse/templates/tpl-handoff.md +11 -2
  33. package/templates/skills/mcp/SKILL.md +2 -2
  34. package/templates/skills/business-analyse/steps/step-01-analyse.md +0 -505
  35. package/templates/skills/business-analyse/steps/step-02-specify.md +0 -833
  36. package/templates/skills/business-analyse/steps/step-03-validate.md +0 -862
  37. package/templates/skills/business-analyse/steps/step-04-handoff.md +0 -1593
@@ -1,862 +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
- ---
127
-
128
- ## 3. Consistency Checks
129
-
130
- ### 3.1 Use Case ↔ Functional Requirement Mapping
131
-
132
- **Rule:** Every UC should have ≥1 linked FR.
133
-
134
- Check each use case:
135
-
136
- ```json
137
- {
138
- "checks": [
139
- {
140
- "check": "UC-001 has linked FRs",
141
- "useCaseId": "UC-001",
142
- "linkedFRs": ["FR-001", "FR-002"],
143
- "status": "PASS" ✓
144
- },
145
- {
146
- "check": "UC-002 has linked FRs",
147
- "useCaseId": "UC-002",
148
- "linkedFRs": ["FR-003"],
149
- "status": "PASS" ✓
150
- },
151
- {
152
- "check": "UC-005 has linked FRs",
153
- "useCaseId": "UC-005",
154
- "linkedFRs": [],
155
- "status": "FAIL" ✗ → "UC-005 orphaned: no FRs linked"
156
- }
157
- ]
158
- }
159
- ```
160
-
161
- **Resolution:**
162
- - ✓ PASS: UC has ≥1 FR
163
- - ✗ FAIL: Add FRs or remove UC
164
-
165
- ### 3.2 Functional Requirement ↔ Business Rule Mapping
166
-
167
- **Rule:** Every FR should have ≥1 linked BR (from analysis section).
168
-
169
- Check each FR:
170
-
171
- ```json
172
- {
173
- "checks": [
174
- {
175
- "check": "FR-001 has linked BRs",
176
- "frId": "FR-001",
177
- "linkedRules": ["BR-001", "BR-003"],
178
- "status": "PASS" ✓
179
- },
180
- {
181
- "check": "FR-004 has linked BRs",
182
- "frId": "FR-004",
183
- "linkedRules": [],
184
- "status": "WARNING" ⚠ → "FR-004: Consider linking to a BR"
185
- }
186
- ]
187
- }
188
- ```
189
-
190
- **Resolution:**
191
- - ✓ PASS: FR has ≥1 BR
192
- - ⚠ WARNING: FR is implementation-detail (may be OK)
193
-
194
- ### 3.3 Business Rule ↔ Use Case Mapping
195
-
196
- **Rule:** Every BR used in specification should exist in analysis.
197
-
198
- Cross-check all BR references:
199
-
200
- ```json
201
- {
202
- "checks": [
203
- {
204
- "check": "All BR references valid",
205
- "referencedBRs": ["BR-001", "BR-003", "BR-005"],
206
- "definedBRs": ["BR-001", "BR-002", "BR-003", "BR-004", "BR-005"],
207
- "missing": [],
208
- "status": "PASS" ✓
209
- },
210
- {
211
- "check": "All BR references valid",
212
- "referencedBRs": ["BR-001", "BR-008"],
213
- "definedBRs": ["BR-001", "BR-002", "BR-003"],
214
- "missing": ["BR-008"],
215
- "status": "FAIL" ✗ → "BR-008 not defined in analysis"
216
- }
217
- ]
218
- }
219
- ```
220
-
221
- **Resolution:**
222
- - ✓ PASS: All referenced BRs exist
223
- - ✗ FAIL: Remove orphaned BR references or add to analysis
224
-
225
- ### 3.4 Actor ↔ Permission Matrix Mapping
226
-
227
- **Rule:** Every actor should appear in permission matrix.
228
-
229
- ```json
230
- {
231
- "checks": [
232
- {
233
- "check": "All actors covered in permission matrix",
234
- "actors": ["Admin", "Manager", "User", "Guest"],
235
- "inMatrix": ["Admin", "Manager", "User", "Guest"],
236
- "missing": [],
237
- "status": "PASS" ✓
238
- },
239
- {
240
- "check": "All actors covered in permission matrix",
241
- "actors": ["Admin", "Manager", "User", "Guest", "External"],
242
- "inMatrix": ["Admin", "Manager", "User"],
243
- "missing": ["Guest", "External"],
244
- "status": "FAIL" ✗ → "2 actors not in permission matrix"
245
- }
246
- ]
247
- }
248
- ```
249
-
250
- **Resolution:**
251
- - ✓ PASS: All actors have permissions
252
- - ✗ FAIL: Add missing actors to matrix or remove from actor list
253
-
254
- ### 3.5 Entity ↔ Permission Resource Mapping
255
-
256
- **Rule:** Every entity in entities[] should have a resource in permissionMatrix.
257
-
258
- ```json
259
- {
260
- "checks": [
261
- {
262
- "check": "All entities have permissions",
263
- "entities": ["Order", "Customer", "Product"],
264
- "permissionResources": ["Order", "Customer", "Product"],
265
- "missing": [],
266
- "status": "PASS" ✓
267
- },
268
- {
269
- "check": "All entities have permissions",
270
- "entities": ["Order", "Customer", "OrderLine"],
271
- "permissionResources": ["Order", "Customer"],
272
- "missing": ["OrderLine"],
273
- "status": "WARNING" ⚠ → "OrderLine has no permissions (may be child entity)"
274
- }
275
- ]
276
- }
277
- ```
278
-
279
- **Resolution:**
280
- - ✓ PASS: All entities have permissions
281
- - ⚠ WARNING: Child entities may not need separate permissions
282
-
283
- ### 3.6 Gherkin ↔ Use Case Coverage
284
-
285
- **Rule:** Every major UC should have ≥2 Gherkin scenarios.
286
-
287
- ```json
288
- {
289
- "checks": [
290
- {
291
- "check": "UC-001 has Gherkin coverage",
292
- "useCaseId": "UC-001",
293
- "scenarios": 3,
294
- "status": "PASS" ✓
295
- },
296
- {
297
- "check": "UC-003 has Gherkin coverage",
298
- "useCaseId": "UC-003",
299
- "scenarios": 0,
300
- "status": "FAIL" ✗ → "UC-003: No Gherkin scenarios"
301
- }
302
- ]
303
- }
304
- ```
305
-
306
- **Resolution:**
307
- - ✓ PASS: UC has ≥2 scenarios
308
- - ✗ FAIL: Add Gherkin scenarios or remove UC
309
-
310
- ---
311
-
312
- ## 4. SmartStack Convention Validation
313
-
314
- ### 4.1 Naming Conventions
315
-
316
- | Element | Pattern | Check |
317
- |---------|---------|-------|
318
- | **Actor** | PascalCase | "Admin", "Manager" ✓ |
319
- | **Use Case** | UC-NNN | "UC-001", "UC-042" ✓ |
320
- | **Functional Req** | FR-NNN | "FR-001", "FR-025" ✓ |
321
- | **Business Rule** | BR-NNN | References to BR-* ✓ |
322
- | **Entity** | PascalCase | "Order", "Customer" ✓ |
323
- | **Field** | camelCase | "orderNumber", "createdDate" ✓ |
324
- | **SeedData Table** | Module_Name | "Order_Status", "Customer_Type" ✓ |
325
- | **State** | PascalCase | "Draft", "Approved" ✓ |
326
- | **Permission** | PascalCase | "Read", "Create", "Update", "Delete" ✓ |
327
-
328
- **Validation:**
329
- ```json
330
- {
331
- "checks": [
332
- {
333
- "element": "Actors",
334
- "rule": "PascalCase",
335
- "actual": ["Admin", "Manager", "User", "Guest"],
336
- "status": "PASS" ✓
337
- },
338
- {
339
- "element": "Use Cases",
340
- "rule": "UC-NNN format",
341
- "actual": ["UC-001", "UC-002", "UC-003", "UC-004"],
342
- "status": "PASS" ✓
343
- },
344
- {
345
- "element": "Functional Requirements",
346
- "rule": "FR-NNN format",
347
- "actual": ["FR-001", "fr-002", "FR-003"],
348
- "status": "FAIL" ✗ → "fr-002 should be FR-002"
349
- }
350
- ]
351
- }
352
- ```
353
-
354
- ### 4.2 RBAC Pattern Validation
355
-
356
- **Rule:** Permission matrix should follow principle of least privilege.
357
-
358
- Check role escalation:
359
-
360
- | Role | Read | Create | Update | Delete | Approve |
361
- |------|------|--------|--------|--------|---------|
362
- | **Guest** | ✓ | ✗ | ✗ | ✗ | ✗ |
363
- | **User** | ✓ | ✓ | ✓ | ✗ | ✗ |
364
- | **Manager** | ✓ | ✓ | ✓ | ✗ | ✓ |
365
- | **Admin** | ✓ | ✓ | ✓ | ✓ | ✓ |
366
-
367
- **Validation:**
368
- ```json
369
- {
370
- "check": "RBAC least privilege",
371
- "issues": [
372
- {
373
- "resource": "Order",
374
- "issue": "User can Delete (should be Manager minimum)",
375
- "severity": "ERROR" ✗
376
- },
377
- {
378
- "resource": "Customer",
379
- "issue": "Guest cannot Read (critical data exposure)",
380
- "severity": "ERROR" ✗
381
- }
382
- ]
383
- }
384
- ```
385
-
386
- ### 4.3 Entity Structure Validation
387
-
388
- **Rule:** Entities must have primary key, timestamps, ownership.
389
-
390
- ```json
391
- {
392
- "checks": [
393
- {
394
- "entity": "Order",
395
- "fields": ["id", "orderNumber", "orderDate", "createdBy", "createdDate"],
396
- "hasPrimaryKey": true,
397
- "hasTimestamps": true,
398
- "hasOwnership": true,
399
- "status": "PASS" ✓
400
- },
401
- {
402
- "entity": "OrderLine",
403
- "fields": ["orderId", "lineNumber", "quantity"],
404
- "hasPrimaryKey": false,
405
- "hasTimestamps": false,
406
- "hasOwnership": false,
407
- "status": "FAIL" ✗ → "Missing primary key, timestamps"
408
- }
409
- ]
410
- }
411
- ```
412
-
413
- ### 4.4 State Machine Validation
414
-
415
- **Rule:** Each state should have exit transitions; terminal states have none.
416
-
417
- ```json
418
- {
419
- "checks": [
420
- {
421
- "entity": "Order",
422
- "state": "Draft",
423
- "hasTransitions": true,
424
- "status": "PASS" ✓
425
- },
426
- {
427
- "entity": "Order",
428
- "state": "Cancelled",
429
- "isTerminal": true,
430
- "hasTransitions": false,
431
- "status": "PASS" ✓
432
- },
433
- {
434
- "entity": "Order",
435
- "state": "Processing",
436
- "hasTransitions": false,
437
- "isTerminal": false,
438
- "status": "WARNING" ⚠ → "Non-terminal state with no exit transitions (deadlock?)"
439
- }
440
- ]
441
- }
442
- ```
443
-
444
- ---
445
-
446
- ## 5. Risk Assessment
447
-
448
- ### 5.1 Scope Creep Detection
449
-
450
- Check for excessive complexity:
451
-
452
- ```json
453
- {
454
- "riskAssessments": [
455
- {
456
- "risk": "Scope Creep",
457
- "indicators": [
458
- {
459
- "metric": "Use case count",
460
- "value": 8,
461
- "threshold": 12,
462
- "status": "ACCEPTABLE" ✓
463
- },
464
- {
465
- "metric": "Functional requirement count",
466
- "value": 28,
467
- "threshold": 20,
468
- "status": "WARNING" ⚠ → "Above typical for single iteration"
469
- }
470
- ]
471
- }
472
- ]
473
- }
474
- ```
475
-
476
- ### 5.2 Missing Validation Rules
477
-
478
- Check for fields without validation:
479
-
480
- ```json
481
- {
482
- "riskAssessments": [
483
- {
484
- "risk": "Unvalidated Fields",
485
- "fields": [
486
- {
487
- "name": "OrderNumber",
488
- "hasValidation": true,
489
- "status": "PASS" ✓
490
- },
491
- {
492
- "name": "Notes",
493
- "hasValidation": false,
494
- "status": "WARNING" ⚠ → "Consider max length, SQL injection protection"
495
- }
496
- ]
497
- }
498
- ]
499
- }
500
- ```
501
-
502
- ### 5.3 Ambiguous Use Cases
503
-
504
- Detect UCs that lack clarity:
505
-
506
- ```json
507
- {
508
- "riskAssessments": [
509
- {
510
- "risk": "Ambiguous Use Cases",
511
- "useCases": [
512
- {
513
- "id": "UC-001",
514
- "clarity": "clear",
515
- "status": "PASS" ✓
516
- },
517
- {
518
- "id": "UC-005",
519
- "clarity": "vague",
520
- "reason": "Main flow not specific; unclear error handling",
521
- "status": "WARNING" ⚠
522
- }
523
- ]
524
- }
525
- ]
526
- }
527
- ```
528
-
529
- ### 5.4 Dependency Complexity
530
-
531
- Check for excessive cross-module dependencies:
532
-
533
- ```json
534
- {
535
- "riskAssessments": [
536
- {
537
- "risk": "Dependency Coupling",
538
- "dependencies": 2,
539
- "threshold": 5,
540
- "status": "ACCEPTABLE" ✓
541
- }
542
- ]
543
- }
544
- ```
545
-
546
- ### 5.5 Security & Compliance Gaps
547
-
548
- Check for missing audit/archival:
549
-
550
- ```json
551
- {
552
- "riskAssessments": [
553
- {
554
- "risk": "Security & Compliance",
555
- "checks": [
556
- {
557
- "check": "Sensitive data (PII) has auditing",
558
- "hasAuditingPolicy": true,
559
- "status": "PASS" ✓
560
- },
561
- {
562
- "check": "Long-term data has archival policy",
563
- "hasArchivalPolicy": true,
564
- "status": "PASS" ✓
565
- },
566
- {
567
- "check": "All state transitions logged",
568
- "status": "PASS" ✓
569
- }
570
- ]
571
- }
572
- ]
573
- }
574
- ```
575
-
576
- ---
577
-
578
- ## 6. Approval Decision Logic
579
-
580
- ### 6.1 Decision Tree
581
-
582
- ```
583
- ┌─ Completeness Check
584
- │ ├─ FAIL → Reject: "Incomplete specification"
585
- │ └─ PASS → Continue
586
- ├─ Consistency Check
587
- │ ├─ ERROR found → Reject: "Inconsistent cross-references"
588
- │ ├─ WARNING found → Continue (review)
589
- │ └─ PASS → Continue
590
- ├─ Convention Check
591
- │ ├─ ERROR found → Reject: "Convention violations"
592
- │ └─ PASS → Continue
593
- ├─ Risk Assessment
594
- │ ├─ CRITICAL risk → Reject: "High-risk specification"
595
- │ ├─ HIGH risk → Require confirmation
596
- │ └─ ACCEPTABLE → Continue
597
- └─ Final Decision
598
- ├─ User confirms → APPROVED ✓ (status: "approved")
599
- └─ User rejects → REJECTED ✗ (status: "specified", mark for revision)
600
- ```
601
-
602
- ### 6.2 Approval Criteria (Standard Mode)
603
-
604
- **AUTO-APPROVE if:**
605
- - Completeness: PASS
606
- - Consistency: PASS or WARNING only
607
- - Conventions: PASS
608
- - Risks: ACCEPTABLE or HIGH (with user confirmation)
609
-
610
- **AUTO-REJECT if:**
611
- - Completeness: FAIL
612
- - Consistency: ERROR
613
- - Conventions: ERROR
614
- - Risks: CRITICAL
615
-
616
- ### 6.3 Approval Criteria (Micro Mode)
617
-
618
- **AUTO-APPROVE if:**
619
- - Completeness: Minimum set present (actors, UCs, FRs, matrix, entities, wireframes, gherkin, validations, messages)
620
- - Consistency: No cross-reference errors
621
- - Naming: Follows conventions (UC-*, FR-*, PascalCase)
622
-
623
- No user interaction required.
624
-
625
- ### 6.4 Approval Criteria (Delta Mode)
626
-
627
- **AUTO-APPROVE if:**
628
- - Affected sections (delta: true) are complete
629
- - Cross-references within delta sections consistent
630
- - No conflicts with existing sections
631
-
632
- ---
633
-
634
- ## 7. Handling Rejections
635
-
636
- ### 7.1 Rejection Reasons & Options
637
-
638
- When specification is REJECTED, offer user choices:
639
-
640
- ```json
641
- {
642
- "rejection": {
643
- "reason": "Inconsistent cross-references",
644
- "errors": [
645
- "UC-005: No linked FRs",
646
- "FR-004: Links to undefined BR-008"
647
- ],
648
- "options": [
649
- {
650
- "id": 1,
651
- "action": "auto-revise",
652
- "description": "Fix obvious issues automatically (remove orphaned UCs, skip FRs)"
653
- },
654
- {
655
- "id": 2,
656
- "action": "manual-revise",
657
- "description": "Return to step-02 to revise specification manually"
658
- },
659
- {
660
- "id": 3,
661
- "action": "force-approve",
662
- "description": "Override validation and approve anyway (risky)"
663
- }
664
- ]
665
- }
666
- }
667
- ```
668
-
669
- ### 7.2 Auto-Revise Strategy
670
-
671
- When user chooses auto-revise:
672
-
673
- 1. **Remove orphaned UCs** - UCs with no linked FRs
674
- 2. **Remove orphaned FRs** - FRs with no linked BRs (optional warning)
675
- 3. **Fix naming** - Convert "fr-002" → "FR-002"
676
- 4. **Remove invalid BR references** - Delete references to undefined BRs
677
- 5. **Add missing permissions** - For any new actors discovered
678
- 6. **Revalidate** - Run validation again
679
-
680
- Example:
681
- ```json
682
- {
683
- "autoRevise": {
684
- "removedElements": [
685
- {
686
- "type": "useCase",
687
- "id": "UC-005",
688
- "reason": "No linked FRs"
689
- },
690
- {
691
- "type": "businessRuleReference",
692
- "location": "FR-004.linkedRules",
693
- "value": "BR-008",
694
- "reason": "BR-008 not defined in analysis"
695
- }
696
- ],
697
- "fixedElements": [
698
- {
699
- "type": "functionalRequirement",
700
- "id": "fr-002",
701
- "from": "fr-002",
702
- "to": "FR-002"
703
- }
704
- ],
705
- "result": "Revalidating..."
706
- }
707
- }
708
- ```
709
-
710
- ### 7.3 Manual Revision (Return to Step-02)
711
-
712
- If user chooses manual revision:
713
-
714
- 1. Provide list of errors to fix
715
- 2. Return to step-02-specify.md with context
716
- 3. User revises specification
717
- 4. Return to step-03 for re-validation
718
- 5. Loop until approved
719
-
720
- ### 7.4 Force-Approve (Override)
721
-
722
- If user chooses force-approve:
723
-
724
- 1. Mark status as "approved" despite errors
725
- 2. Add validation warning to feature.json.validation
726
- 3. Escalate errors to development team
727
- 4. Proceed to handoff
728
- 5. **WARNING:** Development may encounter issues
729
-
730
- ```json
731
- {
732
- "validation": {
733
- "status": "approved",
734
- "approvalMode": "force",
735
- "overriddenErrors": [
736
- {
737
- "type": "consistency",
738
- "message": "UC-005: No linked FRs"
739
- },
740
- {
741
- "type": "convention",
742
- "message": "fr-002: Should be FR-002"
743
- }
744
- ],
745
- "approvedBy": "User override",
746
- "approvedAt": "2025-02-01T10:30:00Z"
747
- }
748
- }
749
- ```
750
-
751
- ---
752
-
753
- ## 8. Execution Workflow
754
-
755
- ### 8.1 Validation Sequence
756
-
757
- 1. **Load specification** from feature.json via `ba-reader`
758
- 2. **Run completeness checks** - Verify all sections present
759
- 3. **Run consistency checks** - Cross-reference validation
760
- 4. **Run convention checks** - Naming, RBAC, structure
761
- 5. **Run risk assessment** - Scope, security, dependencies
762
- 6. **Compile report** - Summarize findings
763
- 7. **Make decision** - Auto-approve, require confirmation, or auto-reject
764
- 8. **Handle result** - Approve, reject with revision options, or force-approve
765
-
766
- ### 8.2 User Interaction (Standard Mode)
767
-
768
- After all checks:
769
-
770
- ```
771
- Validation Report
772
- ═══════════════════════════════════════════════════════════
773
-
774
- ✓ Completeness: PASS (all 9 sections present)
775
- ✓ Consistency: PASS (all cross-references valid)
776
- ✓ Conventions: PASS (naming, RBAC, structure OK)
777
- ⚠ Risk Assessment: HIGH RISK
778
- - Functional requirement count: 28 (above 20 threshold)
779
- - Consider breaking into multiple iterations
780
-
781
- ═══════════════════════════════════════════════════════════
782
-
783
- Decision: Specification can be APPROVED
784
-
785
- Action: [ Approve & Continue ] [ Revise ] [ Override ]
786
- ```
787
-
788
- ### 8.3 Output for Micro Mode
789
-
790
- No user interaction needed:
791
-
792
- ```
793
- Validation Report (Micro Mode - Auto)
794
- ═══════════════════════════════════════════════════════════
795
-
796
- ✓ Structure: PASS (actors, UCs, FRs, matrix, entities, wireframes, gherkin, validations, messages)
797
- ✓ Cross-references: PASS (UC→FR, FR→BR, Actor→Matrix)
798
- ✓ Naming: PASS (UC-*, FR-*, PascalCase)
799
-
800
- Status: AUTO-APPROVED
801
- ═══════════════════════════════════════════════════════════
802
-
803
- Proceeding to handoff...
804
- ```
805
-
806
- ---
807
-
808
- ## 9. Output & Status Update
809
-
810
- ### 9.1 Write Validation Section
811
-
812
- Use `ba-writer.updateValidation()` to write:
813
-
814
- ```json
815
- {
816
- "validation": {
817
- "validatedAt": "2025-02-01T10:30:00Z",
818
- "completenessChecks": [...],
819
- "consistencyChecks": [...],
820
- "conventionChecks": [...],
821
- "riskAssessments": [...],
822
- "decision": {
823
- "approved": true,
824
- "reason": "Specification complete, consistent, and follows SmartStack conventions",
825
- "approvalMode": "standard",
826
- "approvedBy": "user_email@company.com",
827
- "approvedAt": "2025-02-01T10:35:00Z"
828
- }
829
- }
830
- }
831
- ```
832
-
833
- ### 9.2 Update Status
834
-
835
- Use `ba-writer.updateStatus("approved")` to mark validation complete.
836
-
837
- (Or keep status as "specified" if rejected.)
838
-
839
- ### 9.3 User Confirmation (Standard Mode)
840
-
841
- ```
842
- ✓ Validation complete - APPROVED
843
-
844
- Completeness: 9/9 sections present
845
- Consistency: 28 cross-references valid
846
- Conventions: All naming and RBAC patterns followed
847
- Risks: Assessed (HIGH: scope count, mitigated in planning)
848
-
849
- Next step: Handoff (step-04-handoff.md)
850
- ```
851
-
852
- ---
853
-
854
- ## OUTPUT
855
-
856
- This step enriches **feature.json** with:
857
- - **validation** section containing validation checks, risk assessment, and approval decision
858
- - **Status:** "approved" (if validation passes) or "specified" (if rejected, awaiting revision)
859
-
860
- **Standard mode:** User confirms before approval.
861
- **Micro mode:** Auto-validates and auto-approves structural completeness.
862
- **Delta mode:** Validates only affected sections, preserves existing data.