elspais 0.11.2__py3-none-any.whl → 0.43.5__py3-none-any.whl
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.
- elspais/__init__.py +1 -10
- elspais/{sponsors/__init__.py → associates.py} +102 -56
- elspais/cli.py +366 -69
- elspais/commands/__init__.py +9 -3
- elspais/commands/analyze.py +118 -169
- elspais/commands/changed.py +12 -23
- elspais/commands/config_cmd.py +10 -13
- elspais/commands/edit.py +33 -13
- elspais/commands/example_cmd.py +319 -0
- elspais/commands/hash_cmd.py +161 -183
- elspais/commands/health.py +1177 -0
- elspais/commands/index.py +98 -115
- elspais/commands/init.py +99 -22
- elspais/commands/reformat_cmd.py +41 -433
- elspais/commands/rules_cmd.py +2 -2
- elspais/commands/trace.py +443 -324
- elspais/commands/validate.py +193 -411
- elspais/config/__init__.py +799 -5
- elspais/{core/content_rules.py → content_rules.py} +20 -2
- elspais/docs/cli/assertions.md +67 -0
- elspais/docs/cli/commands.md +304 -0
- elspais/docs/cli/config.md +262 -0
- elspais/docs/cli/format.md +66 -0
- elspais/docs/cli/git.md +45 -0
- elspais/docs/cli/health.md +190 -0
- elspais/docs/cli/hierarchy.md +60 -0
- elspais/docs/cli/ignore.md +72 -0
- elspais/docs/cli/mcp.md +245 -0
- elspais/docs/cli/quickstart.md +58 -0
- elspais/docs/cli/traceability.md +89 -0
- elspais/docs/cli/validation.md +96 -0
- elspais/graph/GraphNode.py +383 -0
- elspais/graph/__init__.py +40 -0
- elspais/graph/annotators.py +927 -0
- elspais/graph/builder.py +1886 -0
- elspais/graph/deserializer.py +248 -0
- elspais/graph/factory.py +284 -0
- elspais/graph/metrics.py +127 -0
- elspais/graph/mutations.py +161 -0
- elspais/graph/parsers/__init__.py +156 -0
- elspais/graph/parsers/code.py +213 -0
- elspais/graph/parsers/comments.py +112 -0
- elspais/graph/parsers/config_helpers.py +29 -0
- elspais/graph/parsers/heredocs.py +225 -0
- elspais/graph/parsers/journey.py +131 -0
- elspais/graph/parsers/remainder.py +79 -0
- elspais/graph/parsers/requirement.py +347 -0
- elspais/graph/parsers/results/__init__.py +6 -0
- elspais/graph/parsers/results/junit_xml.py +229 -0
- elspais/graph/parsers/results/pytest_json.py +313 -0
- elspais/graph/parsers/test.py +305 -0
- elspais/graph/relations.py +78 -0
- elspais/graph/serialize.py +216 -0
- elspais/html/__init__.py +8 -0
- elspais/html/generator.py +731 -0
- elspais/html/templates/trace_view.html.j2 +2151 -0
- elspais/mcp/__init__.py +45 -29
- elspais/mcp/__main__.py +5 -1
- elspais/mcp/file_mutations.py +138 -0
- elspais/mcp/server.py +1998 -244
- elspais/testing/__init__.py +3 -3
- elspais/testing/config.py +3 -0
- elspais/testing/mapper.py +1 -1
- elspais/testing/scanner.py +301 -12
- elspais/utilities/__init__.py +1 -0
- elspais/utilities/docs_loader.py +115 -0
- elspais/utilities/git.py +607 -0
- elspais/{core → utilities}/hasher.py +8 -22
- elspais/utilities/md_renderer.py +189 -0
- elspais/{core → utilities}/patterns.py +56 -51
- elspais/utilities/reference_config.py +626 -0
- elspais/validation/__init__.py +19 -0
- elspais/validation/format.py +264 -0
- {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/METADATA +7 -4
- elspais-0.43.5.dist-info/RECORD +80 -0
- elspais/config/defaults.py +0 -179
- elspais/config/loader.py +0 -494
- elspais/core/__init__.py +0 -21
- elspais/core/git.py +0 -346
- elspais/core/models.py +0 -320
- elspais/core/parser.py +0 -639
- elspais/core/rules.py +0 -509
- elspais/mcp/context.py +0 -172
- elspais/mcp/serializers.py +0 -112
- elspais/reformat/__init__.py +0 -50
- elspais/reformat/detector.py +0 -112
- elspais/reformat/hierarchy.py +0 -247
- elspais/reformat/line_breaks.py +0 -218
- elspais/reformat/prompts.py +0 -133
- elspais/reformat/transformer.py +0 -266
- elspais/trace_view/__init__.py +0 -55
- elspais/trace_view/coverage.py +0 -183
- elspais/trace_view/generators/__init__.py +0 -12
- elspais/trace_view/generators/base.py +0 -334
- elspais/trace_view/generators/csv.py +0 -118
- elspais/trace_view/generators/markdown.py +0 -170
- elspais/trace_view/html/__init__.py +0 -33
- elspais/trace_view/html/generator.py +0 -1140
- elspais/trace_view/html/templates/base.html +0 -283
- elspais/trace_view/html/templates/components/code_viewer_modal.html +0 -14
- elspais/trace_view/html/templates/components/file_picker_modal.html +0 -20
- elspais/trace_view/html/templates/components/legend_modal.html +0 -69
- elspais/trace_view/html/templates/components/review_panel.html +0 -118
- elspais/trace_view/html/templates/partials/review/help/help-panel.json +0 -244
- elspais/trace_view/html/templates/partials/review/help/onboarding.json +0 -77
- elspais/trace_view/html/templates/partials/review/help/tooltips.json +0 -237
- elspais/trace_view/html/templates/partials/review/review-comments.js +0 -928
- elspais/trace_view/html/templates/partials/review/review-data.js +0 -961
- elspais/trace_view/html/templates/partials/review/review-help.js +0 -679
- elspais/trace_view/html/templates/partials/review/review-init.js +0 -177
- elspais/trace_view/html/templates/partials/review/review-line-numbers.js +0 -429
- elspais/trace_view/html/templates/partials/review/review-packages.js +0 -1029
- elspais/trace_view/html/templates/partials/review/review-position.js +0 -540
- elspais/trace_view/html/templates/partials/review/review-resize.js +0 -115
- elspais/trace_view/html/templates/partials/review/review-status.js +0 -659
- elspais/trace_view/html/templates/partials/review/review-sync.js +0 -992
- elspais/trace_view/html/templates/partials/review-styles.css +0 -2238
- elspais/trace_view/html/templates/partials/scripts.js +0 -1741
- elspais/trace_view/html/templates/partials/styles.css +0 -1756
- elspais/trace_view/models.py +0 -378
- elspais/trace_view/review/__init__.py +0 -63
- elspais/trace_view/review/branches.py +0 -1142
- elspais/trace_view/review/models.py +0 -1200
- elspais/trace_view/review/position.py +0 -591
- elspais/trace_view/review/server.py +0 -1032
- elspais/trace_view/review/status.py +0 -455
- elspais/trace_view/review/storage.py +0 -1343
- elspais/trace_view/scanning.py +0 -213
- elspais/trace_view/specs/README.md +0 -84
- elspais/trace_view/specs/tv-d00001-template-architecture.md +0 -36
- elspais/trace_view/specs/tv-d00002-css-extraction.md +0 -37
- elspais/trace_view/specs/tv-d00003-js-extraction.md +0 -43
- elspais/trace_view/specs/tv-d00004-build-embedding.md +0 -40
- elspais/trace_view/specs/tv-d00005-test-format.md +0 -78
- elspais/trace_view/specs/tv-d00010-review-data-models.md +0 -33
- elspais/trace_view/specs/tv-d00011-review-storage.md +0 -33
- elspais/trace_view/specs/tv-d00012-position-resolution.md +0 -33
- elspais/trace_view/specs/tv-d00013-git-branches.md +0 -31
- elspais/trace_view/specs/tv-d00014-review-api-server.md +0 -31
- elspais/trace_view/specs/tv-d00015-status-modifier.md +0 -27
- elspais/trace_view/specs/tv-d00016-js-integration.md +0 -33
- elspais/trace_view/specs/tv-p00001-html-generator.md +0 -33
- elspais/trace_view/specs/tv-p00002-review-system.md +0 -29
- elspais-0.11.2.dist-info/RECORD +0 -101
- {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/WHEEL +0 -0
- {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/entry_points.txt +0 -0
- {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# REQUIREMENT FORMAT REFERENCE
|
|
2
|
+
|
|
3
|
+
## File Structure
|
|
4
|
+
|
|
5
|
+
Requirements are Markdown files in `spec/`. Each file can contain
|
|
6
|
+
one or more requirements separated by `---` (horizontal rule).
|
|
7
|
+
|
|
8
|
+
Naming convention: `spec/<level>-<topic>.md`
|
|
9
|
+
Examples: `spec/prd-auth.md`, `spec/dev-api.md`
|
|
10
|
+
|
|
11
|
+
## Requirement Structure
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
# REQ-p00001: Human-Readable Title
|
|
15
|
+
|
|
16
|
+
**Level**: PRD | **Status**: Active | **Implements**: none
|
|
17
|
+
|
|
18
|
+
**Purpose:** One-line description of why this requirement exists.
|
|
19
|
+
|
|
20
|
+
## Assertions
|
|
21
|
+
|
|
22
|
+
A. The system SHALL do something specific and testable.
|
|
23
|
+
B. The system SHALL NOT do something prohibited.
|
|
24
|
+
|
|
25
|
+
*End* *Human-Readable Title* | **Hash**: a1b2c3d4
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ID Format
|
|
29
|
+
|
|
30
|
+
**REQ-<type><number>**
|
|
31
|
+
|
|
32
|
+
Types:
|
|
33
|
+
`p` = PRD (Product) e.g., REQ-p00001
|
|
34
|
+
`o` = OPS (Operations) e.g., REQ-o00001
|
|
35
|
+
`d` = DEV (Development) e.g., REQ-d00001
|
|
36
|
+
|
|
37
|
+
The shorthand `p00001` can be used in displays (without REQ- prefix).
|
|
38
|
+
|
|
39
|
+
## Header Line Fields
|
|
40
|
+
|
|
41
|
+
**Level**: PRD, OPS, or DEV (determines hierarchy position)
|
|
42
|
+
**Status**: Active, Draft, Deprecated, or Proposed
|
|
43
|
+
**Implements**: Parent requirement ID(s), comma-separated
|
|
44
|
+
**Refines**: Parent ID when adding detail without claiming coverage
|
|
45
|
+
|
|
46
|
+
## Hash
|
|
47
|
+
|
|
48
|
+
The 8-character hash is computed from the requirement body content.
|
|
49
|
+
When content changes, the hash changes, triggering review.
|
|
50
|
+
|
|
51
|
+
$ elspais hash update # Recompute all hashes
|
|
52
|
+
$ elspais hash verify # Check for stale hashes
|
|
53
|
+
|
|
54
|
+
## Multiple Requirements Per File
|
|
55
|
+
|
|
56
|
+
Separate requirements with a horizontal rule:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
# REQ-p00001: First Requirement
|
|
60
|
+
...
|
|
61
|
+
*End* *First Requirement* | **Hash**: ...
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
# REQ-p00002: Second Requirement
|
|
65
|
+
...
|
|
66
|
+
```
|
elspais/docs/cli/git.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# GIT INTEGRATION
|
|
2
|
+
|
|
3
|
+
## Detecting Changes
|
|
4
|
+
|
|
5
|
+
$ elspais changed # Show all spec changes
|
|
6
|
+
$ elspais changed -j # Output as JSON
|
|
7
|
+
$ elspais changed -a # Include non-spec files
|
|
8
|
+
$ elspais changed --base-branch develop # Compare to different branch
|
|
9
|
+
|
|
10
|
+
## Command Options
|
|
11
|
+
|
|
12
|
+
`--base-branch BRANCH` Base branch for comparison (default: main)
|
|
13
|
+
`-j, --json` Output as JSON for tooling
|
|
14
|
+
`-a, --all` Include all changed files (not just spec)
|
|
15
|
+
|
|
16
|
+
## What 'Changed' Detects
|
|
17
|
+
|
|
18
|
+
**Uncommitted** - Modified/untracked spec files
|
|
19
|
+
**Hash mismatch** - Content changed but hash not updated
|
|
20
|
+
**Moved** - Requirement relocated to different file
|
|
21
|
+
**vs Main** - Changes compared to main/master branch
|
|
22
|
+
|
|
23
|
+
## In Trace View
|
|
24
|
+
|
|
25
|
+
The interactive trace view (`elspais trace --view`) shows:
|
|
26
|
+
|
|
27
|
+
**◆** Changed vs main branch (diamond indicator)
|
|
28
|
+
Filter buttons: `[Uncommitted]` `[Changed vs Main]`
|
|
29
|
+
|
|
30
|
+
## Pre-Commit Hook Example
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
#!/bin/sh
|
|
34
|
+
# .git/hooks/pre-commit
|
|
35
|
+
elspais validate || exit 1
|
|
36
|
+
elspais hash verify || echo "Warning: stale hashes"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Workflow
|
|
40
|
+
|
|
41
|
+
1. Edit requirements
|
|
42
|
+
2. $ elspais validate # Check format
|
|
43
|
+
3. $ elspais hash update # Update hashes
|
|
44
|
+
4. $ elspais changed # Review what changed
|
|
45
|
+
5. Commit with message referencing requirement IDs
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Health Check Command
|
|
2
|
+
|
|
3
|
+
The `elspais health` command diagnoses configuration and repository issues, helping you identify problems before they affect your workflow.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run all health checks
|
|
9
|
+
elspais health
|
|
10
|
+
|
|
11
|
+
# Check specific category only
|
|
12
|
+
elspais health --config # Configuration checks
|
|
13
|
+
elspais health --spec # Spec file checks
|
|
14
|
+
elspais health --code # Code reference checks
|
|
15
|
+
elspais health --tests # Test mapping checks
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Check Categories
|
|
19
|
+
|
|
20
|
+
### Configuration Checks (`--config`)
|
|
21
|
+
|
|
22
|
+
| Check | Description |
|
|
23
|
+
|-------|-------------|
|
|
24
|
+
| `config.exists` | Verifies config file exists or using defaults |
|
|
25
|
+
| `config.syntax` | Validates TOML syntax is correct |
|
|
26
|
+
| `config.required_fields` | Ensures required sections present |
|
|
27
|
+
| `config.pattern_tokens` | Validates pattern template tokens |
|
|
28
|
+
| `config.hierarchy_rules` | Checks hierarchy rules consistency |
|
|
29
|
+
| `config.paths_exist` | Verifies spec directories exist |
|
|
30
|
+
|
|
31
|
+
### Spec File Checks (`--spec`)
|
|
32
|
+
|
|
33
|
+
| Check | Description |
|
|
34
|
+
|-------|-------------|
|
|
35
|
+
| `spec.parseable` | All spec files can be parsed |
|
|
36
|
+
| `spec.no_duplicates` | No duplicate requirement IDs |
|
|
37
|
+
| `spec.implements_resolve` | All Implements: references resolve |
|
|
38
|
+
| `spec.refines_resolve` | All Refines: references resolve |
|
|
39
|
+
| `spec.hierarchy_levels` | Requirements follow hierarchy rules |
|
|
40
|
+
| `spec.orphans` | No orphan requirements (non-PRD without parents) |
|
|
41
|
+
|
|
42
|
+
### Code Reference Checks (`--code`)
|
|
43
|
+
|
|
44
|
+
| Check | Description |
|
|
45
|
+
|-------|-------------|
|
|
46
|
+
| `code.references_resolve` | Code `# Implements:` comments resolve |
|
|
47
|
+
| `code.coverage` | Code coverage statistics (informational) |
|
|
48
|
+
|
|
49
|
+
### Test Mapping Checks (`--tests`)
|
|
50
|
+
|
|
51
|
+
| Check | Description |
|
|
52
|
+
|-------|-------------|
|
|
53
|
+
| `tests.references_resolve` | Test REQ references resolve |
|
|
54
|
+
| `tests.results` | Test pass/fail status from results |
|
|
55
|
+
| `tests.coverage` | Test coverage statistics (informational) |
|
|
56
|
+
|
|
57
|
+
## Output Formats
|
|
58
|
+
|
|
59
|
+
### Text Output (default)
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
✓ CONFIG (6/6 checks passed)
|
|
63
|
+
----------------------------------------
|
|
64
|
+
✓ config.exists: Config file found: .elspais.toml
|
|
65
|
+
✓ config.syntax: TOML syntax is valid
|
|
66
|
+
✓ config.required_fields: All required configuration fields present
|
|
67
|
+
✓ config.pattern_tokens: Pattern template valid: {prefix}-{type}{id}
|
|
68
|
+
✓ config.hierarchy_rules: Hierarchy rules valid (3 levels configured)
|
|
69
|
+
✓ config.paths_exist: All spec directories exist (1 found)
|
|
70
|
+
|
|
71
|
+
✓ SPEC (6/6 checks passed)
|
|
72
|
+
----------------------------------------
|
|
73
|
+
✓ spec.parseable: Parsed 42 requirements with 128 assertions
|
|
74
|
+
✓ spec.no_duplicates: No duplicate requirement IDs
|
|
75
|
+
✓ spec.implements_resolve: All Implements references resolve
|
|
76
|
+
✓ spec.refines_resolve: All Refines references resolve
|
|
77
|
+
✓ spec.hierarchy_levels: All requirements follow hierarchy rules
|
|
78
|
+
✓ spec.orphans: No orphan requirements
|
|
79
|
+
|
|
80
|
+
========================================
|
|
81
|
+
✓ HEALTHY: 12 checks passed
|
|
82
|
+
========================================
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### JSON Output (`-j` or `--json`)
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"healthy": true,
|
|
90
|
+
"summary": {
|
|
91
|
+
"passed": 12,
|
|
92
|
+
"failed": 0,
|
|
93
|
+
"warnings": 0
|
|
94
|
+
},
|
|
95
|
+
"checks": [
|
|
96
|
+
{
|
|
97
|
+
"name": "config.exists",
|
|
98
|
+
"passed": true,
|
|
99
|
+
"message": "Config file found: .elspais.toml",
|
|
100
|
+
"category": "config",
|
|
101
|
+
"severity": "error",
|
|
102
|
+
"details": {"path": ".elspais.toml"}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Command Options
|
|
109
|
+
|
|
110
|
+
| Option | Description |
|
|
111
|
+
|--------|-------------|
|
|
112
|
+
| `--config` | Run configuration checks only |
|
|
113
|
+
| `--spec` | Run spec file checks only |
|
|
114
|
+
| `--code` | Run code reference checks only |
|
|
115
|
+
| `--tests` | Run test mapping checks only |
|
|
116
|
+
| `-j`, `--json` | Output as JSON |
|
|
117
|
+
| `-v`, `--verbose` | Show additional details |
|
|
118
|
+
|
|
119
|
+
## Exit Codes
|
|
120
|
+
|
|
121
|
+
| Code | Meaning |
|
|
122
|
+
|------|---------|
|
|
123
|
+
| 0 | All checks passed (healthy) |
|
|
124
|
+
| 1 | One or more errors found |
|
|
125
|
+
|
|
126
|
+
Warnings do not affect the exit code - only errors cause a non-zero exit.
|
|
127
|
+
|
|
128
|
+
## Severity Levels
|
|
129
|
+
|
|
130
|
+
- **error**: Critical issue that should be fixed
|
|
131
|
+
- **warning**: Issue that may indicate a problem
|
|
132
|
+
- **info**: Informational (e.g., coverage statistics)
|
|
133
|
+
|
|
134
|
+
## Use Cases
|
|
135
|
+
|
|
136
|
+
### CI/CD Pipeline Check
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Fail pipeline if health checks fail
|
|
140
|
+
elspais health || exit 1
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Quick Config Validation
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Just check config before making changes
|
|
147
|
+
elspais health --config
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Debugging Reference Issues
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Verbose output for debugging
|
|
154
|
+
elspais health --spec -v
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### JSON Processing
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Get failed checks in CI
|
|
161
|
+
elspais health -j | jq '.checks | map(select(.passed == false))'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Troubleshooting
|
|
165
|
+
|
|
166
|
+
### "No requirements found"
|
|
167
|
+
|
|
168
|
+
This usually means:
|
|
169
|
+
- The spec directory doesn't exist
|
|
170
|
+
- No `.md` files in the spec directory
|
|
171
|
+
- Files don't contain valid requirement format
|
|
172
|
+
|
|
173
|
+
Run with verbose to see details:
|
|
174
|
+
```bash
|
|
175
|
+
elspais health --spec -v
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### "Unresolved Implements references"
|
|
179
|
+
|
|
180
|
+
A requirement references another that doesn't exist:
|
|
181
|
+
1. Check for typos in the requirement ID
|
|
182
|
+
2. Ensure the parent requirement exists
|
|
183
|
+
3. Check if using assertion syntax (e.g., `REQ-xxx-A`)
|
|
184
|
+
|
|
185
|
+
### "TOML syntax error"
|
|
186
|
+
|
|
187
|
+
Your `.elspais.toml` has invalid syntax:
|
|
188
|
+
1. Check for unclosed quotes or brackets
|
|
189
|
+
2. Validate with a TOML linter
|
|
190
|
+
3. Compare against the default config structure
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# REQUIREMENT HIERARCHY
|
|
2
|
+
|
|
3
|
+
## The Three Levels
|
|
4
|
+
|
|
5
|
+
elspais enforces a **PRD -> OPS -> DEV** hierarchy:
|
|
6
|
+
|
|
7
|
+
**PRD (Product)** - Business needs, user outcomes
|
|
8
|
+
"What the product must achieve"
|
|
9
|
+
|
|
10
|
+
**OPS (Operations)** - Operational constraints, compliance
|
|
11
|
+
"How the system must behave operationally"
|
|
12
|
+
|
|
13
|
+
**DEV (Development)** - Technical specifications
|
|
14
|
+
"How we implement it technically"
|
|
15
|
+
|
|
16
|
+
## Implements Relationships
|
|
17
|
+
|
|
18
|
+
Lower levels **implement** higher levels:
|
|
19
|
+
|
|
20
|
+
DEV -> OPS (DEV implements OPS)
|
|
21
|
+
DEV -> PRD (DEV implements PRD)
|
|
22
|
+
OPS -> PRD (OPS implements PRD)
|
|
23
|
+
|
|
24
|
+
**Never** the reverse: PRD cannot implement DEV.
|
|
25
|
+
|
|
26
|
+
Example chain:
|
|
27
|
+
|
|
28
|
+
`REQ-p00001`: Users can reset passwords (PRD)
|
|
29
|
+
^
|
|
30
|
+
`REQ-o00001`: Reset tokens expire in 1 hour (OPS)
|
|
31
|
+
^ Implements: REQ-p00001
|
|
32
|
+
`REQ-d00001`: Tokens use HMAC-SHA256 (DEV)
|
|
33
|
+
Implements: REQ-o00001
|
|
34
|
+
|
|
35
|
+
## Implements vs Refines
|
|
36
|
+
|
|
37
|
+
**Implements** - Claims to satisfy the parent requirement
|
|
38
|
+
Coverage rolls up in traceability reports
|
|
39
|
+
|
|
40
|
+
**Refines** - Adds detail to parent without claiming satisfaction
|
|
41
|
+
No coverage rollup; just shows relationship
|
|
42
|
+
|
|
43
|
+
Use `Refines` when you're adding constraints but the parent still
|
|
44
|
+
needs its own implementation.
|
|
45
|
+
|
|
46
|
+
## Assertion-Specific Implementation
|
|
47
|
+
|
|
48
|
+
Implement specific assertions, not the whole requirement:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
**Implements**: REQ-p00001-A # Just assertion A
|
|
52
|
+
**Implements**: REQ-p00001-A-B # Assertions A and B
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This gives precise traceability coverage.
|
|
56
|
+
|
|
57
|
+
## Viewing the Hierarchy
|
|
58
|
+
|
|
59
|
+
$ elspais analyze hierarchy # ASCII tree view
|
|
60
|
+
$ elspais trace --view # Interactive HTML
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Ignore Configuration
|
|
2
|
+
|
|
3
|
+
The `[ignore]` section in `.elspais.toml` controls which files are skipped during scanning.
|
|
4
|
+
|
|
5
|
+
## Pattern Syntax
|
|
6
|
+
|
|
7
|
+
Patterns use Python's `fnmatch` module (similar to shell globs).
|
|
8
|
+
|
|
9
|
+
**Important**: Patterns match from the START of the path, not anywhere. This differs from gitignore behavior.
|
|
10
|
+
|
|
11
|
+
## Pattern Characters
|
|
12
|
+
|
|
13
|
+
- `*` matches any characters within a path component
|
|
14
|
+
- `**` matches across directory separators
|
|
15
|
+
- `?` matches a single character
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
```toml
|
|
20
|
+
[ignore]
|
|
21
|
+
# Skip files named "README.md" or "INDEX.md" (basename match)
|
|
22
|
+
spec = ["README.md", "INDEX.md"]
|
|
23
|
+
|
|
24
|
+
# Skip a directory at any depth - use **/ prefix
|
|
25
|
+
spec = ["**/roadmap/**"]
|
|
26
|
+
|
|
27
|
+
# Skip a specific path from repo root
|
|
28
|
+
spec = ["spec/archive/**"]
|
|
29
|
+
|
|
30
|
+
# Skip by extension (anywhere)
|
|
31
|
+
global = ["*.pyc", "*.tmp"]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Common Patterns
|
|
35
|
+
|
|
36
|
+
| Goal | Pattern | Example Match |
|
|
37
|
+
|------|---------|---------------|
|
|
38
|
+
| Skip directory anywhere | `**/dirname/**` | `spec/dirname/file.md` |
|
|
39
|
+
| Skip specific path | `spec/archive/**` | `spec/archive/old.md` |
|
|
40
|
+
| Skip by filename | `README.md` | `spec/README.md` |
|
|
41
|
+
| Skip by extension | `*.pyc` | `src/__pycache__/foo.pyc` |
|
|
42
|
+
|
|
43
|
+
## Scopes
|
|
44
|
+
|
|
45
|
+
Each scope applies to a specific scanning context:
|
|
46
|
+
|
|
47
|
+
| Scope | When Applied |
|
|
48
|
+
|-------|--------------|
|
|
49
|
+
| `global` | All scanning operations |
|
|
50
|
+
| `spec` | Scanning spec directories for requirements |
|
|
51
|
+
| `code` | Scanning code directories for `# Implements:` references |
|
|
52
|
+
| `test` | Scanning test directories for REQ references |
|
|
53
|
+
|
|
54
|
+
## Default Patterns
|
|
55
|
+
|
|
56
|
+
```toml
|
|
57
|
+
[ignore]
|
|
58
|
+
global = ["node_modules", ".git", "__pycache__", "*.pyc", ".venv", ".env"]
|
|
59
|
+
spec = ["README.md", "INDEX.md"]
|
|
60
|
+
code = ["*_test.py", "conftest.py", "test_*.py"]
|
|
61
|
+
test = ["fixtures/**", "__snapshots__"]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Migration from gitignore-style Patterns
|
|
65
|
+
|
|
66
|
+
If you're used to gitignore patterns, note these differences:
|
|
67
|
+
|
|
68
|
+
| gitignore | elspais [ignore] | Notes |
|
|
69
|
+
|-----------|------------------|-------|
|
|
70
|
+
| `roadmap/` | `**/roadmap/**` | Must use `**/` for "anywhere" |
|
|
71
|
+
| `/roadmap/` | `roadmap/**` | Leading `/` not needed (already anchored) |
|
|
72
|
+
| `*.md` | `*.md` | Same behavior for extensions |
|
elspais/docs/cli/mcp.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# MCP SERVER
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for AI-driven requirements management.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The elspais MCP server exposes the requirements graph to AI assistants,
|
|
8
|
+
enabling intelligent requirement navigation, search, and analysis without
|
|
9
|
+
manual CLI usage.
|
|
10
|
+
|
|
11
|
+
**Installation:**
|
|
12
|
+
|
|
13
|
+
$ pip install 'elspais[mcp]'
|
|
14
|
+
|
|
15
|
+
**Starting the server:**
|
|
16
|
+
|
|
17
|
+
$ elspais mcp serve
|
|
18
|
+
$ python -m elspais.mcp
|
|
19
|
+
|
|
20
|
+
## Available Tools
|
|
21
|
+
|
|
22
|
+
### Graph Status & Control
|
|
23
|
+
|
|
24
|
+
**get_graph_status()**
|
|
25
|
+
|
|
26
|
+
Get current graph health and statistics.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
root_count Number of root requirements
|
|
30
|
+
node_counts Count by node kind (requirement, assertion, code, test)
|
|
31
|
+
total_nodes Total nodes in graph
|
|
32
|
+
has_orphans Whether orphaned nodes exist
|
|
33
|
+
has_broken_references Whether broken references exist
|
|
34
|
+
|
|
35
|
+
Example response:
|
|
36
|
+
{
|
|
37
|
+
"root_count": 3,
|
|
38
|
+
"node_counts": {"requirement": 45, "assertion": 120, "code": 30},
|
|
39
|
+
"total_nodes": 195,
|
|
40
|
+
"has_orphans": false,
|
|
41
|
+
"has_broken_references": false
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
**refresh_graph(full)**
|
|
45
|
+
|
|
46
|
+
Force rebuild the graph from spec files.
|
|
47
|
+
|
|
48
|
+
Parameters:
|
|
49
|
+
full (bool) If true, clear all caches before rebuild
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
success Whether rebuild succeeded
|
|
53
|
+
message Status message
|
|
54
|
+
node_count New total node count
|
|
55
|
+
|
|
56
|
+
### Requirement Search & Navigation
|
|
57
|
+
|
|
58
|
+
**search(query, field, regex, limit)**
|
|
59
|
+
|
|
60
|
+
Search requirements by ID, title, or content.
|
|
61
|
+
|
|
62
|
+
Parameters:
|
|
63
|
+
query (str) Search string or regex pattern
|
|
64
|
+
field (str) Field to search: 'id', 'title', 'body', or 'all' (default)
|
|
65
|
+
regex (bool) If true, treat query as regex pattern (default: false)
|
|
66
|
+
limit (int) Maximum results to return (default: 50)
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
List of matching requirement summaries with id, title, level, status.
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
search("authentication") # Find auth-related requirements
|
|
73
|
+
search("REQ-p", field="id") # Find PRD-level by ID prefix
|
|
74
|
+
search(".*security.*", regex=true) # Regex search in all fields
|
|
75
|
+
|
|
76
|
+
**get_requirement(req_id)**
|
|
77
|
+
|
|
78
|
+
Get full details for a single requirement.
|
|
79
|
+
|
|
80
|
+
Parameters:
|
|
81
|
+
req_id (str) The requirement ID (e.g., 'REQ-p00001')
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
id Requirement ID
|
|
85
|
+
title Requirement title
|
|
86
|
+
level PRD, OPS, or DEV
|
|
87
|
+
status Draft, Active, Deprecated, etc.
|
|
88
|
+
hash Content hash for change detection
|
|
89
|
+
assertions List of assertion objects {id, label, text}
|
|
90
|
+
children Child requirements (summaries)
|
|
91
|
+
parents Parent requirements (summaries)
|
|
92
|
+
|
|
93
|
+
Example:
|
|
94
|
+
get_requirement("REQ-p00001")
|
|
95
|
+
|
|
96
|
+
**get_hierarchy(req_id)**
|
|
97
|
+
|
|
98
|
+
Get requirement hierarchy (ancestors and children).
|
|
99
|
+
|
|
100
|
+
Parameters:
|
|
101
|
+
req_id (str) The requirement ID
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
id The queried requirement ID
|
|
105
|
+
ancestors All ancestor requirements (walks to roots)
|
|
106
|
+
children Direct child requirements
|
|
107
|
+
|
|
108
|
+
Use this to understand where a requirement sits in the hierarchy
|
|
109
|
+
and what depends on it.
|
|
110
|
+
|
|
111
|
+
### Workspace Context
|
|
112
|
+
|
|
113
|
+
**get_workspace_info()**
|
|
114
|
+
|
|
115
|
+
Get information about the current workspace/repository.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
repo_path Absolute path to repository root
|
|
119
|
+
project_name Project name from config or directory name
|
|
120
|
+
config_file Path to .elspais.toml (if exists)
|
|
121
|
+
config_summary Key configuration values:
|
|
122
|
+
- prefix Requirement ID prefix
|
|
123
|
+
- spec_directories Where spec files live
|
|
124
|
+
- testing_enabled Whether test scanning is on
|
|
125
|
+
- project_type 'core' or 'associated'
|
|
126
|
+
|
|
127
|
+
**get_project_summary()**
|
|
128
|
+
|
|
129
|
+
Get summary statistics for the project.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
requirements_by_level Count by PRD/OPS/DEV level
|
|
133
|
+
coverage Coverage statistics:
|
|
134
|
+
- full Requirements with full coverage
|
|
135
|
+
- partial Requirements with partial coverage
|
|
136
|
+
- none Requirements with no coverage
|
|
137
|
+
changes Git change metrics:
|
|
138
|
+
- uncommitted Modified spec files
|
|
139
|
+
- branch_changed Changed vs main branch
|
|
140
|
+
total_nodes Total nodes in graph
|
|
141
|
+
orphan_count Requirements without parents
|
|
142
|
+
broken_reference_count References to non-existent requirements
|
|
143
|
+
|
|
144
|
+
## Client Configuration
|
|
145
|
+
|
|
146
|
+
### Claude Code
|
|
147
|
+
|
|
148
|
+
Add to your project's `.mcp.json`:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"elspais": {
|
|
154
|
+
"type": "stdio",
|
|
155
|
+
"command": "elspais",
|
|
156
|
+
"args": ["mcp", "serve"]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Or with explicit Python path:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"elspais": {
|
|
168
|
+
"type": "stdio",
|
|
169
|
+
"command": "python",
|
|
170
|
+
"args": ["-m", "elspais.mcp"]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Cursor
|
|
177
|
+
|
|
178
|
+
Add to Cursor's MCP settings:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"elspais": {
|
|
183
|
+
"command": "elspais",
|
|
184
|
+
"args": ["mcp", "serve"]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Transport Options
|
|
190
|
+
|
|
191
|
+
stdio (default) Standard input/output, best for local tools
|
|
192
|
+
sse Server-sent events, for HTTP clients
|
|
193
|
+
streamable-http HTTP streaming, for web clients
|
|
194
|
+
|
|
195
|
+
$ elspais mcp serve --transport stdio
|
|
196
|
+
$ elspais mcp serve --transport sse
|
|
197
|
+
|
|
198
|
+
## Typical Workflows
|
|
199
|
+
|
|
200
|
+
### Understanding a Requirement
|
|
201
|
+
|
|
202
|
+
1. `get_requirement("REQ-p00001")` - Get full details
|
|
203
|
+
2. `get_hierarchy("REQ-p00001")` - See where it fits
|
|
204
|
+
3. Check assertions for testable criteria
|
|
205
|
+
|
|
206
|
+
### Finding Related Requirements
|
|
207
|
+
|
|
208
|
+
1. `search("authentication")` - Find by keyword
|
|
209
|
+
2. `get_hierarchy(result_id)` - Navigate relationships
|
|
210
|
+
3. Follow children to see implementations
|
|
211
|
+
|
|
212
|
+
### Project Health Check
|
|
213
|
+
|
|
214
|
+
1. `get_graph_status()` - Check for orphans/broken refs
|
|
215
|
+
2. `get_project_summary()` - Review coverage stats
|
|
216
|
+
3. Address requirements with `coverage: none`
|
|
217
|
+
|
|
218
|
+
### After Editing Spec Files
|
|
219
|
+
|
|
220
|
+
1. `refresh_graph()` - Rebuild after changes
|
|
221
|
+
2. `get_graph_status()` - Verify graph health
|
|
222
|
+
|
|
223
|
+
## Configuration Notes
|
|
224
|
+
|
|
225
|
+
The exact requirement ID syntax (prefixes, patterns) and hierarchy rules are
|
|
226
|
+
**configurable per project** via `.elspais.toml`. Different projects may use:
|
|
227
|
+
|
|
228
|
+
- Different ID prefixes (e.g., `REQ-`, `SPEC-`, `FR-`)
|
|
229
|
+
- Different level types (PRD/OPS/DEV or custom)
|
|
230
|
+
- Different hierarchy rules for "implements" relationships
|
|
231
|
+
|
|
232
|
+
Use `get_workspace_info()` to see the current project's configuration.
|
|
233
|
+
|
|
234
|
+
## Architecture Notes
|
|
235
|
+
|
|
236
|
+
The MCP server is a **pure interface layer** that consumes the TraceGraph
|
|
237
|
+
directly without creating intermediate data structures. This ensures:
|
|
238
|
+
|
|
239
|
+
- Single source of truth (the graph)
|
|
240
|
+
- No data duplication or caching issues
|
|
241
|
+
- Consistent results across all tools
|
|
242
|
+
- Efficient memory usage
|
|
243
|
+
|
|
244
|
+
All tools use the iterator-only API (`iter_children()`, `iter_parents()`,
|
|
245
|
+
`nodes_by_kind()`) to prevent accidental list materialization on large graphs.
|