reqsmart 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.
Files changed (37) hide show
  1. reqsmart-0.1.0/LICENSE +60 -0
  2. reqsmart-0.1.0/MANIFEST.in +5 -0
  3. reqsmart-0.1.0/PKG-INFO +352 -0
  4. reqsmart-0.1.0/README.md +324 -0
  5. reqsmart-0.1.0/config/clients/README.md +13 -0
  6. reqsmart-0.1.0/config/default/gates.md +61 -0
  7. reqsmart-0.1.0/config/templates/README.md +22 -0
  8. reqsmart-0.1.0/config/templates/aerospace-do178c.md +63 -0
  9. reqsmart-0.1.0/config/templates/automotive-iso26262.md +63 -0
  10. reqsmart-0.1.0/config/templates/medical-iec62304.md +63 -0
  11. reqsmart-0.1.0/config/templates/telecom.md +63 -0
  12. reqsmart-0.1.0/pyproject.toml +44 -0
  13. reqsmart-0.1.0/setup.cfg +4 -0
  14. reqsmart-0.1.0/src/reqsmart.egg-info/PKG-INFO +352 -0
  15. reqsmart-0.1.0/src/reqsmart.egg-info/SOURCES.txt +35 -0
  16. reqsmart-0.1.0/src/reqsmart.egg-info/dependency_links.txt +1 -0
  17. reqsmart-0.1.0/src/reqsmart.egg-info/entry_points.txt +2 -0
  18. reqsmart-0.1.0/src/reqsmart.egg-info/requires.txt +16 -0
  19. reqsmart-0.1.0/src/reqsmart.egg-info/top_level.txt +1 -0
  20. reqsmart-0.1.0/src/smart_req/__init__.py +3 -0
  21. reqsmart-0.1.0/src/smart_req/cli.py +337 -0
  22. reqsmart-0.1.0/src/smart_req/config.py +190 -0
  23. reqsmart-0.1.0/src/smart_req/default_config/gates.md +61 -0
  24. reqsmart-0.1.0/src/smart_req/export.py +259 -0
  25. reqsmart-0.1.0/src/smart_req/extract.py +245 -0
  26. reqsmart-0.1.0/src/smart_req/import_decisions.py +147 -0
  27. reqsmart-0.1.0/src/smart_req/llm.py +189 -0
  28. reqsmart-0.1.0/src/smart_req/models.py +119 -0
  29. reqsmart-0.1.0/src/smart_req/pdf.py +246 -0
  30. reqsmart-0.1.0/src/smart_req/review.py +358 -0
  31. reqsmart-0.1.0/src/smart_req/score.py +553 -0
  32. reqsmart-0.1.0/src/smart_req/templates_config/README.md +22 -0
  33. reqsmart-0.1.0/src/smart_req/templates_config/aerospace-do178c.md +63 -0
  34. reqsmart-0.1.0/src/smart_req/templates_config/automotive-iso26262.md +63 -0
  35. reqsmart-0.1.0/src/smart_req/templates_config/medical-iec62304.md +63 -0
  36. reqsmart-0.1.0/src/smart_req/templates_config/telecom.md +63 -0
  37. reqsmart-0.1.0/src/smart_req/webapp.py +1283 -0
reqsmart-0.1.0/LICENSE ADDED
@@ -0,0 +1,60 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: iSterna Inc.
6
+ Licensed Work: smart-req v0.1.0
7
+ The Licensed Work is (c) 2026 iSterna Inc.
8
+ Additional Use Grant: You may make use of the Licensed Work for internal
9
+ evaluation and non-commercial purposes. Commercial use
10
+ requires a separate license from the Licensor.
11
+ Change Date: 2030-03-21
12
+ Change License: Apache License, Version 2.0
13
+
14
+ For information about alternative licensing arrangements for the Licensed Work,
15
+ please contact: support@aisterna.com
16
+
17
+ Notice
18
+
19
+ Business Source License 1.1 (BSL-1.1)
20
+
21
+ Terms
22
+
23
+ The Licensor hereby grants you the right to copy, modify, create derivative
24
+ works, redistribute, and make non-production use of the Licensed Work. The
25
+ Licensor may make an Additional Use Grant, above, permitting limited production
26
+ use.
27
+
28
+ Effective on the Change Date, or the fourth anniversary of the first publicly
29
+ available distribution of a specific version of the Licensed Work under this
30
+ License, whichever comes first, the Licensor hereby grants you rights under the
31
+ terms of the Change License, and the rights granted in the paragraph above
32
+ terminate.
33
+
34
+ If your use of the Licensed Work does not comply with the requirements currently
35
+ in effect as described in this License, you must purchase a commercial license
36
+ from the Licensor, its affiliated entities, or authorized resellers, or you must
37
+ refrain from using the Licensed Work.
38
+
39
+ All copies of the original and modified Licensed Work, and derivative works of
40
+ the Licensed Work, are subject to this License. This License applies separately
41
+ for each version of the Licensed Work and the Change Date may vary for each
42
+ version of the Licensed Work released by Licensor.
43
+
44
+ You must conspicuously display this License on each original or modified copy of
45
+ the Licensed Work. If you receive the Licensed Work in original or modified form
46
+ from a third party, the terms and conditions set forth in this License apply to
47
+ your use of that work.
48
+
49
+ Any use of the Licensed Work in violation of this License will automatically
50
+ terminate your rights under this License for the current and all other versions
51
+ of the Licensed Work.
52
+
53
+ This License does not grant you any right in any trademark or logo of Licensor
54
+ or its affiliates (provided that you may use a trademark or logo of Licensor as
55
+ expressly required by this License).
56
+
57
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
58
+ "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
59
+ OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY,
60
+ FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include config/default *.md
4
+ recursive-include config/templates *.md
5
+ include config/clients/README.md
@@ -0,0 +1,352 @@
1
+ Metadata-Version: 2.4
2
+ Name: reqsmart
3
+ Version: 0.1.0
4
+ Summary: Requirement qualification tool: extract, score, review, export
5
+ Author: Yanbing Li
6
+ License: BSL-1.1
7
+ Project-URL: Homepage, https://aisterna.com/smart-req
8
+ Keywords: requirements,quality,IEEE-29148,governance,traceability
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: click>=8.1.0
13
+ Requires-Dist: rich>=13.0.0
14
+ Requires-Dist: pydantic>=2.0.0
15
+ Requires-Dist: anthropic>=0.18.0
16
+ Requires-Dist: pymupdf>=1.24.0
17
+ Requires-Dist: openpyxl>=3.1.0
18
+ Requires-Dist: fastapi>=0.109.0
19
+ Requires-Dist: uvicorn[standard]>=0.27.0
20
+ Requires-Dist: python-dotenv>=1.0.0
21
+ Requires-Dist: python-multipart>=0.0.6
22
+ Requires-Dist: pyyaml>=6.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
26
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # smart-req
30
+
31
+ SMART Requirement Qualification Tool — extract requirements from specification PDFs, score them against quality gates, review with your team, and export gate-clean spreadsheets.
32
+
33
+ ## Quick Start
34
+
35
+ ### Install
36
+
37
+ **Option A — One-line installer (recommended):**
38
+
39
+ ```bash
40
+ curl -sSL https://raw.githubusercontent.com/aisterna/smart-req/main/install.sh | bash
41
+ ```
42
+
43
+ This checks prerequisites, creates an isolated environment, and adds `smart-req` to your PATH.
44
+
45
+ **Option B — Manual install:**
46
+
47
+ ```bash
48
+ git clone https://github.com/aisterna/smart-req.git
49
+ cd smart-req
50
+ python3 -m venv .venv
51
+ source .venv/bin/activate
52
+ pip install -e .
53
+ ```
54
+
55
+ ### Prerequisites
56
+
57
+ - Python 3.11 or later ([download](https://www.python.org/downloads/))
58
+ - An Anthropic API key ([get one](https://console.anthropic.com/))
59
+
60
+ ### Configure
61
+
62
+ ```bash
63
+ smart-req configure
64
+ ```
65
+
66
+ Enter your Anthropic API key when prompted. Optionally set a default client config:
67
+
68
+ ```bash
69
+ smart-req configure --client mycompany
70
+ ```
71
+
72
+ This is saved locally at `~/.smart-req/config.yaml`.
73
+
74
+ ## Usage
75
+
76
+ ### Step 1: Create a working directory
77
+
78
+ ```bash
79
+ mkdir ~/dc28-sfs-review
80
+ cd ~/dc28-sfs-review
81
+ ```
82
+
83
+ All output files will be saved here.
84
+
85
+ ### Step 2: Extract requirements from your PDF
86
+
87
+ ```bash
88
+ smart-req extract --input /path/to/your-spec.pdf
89
+ ```
90
+
91
+ Extract specific sections only:
92
+
93
+ ```bash
94
+ smart-req extract --input /path/to/SFS.pdf --sections 3.5,3.22
95
+ ```
96
+
97
+ Output: `raw_extract.csv` — open in Excel to sanity-check before scoring.
98
+
99
+ ### Step 3: Score against quality gates
100
+
101
+ ```bash
102
+ smart-req score
103
+ ```
104
+
105
+ Output: `manifest.xlsx` with four tabs:
106
+ - **Instructions** — what to do next
107
+ - **PASS** — requirements that passed all gates
108
+ - **REVIEW** — requirements with warnings
109
+ - **FAIL** — requirements with failures, including suggested fixes
110
+
111
+ ### Step 4: Review (choose one)
112
+
113
+ **Option A — Spreadsheet review:**
114
+
115
+ 1. Open `manifest.xlsx`
116
+ 2. Go to REVIEW and FAIL tabs
117
+ 3. Use the dropdown in the Decision column: **Accept**, **Modify**, or **Reject**
118
+ 4. Add notes in the Engineer Notes column
119
+ 5. Save the spreadsheet
120
+ 6. Run:
121
+
122
+ ```bash
123
+ smart-req finalize
124
+ ```
125
+
126
+ **Option B — Browser review:**
127
+
128
+ ```bash
129
+ smart-req review
130
+ ```
131
+
132
+ A local browser UI opens. Click Accept/Modify/Reject for each requirement. When done, the server auto-exports and closes.
133
+
134
+ ### Step 5: Done
135
+
136
+ Your final output:
137
+
138
+ ```
139
+ your-spec_Final.xlsx ← gate-clean requirements
140
+ your-spec_Final.audit.json ← audit trail (who decided what, when)
141
+ ```
142
+
143
+ ## Commands
144
+
145
+ | Command | What it does |
146
+ |---|---|
147
+ | `smart-req run` | **Full pipeline** — extract, score, review, export in one command |
148
+ | `smart-req extract` | PDF → requirements CSV |
149
+ | `smart-req score` | CSV → scored manifest (XLSX + JSON) |
150
+ | `smart-req review` | Browser-based HITL review |
151
+ | `smart-req finalize` | Import spreadsheet decisions → export final XLSX |
152
+ | `smart-req export` | Export final XLSX (after browser review) |
153
+ | `smart-req import-decisions` | Import decisions from spreadsheet only (advanced) |
154
+ | `smart-req configure` | Set API key and default client |
155
+
156
+ ### Quickest path
157
+
158
+ ```bash
159
+ # Browser review (one command does everything)
160
+ smart-req run --input /path/to/spec.pdf
161
+
162
+ # Spreadsheet review (two commands)
163
+ smart-req run --input /path/to/spec.pdf --spreadsheet
164
+ # fill in decisions in manifest.xlsx, save, then:
165
+ smart-req finalize
166
+ ```
167
+
168
+ ## Quality Gates
169
+
170
+ ### Default (IEEE 29148 Baseline — 6 gates)
171
+
172
+ Six universal gates derived from IEEE/ISO/IEC 29148:2018 Clause 5.2.5:
173
+
174
+ | Gate | IEEE 29148 Characteristic | What it checks |
175
+ |---|---|---|
176
+ | **RQ1** Unambiguous | §5.2.5(c) | Single interpretation. No vague terms. |
177
+ | **RQ2** Verifiable | §5.2.5(l) | Can be proven by test, analysis, or inspection. |
178
+ | **RQ3** Singular | §5.2.5(i) | One concern per requirement. |
179
+ | **RQ4** Appropriate | §5.2.5(a) | Right abstraction level. WHAT, not HOW. |
180
+ | **RQ5** Traceable | §5.2.5(k) | Maps to source AND to implementation + verification. |
181
+ | **RQ6** Complete | §5.2.5(b) | All values specified. No TBDs. |
182
+
183
+ ### Domain Templates
184
+
185
+ Pre-built gate configurations for regulated industries. Copy a template and customize:
186
+
187
+ | Template | Standards | Additional gates |
188
+ |---|---|---|
189
+ | `telecom.md` | TL9000, ITU-T, RFC 2119 | Protocol compliance, keyword compliance, interface completeness, interop reference |
190
+ | `aerospace-do178c.md` | DO-178C, ARP 4754A | DAL allocation, derived req flagging, safety traceability, verification method |
191
+ | `medical-iec62304.md` | IEC 62304, ISO 14971, FDA | Safety class, hazard traceability, intended use, SOUP identification |
192
+ | `automotive-iso26262.md` | ISO 26262, ASPICE | ASIL allocation, freedom from interference, fault handling, bidirectional trace |
193
+
194
+ ```bash
195
+ cp config/templates/telecom.md ~/.smart-req/clients/mycompany/gates.md
196
+ smart-req configure --client mycompany
197
+ ```
198
+
199
+ ### Further customization
200
+
201
+ After applying a template, you can add domain terms to suppress false positives on your terminology:
202
+
203
+ ```bash
204
+ # Create domain_terms.md in your client config
205
+ cat > ~/.smart-req/clients/mycompany/domain_terms.md << 'EOF'
206
+ ## Domain-Specific Terms
207
+ - [your acronyms and defined terms here]
208
+ - [terms that sound vague but have precise meaning in your domain]
209
+ EOF
210
+ ```
211
+
212
+ For gates fully tailored to your methodology and document conventions, contact support@aisterna.com.
213
+
214
+ ## Example
215
+
216
+ ```bash
217
+ # Full pipeline on a 100-page SFS document
218
+ mkdir ~/dc28-review && cd ~/dc28-review
219
+
220
+ smart-req extract --input ~/Documents/my-spec.pdf
221
+ # → 480 requirements extracted (45s)
222
+
223
+ smart-req score
224
+ # → 347 PASS, 98 REVIEW, 35 FAIL (12 min)
225
+
226
+ smart-req review
227
+ # → Browser opens, review 133 items, auto-exports when done
228
+
229
+ ls *_Final.*
230
+ # your-spec_Final.xlsx
231
+ # your-spec_Final.audit.json
232
+ ```
233
+
234
+ ## First Run: What to Expect
235
+
236
+ When you run smart-req for the first time **without a custom client config**, here's what happens:
237
+
238
+ ### The good
239
+
240
+ - Requirements with real quality issues (vague, untestable, compound, incomplete) are correctly flagged
241
+ - Suggested fixes are actionable — you can Accept them directly
242
+ - The 5 default quality gates catch universal problems that apply to any domain
243
+
244
+ ### The noise
245
+
246
+ - **Domain terms flagged as ambiguous (~15-30% of warnings):** Terms like "traffic-affecting fault" or "NETCONF" have precise meaning in your domain, but the default scorer doesn't know that. These show up as G1/Specific warnings.
247
+ - **Missing domain-specific checks:** The default 5 gates cover universal requirement quality. Your domain may need additional gates (interface completeness, protocol compliance, safety traceability).
248
+
249
+ ### What to do about it
250
+
251
+ **1. Just Reject the false positives (5 minutes):** The dropdown makes this fast. Your rejections are recorded in the audit trail — they don't slow you down.
252
+
253
+ **2. Apply a domain template (10 minutes):** Pick the template for your industry. This adds domain-specific gates and reduces noise immediately:
254
+
255
+ ```bash
256
+ mkdir -p ~/.smart-req/clients/mycompany
257
+ cp config/templates/telecom.md ~/.smart-req/clients/mycompany/gates.md
258
+ smart-req configure --client mycompany
259
+ smart-req score # now uses your domain gates
260
+ ```
261
+
262
+ Available templates: `telecom.md`, `aerospace-do178c.md`, `medical-iec62304.md`, `automotive-iso26262.md`.
263
+
264
+ **3. Add your domain terms (1 hour):** Create a terms list so your team's vocabulary stops triggering false warnings:
265
+
266
+ ```bash
267
+ cat > ~/.smart-req/clients/mycompany/domain_terms.md << 'EOF'
268
+ ## Domain-Specific Terms
269
+ - [your acronyms and defined terms here]
270
+ - [terms that sound vague but have precise meaning in your domain]
271
+ EOF
272
+ ```
273
+
274
+ Re-score — false positives drop to <5%.
275
+
276
+ **4. Professional onboarding (2-3 hours):** Gates fully tailored to your methodology, document conventions, and quality standards. Contact support@aisterna.com.
277
+
278
+ ### Example: Reducing noise step by step
279
+
280
+ Suppose your spec contains this requirement:
281
+
282
+ > "The system shall support NETCONF for NBI configuration management."
283
+
284
+ **Step 0 — Default scoring result:**
285
+ ```
286
+ RQ1 Unambiguous: FAIL — "support" is a prohibited vague term (support what exactly?)
287
+ RQ2 Verifiable: FAIL — no testable criteria (which NETCONF operations? which datastore?)
288
+ RQ6 Complete: FAIL — no protocol version, no transport, no error handling
289
+ Suggested fix: "The system shall implement NETCONF (RFC 6241) over SSH (RFC 6242)
290
+ for NBI configuration management, supporting <get>, <get-config>, <edit-config>,
291
+ and <lock> operations on the running and candidate datastores."
292
+ ```
293
+
294
+ Three failures. The suggested fix is good but aggressive — maybe you only need some of those operations.
295
+
296
+ **After Step 1 (Reject):** You click Reject on RQ1: "support has defined meaning in our NBI spec — it means implement all mandatory operations per our NBI compliance matrix." Audit trail records your justification. RQ2 and RQ6 failures are legitimate — you Accept those fixes.
297
+
298
+ **After Step 2 (Telecom template):** You applied `telecom.md`. Now the scoring also checks TQ1 (Protocol Compliance) and TQ3 (Interface Completeness):
299
+ ```
300
+ TQ1 Protocol Compliance: FAIL — no NETCONF version (RFC 6241 vs RFC 4741?)
301
+ TQ3 Interface Completeness: FAIL — no operations, no datastore, no error handling specified
302
+ ```
303
+ The template catches what the baseline missed — and the failures are more precise.
304
+
305
+ **After Step 3 (Domain terms):** You added to `domain_terms.md`:
306
+ ```
307
+ - NBI (Northbound Interface — management plane access)
308
+ - NETCONF, RESTCONF, SNMP (management protocols)
309
+ - "support" when followed by a protocol name (means implement per compliance matrix)
310
+ ```
311
+ Now RQ1 no longer flags "support NETCONF" as vague. Only the real gaps (RQ2, RQ6, TQ1, TQ3) remain.
312
+
313
+ **After Step 4 (Professional onboarding):** iSterna adds a custom gate:
314
+ ```
315
+ ### CQ1: NBI Compliance Matrix Reference
316
+ - Pass: NBI requirement references the compliance matrix row/column
317
+ specifying mandatory vs optional operations for this protocol.
318
+ - Fail: NBI requirement without compliance matrix reference.
319
+ ```
320
+ Now every NBI requirement is automatically checked against your compliance matrix — something no generic template could know about.
321
+
322
+ ### Typical results by configuration
323
+
324
+ | Configuration | False positive rate | Gates | Setup time |
325
+ |---|---|---|---|
326
+ | Default (no config) | 15-30% | 6 RQ baseline | 0 min |
327
+ | Domain template | 10-15% | 6 RQ + 4 domain | 10 min |
328
+ | Template + domain terms | 3-5% | 6 RQ + 4 domain | 1 hour |
329
+ | Professional onboarding | <3% | Custom (8-12 gates) | 2-3 hours with specialist |
330
+
331
+ ---
332
+
333
+ ## FAQ
334
+
335
+ **How much does it cost?**
336
+ LLM costs depend on document size. A 100-page SFS (~480 requirements) costs approximately $15-25 for extraction + scoring using Claude Sonnet.
337
+
338
+ **Can I use a different LLM?**
339
+ Currently Claude only. Pass `--model claude-opus-4-6` for higher quality at higher cost, or `--model claude-sonnet-4-20250514` (default) for the best cost/quality balance.
340
+
341
+ **Does my data leave my machine?**
342
+ Requirement text is sent to the Anthropic API for extraction and scoring. No data is stored by the tool beyond your local machine. Review and export are fully offline.
343
+
344
+ **Can I re-score after editing the CSV?**
345
+ Yes. Edit `raw_extract.csv`, then run `smart-req score` again. The manifest is regenerated from scratch.
346
+
347
+ **What if I disagree with a gate score?**
348
+ Reject it. The Decision column lets you override any gate result with a justification. Rejected items keep their original text and your reason is recorded in the audit trail.
349
+
350
+ ## License
351
+
352
+ Business Source License 1.1 (BSL-1.1). See [LICENSE](LICENSE) for details.