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.
Files changed (147) hide show
  1. elspais/__init__.py +1 -10
  2. elspais/{sponsors/__init__.py → associates.py} +102 -56
  3. elspais/cli.py +366 -69
  4. elspais/commands/__init__.py +9 -3
  5. elspais/commands/analyze.py +118 -169
  6. elspais/commands/changed.py +12 -23
  7. elspais/commands/config_cmd.py +10 -13
  8. elspais/commands/edit.py +33 -13
  9. elspais/commands/example_cmd.py +319 -0
  10. elspais/commands/hash_cmd.py +161 -183
  11. elspais/commands/health.py +1177 -0
  12. elspais/commands/index.py +98 -115
  13. elspais/commands/init.py +99 -22
  14. elspais/commands/reformat_cmd.py +41 -433
  15. elspais/commands/rules_cmd.py +2 -2
  16. elspais/commands/trace.py +443 -324
  17. elspais/commands/validate.py +193 -411
  18. elspais/config/__init__.py +799 -5
  19. elspais/{core/content_rules.py → content_rules.py} +20 -2
  20. elspais/docs/cli/assertions.md +67 -0
  21. elspais/docs/cli/commands.md +304 -0
  22. elspais/docs/cli/config.md +262 -0
  23. elspais/docs/cli/format.md +66 -0
  24. elspais/docs/cli/git.md +45 -0
  25. elspais/docs/cli/health.md +190 -0
  26. elspais/docs/cli/hierarchy.md +60 -0
  27. elspais/docs/cli/ignore.md +72 -0
  28. elspais/docs/cli/mcp.md +245 -0
  29. elspais/docs/cli/quickstart.md +58 -0
  30. elspais/docs/cli/traceability.md +89 -0
  31. elspais/docs/cli/validation.md +96 -0
  32. elspais/graph/GraphNode.py +383 -0
  33. elspais/graph/__init__.py +40 -0
  34. elspais/graph/annotators.py +927 -0
  35. elspais/graph/builder.py +1886 -0
  36. elspais/graph/deserializer.py +248 -0
  37. elspais/graph/factory.py +284 -0
  38. elspais/graph/metrics.py +127 -0
  39. elspais/graph/mutations.py +161 -0
  40. elspais/graph/parsers/__init__.py +156 -0
  41. elspais/graph/parsers/code.py +213 -0
  42. elspais/graph/parsers/comments.py +112 -0
  43. elspais/graph/parsers/config_helpers.py +29 -0
  44. elspais/graph/parsers/heredocs.py +225 -0
  45. elspais/graph/parsers/journey.py +131 -0
  46. elspais/graph/parsers/remainder.py +79 -0
  47. elspais/graph/parsers/requirement.py +347 -0
  48. elspais/graph/parsers/results/__init__.py +6 -0
  49. elspais/graph/parsers/results/junit_xml.py +229 -0
  50. elspais/graph/parsers/results/pytest_json.py +313 -0
  51. elspais/graph/parsers/test.py +305 -0
  52. elspais/graph/relations.py +78 -0
  53. elspais/graph/serialize.py +216 -0
  54. elspais/html/__init__.py +8 -0
  55. elspais/html/generator.py +731 -0
  56. elspais/html/templates/trace_view.html.j2 +2151 -0
  57. elspais/mcp/__init__.py +45 -29
  58. elspais/mcp/__main__.py +5 -1
  59. elspais/mcp/file_mutations.py +138 -0
  60. elspais/mcp/server.py +1998 -244
  61. elspais/testing/__init__.py +3 -3
  62. elspais/testing/config.py +3 -0
  63. elspais/testing/mapper.py +1 -1
  64. elspais/testing/scanner.py +301 -12
  65. elspais/utilities/__init__.py +1 -0
  66. elspais/utilities/docs_loader.py +115 -0
  67. elspais/utilities/git.py +607 -0
  68. elspais/{core → utilities}/hasher.py +8 -22
  69. elspais/utilities/md_renderer.py +189 -0
  70. elspais/{core → utilities}/patterns.py +56 -51
  71. elspais/utilities/reference_config.py +626 -0
  72. elspais/validation/__init__.py +19 -0
  73. elspais/validation/format.py +264 -0
  74. {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/METADATA +7 -4
  75. elspais-0.43.5.dist-info/RECORD +80 -0
  76. elspais/config/defaults.py +0 -179
  77. elspais/config/loader.py +0 -494
  78. elspais/core/__init__.py +0 -21
  79. elspais/core/git.py +0 -346
  80. elspais/core/models.py +0 -320
  81. elspais/core/parser.py +0 -639
  82. elspais/core/rules.py +0 -509
  83. elspais/mcp/context.py +0 -172
  84. elspais/mcp/serializers.py +0 -112
  85. elspais/reformat/__init__.py +0 -50
  86. elspais/reformat/detector.py +0 -112
  87. elspais/reformat/hierarchy.py +0 -247
  88. elspais/reformat/line_breaks.py +0 -218
  89. elspais/reformat/prompts.py +0 -133
  90. elspais/reformat/transformer.py +0 -266
  91. elspais/trace_view/__init__.py +0 -55
  92. elspais/trace_view/coverage.py +0 -183
  93. elspais/trace_view/generators/__init__.py +0 -12
  94. elspais/trace_view/generators/base.py +0 -334
  95. elspais/trace_view/generators/csv.py +0 -118
  96. elspais/trace_view/generators/markdown.py +0 -170
  97. elspais/trace_view/html/__init__.py +0 -33
  98. elspais/trace_view/html/generator.py +0 -1140
  99. elspais/trace_view/html/templates/base.html +0 -283
  100. elspais/trace_view/html/templates/components/code_viewer_modal.html +0 -14
  101. elspais/trace_view/html/templates/components/file_picker_modal.html +0 -20
  102. elspais/trace_view/html/templates/components/legend_modal.html +0 -69
  103. elspais/trace_view/html/templates/components/review_panel.html +0 -118
  104. elspais/trace_view/html/templates/partials/review/help/help-panel.json +0 -244
  105. elspais/trace_view/html/templates/partials/review/help/onboarding.json +0 -77
  106. elspais/trace_view/html/templates/partials/review/help/tooltips.json +0 -237
  107. elspais/trace_view/html/templates/partials/review/review-comments.js +0 -928
  108. elspais/trace_view/html/templates/partials/review/review-data.js +0 -961
  109. elspais/trace_view/html/templates/partials/review/review-help.js +0 -679
  110. elspais/trace_view/html/templates/partials/review/review-init.js +0 -177
  111. elspais/trace_view/html/templates/partials/review/review-line-numbers.js +0 -429
  112. elspais/trace_view/html/templates/partials/review/review-packages.js +0 -1029
  113. elspais/trace_view/html/templates/partials/review/review-position.js +0 -540
  114. elspais/trace_view/html/templates/partials/review/review-resize.js +0 -115
  115. elspais/trace_view/html/templates/partials/review/review-status.js +0 -659
  116. elspais/trace_view/html/templates/partials/review/review-sync.js +0 -992
  117. elspais/trace_view/html/templates/partials/review-styles.css +0 -2238
  118. elspais/trace_view/html/templates/partials/scripts.js +0 -1741
  119. elspais/trace_view/html/templates/partials/styles.css +0 -1756
  120. elspais/trace_view/models.py +0 -378
  121. elspais/trace_view/review/__init__.py +0 -63
  122. elspais/trace_view/review/branches.py +0 -1142
  123. elspais/trace_view/review/models.py +0 -1200
  124. elspais/trace_view/review/position.py +0 -591
  125. elspais/trace_view/review/server.py +0 -1032
  126. elspais/trace_view/review/status.py +0 -455
  127. elspais/trace_view/review/storage.py +0 -1343
  128. elspais/trace_view/scanning.py +0 -213
  129. elspais/trace_view/specs/README.md +0 -84
  130. elspais/trace_view/specs/tv-d00001-template-architecture.md +0 -36
  131. elspais/trace_view/specs/tv-d00002-css-extraction.md +0 -37
  132. elspais/trace_view/specs/tv-d00003-js-extraction.md +0 -43
  133. elspais/trace_view/specs/tv-d00004-build-embedding.md +0 -40
  134. elspais/trace_view/specs/tv-d00005-test-format.md +0 -78
  135. elspais/trace_view/specs/tv-d00010-review-data-models.md +0 -33
  136. elspais/trace_view/specs/tv-d00011-review-storage.md +0 -33
  137. elspais/trace_view/specs/tv-d00012-position-resolution.md +0 -33
  138. elspais/trace_view/specs/tv-d00013-git-branches.md +0 -31
  139. elspais/trace_view/specs/tv-d00014-review-api-server.md +0 -31
  140. elspais/trace_view/specs/tv-d00015-status-modifier.md +0 -27
  141. elspais/trace_view/specs/tv-d00016-js-integration.md +0 -33
  142. elspais/trace_view/specs/tv-p00001-html-generator.md +0 -33
  143. elspais/trace_view/specs/tv-p00002-review-system.md +0 -29
  144. elspais-0.11.2.dist-info/RECORD +0 -101
  145. {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/WHEEL +0 -0
  146. {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/entry_points.txt +0 -0
  147. {elspais-0.11.2.dist-info → elspais-0.43.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,14 +1,24 @@
1
1
  """
2
- elspais.core.content_rules - Content rule loading and parsing.
2
+ elspais.content_rules - Content rule loading and parsing.
3
3
 
4
4
  Content rules are markdown files that provide semantic validation guidance
5
5
  for requirements authoring. They can include YAML frontmatter for metadata.
6
6
  """
7
7
 
8
+ from dataclasses import dataclass, field
8
9
  from pathlib import Path
9
10
  from typing import Any, Dict, List, Tuple
10
11
 
11
- from elspais.core.models import ContentRule
12
+
13
+ @dataclass
14
+ class ContentRule:
15
+ """A content rule loaded from a markdown file."""
16
+
17
+ file_path: Path
18
+ title: str
19
+ content: str
20
+ type: str = "guidance"
21
+ applies_to: List[str] = field(default_factory=list)
12
22
 
13
23
 
14
24
  def parse_frontmatter(text: str) -> Tuple[Dict[str, Any], str]:
@@ -167,3 +177,11 @@ def load_content_rules(
167
177
  pass
168
178
 
169
179
  return rules
180
+
181
+
182
+ __all__ = [
183
+ "ContentRule",
184
+ "parse_frontmatter",
185
+ "load_content_rule",
186
+ "load_content_rules",
187
+ ]
@@ -0,0 +1,67 @@
1
+ # WRITING ASSERTIONS
2
+
3
+ ## What is an Assertion?
4
+
5
+ An assertion is a single, testable statement about system behavior.
6
+ Each assertion:
7
+ - Uses **SHALL** or **SHALL NOT** (normative language)
8
+ - Is labeled A, B, C, etc.
9
+ - Can be independently verified by a test
10
+
11
+ ## Assertion Format
12
+
13
+ ```
14
+ ## Assertions
15
+
16
+ A. The system SHALL authenticate users via email and password.
17
+ B. The system SHALL lock accounts after 5 failed attempts.
18
+ C. The system SHALL NOT store passwords in plain text.
19
+ ```
20
+
21
+ ## Normative Keywords
22
+
23
+ **SHALL** Absolute requirement (must be implemented)
24
+ **SHALL NOT** Absolute prohibition (must never happen)
25
+ **SHOULD** Recommended but not required
26
+ **SHOULD NOT** Not recommended but not prohibited
27
+ **MAY** Optional behavior
28
+
29
+ Most assertions use **SHALL** or **SHALL NOT**.
30
+
31
+ ## Good vs Bad Assertions
32
+
33
+ **Good** (testable, specific):
34
+ A. The system SHALL respond to API requests within 200ms.
35
+ B. The system SHALL encrypt data at rest using AES-256.
36
+
37
+ **Bad** (vague, untestable):
38
+ A. The system should be fast.
39
+ B. The system must be secure.
40
+
41
+ ## Referencing Assertions
42
+
43
+ In implementing requirements:
44
+ ```
45
+ **Implements**: REQ-p00001-A
46
+ ```
47
+
48
+ In code comments:
49
+ ```
50
+ # Implements: REQ-p00001-A
51
+ ```
52
+
53
+ In tests:
54
+ ```python
55
+ def test_login():
56
+ """REQ-p00001-A: Verify email/password auth"""
57
+ ```
58
+
59
+ ## Removed Assertions
60
+
61
+ If you remove an assertion, keep a placeholder to maintain letter sequence:
62
+
63
+ ```
64
+ A. The system SHALL do X.
65
+ B. [Removed - superseded by REQ-d00005]
66
+ C. The system SHALL do Z.
67
+ ```
@@ -0,0 +1,304 @@
1
+ # CLI COMMANDS REFERENCE
2
+
3
+ Complete reference for all elspais commands.
4
+
5
+ ## Global Options
6
+
7
+ These options work with all commands:
8
+
9
+ `-v, --verbose` Verbose output with details
10
+ `-q, --quiet` Suppress non-error output
11
+ `--config PATH` Path to configuration file
12
+ `--spec-dir PATH` Override spec directory
13
+
14
+ ## validate
15
+
16
+ Validate requirements format, links, hashes, and hierarchy.
17
+
18
+ $ elspais validate # Check all rules
19
+ $ elspais validate --fix # Auto-fix fixable issues
20
+ $ elspais validate --fix --dry-run # Preview fixes
21
+ $ elspais validate -j # Output JSON for tooling
22
+
23
+ **Options:**
24
+
25
+ `--fix` Auto-fix hashes and formatting issues
26
+ `--dry-run` Preview fixes without modifying (use with --fix)
27
+ `--skip-rule RULE` Skip validation rules (repeatable)
28
+ `-j, --json` Output requirements as JSON
29
+
30
+ **Skip Rule Patterns:**
31
+
32
+ `hash.*` All hash rules
33
+ `hash.missing` Hash footer is missing
34
+ `hash.mismatch` Hash doesn't match content
35
+ `hierarchy.*` All hierarchy rules
36
+ `format.*` All format rules
37
+
38
+ ## trace
39
+
40
+ Generate traceability matrix and reports.
41
+
42
+ $ elspais trace --view # Interactive HTML view
43
+ $ elspais trace --format html # Basic HTML matrix
44
+ $ elspais trace --graph-json # Export graph as JSON
45
+
46
+ **Options:**
47
+
48
+ `--format {markdown,html,csv,both}` Output format (default: both)
49
+ `--output PATH` Output file path
50
+ `--view` Interactive HTML traceability tree
51
+ `--embed-content` Embed full markdown in HTML for offline
52
+ `--graph` Use unified traceability graph
53
+ `--graph-json` Output graph structure as JSON
54
+ `--report NAME` Report preset (minimal, standard, full)
55
+ `--depth LEVEL` Max graph depth (0=roots, 1=children, ...)
56
+ `--mode {core,sponsor,combined}` Report scope
57
+ `--sponsor NAME` Sponsor name for filtered reports
58
+
59
+ **Depth Levels:**
60
+
61
+ `0` or `requirements` Show only requirements
62
+ `1` or `assertions` Include assertions
63
+ `2` or `implementation` Include code references
64
+ `full` Unlimited depth
65
+
66
+ **Planned Options (not yet implemented):**
67
+
68
+ `--edit-mode` In-browser editing of implements/status
69
+ `--review-mode` Collaborative review with comments
70
+ `--server` Start review server
71
+ `--port PORT` Port for review server
72
+
73
+ ## hash
74
+
75
+ Manage requirement content hashes.
76
+
77
+ $ elspais hash verify # Check without changes
78
+ $ elspais hash update # Update all stale hashes
79
+ $ elspais hash update REQ-p00001 # Update specific requirement
80
+ $ elspais hash update --dry-run # Preview changes
81
+
82
+ **Subcommands:**
83
+
84
+ `verify` Verify hashes without modifying files
85
+ `update [REQ_ID]` Update hashes (optionally for one requirement)
86
+
87
+ **Options for update:**
88
+
89
+ `--dry-run` Show changes without applying
90
+ `--json` Output results as JSON for tooling
91
+
92
+ ## analyze
93
+
94
+ Analyze requirement hierarchy and coverage.
95
+
96
+ $ elspais analyze hierarchy # Tree view of requirements
97
+ $ elspais analyze orphans # Find parentless requirements
98
+ $ elspais analyze coverage # Implementation coverage report
99
+
100
+ **Subcommands:**
101
+
102
+ `hierarchy` Show requirement hierarchy tree
103
+ `orphans` Find requirements with no parent
104
+ `coverage` Implementation coverage report
105
+
106
+ ## changed
107
+
108
+ Detect git changes to spec files.
109
+
110
+ $ elspais changed # Show all spec changes
111
+ $ elspais changed -j # Output as JSON
112
+ $ elspais changed -a # Include non-spec files
113
+
114
+ **Options:**
115
+
116
+ `--base-branch BRANCH` Base branch for comparison (default: main)
117
+ `-j, --json` Output as JSON
118
+ `-a, --all` Include all changed files, not just spec
119
+
120
+ **What's Detected:**
121
+
122
+ Uncommitted changes (modified/new spec files)
123
+ Changes vs main/master branch
124
+ Moved requirements (relocated to different file)
125
+
126
+ ## index
127
+
128
+ Manage INDEX.md file.
129
+
130
+ $ elspais index validate # Check accuracy
131
+ $ elspais index regenerate # Rebuild from scratch
132
+
133
+ **Subcommands:**
134
+
135
+ `validate` Validate INDEX.md matches actual requirements
136
+ `regenerate` Regenerate INDEX.md from current spec files
137
+
138
+ ## edit
139
+
140
+ Edit requirements in-place.
141
+
142
+ $ elspais edit --req-id REQ-d00001 --status Draft
143
+ $ elspais edit --req-id REQ-d00001 --implements REQ-p00001,REQ-p00002
144
+ $ elspais edit --req-id REQ-d00001 --move-to roadmap/future.md
145
+ $ elspais edit --from-json edits.json
146
+
147
+ **Options:**
148
+
149
+ `--req-id ID` Requirement ID to edit
150
+ `--implements REFS` New Implements (comma-separated, "" to clear)
151
+ `--status STATUS` New Status value
152
+ `--move-to FILE` Move to file (relative to spec dir)
153
+ `--from-json FILE` Batch edit from JSON (- for stdin)
154
+ `--dry-run` Show changes without applying
155
+ `--validate-refs` Validate implements references exist
156
+
157
+ **Batch JSON Format:**
158
+
159
+ ```json
160
+ [
161
+ {"req_id": "REQ-d00001", "status": "Draft"},
162
+ {"req_id": "REQ-d00002", "implements": ["REQ-p00001"]}
163
+ ]
164
+ ```
165
+
166
+ ## config
167
+
168
+ View and modify configuration.
169
+
170
+ $ elspais config show # View all settings
171
+ $ elspais config get patterns.prefix
172
+ $ elspais config set project.name "MyApp"
173
+ $ elspais config path # Show config file location
174
+
175
+ **Subcommands:**
176
+
177
+ `show [--section] [-j]` Show current configuration
178
+ `get KEY [-j]` Get value (dot-notation: patterns.prefix)
179
+ `set KEY VALUE` Set value (auto-detects type)
180
+ `unset KEY` Remove a key
181
+ `add KEY VALUE` Add value to array
182
+ `remove KEY VALUE` Remove value from array
183
+ `path` Show config file location
184
+
185
+ **Examples:**
186
+
187
+ $ elspais config get rules.strict_mode
188
+ $ elspais config set rules.strict_mode true
189
+ $ elspais config add directories.code src/lib
190
+ $ elspais config unset associated.prefix
191
+
192
+ ## init
193
+
194
+ Create .elspais.toml configuration.
195
+
196
+ $ elspais init # Create default config
197
+ $ elspais init --template # Also create example requirement
198
+
199
+ **Options:**
200
+
201
+ `--type {core,associated}` Repository type
202
+ `--associated-prefix PREFIX` Prefix for associated repo
203
+ `--force` Overwrite existing configuration
204
+ `--template` Create example requirement in spec/
205
+
206
+ ## example
207
+
208
+ Display requirement format examples.
209
+
210
+ $ elspais example # Quick format reference
211
+ $ elspais example --full # Full specification document
212
+ $ elspais example journey # User journey template
213
+
214
+ **Arguments:**
215
+
216
+ `requirement` Full requirement template (default)
217
+ `journey` User journey template
218
+ `assertion` Assertion rules and examples
219
+ `ids` Show ID patterns from current config
220
+
221
+ **Options:**
222
+
223
+ `--full` Display full requirements specification file
224
+
225
+ ## rules
226
+
227
+ View and manage content rules.
228
+
229
+ $ elspais rules list # List configured rules
230
+ $ elspais rules show myfile.md # Show rule file content
231
+
232
+ **Subcommands:**
233
+
234
+ `list` List configured content rules
235
+ `show FILE` Show content of a rule file
236
+
237
+ ## docs
238
+
239
+ Read the user guide.
240
+
241
+ $ elspais docs # Quickstart guide
242
+ $ elspais docs config # Configuration reference
243
+ $ elspais docs all # Complete documentation
244
+
245
+ **Arguments:**
246
+
247
+ `quickstart` Getting started guide (default)
248
+ `format` Requirement file format
249
+ `hierarchy` PRD/OPS/DEV levels
250
+ `assertions` Writing testable assertions
251
+ `traceability` Linking to code and tests
252
+ `validation` Running validation
253
+ `git` Change detection
254
+ `config` Configuration reference
255
+ `commands` This CLI reference
256
+ `mcp` MCP server for AI integration
257
+ `all` All topics concatenated
258
+
259
+ **Options:**
260
+
261
+ `--plain` Plain text output (no ANSI colors)
262
+ `--no-pager` Disable paging (print to stdout)
263
+
264
+ ## completion
265
+
266
+ Generate shell tab-completion scripts.
267
+
268
+ $ elspais completion # Instructions
269
+ $ elspais completion --shell bash > ~/.elspais-complete.bash
270
+
271
+ **Options:**
272
+
273
+ `--shell {bash,zsh,fish,tcsh}` Generate for specific shell
274
+
275
+ **Setup:**
276
+
277
+ Bash: `source <(elspais completion --shell bash)`
278
+ Zsh: Add to ~/.zshrc: `eval "$(elspais completion --shell zsh)"`
279
+ Fish: `elspais completion --shell fish | source`
280
+
281
+ ## version
282
+
283
+ Show version information.
284
+
285
+ $ elspais version # Show current version
286
+ $ elspais --version # Alternative
287
+
288
+ ## mcp
289
+
290
+ MCP (Model Context Protocol) server commands.
291
+
292
+ $ elspais mcp serve # Start MCP server
293
+
294
+ **Note:** Requires `elspais[mcp]` extra:
295
+
296
+ $ pip install 'elspais[mcp]'
297
+
298
+ **Subcommands:**
299
+
300
+ `serve` Start MCP server
301
+
302
+ **Options for serve:**
303
+
304
+ `--transport {stdio,sse,streamable-http}` Transport type (default: stdio)
@@ -0,0 +1,262 @@
1
+ # CONFIGURATION
2
+
3
+ ## Configuration File
4
+
5
+ elspais looks for `.elspais.toml` in the current directory
6
+ or parent directories up to the git repository root.
7
+
8
+ $ elspais init # Create default config
9
+ $ elspais config path # Show config location
10
+ $ elspais config show # View all settings
11
+
12
+ ## Complete Configuration Reference
13
+
14
+ ### [project] Section
15
+
16
+ ```toml
17
+ [project]
18
+ name = "my-project" # Project name (optional)
19
+ type = "core" # "core" or "associated"
20
+ ```
21
+
22
+ ### [patterns] Section
23
+
24
+ Controls requirement ID format and type definitions.
25
+
26
+ ```toml
27
+ [patterns]
28
+ id_template = "{prefix}-{type}{id}" # ID template with tokens
29
+ prefix = "REQ" # ID prefix
30
+
31
+ # Type definitions (PRD, OPS, DEV levels)
32
+ [patterns.types.prd]
33
+ id = "p" # Character in ID (REQ-p00001)
34
+ name = "PRD" # Display name
35
+ level = 1 # Hierarchy level (1=highest)
36
+
37
+ [patterns.types.ops]
38
+ id = "o"
39
+ name = "OPS"
40
+ level = 2
41
+
42
+ [patterns.types.dev]
43
+ id = "d"
44
+ name = "DEV"
45
+ level = 3
46
+
47
+ # ID number formatting
48
+ [patterns.id_format]
49
+ style = "numeric" # Format style
50
+ digits = 5 # Number of digits (0 = variable)
51
+ leading_zeros = true # Pad with zeros (00001 vs 1)
52
+ ```
53
+
54
+ **Template Tokens:**
55
+ `{prefix}` ID prefix (e.g., "REQ")
56
+ `{type}` Type character (e.g., "p", "o", "d")
57
+ `{associated}` Associated repo prefix (if enabled)
58
+ `{id}` Numeric ID
59
+
60
+ ### [patterns.associated] Section
61
+
62
+ For multi-repository setups with associated requirement IDs.
63
+
64
+ ```toml
65
+ [patterns.associated]
66
+ enabled = true # Enable associated repo IDs
67
+ position = "after_prefix" # Position in ID
68
+ format = "uppercase" # Format style
69
+ length = 3 # Prefix length
70
+ separator = "-" # Separator character
71
+ ```
72
+
73
+ ### [spec] Section
74
+
75
+ Controls spec file discovery.
76
+
77
+ ```toml
78
+ [spec]
79
+ directories = ["spec"] # Directories to scan
80
+ patterns = ["*.md"] # File patterns to include
81
+ skip_files = ["README.md"] # Files to skip
82
+ skip_dirs = ["archive"] # Subdirectories to skip
83
+ index_file = "INDEX.md" # Index file name
84
+
85
+ # Map file patterns to levels (optional)
86
+ [spec.file_patterns]
87
+ "prd-*.md" = "prd"
88
+ "ops-*.md" = "ops"
89
+ "dev-*.md" = "dev"
90
+ ```
91
+
92
+ ### [directories] Section
93
+
94
+ Override directory paths.
95
+
96
+ ```toml
97
+ [directories]
98
+ spec = "spec" # Spec directory (string or array)
99
+ code = ["src", "lib"] # Code directories for traceability
100
+ docs = "docs" # Documentation directory
101
+ ignore = ["node_modules"] # Directories to ignore globally
102
+ ```
103
+
104
+ ### [rules] Section
105
+
106
+ Validation and hierarchy rules.
107
+
108
+ ```toml
109
+ [rules]
110
+ strict_mode = false # Strict implements semantics
111
+
112
+ # Hierarchy relationship rules
113
+ [rules.hierarchy]
114
+ dev = ["ops", "prd"] # DEV can implement OPS or PRD
115
+ ops = ["prd"] # OPS can implement PRD
116
+ prd = [] # PRD cannot implement anything
117
+
118
+ # Alternative syntax (human-readable)
119
+ allowed = [
120
+ "dev -> ops, prd",
121
+ "ops -> prd"
122
+ ]
123
+
124
+ allow_circular = false # Allow circular dependencies
125
+ allow_orphans = false # Allow requirements with no parent
126
+
127
+ # Format validation rules
128
+ [rules.format]
129
+ require_hash = true # Require hash footer
130
+ require_rationale = false # Require rationale section
131
+ require_assertions = true # Require assertions
132
+ require_status = true # Require status field
133
+ allowed_statuses = [ # Valid status values
134
+ "Active",
135
+ "Draft",
136
+ "Deprecated",
137
+ "Superseded"
138
+ ]
139
+
140
+ # Content rule modules (advanced)
141
+ [rules.content_rules]
142
+ modules = [] # Module paths for custom rules
143
+ ```
144
+
145
+ ### [validation] Section
146
+
147
+ Hash and validation settings.
148
+
149
+ ```toml
150
+ [validation]
151
+ strict_hierarchy = true # Strict hierarchy checking
152
+ hash_algorithm = "sha256" # Hash algorithm
153
+ hash_length = 8 # Hash length in characters
154
+ ```
155
+
156
+ ### [traceability] Section
157
+
158
+ Code and test scanning for traceability reports.
159
+
160
+ ```toml
161
+ [traceability]
162
+ output_formats = ["markdown", "html"] # Default output formats
163
+ output_dir = "." # Output directory
164
+
165
+ # Code files to scan for implementations
166
+ scan_patterns = [
167
+ "database/**/*.sql",
168
+ "src/**/*.py",
169
+ "apps/**/*.dart",
170
+ ]
171
+
172
+ # Test result file locations
173
+ test_results = [
174
+ "test-results/*.xml", # JUnit XML
175
+ "pytest-report.json", # pytest JSON
176
+ ]
177
+ ```
178
+
179
+ ### [associated] Section
180
+
181
+ For associated (satellite) repositories.
182
+
183
+ ```toml
184
+ [associated]
185
+ prefix = "TTN" # Associated repo prefix
186
+ id_range = [1, 99999] # ID range for this repo
187
+ path = "../titan-spec" # Path to associated repo
188
+ ```
189
+
190
+ ### [core] Section
191
+
192
+ For associated repos referencing their core.
193
+
194
+ ```toml
195
+ [core]
196
+ path = "../core" # Path to core repository
197
+ ```
198
+
199
+ ## Config Commands
200
+
201
+ $ elspais config show # View all settings
202
+ $ elspais config show --section rules
203
+ $ elspais config show -j # JSON output
204
+ $ elspais config get patterns.prefix
205
+ $ elspais config set project.name "NewName"
206
+ $ elspais config set rules.strict_mode true
207
+ $ elspais config unset rules.strict_mode
208
+ $ elspais config add directories.code src/lib
209
+ $ elspais config remove directories.code src/lib
210
+ $ elspais config path # Show file location
211
+
212
+ ## Environment Variable Overrides
213
+
214
+ Any config key can be overridden via environment variables:
215
+
216
+ ELSPAIS_PATTERNS_PREFIX=MYREQ elspais validate
217
+ ELSPAIS_RULES_STRICT_MODE=true elspais validate
218
+
219
+ **Conversion:**
220
+ `ELSPAIS_PATTERNS_PREFIX` -> `patterns.prefix`
221
+ `ELSPAIS_RULES_STRICT_MODE` -> `rules.strict_mode`
222
+
223
+ Rule: Remove `ELSPAIS_`, lowercase, underscores become dots.
224
+
225
+ ## Skip Directories
226
+
227
+ Exclude directories from scanning:
228
+
229
+ ```toml
230
+ [spec]
231
+ skip_dirs = ["archive", "drafts"]
232
+
233
+ [directories]
234
+ ignore = ["node_modules", ".git"]
235
+ ```
236
+
237
+ ## Multi-Repository Setup
238
+
239
+ **Core Repository (.elspais.toml):**
240
+
241
+ ```toml
242
+ [project]
243
+ name = "core-product"
244
+ type = "core"
245
+
246
+ [patterns]
247
+ prefix = "REQ"
248
+ ```
249
+
250
+ **Associated Repository (.elspais.toml):**
251
+
252
+ ```toml
253
+ [project]
254
+ name = "titan-extension"
255
+ type = "associated"
256
+
257
+ [associated]
258
+ prefix = "TTN"
259
+
260
+ [core]
261
+ path = "../core-product"
262
+ ```