requirements-as-code 0.1.0__tar.gz
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.
- requirements_as_code-0.1.0/PKG-INFO +440 -0
- requirements_as_code-0.1.0/README.md +428 -0
- requirements_as_code-0.1.0/pyproject.toml +25 -0
- requirements_as_code-0.1.0/rac/cli.py +100 -0
- requirements_as_code-0.1.0/rac/diff.py +69 -0
- requirements_as_code-0.1.0/rac/models.py +107 -0
- requirements_as_code-0.1.0/rac/output.py +152 -0
- requirements_as_code-0.1.0/rac/parser.py +159 -0
- requirements_as_code-0.1.0/rac/validate.py +174 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/PKG-INFO +440 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/SOURCES.txt +14 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/dependency_links.txt +1 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/entry_points.txt +2 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/requires.txt +4 -0
- requirements_as_code-0.1.0/requirements_as_code.egg-info/top_level.txt +1 -0
- requirements_as_code-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: requirements-as-code
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RAC — lint and diff product requirements written in Markdown.
|
|
5
|
+
Author: RAC
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: markdown-it-py>=3.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
12
|
+
|
|
13
|
+
# RAC (Requirements-as-Code)
|
|
14
|
+
|
|
15
|
+
> Lint, diff, and analyse product requirements from the command line
|
|
16
|
+
|
|
17
|
+
Product requirements are often trapped in documents, making them difficult to review, validate, and track over time.
|
|
18
|
+
|
|
19
|
+
RAC brings software engineering workflows to product requirements.
|
|
20
|
+
|
|
21
|
+
Write requirements in Markdown. Store them in Git. Validate them, compare versions, and analyse change over time.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Markdown
|
|
25
|
+
↓
|
|
26
|
+
Product Model
|
|
27
|
+
↓
|
|
28
|
+
Validation
|
|
29
|
+
↓
|
|
30
|
+
Diffing
|
|
31
|
+
↓
|
|
32
|
+
Portfolio Analysis
|
|
33
|
+
↓
|
|
34
|
+
AI Review (future)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Why RAC?
|
|
38
|
+
|
|
39
|
+
Engineers have mature tooling for code:
|
|
40
|
+
|
|
41
|
+
- Linters
|
|
42
|
+
- Code review
|
|
43
|
+
- Diffs
|
|
44
|
+
- Static analysis
|
|
45
|
+
- Version control
|
|
46
|
+
|
|
47
|
+
Product requirements typically have none of these.
|
|
48
|
+
|
|
49
|
+
RAC applies the same principles to product requirements.
|
|
50
|
+
|
|
51
|
+
### Validate
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
rac validate bond_dashboard.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Compare
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
rac diff bond_dashboard_v1.md bond_dashboard_v2.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Analyse
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
rac stats ./features
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
*(planned for v0.2)*
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
# Example
|
|
74
|
+
|
|
75
|
+
Create a requirement file:
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
# Bond Dashboard
|
|
79
|
+
|
|
80
|
+
## Problem
|
|
81
|
+
|
|
82
|
+
Retail investors struggle to understand interest-rate exposure.
|
|
83
|
+
|
|
84
|
+
## Requirements
|
|
85
|
+
|
|
86
|
+
- [REQ-001] User can view portfolio holdings
|
|
87
|
+
- [REQ-002] User can view portfolio duration
|
|
88
|
+
- [REQ-003] User can view portfolio yield
|
|
89
|
+
|
|
90
|
+
## Success Metrics
|
|
91
|
+
|
|
92
|
+
- Monthly Active Users
|
|
93
|
+
- Dashboard Views
|
|
94
|
+
|
|
95
|
+
## Risks
|
|
96
|
+
|
|
97
|
+
- Inaccurate market data
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Validate it:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
rac validate bond_dashboard.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Output:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
PASS
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Now compare two versions:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
rac diff bond_dashboard_v1.md bond_dashboard_v2.md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Output:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
Added Requirements
|
|
122
|
+
|
|
123
|
+
+ REQ-004 View projected yield forecast
|
|
124
|
+
|
|
125
|
+
Modified Requirements
|
|
126
|
+
|
|
127
|
+
~ REQ-002
|
|
128
|
+
|
|
129
|
+
Before:
|
|
130
|
+
User can view portfolio duration
|
|
131
|
+
|
|
132
|
+
After:
|
|
133
|
+
User can view and compare portfolio duration
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
RAC compares **product changes**, not just text changes.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
# Installation
|
|
141
|
+
|
|
142
|
+
## Using pip
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
pip install requirements-as-code
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Using uv
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv tool install requirements-as-code
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Verify installation:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
rac --help
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
# Quick Start
|
|
163
|
+
|
|
164
|
+
Create a file:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
touch feature.md
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Add requirements:
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
# Trade Alerts
|
|
174
|
+
|
|
175
|
+
## Problem
|
|
176
|
+
|
|
177
|
+
Investors miss important market movements.
|
|
178
|
+
|
|
179
|
+
## Requirements
|
|
180
|
+
|
|
181
|
+
- [REQ-001] User can create a trade alert
|
|
182
|
+
- [REQ-002] User can edit a trade alert
|
|
183
|
+
- [REQ-003] User can delete a trade alert
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Validate:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
rac validate feature.md
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Compare versions:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
rac diff old.md new.md
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
# Philosophy
|
|
201
|
+
|
|
202
|
+
RAC follows a few simple principles.
|
|
203
|
+
|
|
204
|
+
## Markdown First
|
|
205
|
+
|
|
206
|
+
Requirements should remain easy to write and review.
|
|
207
|
+
|
|
208
|
+
RAC uses Markdown as the source format.
|
|
209
|
+
|
|
210
|
+
No proprietary editors.
|
|
211
|
+
|
|
212
|
+
No custom file formats.
|
|
213
|
+
|
|
214
|
+
## Git Native
|
|
215
|
+
|
|
216
|
+
Requirements should work naturally inside:
|
|
217
|
+
|
|
218
|
+
- GitHub
|
|
219
|
+
- GitLab
|
|
220
|
+
- VS Code
|
|
221
|
+
- Cursor
|
|
222
|
+
- Claude Code
|
|
223
|
+
|
|
224
|
+
## AI Optional
|
|
225
|
+
|
|
226
|
+
RAC should be useful without AI.
|
|
227
|
+
|
|
228
|
+
The foundation is:
|
|
229
|
+
|
|
230
|
+
- structure
|
|
231
|
+
- validation
|
|
232
|
+
- diffing
|
|
233
|
+
- analysis
|
|
234
|
+
|
|
235
|
+
AI is an enhancement, not a dependency.
|
|
236
|
+
|
|
237
|
+
## Product Model
|
|
238
|
+
|
|
239
|
+
Internally, RAC converts Markdown into a structured Product Model.
|
|
240
|
+
|
|
241
|
+
```text
|
|
242
|
+
Markdown
|
|
243
|
+
↓
|
|
244
|
+
Parser
|
|
245
|
+
↓
|
|
246
|
+
Feature Model
|
|
247
|
+
↓
|
|
248
|
+
Validation
|
|
249
|
+
↓
|
|
250
|
+
Diffing
|
|
251
|
+
↓
|
|
252
|
+
Stats
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
This enables reliable analysis without relying on fragile text processing.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
# Markdown Specification
|
|
260
|
+
|
|
261
|
+
Every feature is represented by a single Markdown file.
|
|
262
|
+
|
|
263
|
+
Example:
|
|
264
|
+
|
|
265
|
+
```markdown
|
|
266
|
+
# Feature Title
|
|
267
|
+
|
|
268
|
+
## Problem
|
|
269
|
+
|
|
270
|
+
Problem statement.
|
|
271
|
+
|
|
272
|
+
## Requirements
|
|
273
|
+
|
|
274
|
+
- [REQ-001] Requirement text
|
|
275
|
+
- [REQ-002] Requirement text
|
|
276
|
+
|
|
277
|
+
## Success Metrics
|
|
278
|
+
|
|
279
|
+
- Metric 1
|
|
280
|
+
|
|
281
|
+
## Risks
|
|
282
|
+
|
|
283
|
+
- Risk 1
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Required Sections
|
|
287
|
+
|
|
288
|
+
Required:
|
|
289
|
+
|
|
290
|
+
- `# Title`
|
|
291
|
+
- `## Problem`
|
|
292
|
+
- `## Requirements`
|
|
293
|
+
|
|
294
|
+
Optional (recommended):
|
|
295
|
+
|
|
296
|
+
- `## Success Metrics`
|
|
297
|
+
- `## Risks`
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
# Commands
|
|
302
|
+
|
|
303
|
+
## Validate
|
|
304
|
+
|
|
305
|
+
Validate a requirement file.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
rac validate feature.md
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Checks:
|
|
312
|
+
|
|
313
|
+
- Required sections exist
|
|
314
|
+
- Requirement IDs are valid
|
|
315
|
+
- Requirement IDs are unique
|
|
316
|
+
- Requirement text is not empty
|
|
317
|
+
|
|
318
|
+
Warnings:
|
|
319
|
+
|
|
320
|
+
- Missing risks
|
|
321
|
+
- Missing success metrics
|
|
322
|
+
- Duplicate requirement text
|
|
323
|
+
- Ambiguous wording
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Diff
|
|
328
|
+
|
|
329
|
+
Compare two versions of a feature.
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
rac diff old.md new.md
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Detects:
|
|
336
|
+
|
|
337
|
+
- Added requirements
|
|
338
|
+
- Removed requirements
|
|
339
|
+
- Modified requirements
|
|
340
|
+
- Added metrics
|
|
341
|
+
- Removed metrics
|
|
342
|
+
- Added risks
|
|
343
|
+
- Removed risks
|
|
344
|
+
|
|
345
|
+
Requirements are matched by ID.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Stats (Planned)
|
|
350
|
+
|
|
351
|
+
Portfolio-level analysis.
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
rac stats ./features
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Example output:
|
|
358
|
+
|
|
359
|
+
```text
|
|
360
|
+
Portfolio Overview
|
|
361
|
+
==================
|
|
362
|
+
|
|
363
|
+
Features: 12
|
|
364
|
+
|
|
365
|
+
Requirements: 87
|
|
366
|
+
|
|
367
|
+
Success Metrics: 24
|
|
368
|
+
|
|
369
|
+
Risks: 18
|
|
370
|
+
|
|
371
|
+
Features Missing Risks: 3
|
|
372
|
+
|
|
373
|
+
Features Missing Metrics: 2
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Review (Planned)
|
|
379
|
+
|
|
380
|
+
AI-assisted product review.
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
rac review feature.md
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Potential checks:
|
|
387
|
+
|
|
388
|
+
- Missing requirements
|
|
389
|
+
- Missing risks
|
|
390
|
+
- Ambiguity
|
|
391
|
+
- Product concerns
|
|
392
|
+
- Engineering concerns
|
|
393
|
+
|
|
394
|
+
RAC will use the user's configured AI provider rather than requiring hosted infrastructure.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
# Roadmap
|
|
399
|
+
|
|
400
|
+
## v0.1
|
|
401
|
+
|
|
402
|
+
- Markdown parser
|
|
403
|
+
- Product Model (AST)
|
|
404
|
+
- Validation
|
|
405
|
+
- Diffing
|
|
406
|
+
- CLI
|
|
407
|
+
|
|
408
|
+
## v0.2
|
|
409
|
+
|
|
410
|
+
- Portfolio statistics
|
|
411
|
+
- Quality metrics
|
|
412
|
+
- Repository-wide analysis
|
|
413
|
+
|
|
414
|
+
## v0.3
|
|
415
|
+
|
|
416
|
+
- AI review
|
|
417
|
+
- Provider abstraction
|
|
418
|
+
- Git-aware workflows
|
|
419
|
+
|
|
420
|
+
## v1.0
|
|
421
|
+
|
|
422
|
+
- Product intelligence
|
|
423
|
+
- Daily product briefs
|
|
424
|
+
- VS Code integration
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
# Contributing
|
|
429
|
+
|
|
430
|
+
Contributions, ideas, and feedback are welcome.
|
|
431
|
+
|
|
432
|
+
The project is intentionally focused on one goal:
|
|
433
|
+
|
|
434
|
+
> Treat product requirements like code.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
# License
|
|
439
|
+
|
|
440
|
+
MIT
|