phi-complexity 0.1.9__tar.gz → 0.2.2__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.
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/PKG-INFO +270 -195
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/README.md +238 -169
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/__init__.py +100 -86
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/__main__.py +5 -3
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/akasha.py +166 -158
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/analyseur.py +479 -343
- phi_complexity-0.2.2/phi_complexity/audit_slo.py +493 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/autosuture.py +79 -76
- phi_complexity-0.2.2/phi_complexity/backends/__init__.py +14 -0
- phi_complexity-0.2.2/phi_complexity/backends/asm_light.py +321 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/backends/base.py +21 -20
- phi_complexity-0.2.2/phi_complexity/backends/c_rust_light.py +239 -0
- phi_complexity-0.2.2/phi_complexity/backends/elf_light.py +728 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/backends/python.py +20 -18
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/backup.py +62 -61
- phi_complexity-0.2.2/phi_complexity/bmad.py +144 -0
- phi_complexity-0.2.2/phi_complexity/canvas.py +174 -0
- phi_complexity-0.2.2/phi_complexity/cli.py +1092 -0
- phi_complexity-0.2.2/phi_complexity/commit_risk.py +512 -0
- phi_complexity-0.2.2/phi_complexity/consensus.py +491 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/core.py +176 -90
- phi_complexity-0.2.2/phi_complexity/coverage_reporting.py +181 -0
- phi_complexity-0.2.2/phi_complexity/fingerprint.py +290 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/gnose.py +84 -83
- phi_complexity-0.2.2/phi_complexity/harvest.py +239 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/impossible.py +85 -84
- phi_complexity-0.2.2/phi_complexity/log_parser.py +343 -0
- phi_complexity-0.2.2/phi_complexity/metadata_ops.py +237 -0
- phi_complexity-0.2.2/phi_complexity/metriques.py +498 -0
- phi_complexity-0.2.2/phi_complexity/notebook_helpers.py +839 -0
- phi_complexity-0.2.2/phi_complexity/oracle.py +133 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/rapport.py +232 -164
- phi_complexity-0.2.2/phi_complexity/remediation.py +241 -0
- phi_complexity-0.2.2/phi_complexity/search.py +245 -0
- phi_complexity-0.2.2/phi_complexity/securite.py +1313 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/__init__.py +42 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/bayesian.py +314 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/behavior.py +315 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/host.py +310 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/response.py +374 -0
- phi_complexity-0.2.2/phi_complexity/sentinel/telemetry.py +343 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity/suture.py +118 -116
- phi_complexity-0.2.2/phi_complexity/vault.py +304 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity.egg-info/PKG-INFO +270 -195
- phi_complexity-0.2.2/phi_complexity.egg-info/SOURCES.txt +85 -0
- phi_complexity-0.2.2/phi_complexity.egg-info/requires.txt +5 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/pyproject.toml +83 -59
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/setup.cfg +4 -4
- phi_complexity-0.2.2/tests/test_akasha.py +167 -0
- phi_complexity-0.2.2/tests/test_analyseur.py +603 -0
- phi_complexity-0.2.2/tests/test_asm_backend.py +382 -0
- phi_complexity-0.2.2/tests/test_audit_slo.py +573 -0
- phi_complexity-0.2.2/tests/test_autosuture.py +331 -0
- phi_complexity-0.2.2/tests/test_backends.py +417 -0
- phi_complexity-0.2.2/tests/test_backup.py +137 -0
- phi_complexity-0.2.2/tests/test_bmad.py +70 -0
- phi_complexity-0.2.2/tests/test_canvas.py +147 -0
- phi_complexity-0.2.2/tests/test_cli.py +778 -0
- phi_complexity-0.2.2/tests/test_commit_risk.py +637 -0
- phi_complexity-0.2.2/tests/test_consensus.py +484 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/tests/test_core.py +143 -91
- phi_complexity-0.2.2/tests/test_coverage_reporting.py +94 -0
- phi_complexity-0.2.2/tests/test_elf_backend.py +574 -0
- phi_complexity-0.2.2/tests/test_engine.py +305 -0
- phi_complexity-0.2.2/tests/test_fingerprint.py +298 -0
- phi_complexity-0.2.2/tests/test_gnose.py +116 -0
- phi_complexity-0.2.2/tests/test_harvest.py +263 -0
- phi_complexity-0.2.2/tests/test_impossible.py +103 -0
- phi_complexity-0.2.2/tests/test_log_parser.py +244 -0
- phi_complexity-0.2.2/tests/test_main.py +21 -0
- phi_complexity-0.2.2/tests/test_metadata_ops.py +230 -0
- phi_complexity-0.2.2/tests/test_metriques.py +431 -0
- phi_complexity-0.2.2/tests/test_notebook_helpers.py +689 -0
- phi_complexity-0.2.2/tests/test_oracle.py +160 -0
- phi_complexity-0.2.2/tests/test_public_api_contract.py +29 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/tests/test_rapport.py +162 -147
- phi_complexity-0.2.2/tests/test_remediation.py +219 -0
- phi_complexity-0.2.2/tests/test_scan_cli.py +332 -0
- phi_complexity-0.2.2/tests/test_search.py +306 -0
- phi_complexity-0.2.2/tests/test_securite.py +1348 -0
- phi_complexity-0.2.2/tests/test_sentinel.py +804 -0
- phi_complexity-0.2.2/tests/test_suture.py +138 -0
- phi_complexity-0.2.2/tests/test_vault.py +221 -0
- phi_complexity-0.1.9/phi_complexity/backends/__init__.py +0 -6
- phi_complexity-0.1.9/phi_complexity/backends/c_rust_light.py +0 -87
- phi_complexity-0.1.9/phi_complexity/bmad.py +0 -73
- phi_complexity-0.1.9/phi_complexity/cli.py +0 -356
- phi_complexity-0.1.9/phi_complexity/metriques.py +0 -218
- phi_complexity-0.1.9/phi_complexity.egg-info/SOURCES.txt +0 -30
- phi_complexity-0.1.9/tests/test_analyseur.py +0 -202
- phi_complexity-0.1.9/tests/test_cli.py +0 -163
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/LICENSE +0 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity.egg-info/dependency_links.txt +0 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity.egg-info/entry_points.txt +0 -0
- {phi_complexity-0.1.9 → phi_complexity-0.2.2}/phi_complexity.egg-info/top_level.txt +0 -0
|
@@ -1,195 +1,270 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: phi-complexity
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Code quality metrics based on Golden Ratio (φ) mathematical invariants
|
|
5
|
-
Author-email: Tomy Verreault <
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/spockoo/phi-complexity
|
|
8
|
-
Project-URL: Repository, https://github.com/spockoo/phi-complexity
|
|
9
|
-
Project-URL: Documentation, https://github.com/spockoo/phi-complexity/blob/main/docs/GUIDE.md
|
|
10
|
-
Project-URL: Bug Tracker, https://github.com/spockoo/phi-complexity/issues
|
|
11
|
-
Keywords: code-quality,complexity,golden-ratio,fibonacci,static-analysis,ast,phi,metrics,entropy
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier:
|
|
21
|
-
Classifier:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
phi
|
|
59
|
-
|
|
60
|
-
#
|
|
61
|
-
phi check ./src/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
|
98
|
-
|
|
99
|
-
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phi-complexity
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Code quality metrics based on Golden Ratio (φ) mathematical invariants
|
|
5
|
+
Author-email: Tomy Verreault <Tiloup777@outlook.fr>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/spockoo/phi-complexity
|
|
8
|
+
Project-URL: Repository, https://github.com/spockoo/phi-complexity
|
|
9
|
+
Project-URL: Documentation, https://github.com/spockoo/phi-complexity/blob/main/docs/GUIDE.md
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/spockoo/phi-complexity/issues
|
|
11
|
+
Keywords: code-quality,complexity,golden-ratio,fibonacci,static-analysis,ast,phi,metrics,entropy
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: notebooks
|
|
28
|
+
Requires-Dist: jupyter; extra == "notebooks"
|
|
29
|
+
Requires-Dist: matplotlib; extra == "notebooks"
|
|
30
|
+
Requires-Dist: numpy; extra == "notebooks"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# phi-complexity
|
|
34
|
+
|
|
35
|
+
> *Code quality metrics based on Golden Ratio (φ) mathematical invariants*
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/phi-complexity/)
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](https://github.com/spockoo/phi-complexity/blob/main/LICENSE)
|
|
40
|
+
[](https://github.com/spockoo/phi-complexity/tree/main/tests)
|
|
41
|
+
|
|
42
|
+
`phi-complexity` is the **first code quality library** that measures the health of your Python code using **universal mathematical invariants** derived from the Golden Ratio (φ = 1.618...).
|
|
43
|
+
|
|
44
|
+
Unlike `pylint` (cultural rules) or `radon` (McCabe metrics), `phi-complexity` answers:
|
|
45
|
+
|
|
46
|
+
> *"Is this code in resonance with the natural laws of order, or is it collapsing under its own entropy?"*
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ⚡ Quick Start
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install phi-complexity
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Audit a file
|
|
58
|
+
phi check my_script.py
|
|
59
|
+
|
|
60
|
+
# Audit a folder
|
|
61
|
+
phi check ./src/
|
|
62
|
+
|
|
63
|
+
# Generate a Markdown report
|
|
64
|
+
phi report my_script.py --output report.md
|
|
65
|
+
|
|
66
|
+
# CI/CD strict mode (exit 1 if radiance < 75)
|
|
67
|
+
phi check ./src/ --min-radiance 75
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Python API
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from phi_complexity import auditer, rapport_console, rapport_markdown
|
|
74
|
+
|
|
75
|
+
# Get metrics as a dict
|
|
76
|
+
metrics = auditer("my_script.py")
|
|
77
|
+
print(metrics["radiance"]) # → 82.4
|
|
78
|
+
print(metrics["statut_gnostique"]) # → "EN ÉVEIL ◈"
|
|
79
|
+
print(metrics["oudjat"]) # → {"nom": "process_data", "ligne": 42, ...}
|
|
80
|
+
|
|
81
|
+
# Print console report
|
|
82
|
+
print(rapport_console("my_script.py"))
|
|
83
|
+
|
|
84
|
+
# Save Markdown report
|
|
85
|
+
rapport_markdown("my_script.py", sortie="report.md")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📊 Metrics
|
|
91
|
+
|
|
92
|
+
| Metric | Description | Mathematical basis |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| **Radiance Score** | Global quality score (0–100) | `100 - f(Lilith) - g(H) - h(Anomalies) - i(Fib)` |
|
|
95
|
+
| **Variance de Lilith** | Structural instability | Population variance of function complexities |
|
|
96
|
+
| **Shannon Entropy** | Information density | `H = -Σ p·log₂(p)` |
|
|
97
|
+
| **φ-Ratio** | Dominant function ratio | `max_complexity / mean` → should tend toward φ |
|
|
98
|
+
| **Fibonacci Distance** | Natural size alignment | `Σ|n_i - Fib_k| / φ` |
|
|
99
|
+
| **Zeta-Score** | Global resonance | `ζ_meta(functions, φ)` converging series |
|
|
100
|
+
|
|
101
|
+
### Gnostic Status Levels
|
|
102
|
+
|
|
103
|
+
| Score | Status | Meaning |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| ≥ 85 | **HERMÉTIQUE ✦** | Stable, harmonious, production-ready |
|
|
106
|
+
| 60–84 | **EN ÉVEIL ◈** | Potential exists, some entropy zones |
|
|
107
|
+
| < 60 | **DORMANT ░** | Deep restructuring recommended |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🧭 Command Stability Matrix
|
|
112
|
+
|
|
113
|
+
| Command | Stability | Purpose | Output / Side-effects |
|
|
114
|
+
|---|---|---|---|
|
|
115
|
+
| `phi check` | **Stable** | Audit radiance for files/folders | Console or JSON (no writes) |
|
|
116
|
+
| `phi report` | **Stable** | Markdown report | Writes `report.md` if `--output` |
|
|
117
|
+
| `phi oracle` | **Stable** | Release gate (radiance + tests) | Console; exits 1 on failure |
|
|
118
|
+
| `phi harvest` | Experimental | AST vectors collection | Writes `.phi/harvest.jsonl` |
|
|
119
|
+
| `phi metadata` | Experimental | Metadata summary & purge (harvest/vault) | Summaries; sanitized JSONL |
|
|
120
|
+
| `phi vault` / `phi graph` / `phi canvas` | Experimental | Vault storage + graph export + Obsidian canvas | Writes under `.phi/` (JSON, DOT/ASCII, `.canvas`) |
|
|
121
|
+
| `phi search` | Experimental | Query the vault | Console/JSON; reads `.phi/vault.jsonl` |
|
|
122
|
+
| `phi seal` / `phi heal` | Experimental | Seal + auto-suture via LLM | May call local LLM (`--url`); writes seal metadata in `.phi/` |
|
|
123
|
+
| `phi spiral` | Experimental | Radiance spiral visualization | Console ASCII only |
|
|
124
|
+
|
|
125
|
+
**Tip:** keep `phi check`/`phi report`/`phi oracle` in CI. Use experimental commands locally first and pin outputs under `.phi/` in `.gitignore` if not needed in VCS.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 🔍 Sample Output
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
╔══════════════════════════════════════════════════╗
|
|
133
|
+
║ PHI-COMPLEXITY — AUDIT DE RADIANCE ║
|
|
134
|
+
╚══════════════════════════════════════════════════╝
|
|
135
|
+
|
|
136
|
+
📄 Fichier : my_script.py
|
|
137
|
+
📅 Date : 2026-04-08 17:11
|
|
138
|
+
|
|
139
|
+
☼ RADIANCE : ██████████████░░░░░░ 72.6 / 100
|
|
140
|
+
⚖ LILITH : 11221.9 (Structural variance)
|
|
141
|
+
🌊 ENTROPIE : 2.48 bits (Shannon)
|
|
142
|
+
◈ PHI-RATIO : 3.43 (ideal: φ = 1.618, Δ=1.81)
|
|
143
|
+
ζ ZETA-SCORE : 0.3656 (Global resonance)
|
|
144
|
+
|
|
145
|
+
STATUT : EN ÉVEIL ◈
|
|
146
|
+
|
|
147
|
+
🔎 OUDJAT : 'process_data' (Line 42, Complexity: 376)
|
|
148
|
+
|
|
149
|
+
⚠ SUTURES IDENTIFIED (2):
|
|
150
|
+
🟡 Line 18 [LILITH] : Nested loop (depth 2). Consider a helper function.
|
|
151
|
+
>> for j in range(b):
|
|
152
|
+
🔵 Line 67 [SOUVERAINETE] : 'load_data' receives 6 arguments. Encapsulate in an object.
|
|
153
|
+
>> def load_data(path, sep, enc, cols, dtype, na):
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🚀 CI Innovation Suite (Open Source)
|
|
159
|
+
|
|
160
|
+
`phi-complexity` embarque maintenant une suite orientée productivité/dev/ops :
|
|
161
|
+
|
|
162
|
+
- **AI AutoFix Studio** : règles de mutation déterministes pour appliquer rapidement des corrections CI.
|
|
163
|
+
- **Flow Intelligence** : classification dédiée des annulations liées à la concurrence (`WORKFLOW_CONCURRENCY_CANCELLED`).
|
|
164
|
+
- **Runner Sentinel** : détection explicite des blocages de queue runner (`RUNNER_QUEUE_STALL`).
|
|
165
|
+
- **Ops & Engineering Control Plane** : snapshot exportable JSON/Markdown (succès/échecs/cancelled, MTTR, causes racines, tendances).
|
|
166
|
+
- **Dev Productivity Environment** : `.devcontainer` + `Makefile` + commande `make ci-local` pour reproduire le pipeline localement.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
make setup
|
|
170
|
+
make ci-local
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 🧮 Mathematical Foundations
|
|
176
|
+
|
|
177
|
+
The **Radiance Formula** is derived from:
|
|
178
|
+
|
|
179
|
+
- **φ-Meta Framework** (Tomy Verreault, 2026) — Axioms AX-A0 through AX-A58
|
|
180
|
+
- **Law of Antifragility** (EQ-AFR-BMAD): `φ_{t+1} = P_φ(φ_t + k·Var(E_t)·E_t)`
|
|
181
|
+
- **Cybernetics** (Korchounov, Mir, 1975) — Feedback and variance as control metrics
|
|
182
|
+
- **Shannon Information Theory** — Code as an information channel
|
|
183
|
+
|
|
184
|
+
The **Sovereign Coding Rules** are derived from:
|
|
185
|
+
- **The C Book** (Banahan, Brady, Doran) — Scope hermeticity, resource lifecycle
|
|
186
|
+
- **JaCaMo / Multi-Agent Programming** — Agent independence and encapsulation
|
|
187
|
+
|
|
188
|
+
Full mathematical proof: [docs/MATHEMATIQUES.md](https://github.com/spockoo/phi-complexity/blob/main/docs/MATHEMATIQUES.md)
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 🏗 Sovereign Architecture
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Zero external dependencies.
|
|
196
|
+
Pure Python standard library (ast, math, json).
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
phi_complexity/
|
|
201
|
+
├── core.py ← Golden constants (PHI, TAXE_SUTURE, ETA_GOLDEN...)
|
|
202
|
+
├── analyseur.py ← AST fractal dissection
|
|
203
|
+
├── metriques.py ← Radiance Index calculation
|
|
204
|
+
├── rapport.py ← Console / Markdown / JSON rendering
|
|
205
|
+
└── cli.py ← phi check / phi report
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🔗 Integration
|
|
211
|
+
|
|
212
|
+
### Pre-commit Hook
|
|
213
|
+
```yaml
|
|
214
|
+
repos:
|
|
215
|
+
- repo: https://github.com/spockoo/phi-complexity
|
|
216
|
+
rev: v0.1.0
|
|
217
|
+
hooks:
|
|
218
|
+
- id: phi-check
|
|
219
|
+
args: [--min-radiance, "70"]
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### GitHub Action
|
|
223
|
+
```yaml
|
|
224
|
+
- name: Phi-Complexity Audit
|
|
225
|
+
run: |
|
|
226
|
+
pip install phi-complexity
|
|
227
|
+
phi check ./src/ --min-radiance 75
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Secrets (`ADMIN_TOKEN`)
|
|
231
|
+
|
|
232
|
+
- Never commit `ADMIN_TOKEN` in tracked files.
|
|
233
|
+
- Store it in environment variables or GitHub Actions Secrets.
|
|
234
|
+
- Use `.env.example` as a template only:
|
|
235
|
+
|
|
236
|
+
```dotenv
|
|
237
|
+
ADMIN_TOKEN=
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📜 License
|
|
243
|
+
|
|
244
|
+
MIT — Tomy Verreault, 2026
|
|
245
|
+
|
|
246
|
+
*Anchored in the Bibliothèque Céleste — Morphic Phi Framework (φ-Meta)*
|
|
247
|
+
|
|
248
|
+
## 📜 Historique des Versions (Changelog)
|
|
249
|
+
|
|
250
|
+
- **v0.2.2 (Souveraineté & Cybersécurité) — Actuelle** :
|
|
251
|
+
- Implémentation du **"Cerveau de Sécurité"** : Moteur de triage mathématique départageant les failles critiques cybernétiques (CWE-79, CWE-89) des simples anomalies architecturales (Variance Lilith, Complexité).
|
|
252
|
+
- Algorithmes de **Mémoire Fail-Fast** pour `phi_check` optimisant à 100% le temps processeur et la RAM lors des audits anti-mots-interdits.
|
|
253
|
+
- Conformité CI parfaite garantissant aucune friction entre Windows et Linux (via normalisation PEP8 stricte).
|
|
254
|
+
|
|
255
|
+
- **v0.2.1** : Intégration souveraine du `phi_check` pré-commit natif et de la politique `Quality Gate` pour GitHub Actions. Réparation des métriques de base.
|
|
256
|
+
- **v0.2.0** : Introduction de pydantic pour la vérification de la robustesse, ajouts de structures initiales pour les métriques `Souverainete`.
|
|
257
|
+
- **v0.1.0** : Version primaire. Formule mathématique de base implémentée (Lilith, Shannon, Fib, Radiance).
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 🔒 Sécurité : Activation du contrôle phi-check
|
|
262
|
+
|
|
263
|
+
Ce projet utilise un contrôle automatique (pré-commit) qui bloque tout ajout de code contenant certains mots ou outils réservés (par exemple des scripts ou outils reconnus de piratage).
|
|
264
|
+
|
|
265
|
+
**Pour installer et activer le contrôle localement :**
|
|
266
|
+
```sh
|
|
267
|
+
pip install pre-commit
|
|
268
|
+
pre-commit install
|
|
269
|
+
```
|
|
270
|
+
Le contrôle `phi-check` se lance alors automatiquement à chaque commit.
|