requirements-manager 0.1.1

Plain-text requirements management tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# Review Workflows

> **Note**: Basic suspect link detection is **implemented**. Advanced review workflow features (state tracking, assignments, notifications) are **planned for future releases**.

Review workflows enable teams to track which requirements need review after upstream changes are detected via fingerprint mismatches.

## Available Now: Suspect Link Detection

Requiem can now automatically detect and manage suspect links:

### Commands

**`req suspect`** - List all requirements with fingerprint mismatches

```bash
req suspect
```

Example output:
```
Found 3 suspect link(s):

  SYS-001 → USR-001
    Stored fingerprint:  e533784ff58c16cb
    Current fingerprint: c4020419ead000e9

  SYS-002 → USR-001
    Stored fingerprint:  e533784ff58c16cb
    Current fingerprint: c4020419ead000e9

  SYS-005 → USR-004
    Stored fingerprint:  407c6e3413d5b3fa
    Current fingerprint: c28afe188a974322
```

Exit codes:
- `0`: No suspect links (all current)
- `1`: Suspect links found (useful for CI/CD)

**`req accept <CHILD> <PARENT>`** - Accept a suspect link after review

```bash
req accept SYS-001 USR-001
# Output: Accepted suspect link: SYS-001 → USR-001
```

**`req accept --all`** - Accept all suspect links

```bash
req accept --all
# Output:
# Accepted 3 suspect link(s):
#   SYS-001 → USR-001
#   SYS-002 → USR-001
#   SYS-005 → USR-004
```

### Basic Workflow

```bash
# 1. Check for suspect links
req suspect

# 2. Review parent changes
vim USR-001.md

# 3. Review and update affected children
vim SYS-001.md
vim SYS-002.md

# 4. Accept links after review
req accept SYS-001 USR-001
req accept SYS-002 USR-001

# Or accept all at once
req accept --all

# 5. Verify clean
req suspect
# Output: No suspect links found.
```

### CI/CD Integration

Use in continuous integration:

```bash
#!/bin/bash
# Fail build if suspect links exist
req suspect
if [ $? -ne 0 ]; then
    echo "ERROR: Requirements need review"
    exit 1
fi
```

Or in GitHub Actions:

```yaml
- name: Check for suspect links
  run: |
    req suspect || (echo "Requirements need review" && exit 1)
```

## Planned Advanced Functionality

### Automatic Review Triggers

When a parent requirement changes:

1. Requiem detects fingerprint mismatch in child requirements
2. Child requirements are flagged as "needs review"
3. Team members are notified (configurable)
4. Reviews are tracked until completed

### Review States

Requirements will have review states:

- **Current**: No parent changes; requirement is up to date
- **Suspect**: Parent changed (fingerprint mismatch); needs review
- **Under Review**: Review in progress
- **Reviewed**: Review completed; requirement updated as needed
- **Approved**: Reviewed and approved; baseline updated

### Commands (Planned)

```bash
# Check for requirements needing review
req check

# Mark requirement as under review
req review start SYS-001

# Complete review and update fingerprint
req review complete SYS-001

# Show review status
req status

# Generate review report
req report review
```

## Motivation

### The Problem

**Scenario**: A user requirement changes. Which system requirements are affected?

**Current state**: Manual tracking required.

**Example**:

1. Edit USR-001: Change email validation rules
2. SYS-001, SYS-002, and SYS-005 reference USR-001
3. **Challenge**: Remember to review all three system requirements
4. **Risk**: Forget to review one; inconsistency results

### The Solution

Automatic review tracking:

1. Edit USR-001
2. Requiem automatically flags SYS-001, SYS-002, SYS-005 as "needs review"
3. Team dashboard shows requirements pending review
4. Reviews are tracked and reported
5. Nothing falls through the cracks

## How It Works (Current Implementation)

### Step 1: Make Changes

Edit a requirement:

```bash
vim USR-001.md  # Make your changes
```

The fingerprint of USR-001 automatically changes when content or tags change.

### Step 2: Detect Suspect Links

Find affected children:

```bash
req suspect
```

Output:
```
Found 3 suspect link(s):

  SYS-001 → USR-001
    Stored fingerprint:  e533784ff58c16cb
    Current fingerprint: c4020419ead000e9

  SYS-002 → USR-001
    Stored fingerprint:  e533784ff58c16cb
    Current fingerprint: c4020419ead000e9

  SYS-005 → USR-004
    Stored fingerprint:  407c6e3413d5b3fa
    Current fingerprint: c28afe188a974322
```

### Step 3: Conduct Review

Review each affected requirement:

```bash
# Review parent changes
vim USR-001.md

# Review child and update if needed
vim SYS-001.md
```

### Step 4: Accept Links

After review, accept the fingerprint change:

```bash
# Accept individual link
req accept SYS-001 USR-001

# Or accept all at once
req accept --all
```

Output:
```
Accepted 3 suspect link(s):
  SYS-001 → USR-001
  SYS-002 → USR-001
  SYS-005 → USR-004
```

### Step 5: Verify Clean

Confirm no suspect links remain:

```bash
req suspect
# Output: No suspect links found.
```

## How Advanced Features Will Work (Planned)

### Review State Tracking

Track review progress with states:

```bash
req review start SYS-001
# - Marks requirement as "under review"
# - Records reviewer and timestamp

req review complete SYS-001
# - Marks requirement as "reviewed"
# - Updates parent fingerprints
# - Clears review flag
```

### Status Reports

Generate review reports:

```bash
req report review
```

Output:
```
Review Status Report (2025-07-22)

Pending Reviews:
  SYS-002: parent USR-001 changed (flagged 3 days ago)
  SYS-005: parent USR-001 changed (flagged 3 days ago)

Recently Reviewed:
  SYS-001: reviewed by alice@example.com (2025-07-22)

All Current:
  SYS-003, SYS-004, ...
```

## Use Cases

### Use Case 1: Change Impact Analysis

**Scenario**: Proposing a change to a critical requirement.

**Question**: What's the impact?

**Workflow**:

1. Identify requirement to change (USR-001)
2. Check impact:
```bash
req impact USR-001
```
3. Output shows all descendants:
```
Requirements that depend on USR-001:
  Direct children:
    SYS-001, SYS-002, SYS-005
  Indirect descendants:
    SWR-001, SWR-003 (via SYS-001)
    TST-001, TST-002 (via SYS-001, SYS-002)

Total affected: 7 requirements
```
4. Decide if change is worth the review burden

### Use Case 2: Release Readiness

**Scenario**: Preparing for a release.

**Question**: Are all requirements reviewed and current?

**Workflow**:

```bash
req status
```

Sample output:
```
Requirement Counts
==================
Kind       | Count
-----------+-----
SYS        | 118
TST        | 24
USR        | 6
-----------+-----
Total      | 148

Suspect links: 3
```

If the command exits with code `1`, use the suspect link total as your release checklist—clear
them before shipping:
```bash
req check
# Review each flagged requirement
req review complete ...
```

### Use Case 3: Compliance Audits

**Scenario**: Demonstrating requirements traceability for audit.

**Goal**: Show that all requirements were reviewed after changes.

**Workflow**:

```bash
req report audit --since 2025-01-01
```

Output:
```
Audit Report: Jan 1 - Jul 22, 2025

Requirements Changed: 23
  - USR-001, USR-005, SYS-003, ...

Reviews Conducted: 47
  - All downstream requirements reviewed
  - Average review time: 2.3 days

Compliance: ✓ PASS
  - All changed requirements reviewed
  - All affected descendants reviewed
```

## Configuration (Planned)

### Review Policies

```toml
# config.toml (planned)
[review]
# Automatically flag children when parent changes
auto_flag = true

# Require review completion before allowing further changes
block_on_pending_review = false

# Notification settings
notify_on_flag = true
notification_email = "team@example.com"

# Review SLA (days)
review_sla = 7
```

### Review Rules

```toml
# config.toml (planned)
[review.rules]
# Require review for specific requirement kinds
require_review_for = ["USR", "SYS"]

# Skip review for certain kinds (e.g., documentation)
skip_review_for = ["DOC"]

# Require multiple approvers for critical requirements
require_approvals = 2  # For requirements tagged "critical"
```

## Integration

### Git Integration

Reviews tracked alongside code changes:

```bash
# Edit requirement
vim USR-001.md

# Flag affected requirements
req check

# Create PR with review tracking
git checkout -b update-usr-001
git add USR-001.md
git commit -m "Update USR-001: clarify email validation"

# PR description includes:
# - Changed requirement
# - Affected requirements
# - Review checklist
```

### CI/CD Integration

```yaml
# .github/workflows/requirements.yml (planned)
- name: Check review status
  run: |
    req check
    if [ $? -ne 0 ]; then
      echo "Requirements need review"
      exit 1
    fi
```

### Issue Tracker Integration

Automatically create issues for flagged requirements:

```bash
req check --create-issues
# Creates GitHub/Jira issues for each requirement needing review
```

## Current Workflow Examples

### Example 1: Daily Review Check

Check for suspect links before starting work:

```bash
#!/bin/bash
# daily-check.sh

echo "Checking for suspect links..."
req suspect

if [ $? -eq 0 ]; then
    echo "✓ All requirements current"
else
    echo "⚠ Review needed - see above"
fi
```

### Example 2: Pre-Commit Hook

Prevent commits with unreviewed changes:

```bash
#!/bin/bash
# .git/hooks/pre-commit

req suspect
if [ $? -ne 0 ]; then
    echo "ERROR: Suspect links found. Run 'req suspect' to see them."
    echo "Review and accept links before committing."
    exit 1
fi
```

### Example 3: Pull Request Workflow

```bash
# 1. After making changes
git add -A
git commit -m "Update USR-001 validation rules"

# 2. Check for suspect links
req suspect

# 3. Review and update affected requirements
vim SYS-001.md
vim SYS-002.md

# 4. Accept all after review
req accept --all

# 5. Commit accepted fingerprints
git add -A
git commit -m "Accept fingerprints after USR-001 changes"

# 6. Push
git push
```

### Example 4: Bulk Review Session

Review all pending changes at once:

```bash
# List all suspect links
req suspect > review-list.txt

# Review each one
vim SYS-001.md
vim SYS-002.md
# ... review all

# Accept all at once
req accept --all

# Verify clean
req suspect
```

## Supplementary Tracking (Optional)

While `req suspect` and `req accept` handle basic detection and acceptance, you may want additional tracking:

### Git Commit Messages

Document reviews in commit messages:

```bash
git commit -m "Review SYS-001 after USR-001 change

USR-001 updated email validation rules.
Reviewed SYS-001 and verified consistency.
No changes needed to SYS-001.

Accepted fingerprint: c4020419ead000e9"
```

### Issue Tracking

Create issues for complex reviews:

```markdown
## Review affected requirements after USR-001 change

- [x] SYS-001: Reviewed, no changes needed
- [x] SYS-002: Updated validation logic
- [ ] SYS-005: Waiting for clarification
```

### Tags in Frontmatter

Track review priority with tags:

```yaml
# SYS-001.md
tags:
- high-priority
- security-critical
```

## Future Enhancements

Beyond basic review workflows:

### Advanced Features

**Review assignments**:
```bash
req review assign SYS-001 --to alice@example.com
```

**Review templates**:
```bash
req review start SYS-001 --template checklist.md
# Provides structured review checklist
```

**Review history**:
```bash
req history SYS-001
# Shows all reviews and changes over time
```

**Bulk operations**:
```bash
req review complete SYS-001 SYS-002 SYS-003
# Complete multiple reviews at once
```

### Integrations

**Slack/Teams notifications**:
```
@alice Your review is needed: SYS-001 (parent changed)
```

**Dashboard UI**:
Web dashboard showing review status, pending items, team metrics.

**Approval workflows**:
Multi-step approval for critical requirements.

## Implementation Status

**Current status**: **Partially implemented**

**Available now**:
- ✅ `req suspect` - Detect fingerprint mismatches
- ✅ `req accept <CHILD> <PARENT>` - Accept individual suspect links
- ✅ `req accept --all` - Accept all suspect links
- ✅ CI/CD integration via exit codes

**Planned for future releases**:
- ⏳ Review state tracking (under review, reviewed, approved)
- ⏳ Review assignments and notifications
- ⏳ Status reports and dashboards
- ⏳ Review history and audit logs
- ⏳ Multi-approver workflows

See [GitHub repository](https://github.com/danieleades/requirements-manager) for updates.

## Contributing

Interested in helping implement advanced review workflow features? See the project repository for contribution guidelines.

## Summary

**Implemented features**:

- Automatic suspect link detection (`req suspect`)
- Accepting suspect links after review (`req accept`)
- CI/CD integration with proper exit codes
- Batch operations (`req accept --all`)

**Use these commands now**:
```bash
req suspect              # List suspect links
req accept SYS-001 USR-001  # Accept single link
req accept --all         # Accept all suspect links
```

**Planned advanced features**:

- Review state tracking (suspect → under review → reviewed → approved)
- Commands: `req review start/complete`, `req status`, `req report`
- Review assignments and team workflows
- Notifications and integrations
- Comprehensive audit reports

**Current best practices**:

- Use `req suspect` regularly to check for changes
- Review requirements manually before accepting
- Use `req accept` to update fingerprints after review
- Integrate into CI/CD pipelines for automated checks
- Document reviews in git commit messages

## Next Steps

- Use [Fingerprints]./fingerprints.md for manual change detection
- Implement [workarounds]#workarounds-until-implemented for your workflow
- Watch GitHub repository for implementation updates