phi-complexity 0.2.2__tar.gz → 0.12.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 (152) hide show
  1. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/LICENSE +28 -28
  2. phi_complexity-0.12.0/PKG-INFO +267 -0
  3. phi_complexity-0.12.0/README.md +238 -0
  4. phi_complexity-0.12.0/phi_complexity/__init__.py +251 -0
  5. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/phi_complexity/__main__.py +0 -2
  6. phi_complexity-0.12.0/phi_complexity/analyseur.py +11 -0
  7. phi_complexity-0.12.0/phi_complexity/ancrage.py +283 -0
  8. phi_complexity-0.12.0/phi_complexity/bayes.py +301 -0
  9. phi_complexity-0.12.0/phi_complexity/carte.py +300 -0
  10. phi_complexity-0.12.0/phi_complexity/chemins_verifiables.py +399 -0
  11. phi_complexity-0.12.0/phi_complexity/cli.py +1041 -0
  12. phi_complexity-0.12.0/phi_complexity/core.py +100 -0
  13. phi_complexity-0.12.0/phi_complexity/croyances.py +737 -0
  14. phi_complexity-0.12.0/phi_complexity/durcissement.py +975 -0
  15. phi_complexity-0.12.0/phi_complexity/editeur/__init__.py +41 -0
  16. phi_complexity-0.12.0/phi_complexity/editeur/indexeur.py +281 -0
  17. phi_complexity-0.12.0/phi_complexity/editeur/panneau_phi.py +77 -0
  18. phi_complexity-0.12.0/phi_complexity/editeur/recherche.py +110 -0
  19. phi_complexity-0.12.0/phi_complexity/editeur/tampon.py +154 -0
  20. phi_complexity-0.12.0/phi_complexity/editeur/tui.py +475 -0
  21. phi_complexity-0.12.0/phi_complexity/eft.py +335 -0
  22. phi_complexity-0.12.0/phi_complexity/entropie.py +796 -0
  23. phi_complexity-0.12.0/phi_complexity/explorateur.py +922 -0
  24. phi_complexity-0.12.0/phi_complexity/formules/__init__.py +87 -0
  25. phi_complexity-0.12.0/phi_complexity/formules/nodes.py +222 -0
  26. phi_complexity-0.12.0/phi_complexity/formules/parser.py +200 -0
  27. phi_complexity-0.12.0/phi_complexity/langs/__init__.py +30 -0
  28. phi_complexity-0.12.0/phi_complexity/langs/base.py +42 -0
  29. phi_complexity-0.12.0/phi_complexity/langs/lean.py +306 -0
  30. phi_complexity-0.12.0/phi_complexity/langs/python_native.py +379 -0
  31. phi_complexity-0.12.0/phi_complexity/langs/registry.py +162 -0
  32. phi_complexity-0.12.0/phi_complexity/langs/treesitter_generic.py +402 -0
  33. phi_complexity-0.12.0/phi_complexity/metriques.py +319 -0
  34. phi_complexity-0.12.0/phi_complexity/mission.py +237 -0
  35. phi_complexity-0.12.0/phi_complexity/modeles.py +43 -0
  36. phi_complexity-0.12.0/phi_complexity/oracle.py +142 -0
  37. phi_complexity-0.12.0/phi_complexity/piste_sorry.py +293 -0
  38. phi_complexity-0.12.0/phi_complexity/rapport.py +307 -0
  39. phi_complexity-0.12.0/phi_complexity/sondes.py +1178 -0
  40. phi_complexity-0.12.0/phi_complexity/veille.py +498 -0
  41. phi_complexity-0.12.0/phi_complexity.egg-info/PKG-INFO +267 -0
  42. phi_complexity-0.12.0/phi_complexity.egg-info/SOURCES.txt +71 -0
  43. phi_complexity-0.12.0/phi_complexity.egg-info/requires.txt +4 -0
  44. phi_complexity-0.12.0/pyproject.toml +51 -0
  45. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/setup.cfg +4 -4
  46. phi_complexity-0.12.0/tests/test_adiabatique.py +126 -0
  47. phi_complexity-0.12.0/tests/test_analyseur.py +202 -0
  48. phi_complexity-0.12.0/tests/test_ancrage.py +321 -0
  49. phi_complexity-0.12.0/tests/test_bayes.py +105 -0
  50. phi_complexity-0.12.0/tests/test_carte.py +176 -0
  51. phi_complexity-0.12.0/tests/test_chemins_verifiables.py +271 -0
  52. phi_complexity-0.12.0/tests/test_cli.py +179 -0
  53. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/tests/test_core.py +6 -58
  54. phi_complexity-0.12.0/tests/test_croyances.py +283 -0
  55. phi_complexity-0.12.0/tests/test_durcissement.py +161 -0
  56. phi_complexity-0.12.0/tests/test_durcissement_20261001.py +198 -0
  57. phi_complexity-0.12.0/tests/test_durcissement_sondes.py +369 -0
  58. phi_complexity-0.12.0/tests/test_editeur.py +234 -0
  59. phi_complexity-0.12.0/tests/test_eft.py +261 -0
  60. phi_complexity-0.12.0/tests/test_entropie.py +471 -0
  61. phi_complexity-0.12.0/tests/test_explorateur.py +290 -0
  62. phi_complexity-0.12.0/tests/test_formules.py +135 -0
  63. phi_complexity-0.12.0/tests/test_lean.py +157 -0
  64. phi_complexity-0.12.0/tests/test_mission.py +92 -0
  65. phi_complexity-0.12.0/tests/test_multilang.py +192 -0
  66. phi_complexity-0.12.0/tests/test_piste_sorry.py +196 -0
  67. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/tests/test_rapport.py +46 -28
  68. phi_complexity-0.12.0/tests/test_sondes.py +379 -0
  69. phi_complexity-0.12.0/tests/test_veille.py +219 -0
  70. phi_complexity-0.12.0/tests/test_vitesse.py +274 -0
  71. phi_complexity-0.2.2/PKG-INFO +0 -270
  72. phi_complexity-0.2.2/README.md +0 -238
  73. phi_complexity-0.2.2/phi_complexity/__init__.py +0 -100
  74. phi_complexity-0.2.2/phi_complexity/akasha.py +0 -166
  75. phi_complexity-0.2.2/phi_complexity/analyseur.py +0 -479
  76. phi_complexity-0.2.2/phi_complexity/audit_slo.py +0 -493
  77. phi_complexity-0.2.2/phi_complexity/autosuture.py +0 -79
  78. phi_complexity-0.2.2/phi_complexity/backends/__init__.py +0 -14
  79. phi_complexity-0.2.2/phi_complexity/backends/asm_light.py +0 -321
  80. phi_complexity-0.2.2/phi_complexity/backends/base.py +0 -21
  81. phi_complexity-0.2.2/phi_complexity/backends/c_rust_light.py +0 -239
  82. phi_complexity-0.2.2/phi_complexity/backends/elf_light.py +0 -728
  83. phi_complexity-0.2.2/phi_complexity/backends/python.py +0 -20
  84. phi_complexity-0.2.2/phi_complexity/backup.py +0 -62
  85. phi_complexity-0.2.2/phi_complexity/bmad.py +0 -144
  86. phi_complexity-0.2.2/phi_complexity/canvas.py +0 -174
  87. phi_complexity-0.2.2/phi_complexity/cli.py +0 -1092
  88. phi_complexity-0.2.2/phi_complexity/commit_risk.py +0 -512
  89. phi_complexity-0.2.2/phi_complexity/consensus.py +0 -491
  90. phi_complexity-0.2.2/phi_complexity/core.py +0 -176
  91. phi_complexity-0.2.2/phi_complexity/coverage_reporting.py +0 -181
  92. phi_complexity-0.2.2/phi_complexity/fingerprint.py +0 -290
  93. phi_complexity-0.2.2/phi_complexity/gnose.py +0 -84
  94. phi_complexity-0.2.2/phi_complexity/harvest.py +0 -239
  95. phi_complexity-0.2.2/phi_complexity/impossible.py +0 -85
  96. phi_complexity-0.2.2/phi_complexity/log_parser.py +0 -343
  97. phi_complexity-0.2.2/phi_complexity/metadata_ops.py +0 -237
  98. phi_complexity-0.2.2/phi_complexity/metriques.py +0 -498
  99. phi_complexity-0.2.2/phi_complexity/notebook_helpers.py +0 -839
  100. phi_complexity-0.2.2/phi_complexity/oracle.py +0 -133
  101. phi_complexity-0.2.2/phi_complexity/rapport.py +0 -232
  102. phi_complexity-0.2.2/phi_complexity/remediation.py +0 -241
  103. phi_complexity-0.2.2/phi_complexity/search.py +0 -245
  104. phi_complexity-0.2.2/phi_complexity/securite.py +0 -1313
  105. phi_complexity-0.2.2/phi_complexity/sentinel/__init__.py +0 -42
  106. phi_complexity-0.2.2/phi_complexity/sentinel/bayesian.py +0 -314
  107. phi_complexity-0.2.2/phi_complexity/sentinel/behavior.py +0 -315
  108. phi_complexity-0.2.2/phi_complexity/sentinel/host.py +0 -310
  109. phi_complexity-0.2.2/phi_complexity/sentinel/response.py +0 -374
  110. phi_complexity-0.2.2/phi_complexity/sentinel/telemetry.py +0 -343
  111. phi_complexity-0.2.2/phi_complexity/suture.py +0 -118
  112. phi_complexity-0.2.2/phi_complexity/vault.py +0 -304
  113. phi_complexity-0.2.2/phi_complexity.egg-info/PKG-INFO +0 -270
  114. phi_complexity-0.2.2/phi_complexity.egg-info/SOURCES.txt +0 -85
  115. phi_complexity-0.2.2/phi_complexity.egg-info/requires.txt +0 -5
  116. phi_complexity-0.2.2/pyproject.toml +0 -83
  117. phi_complexity-0.2.2/tests/test_akasha.py +0 -167
  118. phi_complexity-0.2.2/tests/test_analyseur.py +0 -603
  119. phi_complexity-0.2.2/tests/test_asm_backend.py +0 -382
  120. phi_complexity-0.2.2/tests/test_audit_slo.py +0 -573
  121. phi_complexity-0.2.2/tests/test_autosuture.py +0 -331
  122. phi_complexity-0.2.2/tests/test_backends.py +0 -417
  123. phi_complexity-0.2.2/tests/test_backup.py +0 -137
  124. phi_complexity-0.2.2/tests/test_bmad.py +0 -70
  125. phi_complexity-0.2.2/tests/test_canvas.py +0 -147
  126. phi_complexity-0.2.2/tests/test_cli.py +0 -778
  127. phi_complexity-0.2.2/tests/test_commit_risk.py +0 -637
  128. phi_complexity-0.2.2/tests/test_consensus.py +0 -484
  129. phi_complexity-0.2.2/tests/test_coverage_reporting.py +0 -94
  130. phi_complexity-0.2.2/tests/test_elf_backend.py +0 -574
  131. phi_complexity-0.2.2/tests/test_engine.py +0 -305
  132. phi_complexity-0.2.2/tests/test_fingerprint.py +0 -298
  133. phi_complexity-0.2.2/tests/test_gnose.py +0 -116
  134. phi_complexity-0.2.2/tests/test_harvest.py +0 -263
  135. phi_complexity-0.2.2/tests/test_impossible.py +0 -103
  136. phi_complexity-0.2.2/tests/test_log_parser.py +0 -244
  137. phi_complexity-0.2.2/tests/test_main.py +0 -21
  138. phi_complexity-0.2.2/tests/test_metadata_ops.py +0 -230
  139. phi_complexity-0.2.2/tests/test_metriques.py +0 -431
  140. phi_complexity-0.2.2/tests/test_notebook_helpers.py +0 -689
  141. phi_complexity-0.2.2/tests/test_oracle.py +0 -160
  142. phi_complexity-0.2.2/tests/test_public_api_contract.py +0 -29
  143. phi_complexity-0.2.2/tests/test_remediation.py +0 -219
  144. phi_complexity-0.2.2/tests/test_scan_cli.py +0 -332
  145. phi_complexity-0.2.2/tests/test_search.py +0 -306
  146. phi_complexity-0.2.2/tests/test_securite.py +0 -1348
  147. phi_complexity-0.2.2/tests/test_sentinel.py +0 -804
  148. phi_complexity-0.2.2/tests/test_suture.py +0 -138
  149. phi_complexity-0.2.2/tests/test_vault.py +0 -221
  150. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/phi_complexity.egg-info/dependency_links.txt +0 -0
  151. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/phi_complexity.egg-info/entry_points.txt +0 -0
  152. {phi_complexity-0.2.2 → phi_complexity-0.12.0}/phi_complexity.egg-info/top_level.txt +0 -0
@@ -1,28 +1,28 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Tomy Verreault
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
- ---
24
-
25
- This software is anchored in the Bibliothèque Céleste — Morphic Phi Framework (φ-Meta).
26
- The mathematical foundations are derived from the work of Tomy Verreault (2026),
27
- integrating principles from the Quasicrystal Axioms (AX-A0–AX-A58) and the
28
- Antifragility Protocol (EQ-AFR-BMAD).
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tomy Verreault
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This software is anchored in the Bibliothèque Céleste — Morphic Phi Framework (φ-Meta).
26
+ The mathematical foundations are derived from the work of Tomy Verreault (2026),
27
+ integrating principles from the Quasicrystal Axioms (AX-A0–AX-A58) and the
28
+ Antifragility Protocol (EQ-AFR-BMAD).
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: phi-complexity
3
+ Version: 0.12.0
4
+ Summary: Multi-language code quality metrics based on Golden Ratio (φ) mathematical invariants and adiabatic equilibrium
5
+ Author-email: Tomy Verreault <contact@phidelia.dev>
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,tree-sitter,multi-language,phi,metrics,entropy
12
+ Classifier: Development Status :: 4 - Beta
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: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Provides-Extra: multilang
26
+ Requires-Dist: tree-sitter<1.0,>=0.21; extra == "multilang"
27
+ Requires-Dist: tree-sitter-language-pack>=0.13; extra == "multilang"
28
+ Dynamic: license-file
29
+
30
+ # phi-complexity
31
+ [Pour M'offrir un café sur Buy Me a Coffee](https://www.buymeacoffee.com/spockoo)
32
+
33
+ > *Code quality metrics based on Golden Ratio (φ) mathematical invariants*
34
+
35
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/spockoo/phi-complexity/blob/main/LICENSE)
37
+ [![Tests](https://github.com/spockoo/Phi-Complexity/actions/workflows/tests.yml/badge.svg)](https://github.com/spockoo/Phi-Complexity/actions)
38
+
39
+ `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...).
40
+
41
+ Unlike `pylint` (cultural rules) or `radon` (McCabe metrics), `phi-complexity` answers:
42
+
43
+ > *"Is this code in resonance with the natural laws of order, or is it collapsing under its own entropy?"*
44
+
45
+ ---
46
+
47
+ ## ⚡ Quick Start
48
+
49
+ ```bash
50
+ pip install git+https://github.com/spockoo/Phi-Complexity.git
51
+ ```
52
+
53
+ > Note : le paquet publié sur PyPI (0.2.3) date d'avant le nettoyage d'octobre 2026 et ne correspond plus à cet arbre — installez depuis GitHub.
54
+
55
+ ```bash
56
+ # Audit a file
57
+ phi check my_script.py
58
+
59
+ # Audit a folder
60
+ phi check ./src/
61
+
62
+ # Generate a Markdown report
63
+ phi report my_script.py --output report.md
64
+
65
+ # CI/CD strict mode (exit 1 if radiance < 75)
66
+ phi check ./src/ --min-radiance 75
67
+
68
+ # Freeze the structural state (reference)
69
+ phi snapshot ./src/ --out ref.json
70
+
71
+ # Watch for silent degradations
72
+ phi veille ./src/ --ref ref.json
73
+ ```
74
+
75
+ ### Python API
76
+
77
+ ```python
78
+ from phi_complexity import auditer, rapport_console, rapport_markdown
79
+
80
+ # Get metrics as a dict
81
+ metrics = auditer("my_script.py")
82
+ print(metrics["radiance"]) # → 82.4
83
+ print(metrics["statut_gnostique"]) # → "EN ÉVEIL ◈"
84
+ print(metrics["oudjat"]) # → {"nom": "process_data", "ligne": 42, ...}
85
+
86
+ # Print console report
87
+ print(rapport_console("my_script.py"))
88
+
89
+ # Save Markdown report
90
+ rapport_markdown("my_script.py", sortie="report.md")
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 📊 Metrics
96
+
97
+ | Metric | Description | Mathematical basis |
98
+ |---|---|---|
99
+ | **Radiance Score** | Global quality score (0–100) | `100 - f(Lilith) - g(H) - h(Anomalies) - i(Fib)` |
100
+ | **Variance de Lilith** | Structural instability | Population variance of function complexities |
101
+ | **Shannon Entropy** | Information density | `H = -Σ p·log₂(p)` |
102
+ | **φ-Ratio** | Dominant function ratio | `max_complexity / mean` → should tend toward φ |
103
+ | **Fibonacci Distance** | Natural size alignment | `Σ|n_i - Fib_k| / φ` |
104
+ | **Zeta-Score** | Global resonance | `ζ_meta(functions, φ)` converging series |
105
+
106
+ ### Gnostic Status Levels
107
+
108
+ | Score | Status | Meaning |
109
+ |---|---|---|
110
+ | ≥ 85 | **HERMÉTIQUE ✦** | Stable, harmonious, production-ready |
111
+ | 60–84 | **EN ÉVEIL ◈** | Potential exists, some entropy zones |
112
+ | < 60 | **DORMANT ░** | Deep restructuring recommended |
113
+
114
+ ---
115
+
116
+ ## 🧭 Command Stability Matrix
117
+
118
+ | Command | Stability | Purpose |
119
+ |---|---|---|
120
+ | `phi check` | **Stable** | Audit radiance for files/folders (console, JSON, SARIF) + quality gates |
121
+ | `phi report` | **Stable** | Markdown report |
122
+ | `phi index` | **Stable** | Project map: symbols, collisions, φ-health |
123
+ | `phi snapshot` | **Stable** | Freeze structural state (dated, MD5-signed reference) |
124
+ | `phi veille` | **Stable** | Detect silent degradations vs reference (`STABLE` / `DÉGRADATION DÉTECTÉE` / `INSTRUMENT DÉGRADÉ`) |
125
+ | `phi chemins` | **Stable** | Belief map: symbols ranked by posterior — which hole to attack first |
126
+ | `phi oracle` | **Stable** | Exhibited reasoning chain (prior → evidence → posterior → action) |
127
+ | `phi sonde` | **Stable** | A/B probes: tracing the unconditional from the conditional (closure pole / obstruction pole) |
128
+ | `phi piste-sorry` | **Nouveau** | Track a Lean 4 sorry: rigorous inventory, import graph, registry work-items — the path from any complexity |
129
+ | `phi chemins-verifiables` | **Nouveau** | Guided wiring candidates, each formally identified as a proof — Lean decides (`PROUVÉ` / `RÉFUTÉ` / `INDÉCIDÉ`) |
130
+ | `phi infer` | Experimental | Bayesian inference and self-suture prediction |
131
+ | `phi explorer` | Experimental | Interactive explorer (self-contained HTML, zero network) |
132
+ | `phi entropie` | Experimental | Entropy lens: the ciphered ledger of narrowing (H and ΔH in bits, EFT bounds) |
133
+ | `phi ou-aller` | Experimental | Where to go next: attention list (not a decision) |
134
+ | `phi edit` | Experimental | Edit a file in the phi TUI editor |
135
+
136
+ **Tip:** keep `phi check`/`phi report`/`phi oracle` in CI. Use `phi snapshot` + `phi veille` to catch silent regressions between releases.
137
+
138
+ ---
139
+
140
+ ## 🔍 Sample Output
141
+
142
+ ```
143
+ ╔══════════════════════════════════════════════════╗
144
+ ║ PHI-COMPLEXITY — AUDIT DE RADIANCE ║
145
+ ╚══════════════════════════════════════════════════╝
146
+
147
+ 📄 Fichier : my_script.py
148
+ 📅 Date : 2026-04-08 17:11
149
+
150
+ ☼ RADIANCE : ██████████████░░░░░░ 72.6 / 100
151
+ ⚖ LILITH : 11221.9 (Structural variance)
152
+ 🌊 ENTROPIE : 2.48 bits (Shannon)
153
+ ◈ PHI-RATIO : 3.43 (ideal: φ = 1.618, Δ=1.81)
154
+ ζ ZETA-SCORE : 0.3656 (Global resonance)
155
+
156
+ STATUT : EN ÉVEIL ◈
157
+
158
+ 🔎 OUDJAT : 'process_data' (Line 42, Complexity: 376)
159
+
160
+ ⚠ SUTURES IDENTIFIED (2):
161
+ 🟡 Line 18 [LILITH] : Nested loop (depth 2). Consider a helper function.
162
+ >> for j in range(b):
163
+ 🟢 Line 67 [LILITH] : 'load_data' receives 6 arguments. Encapsulate in an object.
164
+ >> def load_data(path, sep, enc, cols, dtype, na):
165
+ ```
166
+
167
+ ---
168
+
169
+ ## 🛡 La Veille — the instrument never lies silently
170
+
171
+ A bad instrument fails silently. `phi-complexity` fails **loudly** :
172
+
173
+ - `phi veille` never reports ✅ on top of a degraded analyzer — it reports `INSTRUMENT DÉGRADÉ` (exit 3) instead of a fake degradation;
174
+ - `phi snapshot` refuses a degraded baseline without `--force`;
175
+ - every development of the instrument carries its **mission justification** (`phi_complexity/mission.py`) : which goal it serves. A module added without justification fails the test suite — mechanically, not by discipline.
176
+
177
+ Trust in the tool is verified trust, never faith : 386 tests, run on every change.
178
+
179
+ ---
180
+
181
+ ## 🧮 Mathematical Foundations
182
+
183
+ The **Radiance Formula** is derived from:
184
+
185
+ - **φ-Meta Framework** (Tomy Verreault, 2026) — Axioms AX-A0 through AX-A58
186
+ - **Law of Antifragility** (EQ-AFR-BMAD): `φ_{t+1} = P_φ(φ_t + k·Var(E_t)·E_t)`
187
+ - **Cybernetics** — Feedback and variance as control metrics
188
+ - **Shannon Information Theory** — Code as an information channel
189
+
190
+ The **Sovereign Coding Rules** are derived from:
191
+ - **The C Book** (Banahan, Brady, Doran) — Scope hermeticity, resource lifecycle
192
+ - **JaCaMo / Multi-Agent Programming** — Agent independence and encapsulation
193
+
194
+ ---
195
+
196
+ ## 🏗 Sovereign Architecture
197
+
198
+ ```
199
+ Zero heavy dependencies.
200
+ Pure Python standard library (ast, math, json) + tree-sitter (optional, for non-Python languages).
201
+ ```
202
+
203
+ ```
204
+ phi_complexity/
205
+ ├── core.py ← Golden constants (PHI, TAXE_SUTURE, ETA_GOLDEN...) + VERSION
206
+ ├── analyseur.py ← AST fractal dissection
207
+ ├── metriques.py ← Radiance Index calculation
208
+ ├── rapport.py ← Console / Markdown / JSON rendering
209
+ ├── cli.py ← the 15 phi commands
210
+ ├── veille.py ← Silent-degradation detection (STABLE / DÉGRADATION DÉTECTÉE)
211
+ ├── mission.py ← Mission-justification registry (anti-divergence guard)
212
+ ├── croyances.py ← Bayesian belief layer over symbols
213
+ ├── sondes.py ← A/B probes (closure / obstruction poles)
214
+ ├── piste_sorry.py ← Rigorous sorry inventory + import graph (Lean 4)
215
+ ├── chemins_verifiables.py← Guided wiring candidates Lean formally decides
216
+ ├── entropie.py ← Entropy lens (H, ΔH, EFT bounds)
217
+ ├── oracle.py ← Exhibited reasoning traces
218
+ ├── explorateur.py ← Interactive explorer
219
+ ├── bayes.py / eft.py ← Bayesian EFT machinery, error-free transformations
220
+ ├── carte.py / ancrage.py ← Maps, anchoring
221
+ ├── durcissement.py ← Hardening battery
222
+ ├── modeles.py ← Models
223
+ ├── editeur/ ← TUI editor (phi edit)
224
+ ├── formules/ ← Formula language
225
+ └── langs/ ← Multi-language backends (Python native, tree-sitter generic)
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 🔗 Integration
231
+
232
+ ### GitHub Action
233
+ ```yaml
234
+ - name: Phi-Complexity Audit
235
+ run: |
236
+ pip install git+https://github.com/spockoo/Phi-Complexity.git
237
+ phi check ./src/ --min-radiance 75
238
+ ```
239
+
240
+ ### Watchdog (snapshot + veille)
241
+ ```bash
242
+ phi snapshot ./src/ --out ref.json # after each audited release
243
+ phi veille ./src/ --ref ref.json # at the start of the next work session
244
+ ```
245
+
246
+ ---
247
+
248
+ ## 📜 License
249
+
250
+ MIT — Tomy Verreault, 2026
251
+
252
+ *Anchored in the Bibliothèque Céleste — Morphic Phi Framework (φ-Meta)*
253
+
254
+ ## 📜 Historique des Versions (Changelog)
255
+
256
+ - **v0.12.0 (Chemins vérifiables)** :
257
+ - **Nouveau `phi piste-sorry`** : piste d'un sorry Lean 4 — inventaire rigoureux (commentaires/chaînes exclus), graphe d'imports, chantiers du registre.
258
+ - **Nouveau `phi chemins-verifiables`** : propose des candidats de câblage guidés, chacun identifié formellement comme une preuve ; Lean tranche mécaniquement (`PROUVÉ` / `RÉFUTÉ` / `INDÉCIDÉ`). Jamais le sorry lui-même, jamais un `sorry` déguisé.
259
+ - Vocabulaire : « terminer » remplace les termes violents pour les hypothèses closes.
260
+ - Exclusion des artefacts `.lake` des scans (vitesse, pas de bruit Mathlib).
261
+
262
+ - **v0.11.0 (La Veille) — release GitHub** :
263
+ - **Garde anti-divergence** : chaque module porte sa justification « but de mission » (`mission.py`) — un module sans justification fait échouer les tests.
264
+ - **Durcissement** : l'instrument échoue bruyamment (`INSTRUMENT DÉGRADÉ`, exit 3) au lieu de mentir quand l'analyseur manque ; `phi snapshot` refuse une baseline dégradée sans `--force`.
265
+ - 386 tests verts, multi-langages (Python natif + tree-sitter générique).
266
+
267
+ > Note d'honnêteté : les numéros 0.1.x–0.2.x publiés avant octobre 2026 couvraient du scaffolding généré par bots, supprimé lors du nettoyage du 2026-10-01. Le PyPI (0.2.3) est obsolète — voir l'installation depuis GitHub ci-dessus. L'historique fiable commence à v0.11.0.
@@ -0,0 +1,238 @@
1
+ # phi-complexity
2
+ [Pour M'offrir un café sur Buy Me a Coffee](https://www.buymeacoffee.com/spockoo)
3
+
4
+ > *Code quality metrics based on Golden Ratio (φ) mathematical invariants*
5
+
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/spockoo/phi-complexity/blob/main/LICENSE)
8
+ [![Tests](https://github.com/spockoo/Phi-Complexity/actions/workflows/tests.yml/badge.svg)](https://github.com/spockoo/Phi-Complexity/actions)
9
+
10
+ `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...).
11
+
12
+ Unlike `pylint` (cultural rules) or `radon` (McCabe metrics), `phi-complexity` answers:
13
+
14
+ > *"Is this code in resonance with the natural laws of order, or is it collapsing under its own entropy?"*
15
+
16
+ ---
17
+
18
+ ## ⚡ Quick Start
19
+
20
+ ```bash
21
+ pip install git+https://github.com/spockoo/Phi-Complexity.git
22
+ ```
23
+
24
+ > Note : le paquet publié sur PyPI (0.2.3) date d'avant le nettoyage d'octobre 2026 et ne correspond plus à cet arbre — installez depuis GitHub.
25
+
26
+ ```bash
27
+ # Audit a file
28
+ phi check my_script.py
29
+
30
+ # Audit a folder
31
+ phi check ./src/
32
+
33
+ # Generate a Markdown report
34
+ phi report my_script.py --output report.md
35
+
36
+ # CI/CD strict mode (exit 1 if radiance < 75)
37
+ phi check ./src/ --min-radiance 75
38
+
39
+ # Freeze the structural state (reference)
40
+ phi snapshot ./src/ --out ref.json
41
+
42
+ # Watch for silent degradations
43
+ phi veille ./src/ --ref ref.json
44
+ ```
45
+
46
+ ### Python API
47
+
48
+ ```python
49
+ from phi_complexity import auditer, rapport_console, rapport_markdown
50
+
51
+ # Get metrics as a dict
52
+ metrics = auditer("my_script.py")
53
+ print(metrics["radiance"]) # → 82.4
54
+ print(metrics["statut_gnostique"]) # → "EN ÉVEIL ◈"
55
+ print(metrics["oudjat"]) # → {"nom": "process_data", "ligne": 42, ...}
56
+
57
+ # Print console report
58
+ print(rapport_console("my_script.py"))
59
+
60
+ # Save Markdown report
61
+ rapport_markdown("my_script.py", sortie="report.md")
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 📊 Metrics
67
+
68
+ | Metric | Description | Mathematical basis |
69
+ |---|---|---|
70
+ | **Radiance Score** | Global quality score (0–100) | `100 - f(Lilith) - g(H) - h(Anomalies) - i(Fib)` |
71
+ | **Variance de Lilith** | Structural instability | Population variance of function complexities |
72
+ | **Shannon Entropy** | Information density | `H = -Σ p·log₂(p)` |
73
+ | **φ-Ratio** | Dominant function ratio | `max_complexity / mean` → should tend toward φ |
74
+ | **Fibonacci Distance** | Natural size alignment | `Σ|n_i - Fib_k| / φ` |
75
+ | **Zeta-Score** | Global resonance | `ζ_meta(functions, φ)` converging series |
76
+
77
+ ### Gnostic Status Levels
78
+
79
+ | Score | Status | Meaning |
80
+ |---|---|---|
81
+ | ≥ 85 | **HERMÉTIQUE ✦** | Stable, harmonious, production-ready |
82
+ | 60–84 | **EN ÉVEIL ◈** | Potential exists, some entropy zones |
83
+ | < 60 | **DORMANT ░** | Deep restructuring recommended |
84
+
85
+ ---
86
+
87
+ ## 🧭 Command Stability Matrix
88
+
89
+ | Command | Stability | Purpose |
90
+ |---|---|---|
91
+ | `phi check` | **Stable** | Audit radiance for files/folders (console, JSON, SARIF) + quality gates |
92
+ | `phi report` | **Stable** | Markdown report |
93
+ | `phi index` | **Stable** | Project map: symbols, collisions, φ-health |
94
+ | `phi snapshot` | **Stable** | Freeze structural state (dated, MD5-signed reference) |
95
+ | `phi veille` | **Stable** | Detect silent degradations vs reference (`STABLE` / `DÉGRADATION DÉTECTÉE` / `INSTRUMENT DÉGRADÉ`) |
96
+ | `phi chemins` | **Stable** | Belief map: symbols ranked by posterior — which hole to attack first |
97
+ | `phi oracle` | **Stable** | Exhibited reasoning chain (prior → evidence → posterior → action) |
98
+ | `phi sonde` | **Stable** | A/B probes: tracing the unconditional from the conditional (closure pole / obstruction pole) |
99
+ | `phi piste-sorry` | **Nouveau** | Track a Lean 4 sorry: rigorous inventory, import graph, registry work-items — the path from any complexity |
100
+ | `phi chemins-verifiables` | **Nouveau** | Guided wiring candidates, each formally identified as a proof — Lean decides (`PROUVÉ` / `RÉFUTÉ` / `INDÉCIDÉ`) |
101
+ | `phi infer` | Experimental | Bayesian inference and self-suture prediction |
102
+ | `phi explorer` | Experimental | Interactive explorer (self-contained HTML, zero network) |
103
+ | `phi entropie` | Experimental | Entropy lens: the ciphered ledger of narrowing (H and ΔH in bits, EFT bounds) |
104
+ | `phi ou-aller` | Experimental | Where to go next: attention list (not a decision) |
105
+ | `phi edit` | Experimental | Edit a file in the phi TUI editor |
106
+
107
+ **Tip:** keep `phi check`/`phi report`/`phi oracle` in CI. Use `phi snapshot` + `phi veille` to catch silent regressions between releases.
108
+
109
+ ---
110
+
111
+ ## 🔍 Sample Output
112
+
113
+ ```
114
+ ╔══════════════════════════════════════════════════╗
115
+ ║ PHI-COMPLEXITY — AUDIT DE RADIANCE ║
116
+ ╚══════════════════════════════════════════════════╝
117
+
118
+ 📄 Fichier : my_script.py
119
+ 📅 Date : 2026-04-08 17:11
120
+
121
+ ☼ RADIANCE : ██████████████░░░░░░ 72.6 / 100
122
+ ⚖ LILITH : 11221.9 (Structural variance)
123
+ 🌊 ENTROPIE : 2.48 bits (Shannon)
124
+ ◈ PHI-RATIO : 3.43 (ideal: φ = 1.618, Δ=1.81)
125
+ ζ ZETA-SCORE : 0.3656 (Global resonance)
126
+
127
+ STATUT : EN ÉVEIL ◈
128
+
129
+ 🔎 OUDJAT : 'process_data' (Line 42, Complexity: 376)
130
+
131
+ ⚠ SUTURES IDENTIFIED (2):
132
+ 🟡 Line 18 [LILITH] : Nested loop (depth 2). Consider a helper function.
133
+ >> for j in range(b):
134
+ 🟢 Line 67 [LILITH] : 'load_data' receives 6 arguments. Encapsulate in an object.
135
+ >> def load_data(path, sep, enc, cols, dtype, na):
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🛡 La Veille — the instrument never lies silently
141
+
142
+ A bad instrument fails silently. `phi-complexity` fails **loudly** :
143
+
144
+ - `phi veille` never reports ✅ on top of a degraded analyzer — it reports `INSTRUMENT DÉGRADÉ` (exit 3) instead of a fake degradation;
145
+ - `phi snapshot` refuses a degraded baseline without `--force`;
146
+ - every development of the instrument carries its **mission justification** (`phi_complexity/mission.py`) : which goal it serves. A module added without justification fails the test suite — mechanically, not by discipline.
147
+
148
+ Trust in the tool is verified trust, never faith : 386 tests, run on every change.
149
+
150
+ ---
151
+
152
+ ## 🧮 Mathematical Foundations
153
+
154
+ The **Radiance Formula** is derived from:
155
+
156
+ - **φ-Meta Framework** (Tomy Verreault, 2026) — Axioms AX-A0 through AX-A58
157
+ - **Law of Antifragility** (EQ-AFR-BMAD): `φ_{t+1} = P_φ(φ_t + k·Var(E_t)·E_t)`
158
+ - **Cybernetics** — Feedback and variance as control metrics
159
+ - **Shannon Information Theory** — Code as an information channel
160
+
161
+ The **Sovereign Coding Rules** are derived from:
162
+ - **The C Book** (Banahan, Brady, Doran) — Scope hermeticity, resource lifecycle
163
+ - **JaCaMo / Multi-Agent Programming** — Agent independence and encapsulation
164
+
165
+ ---
166
+
167
+ ## 🏗 Sovereign Architecture
168
+
169
+ ```
170
+ Zero heavy dependencies.
171
+ Pure Python standard library (ast, math, json) + tree-sitter (optional, for non-Python languages).
172
+ ```
173
+
174
+ ```
175
+ phi_complexity/
176
+ ├── core.py ← Golden constants (PHI, TAXE_SUTURE, ETA_GOLDEN...) + VERSION
177
+ ├── analyseur.py ← AST fractal dissection
178
+ ├── metriques.py ← Radiance Index calculation
179
+ ├── rapport.py ← Console / Markdown / JSON rendering
180
+ ├── cli.py ← the 15 phi commands
181
+ ├── veille.py ← Silent-degradation detection (STABLE / DÉGRADATION DÉTECTÉE)
182
+ ├── mission.py ← Mission-justification registry (anti-divergence guard)
183
+ ├── croyances.py ← Bayesian belief layer over symbols
184
+ ├── sondes.py ← A/B probes (closure / obstruction poles)
185
+ ├── piste_sorry.py ← Rigorous sorry inventory + import graph (Lean 4)
186
+ ├── chemins_verifiables.py← Guided wiring candidates Lean formally decides
187
+ ├── entropie.py ← Entropy lens (H, ΔH, EFT bounds)
188
+ ├── oracle.py ← Exhibited reasoning traces
189
+ ├── explorateur.py ← Interactive explorer
190
+ ├── bayes.py / eft.py ← Bayesian EFT machinery, error-free transformations
191
+ ├── carte.py / ancrage.py ← Maps, anchoring
192
+ ├── durcissement.py ← Hardening battery
193
+ ├── modeles.py ← Models
194
+ ├── editeur/ ← TUI editor (phi edit)
195
+ ├── formules/ ← Formula language
196
+ └── langs/ ← Multi-language backends (Python native, tree-sitter generic)
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 🔗 Integration
202
+
203
+ ### GitHub Action
204
+ ```yaml
205
+ - name: Phi-Complexity Audit
206
+ run: |
207
+ pip install git+https://github.com/spockoo/Phi-Complexity.git
208
+ phi check ./src/ --min-radiance 75
209
+ ```
210
+
211
+ ### Watchdog (snapshot + veille)
212
+ ```bash
213
+ phi snapshot ./src/ --out ref.json # after each audited release
214
+ phi veille ./src/ --ref ref.json # at the start of the next work session
215
+ ```
216
+
217
+ ---
218
+
219
+ ## 📜 License
220
+
221
+ MIT — Tomy Verreault, 2026
222
+
223
+ *Anchored in the Bibliothèque Céleste — Morphic Phi Framework (φ-Meta)*
224
+
225
+ ## 📜 Historique des Versions (Changelog)
226
+
227
+ - **v0.12.0 (Chemins vérifiables)** :
228
+ - **Nouveau `phi piste-sorry`** : piste d'un sorry Lean 4 — inventaire rigoureux (commentaires/chaînes exclus), graphe d'imports, chantiers du registre.
229
+ - **Nouveau `phi chemins-verifiables`** : propose des candidats de câblage guidés, chacun identifié formellement comme une preuve ; Lean tranche mécaniquement (`PROUVÉ` / `RÉFUTÉ` / `INDÉCIDÉ`). Jamais le sorry lui-même, jamais un `sorry` déguisé.
230
+ - Vocabulaire : « terminer » remplace les termes violents pour les hypothèses closes.
231
+ - Exclusion des artefacts `.lake` des scans (vitesse, pas de bruit Mathlib).
232
+
233
+ - **v0.11.0 (La Veille) — release GitHub** :
234
+ - **Garde anti-divergence** : chaque module porte sa justification « but de mission » (`mission.py`) — un module sans justification fait échouer les tests.
235
+ - **Durcissement** : l'instrument échoue bruyamment (`INSTRUMENT DÉGRADÉ`, exit 3) au lieu de mentir quand l'analyseur manque ; `phi snapshot` refuse une baseline dégradée sans `--force`.
236
+ - 386 tests verts, multi-langages (Python natif + tree-sitter générique).
237
+
238
+ > Note d'honnêteté : les numéros 0.1.x–0.2.x publiés avant octobre 2026 couvraient du scaffolding généré par bots, supprimé lors du nettoyage du 2026-10-01. Le PyPI (0.2.3) est obsolète — voir l'installation depuis GitHub ci-dessus. L'historique fiable commence à v0.11.0.