intentumdiff-python 0.0.1__py3-none-win_amd64.whl
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.
- intentumdiff/__init__.py +134 -0
- intentumdiff/_differ_gate.py +210 -0
- intentumdiff/_differ_presentation.py +786 -0
- intentumdiff/_differ_runtime.py +320 -0
- intentumdiff/analysis/__init__.py +1 -0
- intentumdiff/analysis/compile_commands.py +151 -0
- intentumdiff/analysis/cross_file.py +71 -0
- intentumdiff/analysis/diagnostics.py +309 -0
- intentumdiff/analysis/guardrail_reports.py +254 -0
- intentumdiff/analysis/guardrails.py +318 -0
- intentumdiff/analysis/invariances.py +1207 -0
- intentumdiff/analysis/keyed_profiles.py +25 -0
- intentumdiff/analysis/resource_profiles.py +14 -0
- intentumdiff/analysis/schema_resolver.py +816 -0
- intentumdiff/analysis/text_review.py +46 -0
- intentumdiff/analysis/user_schemas.py +430 -0
- intentumdiff/assets.py +45 -0
- intentumdiff/cache/__init__.py +37 -0
- intentumdiff/cache/duckdb_store.py +98 -0
- intentumdiff/cache/sqlite_store.py +149 -0
- intentumdiff/cache/store.py +190 -0
- intentumdiff/cli/__init__.py +199 -0
- intentumdiff/cli/_commands.py +2141 -0
- intentumdiff/cli/_parser.py +1061 -0
- intentumdiff/cli/_shared.py +644 -0
- intentumdiff/content_type.py +59 -0
- intentumdiff/core/__init__.py +1 -0
- intentumdiff/core/commit_differ.py +599 -0
- intentumdiff/core/config.py +51 -0
- intentumdiff/core/cst_serializer.py +101 -0
- intentumdiff/core/diffignore.py +87 -0
- intentumdiff/core/index.py +189 -0
- intentumdiff/core/indexer.py +792 -0
- intentumdiff/core/models.py +837 -0
- intentumdiff/differ.py +2195 -0
- intentumdiff/github_app.py +287 -0
- intentumdiff/intentumdiff_rust_core/__init__.py +7 -0
- intentumdiff/intentumdiff_rust_core/ffi.py +8 -0
- intentumdiff/intentumdiff_rust_core/intentumdiff_rust_core.dll +0 -0
- intentumdiff/invariances/__init__.py +2 -0
- intentumdiff/invariances/rules.schema.json +283 -0
- intentumdiff/invariances/rules.yaml +349 -0
- intentumdiff/live_server.py +1314 -0
- intentumdiff/lsp/__init__.py +67 -0
- intentumdiff/lsp/client.py +544 -0
- intentumdiff/lsp/config.py +96 -0
- intentumdiff/lsp/enricher.py +227 -0
- intentumdiff/lsp/exceptions.py +27 -0
- intentumdiff/lsp/launcher.py +273 -0
- intentumdiff/lsp/servers.py +356 -0
- intentumdiff/lsp_server/__init__.py +14 -0
- intentumdiff/lsp_server/_codelens.py +67 -0
- intentumdiff/lsp_server/_diagnostics.py +62 -0
- intentumdiff/lsp_server/_handlers.py +175 -0
- intentumdiff/lsp_server/server.py +205 -0
- intentumdiff/plugins/__init__.py +1 -0
- intentumdiff/plugins/adapter.py +397 -0
- intentumdiff/plugins/builtins.py +323 -0
- intentumdiff/plugins/exceptions.py +93 -0
- intentumdiff/plugins/hub.py +1155 -0
- intentumdiff/plugins/language_metadata.py +250 -0
- intentumdiff/plugins/loader.py +1252 -0
- intentumdiff/plugins/registry.py +1079 -0
- intentumdiff/plugins/registry.schema.json +99 -0
- intentumdiff/plugins/registry_schema.py +280 -0
- intentumdiff/plugins/wit/plugin.wit +351 -0
- intentumdiff/rust_core.py +2370 -0
- intentumdiff/serve/__init__.py +19 -0
- intentumdiff/serve/_app.py +485 -0
- intentumdiff/serve/_static/index.html +326 -0
- intentumdiff/serve/_static/playground.js +567 -0
- intentumdiff/sources/__init__.py +1 -0
- intentumdiff/sources/base.py +28 -0
- intentumdiff/sources/file_source.py +48 -0
- intentumdiff/sources/git_source.py +375 -0
- intentumdiff/sources/live_buffer_source.py +113 -0
- intentumdiff/sources/patch_source.py +126 -0
- intentumdiff/sources/string_source.py +44 -0
- intentumdiff/testing.py +165 -0
- intentumdiff/vcs/__init__.py +37 -0
- intentumdiff/vcs/_safe_path.py +50 -0
- intentumdiff/vcs/base.py +136 -0
- intentumdiff/vcs/git_backend.py +97 -0
- intentumdiff/vcs/git_cli.py +100 -0
- intentumdiff/vcs/hg_backend.py +94 -0
- intentumdiff/vcs/perforce_backend.py +109 -0
- intentumdiff/vcs/svn_backend.py +105 -0
- intentumdiff/wasm/.gitkeep +2 -0
- intentumdiff/wasm/abap_parser.wasm +0 -0
- intentumdiff/wasm/adf_parser.wasm +0 -0
- intentumdiff/wasm/asciidoc_parser.wasm +0 -0
- intentumdiff/wasm/asm_parser.wasm +0 -0
- intentumdiff/wasm/assemblyscript_parser.wasm +0 -0
- intentumdiff/wasm/astro_parser.wasm +0 -0
- intentumdiff/wasm/bash_parser.wasm +0 -0
- intentumdiff/wasm/clojure_parser.wasm +0 -0
- intentumdiff/wasm/cmake_parser.wasm +0 -0
- intentumdiff/wasm/cpp_parser.wasm +0 -0
- intentumdiff/wasm/csharp_parser.wasm +0 -0
- intentumdiff/wasm/css_parser.wasm +0 -0
- intentumdiff/wasm/dart_parser.wasm +0 -0
- intentumdiff/wasm/databricks_parser.wasm +0 -0
- intentumdiff/wasm/dax_parser.wasm +0 -0
- intentumdiff/wasm/delphi_parser.wasm +0 -0
- intentumdiff/wasm/dockerfile_parser.wasm +0 -0
- intentumdiff/wasm/elixir_parser.wasm +0 -0
- intentumdiff/wasm/freebasic_parser.wasm +0 -0
- intentumdiff/wasm/generic_parser.wasm +0 -0
- intentumdiff/wasm/gitignore_parser.wasm +0 -0
- intentumdiff/wasm/go_parser.wasm +0 -0
- intentumdiff/wasm/gomod_parser.wasm +0 -0
- intentumdiff/wasm/graphql_parser.wasm +0 -0
- intentumdiff/wasm/groovy_parser.wasm +0 -0
- intentumdiff/wasm/haskell_parser.wasm +0 -0
- intentumdiff/wasm/html_parser.wasm +0 -0
- intentumdiff/wasm/ini_parser.wasm +0 -0
- intentumdiff/wasm/java_parser.wasm +0 -0
- intentumdiff/wasm/js_ts_parser.wasm +0 -0
- intentumdiff/wasm/json_parser.wasm +0 -0
- intentumdiff/wasm/kotlin_parser.wasm +0 -0
- intentumdiff/wasm/latex_parser.wasm +0 -0
- intentumdiff/wasm/lua_parser.wasm +0 -0
- intentumdiff/wasm/make_parser.wasm +0 -0
- intentumdiff/wasm/markdown_parser.wasm +0 -0
- intentumdiff/wasm/mdx_parser.wasm +0 -0
- intentumdiff/wasm/ocaml_parser.wasm +0 -0
- intentumdiff/wasm/odin_parser.wasm +0 -0
- intentumdiff/wasm/parser_manifest.json +590 -0
- intentumdiff/wasm/perl_parser.wasm +0 -0
- intentumdiff/wasm/php_parser.wasm +0 -0
- intentumdiff/wasm/plsql_parser.wasm +0 -0
- intentumdiff/wasm/po_parser.wasm +0 -0
- intentumdiff/wasm/postscript_parser.wasm +0 -0
- intentumdiff/wasm/powershell_parser.wasm +0 -0
- intentumdiff/wasm/proto_parser.wasm +0 -0
- intentumdiff/wasm/puppet_parser.wasm +0 -0
- intentumdiff/wasm/python_parser.wasm +0 -0
- intentumdiff/wasm/qsharp_parser.wasm +0 -0
- intentumdiff/wasm/r_parser.wasm +0 -0
- intentumdiff/wasm/reasonml_parser.wasm +0 -0
- intentumdiff/wasm/ruby_parser.wasm +0 -0
- intentumdiff/wasm/rust_parser.wasm +0 -0
- intentumdiff/wasm/sas_parser.wasm +0 -0
- intentumdiff/wasm/scala_parser.wasm +0 -0
- intentumdiff/wasm/scss_parser.wasm +0 -0
- intentumdiff/wasm/sql_parser.wasm +0 -0
- intentumdiff/wasm/squirrel_parser.wasm +0 -0
- intentumdiff/wasm/svelte_parser.wasm +0 -0
- intentumdiff/wasm/swift_parser.wasm +0 -0
- intentumdiff/wasm/terraform_parser.wasm +0 -0
- intentumdiff/wasm/toml_parser.wasm +0 -0
- intentumdiff/wasm/tsql_parser.wasm +0 -0
- intentumdiff/wasm/vbnet_parser.wasm +0 -0
- intentumdiff/wasm/vue_parser.wasm +0 -0
- intentumdiff/wasm/wat_parser.wasm +0 -0
- intentumdiff/wasm/xml_parser.wasm +0 -0
- intentumdiff/wasm/yaml_parser.wasm +0 -0
- intentumdiff/wasm/zig_parser.wasm +0 -0
- intentumdiff/watcher.py +259 -0
- intentumdiff_python-0.0.1.dist-info/METADATA +112 -0
- intentumdiff_python-0.0.1.dist-info/RECORD +165 -0
- intentumdiff_python-0.0.1.dist-info/WHEEL +4 -0
- intentumdiff_python-0.0.1.dist-info/entry_points.txt +80 -0
- intentumdiff_python-0.0.1.dist-info/licenses/LICENSE +21 -0
- intentumdiff_python-0.0.1.dist-info/sboms/intentumdiff-rust-core.cyclonedx.json +10968 -0
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"""
|
|
2
|
+
intentumdiff.plugins.builtins
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
Entry-point callables for the built-in Wasm plugins.
|
|
6
|
+
|
|
7
|
+
Each function returns the absolute path to the corresponding ``.wasm`` file
|
|
8
|
+
inside the package's ``wasm/`` directory. These functions are registered in
|
|
9
|
+
``pyproject.toml`` under ``[project.entry-points]``.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
_WASM_DIR = Path(__file__).parent.parent / "wasm"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _wasm(name: str) -> str:
|
|
20
|
+
return str(_WASM_DIR / name)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _wasm_or_generic(name: str) -> str:
|
|
24
|
+
path = _WASM_DIR / name
|
|
25
|
+
if path.exists():
|
|
26
|
+
return str(path)
|
|
27
|
+
return _wasm("generic_parser.wasm")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# ── Parser entry points ──────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
def python_parser_entry() -> str:
|
|
33
|
+
return _wasm("python_parser.wasm")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def sql_parser_entry() -> str:
|
|
37
|
+
return _wasm("sql_parser.wasm")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def generic_parser_entry() -> str:
|
|
41
|
+
return _wasm("generic_parser.wasm")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def graphql_parser_entry() -> str:
|
|
45
|
+
return _wasm_or_generic("graphql_parser.wasm")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def gitignore_parser_entry() -> str:
|
|
49
|
+
return _wasm_or_generic("gitignore_parser.wasm")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def ocaml_parser_entry() -> str:
|
|
53
|
+
return _wasm_or_generic("ocaml_parser.wasm")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def reasonml_parser_entry() -> str:
|
|
57
|
+
return _wasm_or_generic("reasonml_parser.wasm")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def latex_parser_entry() -> str:
|
|
61
|
+
return _wasm_or_generic("latex_parser.wasm")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def asciidoc_parser_entry() -> str:
|
|
65
|
+
return _wasm_or_generic("asciidoc_parser.wasm")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def po_parser_entry() -> str:
|
|
69
|
+
return _wasm_or_generic("po_parser.wasm")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def js_ts_parser_entry() -> str:
|
|
73
|
+
return _wasm("js_ts_parser.wasm")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def java_parser_entry() -> str:
|
|
77
|
+
return _wasm("java_parser.wasm")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def go_parser_entry() -> str:
|
|
81
|
+
return _wasm("go_parser.wasm")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def rust_parser_entry() -> str:
|
|
85
|
+
return _wasm("rust_parser.wasm")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def csharp_parser_entry() -> str:
|
|
89
|
+
return _wasm("csharp_parser.wasm")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def ruby_parser_entry() -> str:
|
|
93
|
+
return _wasm("ruby_parser.wasm")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def php_parser_entry() -> str:
|
|
97
|
+
return _wasm("php_parser.wasm")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def kotlin_parser_entry() -> str:
|
|
101
|
+
return _wasm("kotlin_parser.wasm")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def cpp_parser_entry() -> str:
|
|
105
|
+
return _wasm("cpp_parser.wasm")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def swift_parser_entry() -> str:
|
|
109
|
+
return _wasm("swift_parser.wasm")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def bash_parser_entry() -> str:
|
|
113
|
+
return _wasm("bash_parser.wasm")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def powershell_parser_entry() -> str:
|
|
117
|
+
return _wasm("powershell_parser.wasm")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def elixir_parser_entry() -> str:
|
|
121
|
+
return _wasm("elixir_parser.wasm")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def groovy_parser_entry() -> str:
|
|
125
|
+
return _wasm("groovy_parser.wasm")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def dart_parser_entry() -> str:
|
|
129
|
+
return _wasm("dart_parser.wasm")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def lua_parser_entry() -> str:
|
|
133
|
+
return _wasm("lua_parser.wasm")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def xml_parser_entry() -> str:
|
|
137
|
+
return _wasm("xml_parser.wasm")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def dockerfile_parser_entry() -> str:
|
|
141
|
+
return _wasm("dockerfile_parser.wasm")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def vbnet_parser_entry() -> str:
|
|
145
|
+
return _wasm("vbnet_parser.wasm")
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def squirrel_parser_entry() -> str:
|
|
149
|
+
return _wasm("squirrel_parser.wasm")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def puppet_parser_entry() -> str:
|
|
153
|
+
return _wasm("puppet_parser.wasm")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def terraform_parser_entry() -> str:
|
|
157
|
+
return _wasm("terraform_parser.wasm")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def delphi_parser_entry() -> str:
|
|
161
|
+
return _wasm("delphi_parser.wasm")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def adf_parser_entry() -> str:
|
|
165
|
+
return _wasm("adf_parser.wasm")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def databricks_parser_entry() -> str:
|
|
169
|
+
return _wasm("databricks_parser.wasm")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def mdx_parser_entry() -> str:
|
|
173
|
+
return _wasm("mdx_parser.wasm")
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def markdown_parser_entry() -> str:
|
|
177
|
+
return _wasm("markdown_parser.wasm")
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def toml_parser_entry() -> str:
|
|
181
|
+
return _wasm("toml_parser.wasm")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def ini_parser_entry() -> str:
|
|
185
|
+
return _wasm("ini_parser.wasm")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def gomod_parser_entry() -> str:
|
|
189
|
+
return _wasm("gomod_parser.wasm")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def make_parser_entry() -> str:
|
|
193
|
+
return _wasm("make_parser.wasm")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def proto_parser_entry() -> str:
|
|
197
|
+
return _wasm("proto_parser.wasm")
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def cmake_parser_entry() -> str:
|
|
201
|
+
return _wasm("cmake_parser.wasm")
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def r_parser_entry() -> str:
|
|
205
|
+
return _wasm("r_parser.wasm")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def haskell_parser_entry() -> str:
|
|
209
|
+
return _wasm("haskell_parser.wasm")
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def zig_parser_entry() -> str:
|
|
213
|
+
return _wasm("zig_parser.wasm")
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def scala_parser_entry() -> str:
|
|
217
|
+
return _wasm("scala_parser.wasm")
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def clojure_parser_entry() -> str:
|
|
221
|
+
return _wasm("clojure_parser.wasm")
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def perl_parser_entry() -> str:
|
|
225
|
+
return _wasm("perl_parser.wasm")
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def asm_parser_entry() -> str:
|
|
229
|
+
return _wasm("asm_parser.wasm")
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def assemblyscript_parser_entry() -> str:
|
|
233
|
+
return _wasm("assemblyscript_parser.wasm")
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def freebasic_parser_entry() -> str:
|
|
237
|
+
return _wasm("freebasic_parser.wasm")
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def odin_parser_entry() -> str:
|
|
241
|
+
return _wasm("odin_parser.wasm")
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def wat_parser_entry() -> str:
|
|
245
|
+
return _wasm("wat_parser.wasm")
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def tsql_parser_entry() -> str:
|
|
249
|
+
return _wasm("tsql_parser.wasm")
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def plsql_parser_entry() -> str:
|
|
253
|
+
return _wasm("plsql_parser.wasm")
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def abap_parser_entry() -> str:
|
|
257
|
+
return _wasm("abap_parser.wasm")
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def dax_parser_entry() -> str:
|
|
261
|
+
return _wasm("dax_parser.wasm")
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def sas_parser_entry() -> str:
|
|
265
|
+
return _wasm("sas_parser.wasm")
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def qsharp_parser_entry() -> str:
|
|
269
|
+
return _wasm("qsharp_parser.wasm")
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def postscript_parser_entry() -> str:
|
|
273
|
+
return _wasm("postscript_parser.wasm")
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def css_parser_entry() -> str:
|
|
277
|
+
return _wasm("css_parser.wasm")
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def json_parser_entry() -> str:
|
|
281
|
+
return _wasm("json_parser.wasm")
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def yaml_parser_entry() -> str:
|
|
285
|
+
return _wasm("yaml_parser.wasm")
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def html_parser_entry() -> str:
|
|
289
|
+
return _wasm("html_parser.wasm")
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def scss_parser_entry() -> str:
|
|
293
|
+
return _wasm("scss_parser.wasm")
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def vue_parser_entry() -> str:
|
|
297
|
+
return _wasm("vue_parser.wasm")
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def svelte_parser_entry() -> str:
|
|
301
|
+
return _wasm("svelte_parser.wasm")
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def astro_parser_entry() -> str:
|
|
305
|
+
return _wasm("astro_parser.wasm")
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
# ── Renderer entry points ────────────────────────────────────────────────────
|
|
309
|
+
|
|
310
|
+
def terminal_renderer_entry() -> str:
|
|
311
|
+
return _wasm("terminal_renderer.wasm")
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def patch_renderer_entry() -> str:
|
|
315
|
+
return _wasm("patch_renderer.wasm")
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def html_renderer_entry() -> str:
|
|
319
|
+
return _wasm("html_renderer.wasm")
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def llm_renderer_entry() -> str:
|
|
323
|
+
return _wasm("llm_renderer.wasm")
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""
|
|
2
|
+
intentumdiff.plugins.exceptions
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
Plugin-related exception hierarchy.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _fmt_fuel(n: int) -> str:
|
|
12
|
+
"""Format a fuel count as a compact human-readable string (376.6M, 1.2B …)."""
|
|
13
|
+
if n >= 1_000_000_000:
|
|
14
|
+
return f"{n / 1_000_000_000:.1f}B"
|
|
15
|
+
if n >= 1_000_000:
|
|
16
|
+
return f"{n / 1_000_000:.1f}M"
|
|
17
|
+
if n >= 1_000:
|
|
18
|
+
return f"{n / 1_000:.1f}K"
|
|
19
|
+
return str(n)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PluginError(Exception):
|
|
23
|
+
"""Base class for all plugin errors."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class PluginNotFoundError(PluginError):
|
|
27
|
+
"""No plugin is registered for a given language."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, language: str, filename: str = "") -> None:
|
|
30
|
+
self.language = language
|
|
31
|
+
self.filename = filename
|
|
32
|
+
where = f" (file: {filename!r})" if filename else ""
|
|
33
|
+
super().__init__(
|
|
34
|
+
f"No parser plugin found for language {language!r}{where}. "
|
|
35
|
+
"Install a plugin package or use a built-in language."
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class PluginOutputError(PluginError):
|
|
40
|
+
"""A plugin returned output that failed Pydantic validation."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, plugin_id: str, detail: str) -> None:
|
|
43
|
+
self.plugin_id = plugin_id
|
|
44
|
+
super().__init__(
|
|
45
|
+
f"Plugin {plugin_id!r} returned invalid output: {detail}"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class GrammarNotInstalledError(PluginError):
|
|
50
|
+
"""A Python tree-sitter grammar package is not installed."""
|
|
51
|
+
|
|
52
|
+
def __init__(self, package: str, language: str) -> None:
|
|
53
|
+
self.package = package
|
|
54
|
+
self.language = language
|
|
55
|
+
super().__init__(
|
|
56
|
+
f"Tree Sitter library '{package}' is not available for language '{language}'. "
|
|
57
|
+
f"To install it run: pip install {package.replace('_', '-')}"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class PluginFuelExhausted(PluginError):
|
|
62
|
+
"""A plugin ran out of Wasm fuel (infinite-loop guard)."""
|
|
63
|
+
|
|
64
|
+
def __init__(self, plugin_id: str, fuel: int, context: str = "") -> None:
|
|
65
|
+
self.plugin_id = plugin_id
|
|
66
|
+
self.fuel = fuel
|
|
67
|
+
ctx = f" — {context}" if context else ""
|
|
68
|
+
super().__init__(
|
|
69
|
+
f"FUEL_EXCEEDED: {_fmt_fuel(fuel)}{ctx} "
|
|
70
|
+
"(pass --fuel inf or increase DiffConfig.plugin_fuel to remove the cap)"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class PluginSandboxViolation(PluginError):
|
|
75
|
+
"""
|
|
76
|
+
A plugin attempted a capability it was not granted (filesystem, network, …).
|
|
77
|
+
|
|
78
|
+
Raised when wasmtime traps on an unsatisfied import.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def __init__(self, plugin_id: str, detail: str) -> None:
|
|
82
|
+
self.plugin_id = plugin_id
|
|
83
|
+
super().__init__(
|
|
84
|
+
f"Plugin {plugin_id!r} attempted a sandboxed capability: {detail}"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class PluginLoadError(PluginError):
|
|
89
|
+
"""Failed to instantiate a .wasm plugin."""
|
|
90
|
+
|
|
91
|
+
def __init__(self, wasm_path: str, detail: str) -> None:
|
|
92
|
+
self.wasm_path = wasm_path
|
|
93
|
+
super().__init__(f"Failed to load plugin from {wasm_path!r}: {detail}")
|