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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# CLI Command Reference

Complete reference for the `req` command-line interface.

## Overview

The `req` command is the main interface to Requiem. It provides commands for creating, linking, and managing requirements.

### Global Synopsis

```
req [OPTIONS] <COMMAND>
```

Running `req` with no subcommand defaults to `req status`, providing a quick health
dashboard for the repository.

### Getting Help

```bash
# General help
req --help

# Command-specific help
req add --help
req link --help
req clean --help
```

### Version Information

```bash
req --version
```

## Global Options

Options that apply to all commands.

### `-v, --verbose`

Increase logging verbosity. Can be specified multiple times.

**Levels**:
- No `-v`: WARN level (errors and warnings only)
- `-v`: INFO level (general information)
- `-vv`: DEBUG level (detailed debugging information)
- `-vvv`: TRACE level (very detailed trace information)

**Examples**:
```bash
req -v clean              # INFO level
req -vv add USR           # DEBUG level
req -vvv link SYS-001 USR-001  # TRACE level
```

**Use cases**:
- **Normal use**: No `-v` flag
- **Troubleshooting**: `-v` or `-vv`
- **Development/debugging**: `-vvv`

### `-r, --root <PATH>`

Specify the root directory containing requirements.

**Default**: Current directory (`.`)

**Examples**:
```bash
req --root /path/to/requirements add USR
req -r ./reqs clean
req --root ~/project/requirements link SYS-001 USR-001
```

**Notes**:
- Path can be absolute or relative
- Must be a directory
- Directory should contain `config.toml` (optional) and `.md` requirement files

## Commands

### `req status`

Display a quick summary of requirement counts and suspect links.

#### Synopsis

```
req status [OPTIONS]
```

#### Options

None.

#### Behavior

1. Loads all requirements in the repository.
2. Prints a table listing each requirement kind with its count and the overall total.
3. Displays the total number of suspect links.
4. Exits with status code `1` when any suspect links are present, otherwise `0`.

#### Examples

**Summary view**:
```bash
req status
```

### `req add`

Create a new requirement.

#### Synopsis

```
req add [OPTIONS] <KIND>
```

#### Arguments

**`<KIND>`** (required)

The kind of requirement to create. This becomes the KIND component of the HRID.

Examples: `USR`, `SYS`, `SWR`, `TST`, `AUTH-USR` (with namespace)

#### Options

**`-p, --parent <PARENT>...`**

Specify parent requirement(s) by HRID. Can be specified multiple times or as comma-separated list.

**Examples**:
```bash
# Single parent
req add SYS --parent USR-001

# Multiple parents (multiple flags)
req add SYS --parent USR-001 --parent USR-002

# Multiple parents (comma-separated)
req add SYS --parents USR-001,USR-002

# Short form
req add SYS -p USR-001,USR-002
```

**`-t, --title <TITLE>`**

Set the title of the requirement. The title will be formatted as a markdown heading (`# Title`).

If both `-t` and `-b` are provided, the title appears first, followed by a blank line, then the body.

**Examples**:
```bash
# Create with title only
req add USR -t "User Authentication"

# Create with title and body
req add USR -t "User Authentication" -b "The system shall authenticate users."
```

**`-b, --body <BODY>`**

Set the body content of the requirement. Can be any markdown text.

**Examples**:
```bash
# Create with body only
req add USR -b "The system shall validate user input."

# Create with multi-line body (using quotes)
req add USR -b "The system shall:
- Validate input
- Sanitize data
- Log attempts"
```

#### Behavior

1. Determines next available ID for the given KIND (e.g., `USR-001`)
2. Determines title and body:
   - Title from `-t/--title` flag, or empty if not provided
   - Body from `-b/--body` flag, or template file, or empty
3. Creates requirement file `<KIND>-<ID>.md` with:
   - Level-1 heading with HRID and title (e.g., `# USR-001 My Title`)
   - YAML frontmatter (UUID, timestamp, tags, parents)
   - Body content (from flag, template, or empty)
4. Prints the HRID of created requirement

**Template Behavior**:
- Templates provide body content only (not HRID or title)
- CLI flags (`-t`, `-b`) always override templates
- Templates are matched by KIND (e.g., `USR.md` for `USR` requirements)
- Template files are stored in `.req/templates/` directory
- See [Templates Guide](../working-with-requirements/templates.md) for details

#### Examples

**Create user requirement**:
```bash
req add USR
# Output: Added requirement USR-001
```

**Create system requirement with parent**:
```bash
req add SYS --parent USR-001
# Output: Added requirement SYS-001
```

**Create requirement with multiple parents**:
```bash
req add SWR --parents SYS-001,SYS-002
# Output: Added requirement SWR-001
```

**Create namespaced requirement**:
```bash
req add AUTH-USR
# Output: Added requirement AUTH-USR-001
```

**Create with title and body**:
```bash
req add USR -t "User Authentication" -b "The system shall authenticate users."
# Output: Added requirement USR-001
# Content: # User Authentication\n\nThe system shall authenticate users.
```

**Create with template** (assuming `.req/templates/USR.md` exists):
```bash
req add USR
# Output: Added requirement USR-001
# File structure:
# ---
# _version: '1'
# uuid: ...
# created: ...
# ---
# # USR-001
#
# [Template body content from .req/templates/USR.md]
```

**Create with template and title**:
```bash
req add USR -t "User Authentication"
# Output: Added requirement USR-001
# Uses title from -t flag, body from template
```

**Override template with body flag**:
```bash
req add USR -b "Custom content"
# Output: Added requirement USR-001
# Uses body from -b flag, template ignored
```

#### Error Cases

**Empty KIND**:
```bash
req add ""
# Error: Kind cannot be empty
```

**Invalid KIND** (if `allowed_kinds` configured):
```bash
req add INVALID
# Error: Kind 'INVALID' is not in the allowed list
```

**Parent not found**:
```bash
req add SYS --parent USR-999
# Error: Parent requirement USR-999 not found
```

### `req link`

Create a parent-child link between two existing requirements.

#### Synopsis

```
req link <CHILD> <PARENT>
```

#### Arguments

**`<CHILD>`** (required)

HRID of the child requirement (the requirement gaining a parent).

**`<PARENT>`** (required)

HRID of the parent requirement (the upstream requirement).

#### Behavior

1. Loads both child and parent requirements
2. Adds parent reference to child's frontmatter:
   - Parent's UUID
   - Parent's current HRID
   - Parent's current fingerprint
3. Saves updated child requirement
4. Prints confirmation message

#### Examples

**Link system to user requirement**:
```bash
req link SYS-001 USR-001
# Output: Linked SYS-001 to USR-001
```

**Link with namespaces**:
```bash
req link AUTH-SYS-001 AUTH-USR-001
# Output: Linked AUTH-SYS-001 to AUTH-USR-001
```

**Create second parent** (multiple parents supported):
```bash
req link SYS-001 USR-001  # First parent
req link SYS-001 USR-002  # Second parent
# SYS-001 now has two parents
```

#### Error Cases

**Child not found**:
```bash
req link SYS-999 USR-001
# Error: Child requirement SYS-999 not found
```

**Parent not found**:
```bash
req link SYS-001 USR-999
# Error: Parent requirement USR-999 not found
```

**Invalid HRID format**:
```bash
req link INVALID USR-001
# Error: Invalid HRID format: INVALID
```

### `req suspect`

List all suspect links in the requirement graph.

#### Synopsis

```
req suspect
```

#### Arguments

None.

#### Options

None.

#### Behavior

1. Loads all requirements from the requirements directory
2. Compares stored parent fingerprints with current parent fingerprints
3. Lists all requirements with mismatched fingerprints (suspect links)
4. For each suspect link, displays:
   - Child HRID → Parent HRID
   - Stored fingerprint (first 16 characters)
   - Current fingerprint (first 16 characters)
5. Exits with code 1 if suspect links found (useful for CI/CD)
6. Exits with code 0 if no suspect links found

#### Examples

**Check for suspect links**:
```bash
req suspect
```

Example output when suspect links exist:
```
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
```

Example output when no suspect links:
```
No suspect links found.
```

**In CI/CD pipeline**:
```bash
req suspect && echo "All links current" || echo "Review needed"
```

#### Use Cases

- **Pre-commit validation**: Check if parent requirements changed without updating children
- **CI/CD integration**: Fail builds when requirements need review
- **Regular audits**: Identify requirements needing review after upstream changes
- **Change impact**: See which requirements are affected by parent changes

#### Exit Codes

- **0**: No suspect links found (all fingerprints current)
- **1**: Suspect links found (some requirements need review)

This exit code behavior makes the command useful in automation:

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

### `req accept`

Accept suspect links after review, updating fingerprints to current values.

#### Synopsis

```
req accept <CHILD> <PARENT>
req accept --all
```

#### Arguments

**`<CHILD>`** (required unless `--all`)

HRID of the child requirement containing the suspect link.

**`<PARENT>`** (required unless `--all`)

HRID of the parent requirement referenced by the suspect link.

#### Options

**`--all`**

Accept all suspect links in the requirements directory. Updates all fingerprints to match current parent values.

#### Behavior

**Single link mode** (`req accept <CHILD> <PARENT>`):
1. Loads the child and parent requirements
2. Verifies the link exists
3. Updates the stored fingerprint to match the parent's current fingerprint
4. Saves the updated child requirement
5. Prints confirmation or reports if link was already up to date

**Bulk mode** (`req accept --all`):
1. Finds all suspect links
2. Updates all fingerprints to current values
3. Saves all affected requirements
4. Prints summary of updated links

#### Examples

**Accept a single suspect link**:
```bash
req accept SYS-001 USR-001
# Output: Accepted suspect link: SYS-001 → USR-001
```

**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
```

**Accept after no review needed**:
```bash
req accept SYS-001 USR-001
# Output: Link SYS-001 → USR-001 is already up to date (not suspect).
```

#### Workflow

Typical workflow for handling suspect links:

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

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

# 3. Review child requirement
vim SYS-001.md  # Update if needed

# 4. Accept the link (marks as reviewed)
req accept SYS-001 USR-001

# 5. Verify no more suspect links
req suspect
```

#### Use Cases

- **After review**: Mark requirements as reviewed after verifying consistency with parent changes
- **Bulk acceptance**: Update all fingerprints after reviewing multiple changes
- **Post-merge**: Accept fingerprints after merging upstream requirement changes
- **Release preparation**: Clear all suspect links before release

#### Error Cases

**Link not found**:
```bash
req accept SYS-001 USR-999
# Error: Parent requirement USR-999 not found
```

**Child not found**:
```bash
req accept SYS-999 USR-001
# Error: Child requirement SYS-999 not found
```

**No link exists**:
```bash
req accept SYS-001 USR-001
# Error: link from SYS-001 to USR-001 not found
```

**No suspect links with --all**:
```bash
req accept --all
# Output: No suspect links to accept.
```

### `req list`

List requirements with optional filtering, traversal, and output formatting.

#### Synopsis

```
req list [OPTIONS] [HRID...]
```

#### Arguments

**`<HRID>`** *(optional, repeats)*

Target requirements to anchor the listing. When omitted, the command starts from all
requirements (with the default view limited to top-level, parentless requirements).

#### Options

- **`--columns <COL>`**: Comma-separated list of columns (`hrid`, `title`, `kind`, `namespace`,
  `parents`, `children`, `tags`, `path`, `created`). Default columns show HRID, title, kind,
  parent count, child count, and tags. When `--quiet` is present without explicit columns, only
  HRIDs are emitted.
- **`--sort <FIELD>`**: Sort output by `hrid` *(default)*, `kind`, `title`, or `created`.
- **`--output <FORMAT>`**: Choose `table` *(default)*, `json`, or `csv`. Table output is human
  readable; JSON and CSV are machine friendly.
- **`--quiet`**: Suppress headers and format rows for shell pipelines. Defaults to one HRID per
  line unless additional columns are requested.
- **`--kind <KIND>`**, **`--namespace <SEG>`**, **`--tag <TAG>`**: Filter by kind, namespace
  segment, or tag (case-insensitive, commas or repeated flags allowed).
- **`--orphans`**, **`--leaves`**: Limit to requirements with no parents or no children.
- **`--contains <TEXT>`**, **`--regex <PATTERN>`**: Search requirement title/body with a
  case-insensitive substring or Rust regular expression (mutually exclusive).
- **`--view <MODE>`**: Choose how to explore relationships. Options: `summary` *(default table)*,
  `parents`, `children`, `ancestors`, `descendants`, `tree` (indented descendant view), and
  `context` (base rows plus labelled neighbours).
- **`--depth <N>`**: Depth limit for the selected view (default `1` for parents/children/context,
  unlimited for ancestors/descendants/tree). Use `0` for no limit.
- **`--limit <N>`**, **`--offset <N>`**: Paginate large result sets by skipping `offset` rows and
  then truncating to `limit`. Defaults to 200 rows when omitted; pass `--limit 0` for no cap.

#### Behavior

1. Loads all requirements and builds parent/child relationships.
2. Determines the working set:
   - If HRIDs are provided, they anchor traversal; otherwise all requirements are considered.
   - Without explicit filters or traversal flags, the default view lists every requirement sorted
     by HRID and capped at the default limit.
3. Applies requested filters and relationship traversal.
4. Formats output according to the selected layout.

#### Examples

**Top-level overview**:
```bash
req list
HRID     Title                              Kind  Parents  Children  Tags
USR-001  Plain Text Storage                 USR   0        2         
USR-004  Graph Analysis and Validation      USR   0        5         
```

**Filter by kind and tag**:
```bash
req list --kind SYS --tag navigation --output csv
```

**Descendants of a user requirement**:
```bash
req list USR-004 --view descendants --kind SYS
```

**Tree view**:
```bash
req list USR-004 --view tree --depth 2
```

### `req clean`

Correct parent HRIDs in all requirements.

#### Synopsis

```
req clean
```

#### Arguments

None.

#### Options

None.

#### Behavior

1. Loads all requirements from the requirements directory
2. For each requirement:
   - Checks parent HRIDs against actual parent filenames
   - If HRID is outdated, updates to current HRID
   - Saves requirement if changed
3. Silent on success (no output if no corrections made)
4. With `-v`, logs each correction

#### Examples

**Validate/correct all requirements**:
```bash
req clean
# (no output = success, all HRIDs correct or corrected)
```

**Verbose output**:
```bash
req -v clean
# Output:
# INFO Corrected parent HRID in SYS-001: USR-001 → USR-100
# INFO Corrected parent HRID in SYS-002: USR-001 → USR-100
```

**With custom root**:
```bash
req --root /path/to/requirements clean
```

#### Use Cases

- After renaming requirement files
- After reorganizing requirements
- Before committing changes (validation)
- Regular maintenance

#### Error Cases

**Parent UUID not found**:
```bash
req clean
# Error: Parent requirement <UUID> not found!
```

This indicates a requirement references a parent that doesn't exist. Either restore the parent or manually remove the reference.

**Self-referential parent**:
```bash
req clean
# Error: Requirement <UUID> is its own parent!
```

This indicates a requirement lists itself as a parent. Manually remove the self-reference.

## Common Workflows

### Creating a Requirement Hierarchy

```bash
# Create user requirements
req add USR  # USR-001
req add USR  # USR-002

# Create system requirements linked to user requirements
req add SYS --parent USR-001  # SYS-001
req add SYS --parent USR-002  # SYS-002

# Create software requirement satisfying multiple system requirements
req add SWR --parents SYS-001,SYS-002  # SWR-001

# Create test linked to software requirement
req add TST --parent SWR-001  # TST-001
```

### Renaming Requirements

```bash
# Rename requirement file
mv USR-001.md USR-100.md

# Update parent references
req clean

# Verify
git diff  # See updated parent HRIDs
```

### Linking Existing Requirements

```bash
# Requirements already exist
# USR-001.md
# SYS-001.md

# Create link
req link SYS-001 USR-001

# Add second parent
req link SYS-001 USR-002
```

### Managing Requirement Changes

```bash
# Edit a parent requirement
vim USR-001.md  # Make changes

# Check for suspect links
req suspect
# Output: SYS-001 → USR-001 (fingerprint mismatch)

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

# Accept the change
req accept SYS-001 USR-001

# Verify all links current
req suspect
# Output: No suspect links found.
```

### Bulk Review Workflow

```bash
# After updating multiple parent requirements
req suspect
# Shows all suspect links

# Review and update children as needed
vim SYS-001.md
vim SYS-002.md
# ... review all affected requirements

# Accept all at once
req accept --all

# Commit changes
git add -A
git commit -m "Update requirements after USR changes"
```

## Exit Codes

Requiem uses standard exit codes:

- **0**: Success
- **Non-zero**: Error

Examples:
```bash
req add USR && echo "Success"  # Success
req add INVALID || echo "Failed"  # Failed (if KIND not allowed)
```

Use in scripts:
```bash
#!/bin/bash
req clean
if [ $? -eq 0 ]; then
    echo "Requirements validated"
    git commit -am "Update requirements"
else
    echo "Validation failed"
    exit 1
fi
```

## Environment Variables

### `RUST_LOG`

Control logging level (alternative to `-v` flags).

**Values**:
- `error`: Error messages only
- `warn`: Warnings and errors (default)
- `info`: Informational messages
- `debug`: Debug messages
- `trace`: Verbose trace messages

**Examples**:
```bash
RUST_LOG=info req clean
RUST_LOG=debug req add USR
RUST_LOG=trace req link SYS-001 USR-001
```

**Module-specific logging**:
```bash
RUST_LOG=requiem=debug req clean
RUST_LOG=requiem::storage=trace req add USR
```

## Output Formats

### Standard Output

Success messages go to stdout:
```bash
req add USR
# Output: Added requirement USR-001
```

### Standard Error

Errors and logs go to stderr:
```bash
req add INVALID 2> errors.log
```

### JSON Output (Planned)

Machine-readable output:
```bash
req add USR --format json
# {"success": true, "hrid": "USR-001", "uuid": "..."}
```

## Shell Completion

Generate shell completion scripts:

**Bash**:
```bash
req --generate-completion bash > /etc/bash_completion.d/req
```

**Zsh**:
```bash
req --generate-completion zsh > /usr/local/share/zsh/site-functions/_req
```

**Fish**:
```bash
req --generate-completion fish > ~/.config/fish/completions/req.fish
```

**PowerShell**:
```powershell
req --generate-completion powershell > req.ps1
```

(Note: Completion generation not yet implemented in current version)

## Configuration File

While not a CLI option, the `config.toml` file affects CLI behavior:

```toml
_version = "1"
allowed_kinds = ["USR", "SYS", "TST"]  # Restricts req add
digits = 3                              # Affects HRID formatting
allow_unrecognised = true               # Affects req clean behavior
```

See [Configuration Reference](./configuration.md) for details.

## Performance Considerations

### Parallel Loading

Requiem loads requirements in parallel for performance:

- 100 requirements: < 1 second
- 1000 requirements: ~2-3 seconds
- 10000 requirements: ~15-20 seconds

### Large Directories

For very large requirement sets (1000+):
- Use subdirectories for organization
- `req clean` scales well due to parallelism
- Consider namespaces to partition large sets

## Troubleshooting

### Command Not Found

**Error**: `req: command not found`

**Solution**:
```bash
# Install Requiem
cargo install requirements-manager

# Verify installation
which req
req --version
```

### Permission Denied

**Error**: `Permission denied` when creating/modifying files

**Solution**: Ensure write permissions to requirements directory:
```bash
chmod u+w *.md
chmod u+w .
```

### Invalid Configuration

**Error**: `Failed to parse config file`

**Solution**: Check `config.toml` syntax:
```bash
# Validate TOML
cat config.toml | python -c "import sys, toml; toml.load(sys.stdin)"
```

### Unexpected Behavior

Enable verbose logging:
```bash
req -vv <command>
```

Check logs for detailed error messages.

## Summary

**Core commands**:
- `req add <KIND>` - Create requirement
- `req link <CHILD> <PARENT>` - Link requirements
- `req suspect` - List suspect links (fingerprint mismatches)
- `req accept <CHILD> <PARENT>` - Accept suspect link after review
- `req accept --all` - Accept all suspect links
- `req clean` - Correct parent HRIDs

**Global options**:
- `-v, --verbose` - Increase logging
- `-r, --root <PATH>` - Specify requirements directory

**Exit codes**:
- `0` - Success
- `1` - Suspect links found (req suspect only)
- Non-zero - Error (other commands)

**Getting help**:
- `req --help` - General help
- `req <command> --help` - Command-specific help

## Next Steps

- See [File Format Specification]./file-format.md for requirement file structure
- See [Configuration Reference]./configuration.md for `config.toml` options
- Review [Working with Requirements]../working-with-requirements.md for practical usage