precommiteu 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 (112) hide show
  1. precommiteu-0.1.0/.gitignore +37 -0
  2. precommiteu-0.1.0/LICENSE +201 -0
  3. precommiteu-0.1.0/NOTICE +8 -0
  4. precommiteu-0.1.0/PKG-INFO +310 -0
  5. precommiteu-0.1.0/README.md +278 -0
  6. precommiteu-0.1.0/THIRD_PARTY_NOTICES.md +40 -0
  7. precommiteu-0.1.0/docs/_config.yml +28 -0
  8. precommiteu-0.1.0/docs/_sass/custom/custom.scss +75 -0
  9. precommiteu-0.1.0/docs/assets/img/bat-hero-dark.png +0 -0
  10. precommiteu-0.1.0/docs/assets/img/bat-hero-light.png +0 -0
  11. precommiteu-0.1.0/docs/assets/img/bat.png +0 -0
  12. precommiteu-0.1.0/docs/assets/img/scan-demo.gif +0 -0
  13. precommiteu-0.1.0/docs/ci.md +301 -0
  14. precommiteu-0.1.0/docs/cli.md +279 -0
  15. precommiteu-0.1.0/docs/demo.tape +38 -0
  16. precommiteu-0.1.0/docs/examples.md +777 -0
  17. precommiteu-0.1.0/docs/index.md +154 -0
  18. precommiteu-0.1.0/docs/install.md +555 -0
  19. precommiteu-0.1.0/docs/library.md +264 -0
  20. precommiteu-0.1.0/docs/regulations.md +91 -0
  21. precommiteu-0.1.0/docs/reports.md +163 -0
  22. precommiteu-0.1.0/docs/suppressions.md +210 -0
  23. precommiteu-0.1.0/docs/troubleshooting.md +814 -0
  24. precommiteu-0.1.0/pyproject.toml +99 -0
  25. precommiteu-0.1.0/src/precommiteu/__init__.py +17 -0
  26. precommiteu-0.1.0/src/precommiteu/__main__.py +4 -0
  27. precommiteu-0.1.0/src/precommiteu/agents/__init__.py +0 -0
  28. precommiteu-0.1.0/src/precommiteu/agents/orchestrator.py +472 -0
  29. precommiteu-0.1.0/src/precommiteu/agents/prompts.py +249 -0
  30. precommiteu-0.1.0/src/precommiteu/agents/react_loop.py +252 -0
  31. precommiteu-0.1.0/src/precommiteu/chunking.py +97 -0
  32. precommiteu-0.1.0/src/precommiteu/cli.py +528 -0
  33. precommiteu-0.1.0/src/precommiteu/config.py +38 -0
  34. precommiteu-0.1.0/src/precommiteu/debuglog.py +19 -0
  35. precommiteu-0.1.0/src/precommiteu/defaults.py +37 -0
  36. precommiteu-0.1.0/src/precommiteu/detector_call.py +46 -0
  37. precommiteu-0.1.0/src/precommiteu/direct.py +91 -0
  38. precommiteu-0.1.0/src/precommiteu/grammar.py +57 -0
  39. precommiteu-0.1.0/src/precommiteu/llama_server.py +309 -0
  40. precommiteu-0.1.0/src/precommiteu/model_factory.py +135 -0
  41. precommiteu-0.1.0/src/precommiteu/py.typed +0 -0
  42. precommiteu-0.1.0/src/precommiteu/regulations/__init__.py +86 -0
  43. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/__init__.py +0 -0
  44. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/cases.jsonl +614 -0
  45. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/detector_summary.md +275 -0
  46. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/metadata.json +1 -0
  47. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/regulations_summary.md +245 -0
  48. precommiteu-0.1.0/src/precommiteu/regulations/cra_dma_nis2/validator_summary.md +203 -0
  49. precommiteu-0.1.0/src/precommiteu/regulations/dora/__init__.py +0 -0
  50. precommiteu-0.1.0/src/precommiteu/regulations/dora/cases.jsonl +474 -0
  51. precommiteu-0.1.0/src/precommiteu/regulations/dora/detector_summary.md +290 -0
  52. precommiteu-0.1.0/src/precommiteu/regulations/dora/metadata.json +1 -0
  53. precommiteu-0.1.0/src/precommiteu/regulations/dora/regulations_summary.md +196 -0
  54. precommiteu-0.1.0/src/precommiteu/regulations/dora/validator_summary.md +181 -0
  55. precommiteu-0.1.0/src/precommiteu/regulations/dsa/__init__.py +0 -0
  56. precommiteu-0.1.0/src/precommiteu/regulations/dsa/cases.jsonl +464 -0
  57. precommiteu-0.1.0/src/precommiteu/regulations/dsa/detector_summary.md +312 -0
  58. precommiteu-0.1.0/src/precommiteu/regulations/dsa/metadata.json +1 -0
  59. precommiteu-0.1.0/src/precommiteu/regulations/dsa/regulations_summary.md +372 -0
  60. precommiteu-0.1.0/src/precommiteu/regulations/dsa/validator_summary.md +281 -0
  61. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/__init__.py +0 -0
  62. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/cases.jsonl +461 -0
  63. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/detector_summary.md +332 -0
  64. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/metadata.json +1 -0
  65. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/regulations_summary.md +383 -0
  66. precommiteu-0.1.0/src/precommiteu/regulations/eu_ai_act/validator_summary.md +287 -0
  67. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/__init__.py +0 -0
  68. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/cases.jsonl +467 -0
  69. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/detector_summary.md +284 -0
  70. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/metadata.json +1 -0
  71. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/regulations_summary.md +270 -0
  72. precommiteu-0.1.0/src/precommiteu/regulations/eu_data_act/validator_summary.md +216 -0
  73. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/__init__.py +0 -0
  74. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/cases.jsonl +450 -0
  75. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/detector_summary.md +288 -0
  76. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/metadata.json +1 -0
  77. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/regulations_summary.md +387 -0
  78. precommiteu-0.1.0/src/precommiteu/regulations/gdpr/validator_summary.md +316 -0
  79. precommiteu-0.1.0/src/precommiteu/reporting.py +101 -0
  80. precommiteu-0.1.0/src/precommiteu/retrieval.py +168 -0
  81. precommiteu-0.1.0/src/precommiteu/scan.py +950 -0
  82. precommiteu-0.1.0/src/precommiteu/src/__init__.py +0 -0
  83. precommiteu-0.1.0/src/precommiteu/src/chunk_view.py +31 -0
  84. precommiteu-0.1.0/src/precommiteu/src/eu_ignore_marker.py +104 -0
  85. precommiteu-0.1.0/src/precommiteu/src/file_filter.py +519 -0
  86. precommiteu-0.1.0/src/precommiteu/src/ignore_directives.py +94 -0
  87. precommiteu-0.1.0/src/precommiteu/src/inference.py +16 -0
  88. precommiteu-0.1.0/src/precommiteu/src/progress.py +49 -0
  89. precommiteu-0.1.0/src/precommiteu/src/regulations.json +1193 -0
  90. precommiteu-0.1.0/src/precommiteu/src/regulations.py +146 -0
  91. precommiteu-0.1.0/src/precommiteu/src/reporters/__init__.py +6 -0
  92. precommiteu-0.1.0/src/precommiteu/src/reporters/comment.py +68 -0
  93. precommiteu-0.1.0/src/precommiteu/src/reporters/json_report.py +15 -0
  94. precommiteu-0.1.0/src/precommiteu/src/reporters/jsonl_ledger.py +48 -0
  95. precommiteu-0.1.0/src/precommiteu/src/reporters/sarif_report.py +16 -0
  96. precommiteu-0.1.0/src/precommiteu/src/sarif.py +138 -0
  97. precommiteu-0.1.0/src/precommiteu/src/scanner.py +108 -0
  98. precommiteu-0.1.0/src/precommiteu/src/schemas.py +99 -0
  99. precommiteu-0.1.0/src/precommiteu/src/tools/__init__.py +0 -0
  100. precommiteu-0.1.0/src/precommiteu/src/tools/read_tools.py +286 -0
  101. precommiteu-0.1.0/src/precommiteu/src/tools/regulation_tools.py +118 -0
  102. precommiteu-0.1.0/src/precommiteu/src/tools/sandbox.py +31 -0
  103. precommiteu-0.1.0/src/precommiteu/this.py +28 -0
  104. precommiteu-0.1.0/src/precommiteu/tools/__init__.py +0 -0
  105. precommiteu-0.1.0/src/precommiteu/tools/detector_tool.py +31 -0
  106. precommiteu-0.1.0/src/precommiteu/tools/find_references.py +158 -0
  107. precommiteu-0.1.0/src/precommiteu/tools/read_tools.py +19 -0
  108. precommiteu-0.1.0/src/precommiteu/tools/regulation_tools.py +9 -0
  109. precommiteu-0.1.0/src/precommiteu/tools/sandbox.py +5 -0
  110. precommiteu-0.1.0/src/precommiteu/tools/validator_tool.py +88 -0
  111. precommiteu-0.1.0/src/precommiteu/validator_call.py +127 -0
  112. precommiteu-0.1.0/uv.lock +275 -0
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .DS_Store
7
+
8
+ # Distribution / packaging
9
+ dist/
10
+ build/
11
+ *.egg-info/
12
+
13
+ # Virtual environments
14
+ .venv/
15
+ venv/
16
+ env/
17
+
18
+ # Testing
19
+ .pytest_cache/
20
+
21
+ # Linting/Formatting
22
+ .ruff_cache/
23
+
24
+ # Type checking
25
+ .mypy_cache/
26
+
27
+ # Never commit secrets
28
+ .env
29
+ .env.*
30
+ *.pem
31
+ *.p12
32
+ *.pfx
33
+ *.key
34
+ id_rsa*
35
+ .netrc
36
+ *.credentials
37
+ *.log
@@ -0,0 +1,201 @@
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
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Alexandru Girlea
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ precommiteu
2
+ Copyright 2026 Alexandru Girlea
3
+
4
+ This product is part of the precommitEU project
5
+ (https://github.com/AlexandruGirlea/precommiteu).
6
+
7
+ Third-party components used with, but not bundled in, this software are
8
+ listed in THIRD_PARTY_NOTICES.md.
@@ -0,0 +1,310 @@
1
+ Metadata-Version: 2.4
2
+ Name: precommiteu
3
+ Version: 0.1.0
4
+ Summary: Local-first EU regulatory compliance scanner for source code.
5
+ Project-URL: Homepage, https://precommit.eu
6
+ Project-URL: Documentation, https://alexandrugirlea.github.io/precommiteu/
7
+ Project-URL: Repository, https://github.com/AlexandruGirlea/precommiteu
8
+ Project-URL: Issues, https://github.com/AlexandruGirlea/precommiteu/issues
9
+ Project-URL: Changelog, https://github.com/AlexandruGirlea/precommiteu/blob/main/CHANGELOG.md
10
+ Author-email: Alexandru Girlea <alex@girlea.ro>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ License-File: THIRD_PARTY_NOTICES.md
15
+ Keywords: code-scanner,compliance,dora,dsa,eu-ai-act,gdpr,privacy,security,slm,static-analysis
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Environment :: Console
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Security
25
+ Classifier: Topic :: Software Development :: Quality Assurance
26
+ Requires-Python: >=3.11
27
+ Requires-Dist: pydantic>=2
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.9.10; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ <p align="center">
34
+ <picture>
35
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/AlexandruGirlea/precommiteu/main/docs/assets/img/bat-hero-dark.png">
36
+ <img src="https://raw.githubusercontent.com/AlexandruGirlea/precommiteu/main/docs/assets/img/bat-hero-light.png" alt="precommitEU" width="180" height="180">
37
+ </picture>
38
+ </p>
39
+
40
+ <h1 align="center">precommitEU</h1>
41
+
42
+ <p align="center">
43
+ <strong>Catch EU regulatory violations at PR time, on your own machine, with
44
+ zero data egress.</strong>
45
+ </p>
46
+
47
+ <p align="center">
48
+ One local scanner, eight EU regulations: GDPR, the EU AI Act, NIS2, DORA, the
49
+ Cyber Resilience Act, the Digital Services Act, the Digital Markets Act and
50
+ the Data Act.
51
+ </p>
52
+
53
+ <p align="center">
54
+ <a href="https://alexandrugirlea.github.io/precommiteu/"><strong>Documentation</strong></a>
55
+ &nbsp;&middot;&nbsp;
56
+ <a href="https://alexandrugirlea.github.io/precommiteu/install.html">Install</a>
57
+ &nbsp;&middot;&nbsp;
58
+ <a href="https://alexandrugirlea.github.io/precommiteu/cli.html">CLI reference</a>
59
+ &nbsp;&middot;&nbsp;
60
+ <a href="https://huggingface.co/AlexandruGirlea/precommiteu-models">Model bundle</a>
61
+ &nbsp;&middot;&nbsp;
62
+ <a href="https://precommit.eu">precommit.eu</a>
63
+ </p>
64
+
65
+ <p align="center">
66
+ <img src="https://raw.githubusercontent.com/AlexandruGirlea/precommiteu/main/docs/assets/img/scan-demo.gif" alt="precommitEU scanning a Python project for GDPR violations">
67
+ </p>
68
+
69
+ A real scan, unedited: about 80 seconds on an M-series MacBook, played back at
70
+ 5&times;. `models.py` holds only a dataclass, so the detector clears it and the
71
+ validator is never called. `user_store.py` mentions a sibling file, so the
72
+ orchestrator takes over: it resolves `UserProfile` into `models.py`, finds that
73
+ `audit_line()` interpolates a national ID and a home address, and confirms a
74
+ GDPR Art. 32 violation on a log line that looks harmless on its own. Grep
75
+ cannot find that one.
76
+
77
+ **[Replay this scan in your browser](https://precommit.eu/try)**. No install,
78
+ nothing to upload.
79
+
80
+ ```bash
81
+ export PRECOMMITEU_MODELS_DIR=~/.precommiteu/models
82
+ precommiteu scan src/ --fail-on-findings
83
+ ```
84
+
85
+ ## The Zen of EU Code
86
+
87
+ 1. Put purpose before collection.
88
+ 2. Collect less than you could, and keep it for less time.
89
+ 3. Let people know what the system knows.
90
+ 4. Make consent a choice, not a trap.
91
+ 5. Give people working controls over their data.
92
+ 6. Protect what you keep, from design to update.
93
+ 7. Children deserve stronger defaults.
94
+ 8. Explain automated decisions before they become consequences.
95
+ 9. Build systems that fail safely, recover clearly, and report harm responsibly.
96
+ 10. Make switching, portability, and interoperability real.
97
+
98
+ *Run `precommiteu this` to print it.*
99
+
100
+ ## Quick start
101
+
102
+ ```bash
103
+ brew install llama.cpp
104
+ pip install precommiteu "huggingface_hub[cli]"
105
+ hf download AlexandruGirlea/precommiteu-models base.gguf gdpr/detector-adapter.gguf --local-dir ~/.precommiteu/models
106
+ export PRECOMMITEU_MODELS_DIR=~/.precommiteu/models
107
+ precommiteu scan src/
108
+ ```
109
+
110
+ Linux, source and GPU builds, downloading more packs, air-gapped installs and
111
+ uninstall: **[Installation](https://alexandrugirlea.github.io/precommiteu/install.html)**.
112
+
113
+ `hf download` writes the bundle in the layout the scanner expects. Each
114
+ adapter must sit in a directory named exactly after its pack, because the
115
+ scanner resolves `<models-dir>/<regulation>/detector-adapter.gguf`:
116
+
117
+ ```text
118
+ ~/.precommiteu/models/
119
+ ├── base.gguf # shared by every regulation
120
+ ├── gdpr/detector-adapter.gguf
121
+ └── eu_ai_act/detector-adapter.gguf # one directory per pack you downloaded
122
+ ```
123
+
124
+ A flat directory does not work: a missing adapter is not an error, the scan
125
+ just continues on the base model alone in degraded mode and logs a warning.
126
+
127
+ ```bash
128
+ precommiteu scan src/ --regulations gdpr,eu_ai_act # several regulations
129
+ precommiteu scan --ci --fail-on-findings # changed files only, gate the build
130
+ ```
131
+
132
+ ### From Python
133
+
134
+ ```python
135
+ import os
136
+ from precommiteu import scan_paths
137
+
138
+ # Required unless you pass orchestrator_model_path / detector_adapter_path
139
+ # explicitly. Without it, scan_paths raises ValueError.
140
+ os.environ["PRECOMMITEU_MODELS_DIR"] = "~/.precommiteu/models"
141
+
142
+ result = scan_paths(["src/"], regulations=("gdpr",))
143
+ for finding in result.findings:
144
+ print(finding.regulation, finding.file,
145
+ finding.probable_article_id, finding.description)
146
+ ```
147
+
148
+ Full API reference, every parameter, the result schemas and streaming
149
+ callbacks: **[Python library](https://alexandrugirlea.github.io/precommiteu/library.html)**.
150
+
151
+ ## How it works
152
+
153
+ - **Your code never leaves your machine.** All analysis runs on local
154
+ `llama-server` processes the scanner starts and stops itself. No cloud, no
155
+ telemetry, no network egress.
156
+ - **No finding without proof.** A detector proposes candidates; a validator
157
+ then has to locate the quoted evidence verbatim in your file, or the
158
+ candidate is dropped. Confirmed findings cite the line. Candidates that fail
159
+ validation are reported as advisories: clearly labeled, never gating. Only
160
+ confirmed findings can fail a build.
161
+ - **Deterministic where it matters.** Grammar-constrained model output,
162
+ fixed budgets per file, suppression rules with auditable reasons.
163
+
164
+ ## Model bundle
165
+
166
+ precommitEU ships as two artifacts. The scanner is a pure-Python wheel on
167
+ PyPI; the weights are published separately on Hugging Face at
168
+ [AlexandruGirlea/precommiteu-models](https://huggingface.co/AlexandruGirlea/precommiteu-models)
169
+ (public, no token needed). `pip install` does **not** fetch them.
170
+
171
+ The repository holds seven files: one shared 4.36 GiB `base.gguf` used by every
172
+ regulation, plus a 77 MiB detector adapter per pack. **You choose which
173
+ adapters to download.** Name the files you want, or omit them to take
174
+ everything:
175
+
176
+ ```bash
177
+ # base + GDPR only, about 4.5 GB
178
+ hf download AlexandruGirlea/precommiteu-models base.gguf gdpr/detector-adapter.gguf --local-dir ~/.precommiteu/models
179
+
180
+ # add another pack later, the base is already there
181
+ hf download AlexandruGirlea/precommiteu-models eu_ai_act/detector-adapter.gguf --local-dir ~/.precommiteu/models
182
+
183
+ # everything, about 4.9 GB
184
+ hf download AlexandruGirlea/precommiteu-models --local-dir ~/.precommiteu/models
185
+ ```
186
+
187
+ `--regulations` then picks which of the downloaded packs to run. The two are
188
+ independent, and that is worth knowing: scanning with a regulation whose
189
+ adapter you never downloaded is **not** an error. The run continues on the base
190
+ model alone in degraded mode, logs a warning, and detects noticeably less. If a
191
+ scan seems weak, check the adapter is actually on disk.
192
+
193
+ Air-gapped installs, checksum verification and uninstall:
194
+ [Installation](https://alexandrugirlea.github.io/precommiteu/install.html).
195
+
196
+ ## Regulation packs
197
+
198
+ Eight EU regulations, shipped as six adapter packs. `gdpr` is the default and
199
+ the sensible one for almost any product repo.
200
+
201
+ | `--regulations` value | Covers |
202
+ |---|---|
203
+ | `gdpr` *(default)* | General Data Protection Regulation |
204
+ | `eu_ai_act` | Artificial Intelligence Act |
205
+ | `eu_data_act` | Data Act |
206
+ | `dora` | Digital Operational Resilience Act |
207
+ | `dsa` | Digital Services Act |
208
+ | `cra_dma_nis2` | Cyber Resilience Act, Digital Markets Act and NIS2 |
209
+
210
+ ```bash
211
+ precommiteu scan src/ --regulations gdpr,eu_ai_act
212
+ ```
213
+
214
+ Each adapter is trained on code its own regulation governs, so scanning with
215
+ all six is noisier rather than more thorough. Application dates, what each pack
216
+ is for, and how several packs run in one scan are in
217
+ [Regulation packs](https://alexandrugirlea.github.io/precommiteu/regulations.html).
218
+
219
+ ## Detection quality
220
+
221
+ precommitEU is not built to catch everything. The bar it aims for is: **flag
222
+ more than half of the real violations, and be right about nine out of ten
223
+ things it flags.**
224
+
225
+ From local evaluation runs on my own codebases, measured on confirmed findings
226
+ (advisories are excluded):
227
+
228
+ | Pack | Precision | Recall | False positive rate |
229
+ |---|---|---|---|
230
+ | `gdpr` | 97% | 98% | 6% |
231
+ | `eu_ai_act` | 97% | 93% | 5% |
232
+ | `eu_data_act` | 97% | 93% | 5% |
233
+ | `cra_dma_nis2` | 97% | 93% | 5% |
234
+ | `dsa` | 90% | 90% | 15% |
235
+ | `dora` | 100% | 73% | 0% |
236
+
237
+ Every pack clears both bars. `dora` is the most conservative and `dsa` the
238
+ noisiest, but nothing here is a compliance guarantee - treat a clean scan as
239
+ one useful signal, not as sign-off.
240
+
241
+ Numbers are for the shipped setup: shared base model plus the per-regulation
242
+ LoRA adapter, loaded at runtime, exactly as a normal scan runs them.
243
+
244
+ ## In CI
245
+
246
+ ```yaml
247
+ - uses: actions/checkout@v4
248
+ with:
249
+ fetch-depth: 0
250
+ - uses: AlexandruGirlea/precommiteu@v0.1.0
251
+ with:
252
+ regulations: gdpr,eu_ai_act
253
+ ```
254
+
255
+ `--ci` scans only the files changed against the merge-target branch. Exit code
256
+ `1` on confirmed findings with `--fail-on-findings`, `0` when clean. GitLab,
257
+ Azure DevOps, the full input list and every exit code are in
258
+ [CI integration](https://alexandrugirlea.github.io/precommiteu/ci.html).
259
+
260
+ ## Documentation
261
+
262
+ | Guide | Contents |
263
+ |---|---|
264
+ | [Installation](https://alexandrugirlea.github.io/precommiteu/install.html) | Requirements, per-platform install, model bundle download, CPU vs GPU, verify, uninstall |
265
+ | [CLI reference](https://alexandrugirlea.github.io/precommiteu/cli.html) | CLI usage, complete flag reference, reports, suppressions |
266
+ | [Regulation packs](https://alexandrugirlea.github.io/precommiteu/regulations.html) | The six packs, application dates, choosing packs, multi-regulation runs |
267
+ | [CI integration](https://alexandrugirlea.github.io/precommiteu/ci.html) | GitHub Actions, GitLab, exit codes, caching the model bundle |
268
+ | [Python library](https://alexandrugirlea.github.io/precommiteu/library.html) | Python API: `scan_paths`, `scan_diff`, schemas, callbacks |
269
+ | [Report reference](https://alexandrugirlea.github.io/precommiteu/reports.html) | Report formats: JSON field reference, SARIF, summary, ledger |
270
+ | [Ignoring and suppressing](https://alexandrugirlea.github.io/precommiteu/suppressions.html) | `.eu-ignore`, inline `eu-ignore` directives, audited `precommiteu-ignore` markers |
271
+ | [Examples](https://alexandrugirlea.github.io/precommiteu/examples.html) | Worked scans, real output, common flag combinations |
272
+ | [Troubleshooting](https://alexandrugirlea.github.io/precommiteu/troubleshooting.html) | Model paths, `llama-server` startup, empty scans, error messages |
273
+
274
+ Rendered documentation site: <https://alexandrugirlea.github.io/precommiteu/>
275
+ Project site: <https://precommit.eu>
276
+
277
+ ## Disclaimer
278
+
279
+ precommitEU is free and fully open source under the Apache License 2.0, and is
280
+ provided **as is**, without warranty or condition of any kind, express or
281
+ implied, as set out in sections 7 and 8 of that license. Use is entirely at
282
+ your own risk. There is no service level, no availability commitment and no
283
+ guarantee of accuracy or fitness for any purpose.
284
+
285
+ It produces a compliance signal, not legal advice: it can report findings that
286
+ are not violations and can miss violations that are present. Nothing it
287
+ outputs establishes, certifies or evidences compliance with any regulation.
288
+
289
+ The author is not a lawyer and provides no legal, regulatory or compliance
290
+ advice. This software does not replace legal analysis. To the maximum extent
291
+ permitted by applicable law, Alexandru Girlea accepts no liability for any
292
+ damages, losses, costs, regulatory outcome or misrepresentation arising from
293
+ use of this software or reliance on its output. Have findings reviewed by
294
+ qualified legal counsel before acting on them.
295
+
296
+ ## License
297
+
298
+ Apache License 2.0, see
299
+ [LICENSE](https://github.com/AlexandruGirlea/precommiteu/blob/main/LICENSE),
300
+ [NOTICE](https://github.com/AlexandruGirlea/precommiteu/blob/main/NOTICE) and
301
+ [THIRD_PARTY_NOTICES.md](https://github.com/AlexandruGirlea/precommiteu/blob/main/THIRD_PARTY_NOTICES.md).
302
+ Copyright (c) 2026 Alexandru Girlea.
303
+
304
+ Everything precommitEU produces is Apache-2.0: the scanner, the
305
+ per-regulation LoRA detector adapters, the GBNF grammars and the regulation
306
+ knowledge packs, including everything in the
307
+ [model bundle](https://huggingface.co/AlexandruGirlea/precommiteu-models).
308
+ The base model weights (Qwen 2.5 Coder, Apache-2.0) and the `llama-server`
309
+ binary (llama.cpp, MIT) are delivered separately and carry their own
310
+ licenses.