regix 0.1.1__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 (36) hide show
  1. regix-0.1.1/LICENSE +183 -0
  2. regix-0.1.1/PKG-INFO +382 -0
  3. regix-0.1.1/README.md +327 -0
  4. regix-0.1.1/pyproject.toml +122 -0
  5. regix-0.1.1/regix/__init__.py +132 -0
  6. regix-0.1.1/regix/backends/__init__.py +54 -0
  7. regix-0.1.1/regix/backends/coverage_backend.py +110 -0
  8. regix-0.1.1/regix/backends/docstring_backend.py +66 -0
  9. regix-0.1.1/regix/backends/lizard_backend.py +71 -0
  10. regix-0.1.1/regix/backends/radon_backend.py +92 -0
  11. regix-0.1.1/regix/backends/vallm_backend.py +74 -0
  12. regix-0.1.1/regix/cache.py +97 -0
  13. regix-0.1.1/regix/cli.py +297 -0
  14. regix-0.1.1/regix/compare.py +175 -0
  15. regix-0.1.1/regix/config.py +202 -0
  16. regix-0.1.1/regix/exceptions.py +54 -0
  17. regix-0.1.1/regix/gates.py +52 -0
  18. regix-0.1.1/regix/git.py +121 -0
  19. regix-0.1.1/regix/history.py +100 -0
  20. regix-0.1.1/regix/integrations/__init__.py +64 -0
  21. regix-0.1.1/regix/models.py +387 -0
  22. regix-0.1.1/regix/report.py +133 -0
  23. regix-0.1.1/regix/snapshot.py +137 -0
  24. regix-0.1.1/regix.egg-info/PKG-INFO +382 -0
  25. regix-0.1.1/regix.egg-info/SOURCES.txt +34 -0
  26. regix-0.1.1/regix.egg-info/dependency_links.txt +1 -0
  27. regix-0.1.1/regix.egg-info/entry_points.txt +2 -0
  28. regix-0.1.1/regix.egg-info/requires.txt +36 -0
  29. regix-0.1.1/regix.egg-info/top_level.txt +1 -0
  30. regix-0.1.1/setup.cfg +4 -0
  31. regix-0.1.1/tests/test_backends.py +116 -0
  32. regix-0.1.1/tests/test_compare.py +116 -0
  33. regix-0.1.1/tests/test_config.py +103 -0
  34. regix-0.1.1/tests/test_models.py +182 -0
  35. regix-0.1.1/tests/test_regix.py +11 -0
  36. regix-0.1.1/tests/test_report.py +85 -0
regix-0.1.1/LICENSE ADDED
@@ -0,0 +1,183 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ Copyright (c) 2026 Tom Sapletta
166
+
167
+ Permission is hereby granted, free of charge, to any person obtaining a copy
168
+ of this software and associated documentation files (the "Software"), to deal
169
+ in the Software without restriction, including without limitation the rights
170
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
171
+ copies of the Software, and to permit persons to whom the Software is
172
+ furnished to do so, subject to the following conditions:
173
+
174
+ The above copyright notice and this permission notice shall be included in all
175
+ copies or substantial portions of the Software.
176
+
177
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
180
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
181
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
182
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
183
+ SOFTWARE.
regix-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: regix
3
+ Version: 0.1.1
4
+ Summary: Regression Index — detect and measure code quality regressions between git versions
5
+ Author-email: Tom Sapletta <tom@sapletta.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/semcod/regix
8
+ Project-URL: Documentation, https://github.com/semcod/regix/tree/main/docs
9
+ Project-URL: Repository, https://github.com/semcod/regix
10
+ Project-URL: Issues, https://github.com/semcod/regix/issues
11
+ Keywords: regression,refactoring,code-quality,git,cyclomatic-complexity,CI
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Classifier: Topic :: Software Development :: Version Control :: Git
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pyyaml>=6.0
27
+ Requires-Dist: typer>=0.12
28
+ Requires-Dist: rich>=13.0
29
+ Provides-Extra: lizard
30
+ Requires-Dist: lizard>=1.17; extra == "lizard"
31
+ Provides-Extra: radon
32
+ Requires-Dist: radon>=6.0; extra == "radon"
33
+ Provides-Extra: coverage
34
+ Requires-Dist: coverage[toml]>=7.0; extra == "coverage"
35
+ Provides-Extra: vallm
36
+ Requires-Dist: vallm>=0.1; extra == "vallm"
37
+ Provides-Extra: docstring
38
+ Provides-Extra: full
39
+ Requires-Dist: lizard>=1.17; extra == "full"
40
+ Requires-Dist: radon>=6.0; extra == "full"
41
+ Requires-Dist: coverage[toml]>=7.0; extra == "full"
42
+ Requires-Dist: vallm>=0.1; extra == "full"
43
+ Provides-Extra: pyqual
44
+ Requires-Dist: pyqual>=0.1.50; extra == "pyqual"
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=8.0; extra == "dev"
47
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
48
+ Requires-Dist: lizard>=1.17; extra == "dev"
49
+ Requires-Dist: radon>=6.0; extra == "dev"
50
+ Requires-Dist: coverage[toml]>=7.0; extra == "dev"
51
+ Requires-Dist: goal>=2.1.0; extra == "dev"
52
+ Requires-Dist: costs>=0.1.20; extra == "dev"
53
+ Requires-Dist: pfix>=0.1.60; extra == "dev"
54
+ Dynamic: license-file
55
+
56
+ # Regix — Regression Index for Python Code Quality
57
+
58
+
59
+ ## AI Cost Tracking
60
+
61
+ ![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.1-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
62
+ ![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.15-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-2.0h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
63
+
64
+ - 🤖 **LLM usage:** $0.1500 (1 commits)
65
+ - 👤 **Human dev:** ~$200 (2.0h @ $100/h, 30min dedup)
66
+
67
+ Generated on 2026-03-31 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
68
+
69
+ ---
70
+
71
+ **Regix** is a Python library for detecting, measuring, and reporting code quality regressions between versions of a codebase. It compares static analysis metrics across git commits, branches, or local snapshots and pinpoints exactly which functions, classes, or lines have regressed — and by how much.
72
+
73
+ > Inspired by operational experience with [pyqual](https://github.com/semcod/pyqual): iterative quality-gate pipelines revealed that without structured regression tracking, metric changes across refactoring cycles are invisible until a gate breaks.
74
+
75
+ ---
76
+
77
+ ## Problem statement
78
+
79
+ When refactoring code over multiple iterations:
80
+
81
+ - A function's cyclomatic complexity improves in one commit, then regresses two commits later.
82
+ - Test coverage drops by 3% after a merge — but no single file is obviously responsible.
83
+ - Maintainability index worsens across three files simultaneously; the cause is spread over dozens of small changes.
84
+ - A CI pipeline fails a quality gate without explaining *what changed* since the last passing run.
85
+
86
+ Standard linters and quality tools report the **current state**. They do not answer: *"Is this better or worse than before, and where exactly did it change?"*
87
+
88
+ **Regix answers that question.**
89
+
90
+ ---
91
+
92
+ ## What Regix does
93
+
94
+ ```
95
+ git commit A ──► snapshot_A ─┐
96
+ ├──► compare ──► regression report
97
+ git commit B ──► snapshot_B ─┘
98
+ ```
99
+
100
+ For every function, class, and module it tracks:
101
+
102
+ | Metric | Unit | Regression when |
103
+ |---|---|---|
104
+ | Cyclomatic complexity (CC) | integer | increases |
105
+ | Maintainability index (MI) | 0–100 | decreases |
106
+ | Test coverage | % | decreases |
107
+ | Function length | lines | increases beyond threshold |
108
+ | Docstring coverage | % | decreases |
109
+ | LLM validation score | 0–1 | decreases (via vallm) |
110
+ | Import count | integer | increases |
111
+
112
+ Regressions are reported at **three granularity levels**:
113
+
114
+ 1. **Line** — the exact line range that changed and caused the metric shift.
115
+ 2. **Symbol** — the function or class whose metric crossed a threshold.
116
+ 3. **Module** — the file-level aggregate delta.
117
+
118
+ ---
119
+
120
+ ## Key features
121
+
122
+ - **Git-native**: compares any two refs (`HEAD~1`, branch names, tags, commit SHAs).
123
+ - **Local-snapshot mode**: compare a dirty working tree against any historical ref without committing.
124
+ - **Multi-version history**: compute a regression timeline across N commits to see trends.
125
+ - **Configurable thresholds**: per-metric, per-file, or per-symbol severity rules.
126
+ - **Multiple backends**: lizard (CC), radon (MI), pytest-cov (coverage), vallm (LLM quality).
127
+ - **Machine-readable output**: JSON, YAML, or TOON format for CI integration.
128
+ - **Human-readable output**: rich terminal tables and diff-style reports.
129
+ - **Zero false-positives mode**: only report regressions that cross a configured threshold delta.
130
+
131
+ ---
132
+
133
+ ## Installation
134
+
135
+ ```bash
136
+ pip install regix
137
+ ```
138
+
139
+ With optional backends:
140
+
141
+ ```bash
142
+ pip install "regix[full]" # lizard + radon + vallm + pytest-cov
143
+ pip install "regix[lizard]" # CC + length analysis only
144
+ pip install "regix[coverage]" # pytest-cov integration only
145
+ ```
146
+
147
+ Python requirement: **>= 3.9**
148
+
149
+ ---
150
+
151
+ ## Quick start
152
+
153
+ ### Compare HEAD against previous commit
154
+
155
+ ```bash
156
+ regix compare HEAD~1 HEAD
157
+ ```
158
+
159
+ ```
160
+ Regression Report: HEAD~1 → HEAD
161
+ ════════════════════════════════════════════════════════════
162
+ pyqual/cli.py
163
+ ▲ bulk_run_cmd CC 14 → 19 (+5) ⚠ WARNING
164
+ ▲ _build_run_summary CC 12 → 18 (+6) ✗ ERROR
165
+
166
+ Summary: 1 error(s), 1 warning(s), 0 improvement(s)
167
+ Gates: ✗ FAIL
168
+ ```
169
+
170
+ ### Compare two branches
171
+
172
+ ```bash
173
+ regix compare main feature/refactor --format json > regression.json
174
+ ```
175
+
176
+ ### Check before committing
177
+
178
+ ```bash
179
+ regix compare HEAD --local
180
+ ```
181
+
182
+ ### Track regressions over last 10 commits
183
+
184
+ ```bash
185
+ regix history --depth 10 --metric cc --metric coverage
186
+ ```
187
+
188
+ ### Use from Python
189
+
190
+ ```python
191
+ from regix import Regix, RegressionConfig
192
+
193
+ cfg = RegressionConfig(cc_max=15, delta_error=5)
194
+ rx = Regix(config=cfg, workdir=".")
195
+ report = rx.compare("HEAD~1", "HEAD")
196
+
197
+ for regression in report.regressions:
198
+ print(f"{regression.file}::{regression.symbol} "
199
+ f"{regression.metric} {regression.before} → {regression.after} "
200
+ f"({regression.severity})")
201
+
202
+ if report.has_errors:
203
+ raise SystemExit(1)
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Core concepts
209
+
210
+ ### Snapshot
211
+
212
+ A `Snapshot` is an immutable record of all tracked metrics for a codebase at a specific point in time. It is identified by a git ref (commit SHA, branch, tag) or the special value `"local"` for the current working tree.
213
+
214
+ ```python
215
+ from regix import Snapshot
216
+
217
+ snap = Snapshot.from_ref("HEAD", workdir=".")
218
+ print(snap.metrics["pyqual/cli.py"]["bulk_run_cmd"]["cc"]) # 19
219
+ ```
220
+
221
+ Snapshots are cached by content hash so repeated comparisons are fast.
222
+
223
+ ### Regression
224
+
225
+ A `Regression` is a detected worsening of a metric between two snapshots, at symbol, module, or project level.
226
+
227
+ ```python
228
+ @dataclass
229
+ class Regression:
230
+ file: str # relative path
231
+ symbol: str | None # function or class name, None = module-level
232
+ line: int | None # approximate line in the target ref
233
+ metric: str # "cc", "mi", "coverage", "length", ...
234
+ before: float
235
+ after: float
236
+ delta: float # after - before (positive = worse for cc/length)
237
+ severity: str # "error" | "warning" | "info"
238
+ threshold: float # the configured limit that was crossed
239
+ ```
240
+
241
+ ### Improvement
242
+
243
+ An `Improvement` is the mirror of a `Regression` — a metric that got *better*. Regix tracks both so you get a complete picture of a refactoring.
244
+
245
+ ### Report
246
+
247
+ A `RegressionReport` aggregates all `Regression` and `Improvement` objects from a comparison, plus summary statistics, gate pass/fail status, and the two snapshot refs.
248
+
249
+ ---
250
+
251
+ ## CLI reference
252
+
253
+ ```
254
+ regix compare [REF_A] [REF_B] Compare metrics between two git refs
255
+ regix history [--depth N] Show metric timeline across commits
256
+ regix snapshot [REF] Capture and store a snapshot
257
+ regix diff [REF_A] [REF_B] Symbol-level metric diff
258
+ regix gates Check against absolute quality gates
259
+ regix status Show config and backend availability
260
+ regix init Create a default regix.yaml
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Configuration
266
+
267
+ Create `regix.yaml` at the project root, or add `[tool.regix]` to `pyproject.toml`:
268
+
269
+ ```yaml
270
+ regix:
271
+ metrics:
272
+ cc_max: 15
273
+ mi_min: 20
274
+ coverage_min: 80
275
+ thresholds:
276
+ delta_warn: 2
277
+ delta_error: 5
278
+ backends:
279
+ cc: lizard
280
+ mi: radon
281
+ coverage: pytest-cov
282
+ exclude:
283
+ - "tests/**"
284
+ - "examples/**"
285
+ output:
286
+ format: rich
287
+ dir: .regix/
288
+ gates:
289
+ on_regression: warn
290
+ ```
291
+
292
+ ---
293
+
294
+ ## CI Integration
295
+
296
+ ### GitHub Actions
297
+
298
+ ```yaml
299
+ - name: Check for regressions
300
+ run: |
301
+ pip install "regix[full]"
302
+ regix compare ${{ github.event.pull_request.base.sha }} HEAD \
303
+ --format json --output .regix/report.json
304
+ regix gates --fail-on error
305
+ ```
306
+
307
+ ### Pre-commit hook
308
+
309
+ ```yaml
310
+ repos:
311
+ - repo: local
312
+ hooks:
313
+ - id: regix
314
+ name: Regression check
315
+ entry: regix compare HEAD --local --errors-only
316
+ language: python
317
+ pass_filenames: false
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Design principles
323
+
324
+ 1. **Fix the measurement before fixing the code.** Regix measures only what it can actually analyse.
325
+ 2. **Report at symbol granularity.** A file-level average of CC=6.4 masks individual functions with CC=19+.
326
+ 3. **Distinguish regression from absolute violation.** CC=18 that was CC=18 last week is an existing issue, not a new regression.
327
+ 4. **Stagnation is a signal.** If metrics are identical across iterations, continuing wastes time.
328
+ 5. **Make improvements visible too.** Hiding improvements creates a discouraging feedback loop.
329
+ 6. **Historical depth is essential.** A single before/after comparison misses the trend.
330
+ 7. **Output must be machine-readable.** JSON, YAML, TOON — all stable and versioned.
331
+
332
+ ---
333
+
334
+ ## Architecture
335
+
336
+ ```
337
+ regix/
338
+ ├── __init__.py # Public API: Regix, Snapshot, RegressionReport
339
+ ├── cli.py # Typer CLI (compare, history, diff, gates, ...)
340
+ ├── config.py # RegressionConfig + YAML/TOML loader
341
+ ├── models.py # Snapshot, Regression, Improvement, Report, etc.
342
+ ├── snapshot.py # Snapshot capture, git worktree, file collection
343
+ ├── compare.py # Core comparison engine
344
+ ├── history.py # Multi-commit timeline builder
345
+ ├── report.py # Rendering: rich, JSON, YAML, TOON
346
+ ├── gates.py # Absolute gate evaluation
347
+ ├── cache.py # Content-addressed snapshot cache
348
+ ├── git.py # Git helpers: worktree, ref resolution, diff
349
+ ├── exceptions.py # Typed exceptions
350
+ ├── backends/
351
+ │ ├── __init__.py # BackendBase ABC + registry
352
+ │ ├── lizard_backend.py
353
+ │ ├── radon_backend.py
354
+ │ ├── coverage_backend.py
355
+ │ ├── docstring_backend.py
356
+ │ └── vallm_backend.py
357
+ └── integrations/
358
+ └── __init__.py # pyqual preset + gate collector
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Ecosystem
364
+
365
+ Regix is part of the **semcod/wronai** AI-assisted development toolchain:
366
+
367
+ | Package | Role |
368
+ |---|---|
369
+ | **code2llm** | Static analysis engine |
370
+ | **vallm** | LLM code validator |
371
+ | **regix** | Regression detection layer |
372
+ | **devloop** | Declarative pipeline runner |
373
+ | **planfile** | Universal ticket standard |
374
+ | **llx** | Intelligent LLM router |
375
+ | **proxym** | Dashboard layer |
376
+ | **costs** | AI cost tracker |
377
+
378
+ ---
379
+
380
+ ## License
381
+
382
+ Licensed under Apache-2.0.