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.
Files changed (165) hide show
  1. intentumdiff/__init__.py +134 -0
  2. intentumdiff/_differ_gate.py +210 -0
  3. intentumdiff/_differ_presentation.py +786 -0
  4. intentumdiff/_differ_runtime.py +320 -0
  5. intentumdiff/analysis/__init__.py +1 -0
  6. intentumdiff/analysis/compile_commands.py +151 -0
  7. intentumdiff/analysis/cross_file.py +71 -0
  8. intentumdiff/analysis/diagnostics.py +309 -0
  9. intentumdiff/analysis/guardrail_reports.py +254 -0
  10. intentumdiff/analysis/guardrails.py +318 -0
  11. intentumdiff/analysis/invariances.py +1207 -0
  12. intentumdiff/analysis/keyed_profiles.py +25 -0
  13. intentumdiff/analysis/resource_profiles.py +14 -0
  14. intentumdiff/analysis/schema_resolver.py +816 -0
  15. intentumdiff/analysis/text_review.py +46 -0
  16. intentumdiff/analysis/user_schemas.py +430 -0
  17. intentumdiff/assets.py +45 -0
  18. intentumdiff/cache/__init__.py +37 -0
  19. intentumdiff/cache/duckdb_store.py +98 -0
  20. intentumdiff/cache/sqlite_store.py +149 -0
  21. intentumdiff/cache/store.py +190 -0
  22. intentumdiff/cli/__init__.py +199 -0
  23. intentumdiff/cli/_commands.py +2141 -0
  24. intentumdiff/cli/_parser.py +1061 -0
  25. intentumdiff/cli/_shared.py +644 -0
  26. intentumdiff/content_type.py +59 -0
  27. intentumdiff/core/__init__.py +1 -0
  28. intentumdiff/core/commit_differ.py +599 -0
  29. intentumdiff/core/config.py +51 -0
  30. intentumdiff/core/cst_serializer.py +101 -0
  31. intentumdiff/core/diffignore.py +87 -0
  32. intentumdiff/core/index.py +189 -0
  33. intentumdiff/core/indexer.py +792 -0
  34. intentumdiff/core/models.py +837 -0
  35. intentumdiff/differ.py +2195 -0
  36. intentumdiff/github_app.py +287 -0
  37. intentumdiff/intentumdiff_rust_core/__init__.py +7 -0
  38. intentumdiff/intentumdiff_rust_core/ffi.py +8 -0
  39. intentumdiff/intentumdiff_rust_core/intentumdiff_rust_core.dll +0 -0
  40. intentumdiff/invariances/__init__.py +2 -0
  41. intentumdiff/invariances/rules.schema.json +283 -0
  42. intentumdiff/invariances/rules.yaml +349 -0
  43. intentumdiff/live_server.py +1314 -0
  44. intentumdiff/lsp/__init__.py +67 -0
  45. intentumdiff/lsp/client.py +544 -0
  46. intentumdiff/lsp/config.py +96 -0
  47. intentumdiff/lsp/enricher.py +227 -0
  48. intentumdiff/lsp/exceptions.py +27 -0
  49. intentumdiff/lsp/launcher.py +273 -0
  50. intentumdiff/lsp/servers.py +356 -0
  51. intentumdiff/lsp_server/__init__.py +14 -0
  52. intentumdiff/lsp_server/_codelens.py +67 -0
  53. intentumdiff/lsp_server/_diagnostics.py +62 -0
  54. intentumdiff/lsp_server/_handlers.py +175 -0
  55. intentumdiff/lsp_server/server.py +205 -0
  56. intentumdiff/plugins/__init__.py +1 -0
  57. intentumdiff/plugins/adapter.py +397 -0
  58. intentumdiff/plugins/builtins.py +323 -0
  59. intentumdiff/plugins/exceptions.py +93 -0
  60. intentumdiff/plugins/hub.py +1155 -0
  61. intentumdiff/plugins/language_metadata.py +250 -0
  62. intentumdiff/plugins/loader.py +1252 -0
  63. intentumdiff/plugins/registry.py +1079 -0
  64. intentumdiff/plugins/registry.schema.json +99 -0
  65. intentumdiff/plugins/registry_schema.py +280 -0
  66. intentumdiff/plugins/wit/plugin.wit +351 -0
  67. intentumdiff/rust_core.py +2370 -0
  68. intentumdiff/serve/__init__.py +19 -0
  69. intentumdiff/serve/_app.py +485 -0
  70. intentumdiff/serve/_static/index.html +326 -0
  71. intentumdiff/serve/_static/playground.js +567 -0
  72. intentumdiff/sources/__init__.py +1 -0
  73. intentumdiff/sources/base.py +28 -0
  74. intentumdiff/sources/file_source.py +48 -0
  75. intentumdiff/sources/git_source.py +375 -0
  76. intentumdiff/sources/live_buffer_source.py +113 -0
  77. intentumdiff/sources/patch_source.py +126 -0
  78. intentumdiff/sources/string_source.py +44 -0
  79. intentumdiff/testing.py +165 -0
  80. intentumdiff/vcs/__init__.py +37 -0
  81. intentumdiff/vcs/_safe_path.py +50 -0
  82. intentumdiff/vcs/base.py +136 -0
  83. intentumdiff/vcs/git_backend.py +97 -0
  84. intentumdiff/vcs/git_cli.py +100 -0
  85. intentumdiff/vcs/hg_backend.py +94 -0
  86. intentumdiff/vcs/perforce_backend.py +109 -0
  87. intentumdiff/vcs/svn_backend.py +105 -0
  88. intentumdiff/wasm/.gitkeep +2 -0
  89. intentumdiff/wasm/abap_parser.wasm +0 -0
  90. intentumdiff/wasm/adf_parser.wasm +0 -0
  91. intentumdiff/wasm/asciidoc_parser.wasm +0 -0
  92. intentumdiff/wasm/asm_parser.wasm +0 -0
  93. intentumdiff/wasm/assemblyscript_parser.wasm +0 -0
  94. intentumdiff/wasm/astro_parser.wasm +0 -0
  95. intentumdiff/wasm/bash_parser.wasm +0 -0
  96. intentumdiff/wasm/clojure_parser.wasm +0 -0
  97. intentumdiff/wasm/cmake_parser.wasm +0 -0
  98. intentumdiff/wasm/cpp_parser.wasm +0 -0
  99. intentumdiff/wasm/csharp_parser.wasm +0 -0
  100. intentumdiff/wasm/css_parser.wasm +0 -0
  101. intentumdiff/wasm/dart_parser.wasm +0 -0
  102. intentumdiff/wasm/databricks_parser.wasm +0 -0
  103. intentumdiff/wasm/dax_parser.wasm +0 -0
  104. intentumdiff/wasm/delphi_parser.wasm +0 -0
  105. intentumdiff/wasm/dockerfile_parser.wasm +0 -0
  106. intentumdiff/wasm/elixir_parser.wasm +0 -0
  107. intentumdiff/wasm/freebasic_parser.wasm +0 -0
  108. intentumdiff/wasm/generic_parser.wasm +0 -0
  109. intentumdiff/wasm/gitignore_parser.wasm +0 -0
  110. intentumdiff/wasm/go_parser.wasm +0 -0
  111. intentumdiff/wasm/gomod_parser.wasm +0 -0
  112. intentumdiff/wasm/graphql_parser.wasm +0 -0
  113. intentumdiff/wasm/groovy_parser.wasm +0 -0
  114. intentumdiff/wasm/haskell_parser.wasm +0 -0
  115. intentumdiff/wasm/html_parser.wasm +0 -0
  116. intentumdiff/wasm/ini_parser.wasm +0 -0
  117. intentumdiff/wasm/java_parser.wasm +0 -0
  118. intentumdiff/wasm/js_ts_parser.wasm +0 -0
  119. intentumdiff/wasm/json_parser.wasm +0 -0
  120. intentumdiff/wasm/kotlin_parser.wasm +0 -0
  121. intentumdiff/wasm/latex_parser.wasm +0 -0
  122. intentumdiff/wasm/lua_parser.wasm +0 -0
  123. intentumdiff/wasm/make_parser.wasm +0 -0
  124. intentumdiff/wasm/markdown_parser.wasm +0 -0
  125. intentumdiff/wasm/mdx_parser.wasm +0 -0
  126. intentumdiff/wasm/ocaml_parser.wasm +0 -0
  127. intentumdiff/wasm/odin_parser.wasm +0 -0
  128. intentumdiff/wasm/parser_manifest.json +590 -0
  129. intentumdiff/wasm/perl_parser.wasm +0 -0
  130. intentumdiff/wasm/php_parser.wasm +0 -0
  131. intentumdiff/wasm/plsql_parser.wasm +0 -0
  132. intentumdiff/wasm/po_parser.wasm +0 -0
  133. intentumdiff/wasm/postscript_parser.wasm +0 -0
  134. intentumdiff/wasm/powershell_parser.wasm +0 -0
  135. intentumdiff/wasm/proto_parser.wasm +0 -0
  136. intentumdiff/wasm/puppet_parser.wasm +0 -0
  137. intentumdiff/wasm/python_parser.wasm +0 -0
  138. intentumdiff/wasm/qsharp_parser.wasm +0 -0
  139. intentumdiff/wasm/r_parser.wasm +0 -0
  140. intentumdiff/wasm/reasonml_parser.wasm +0 -0
  141. intentumdiff/wasm/ruby_parser.wasm +0 -0
  142. intentumdiff/wasm/rust_parser.wasm +0 -0
  143. intentumdiff/wasm/sas_parser.wasm +0 -0
  144. intentumdiff/wasm/scala_parser.wasm +0 -0
  145. intentumdiff/wasm/scss_parser.wasm +0 -0
  146. intentumdiff/wasm/sql_parser.wasm +0 -0
  147. intentumdiff/wasm/squirrel_parser.wasm +0 -0
  148. intentumdiff/wasm/svelte_parser.wasm +0 -0
  149. intentumdiff/wasm/swift_parser.wasm +0 -0
  150. intentumdiff/wasm/terraform_parser.wasm +0 -0
  151. intentumdiff/wasm/toml_parser.wasm +0 -0
  152. intentumdiff/wasm/tsql_parser.wasm +0 -0
  153. intentumdiff/wasm/vbnet_parser.wasm +0 -0
  154. intentumdiff/wasm/vue_parser.wasm +0 -0
  155. intentumdiff/wasm/wat_parser.wasm +0 -0
  156. intentumdiff/wasm/xml_parser.wasm +0 -0
  157. intentumdiff/wasm/yaml_parser.wasm +0 -0
  158. intentumdiff/wasm/zig_parser.wasm +0 -0
  159. intentumdiff/watcher.py +259 -0
  160. intentumdiff_python-0.0.1.dist-info/METADATA +112 -0
  161. intentumdiff_python-0.0.1.dist-info/RECORD +165 -0
  162. intentumdiff_python-0.0.1.dist-info/WHEEL +4 -0
  163. intentumdiff_python-0.0.1.dist-info/entry_points.txt +80 -0
  164. intentumdiff_python-0.0.1.dist-info/licenses/LICENSE +21 -0
  165. intentumdiff_python-0.0.1.dist-info/sboms/intentumdiff-rust-core.cyclonedx.json +10968 -0
@@ -0,0 +1,287 @@
1
+ """Repo-hostable GitHub App helpers for IntentumDiff review checks."""
2
+
3
+ import hashlib
4
+ import hmac
5
+ import html
6
+ import json
7
+ import urllib.parse
8
+ from dataclasses import dataclass
9
+ from typing import Any, Mapping
10
+
11
+
12
+ class GitHubAppError(ValueError):
13
+ """Raised when GitHub App input cannot be safely accepted."""
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class PullRequestRef:
18
+ owner: str
19
+ repo: str
20
+ number: int
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class GistRef:
25
+ gist_id: str
26
+ revision: str | None = None
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class GitHubAppReviewResult:
31
+ checked_files: int
32
+ semantic_changes: int
33
+ guardrail_violations: int
34
+ passed: bool
35
+ summary_markdown: str
36
+ html_report: str
37
+
38
+
39
+ def verify_webhook_signature(secret: str, body: bytes, signature_header: str | None) -> bool:
40
+ """Return True when *signature_header* matches GitHub's sha256 HMAC."""
41
+
42
+ if not secret or not signature_header or not signature_header.startswith("sha256="):
43
+ return False
44
+ expected = "sha256=" + hmac.new(secret.encode("utf-8"), body, hashlib.sha256).hexdigest()
45
+ return hmac.compare_digest(expected, signature_header)
46
+
47
+
48
+ def parse_pull_request_url(url: str) -> PullRequestRef:
49
+ parsed = urllib.parse.urlparse(url)
50
+ if parsed.scheme != "https" or parsed.netloc.lower() != "github.com":
51
+ raise GitHubAppError("Pull request URL must use https://github.com")
52
+ parts = [part for part in parsed.path.split("/") if part]
53
+ if len(parts) != 4 or parts[2] != "pull":
54
+ raise GitHubAppError("Pull request URL must look like https://github.com/OWNER/REPO/pull/NUMBER")
55
+ try:
56
+ number = int(parts[3])
57
+ except ValueError as exc:
58
+ raise GitHubAppError("Pull request number must be an integer") from exc
59
+ if number <= 0:
60
+ raise GitHubAppError("Pull request number must be positive")
61
+ return PullRequestRef(owner=parts[0], repo=parts[1], number=number)
62
+
63
+
64
+ def parse_gist_url(url: str) -> GistRef:
65
+ parsed = urllib.parse.urlparse(url)
66
+ if parsed.scheme != "https" or parsed.netloc.lower() != "gist.github.com":
67
+ raise GitHubAppError("Gist URL must use https://gist.github.com")
68
+ parts = [part for part in parsed.path.split("/") if part]
69
+ if len(parts) not in {1, 2}:
70
+ raise GitHubAppError("Gist URL must look like https://gist.github.com/OWNER/GIST_ID")
71
+ gist_id = parts[-1]
72
+ if not gist_id or any(char in gist_id for char in "\\?#"):
73
+ raise GitHubAppError("Gist URL has an invalid gist id")
74
+ revision = None
75
+ fragment = parsed.fragment.strip()
76
+ if fragment.startswith("file-"):
77
+ revision = fragment
78
+ return GistRef(gist_id=gist_id, revision=revision)
79
+
80
+
81
+ def parse_pull_request_event(payload: Mapping[str, Any]) -> PullRequestRef:
82
+ repository = payload.get("repository")
83
+ pull_request = payload.get("pull_request")
84
+ if not isinstance(repository, Mapping) or not isinstance(pull_request, Mapping):
85
+ raise GitHubAppError("Webhook payload is missing repository or pull_request")
86
+ full_name = str(repository.get("full_name") or "")
87
+ if "/" not in full_name:
88
+ raise GitHubAppError("Webhook repository.full_name must be OWNER/REPO")
89
+ number = pull_request.get("number") or payload.get("number")
90
+ try:
91
+ pr_number = int(number)
92
+ except (TypeError, ValueError) as exc:
93
+ raise GitHubAppError("Webhook pull request number must be an integer") from exc
94
+ owner, repo = full_name.split("/", 1)
95
+ if not owner or not repo:
96
+ raise GitHubAppError("Webhook repository.full_name must be OWNER/REPO")
97
+ if pr_number <= 0:
98
+ raise GitHubAppError("Webhook pull request number must be positive")
99
+ return PullRequestRef(owner=owner, repo=repo, number=pr_number)
100
+
101
+
102
+ def build_check_run_payload(
103
+ *,
104
+ name: str,
105
+ head_sha: str,
106
+ summary_markdown: str,
107
+ passed: bool,
108
+ details_url: str | None = None,
109
+ ) -> dict[str, Any]:
110
+ conclusion = "success" if passed else "failure"
111
+ payload: dict[str, Any] = {
112
+ "name": name,
113
+ "head_sha": head_sha,
114
+ "status": "completed",
115
+ "conclusion": conclusion,
116
+ "output": {
117
+ "title": "IntentumDiff semantic review",
118
+ "summary": summary_markdown,
119
+ },
120
+ }
121
+ if details_url:
122
+ payload["details_url"] = details_url
123
+ return payload
124
+
125
+
126
+ def build_review_result_from_payload(payload: Mapping[str, Any]) -> GitHubAppReviewResult:
127
+ """Build deterministic local review artifacts from injectable webhook payload data."""
128
+
129
+ review = payload.get("intentumdiff_review")
130
+ if not isinstance(review, Mapping):
131
+ review = {}
132
+ checked_files = _non_negative_int(review.get("checked_files"), default=0)
133
+ semantic_changes = _non_negative_int(review.get("semantic_changes"), default=0)
134
+ guardrail_violations = _non_negative_int(review.get("guardrail_violations"), default=0)
135
+ passed = bool(review.get("passed", semantic_changes == 0 and guardrail_violations == 0))
136
+ summary_markdown = render_github_app_summary(
137
+ checked_files=checked_files,
138
+ semantic_changes=semantic_changes,
139
+ guardrail_violations=guardrail_violations,
140
+ passed=passed,
141
+ )
142
+ html_report = render_github_app_html_report(
143
+ checked_files=checked_files,
144
+ semantic_changes=semantic_changes,
145
+ guardrail_violations=guardrail_violations,
146
+ passed=passed,
147
+ )
148
+ return GitHubAppReviewResult(
149
+ checked_files=checked_files,
150
+ semantic_changes=semantic_changes,
151
+ guardrail_violations=guardrail_violations,
152
+ passed=passed,
153
+ summary_markdown=summary_markdown,
154
+ html_report=html_report,
155
+ )
156
+
157
+
158
+ def build_pull_request_check_response(
159
+ payload: Mapping[str, Any],
160
+ *,
161
+ details_url: str | None = None,
162
+ review_result: GitHubAppReviewResult | None = None,
163
+ ) -> dict[str, Any]:
164
+ pr = parse_pull_request_event(payload)
165
+ pull_request = payload.get("pull_request")
166
+ head = pull_request.get("head") if isinstance(pull_request, Mapping) else None
167
+ head_sha = str(head.get("sha") if isinstance(head, Mapping) else payload.get("after") or "")
168
+ if not head_sha:
169
+ raise GitHubAppError("Webhook pull request head.sha is required for check-run creation")
170
+ result = review_result or build_review_result_from_payload(payload)
171
+ check_run = build_check_run_payload(
172
+ name="IntentumDiff",
173
+ head_sha=head_sha,
174
+ summary_markdown=result.summary_markdown,
175
+ passed=result.passed,
176
+ details_url=details_url,
177
+ )
178
+ return {
179
+ "ok": True,
180
+ "event": "pull_request",
181
+ "owner": pr.owner,
182
+ "repo": pr.repo,
183
+ "number": pr.number,
184
+ "check_run": check_run,
185
+ "artifacts": {
186
+ "summary_markdown": result.summary_markdown,
187
+ "html_report": result.html_report,
188
+ },
189
+ "review": {
190
+ "checked_files": result.checked_files,
191
+ "semantic_changes": result.semantic_changes,
192
+ "guardrail_violations": result.guardrail_violations,
193
+ "passed": result.passed,
194
+ },
195
+ }
196
+
197
+
198
+ def render_github_app_summary(
199
+ *,
200
+ checked_files: int,
201
+ semantic_changes: int,
202
+ guardrail_violations: int,
203
+ passed: bool,
204
+ ) -> str:
205
+ status = "passed" if passed else "needs attention"
206
+ return "\n".join(
207
+ [
208
+ "# IntentumDiff GitHub App Review",
209
+ "",
210
+ f"Status: **{status}**",
211
+ "",
212
+ "| Metric | Count |",
213
+ "|---|---:|",
214
+ f"| Files checked | {checked_files} |",
215
+ f"| Semantic changes | {semantic_changes} |",
216
+ f"| Guardrail violations | {guardrail_violations} |",
217
+ "",
218
+ ],
219
+ )
220
+
221
+
222
+ def render_github_app_html_report(
223
+ *,
224
+ checked_files: int,
225
+ semantic_changes: int,
226
+ guardrail_violations: int,
227
+ passed: bool,
228
+ ) -> str:
229
+ status = "passed" if passed else "needs attention"
230
+ metrics = {
231
+ "Files checked": checked_files,
232
+ "Semantic changes": semantic_changes,
233
+ "Guardrail violations": guardrail_violations,
234
+ }
235
+ rows = "".join(
236
+ f"<div class=\"metric\"><strong>{value}</strong><span>{html.escape(label)}</span></div>"
237
+ for label, value in metrics.items()
238
+ )
239
+ return (
240
+ "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\">"
241
+ "<title>IntentumDiff GitHub App Review</title></head><body>"
242
+ f"<main><h1>IntentumDiff GitHub App Review</h1><p>Status: <strong>{html.escape(status)}</strong></p>"
243
+ f"<section class=\"metrics\">{rows}</section></main></body></html>"
244
+ )
245
+
246
+
247
+ def decode_webhook_body(body: bytes) -> dict[str, Any]:
248
+ payload = json.loads(body.decode("utf-8"))
249
+ if not isinstance(payload, dict):
250
+ raise GitHubAppError("Webhook JSON body must be an object")
251
+ return payload
252
+
253
+
254
+ def _non_negative_int(value: Any, *, default: int) -> int:
255
+ try:
256
+ parsed = int(value)
257
+ except (TypeError, ValueError):
258
+ return default
259
+ return max(parsed, 0)
260
+
261
+
262
+ def create_app() -> Any:
263
+ """Create the optional FastAPI app without making FastAPI a core dependency."""
264
+
265
+ try:
266
+ from fastapi import FastAPI, Header, HTTPException, Request
267
+ except ImportError as exc: # pragma: no cover - exercised when optional extra absent.
268
+ raise RuntimeError("Install intentumdiff[serve] to run the GitHub App server.") from exc
269
+
270
+ app = FastAPI(title="IntentumDiff GitHub App")
271
+
272
+ @app.post("/github/webhook")
273
+ async def github_webhook(
274
+ request: Request,
275
+ x_github_event: str = Header(default=""),
276
+ x_hub_signature_256: str | None = Header(default=None),
277
+ ) -> dict[str, Any]:
278
+ body = await request.body()
279
+ secret = request.app.state.webhook_secret if hasattr(request.app.state, "webhook_secret") else ""
280
+ if secret and not verify_webhook_signature(secret, body, x_hub_signature_256):
281
+ raise HTTPException(status_code=401, detail="invalid signature")
282
+ payload = decode_webhook_body(body)
283
+ if x_github_event == "pull_request":
284
+ return build_pull_request_check_response(payload)
285
+ return {"ok": True, "event": x_github_event}
286
+
287
+ return app
@@ -0,0 +1,7 @@
1
+ __all__ = ["lib", "ffi"]
2
+
3
+ import os
4
+ from .ffi import ffi
5
+
6
+ lib = ffi.dlopen(os.path.join(os.path.dirname(__file__), 'intentumdiff_rust_core.dll'))
7
+ del os
@@ -0,0 +1,8 @@
1
+ # auto-generated file
2
+ import _cffi_backend
3
+
4
+ ffi = _cffi_backend.FFI('ffi',
5
+ _version = 0x2601,
6
+ _types = b'\x00\x00\x05\x0D\x00\x00\x07\x03\x00\x00\x01\x11\x00\x00\x00\x0F\x00\x00\x08\x0D\x00\x00\x07\x03\x00\x00\x00\x0F\x00\x00\x02\x01\x00\x00\x00\x01',
7
+ _globals = (b'\x00\x00\x00\x23intentumdiff_call',0,b'\x00\x00\x04\x23intentumdiff_free',0),
8
+ )
@@ -0,0 +1,2 @@
1
+ """Packaged declarative invariance rules."""
2
+
@@ -0,0 +1,283 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentumdiff.local/schemas/invariances/rules.schema.json",
4
+ "title": "IntentumDiff Invariance Rules",
5
+ "description": "Declarative invariance rule catalogue and runtime rule definitions for IntentumDiff.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["version", "rules"],
9
+ "properties": {
10
+ "version": {
11
+ "type": "integer",
12
+ "minimum": 1
13
+ },
14
+ "rules": {
15
+ "type": "array",
16
+ "items": {
17
+ "$ref": "#/$defs/rule"
18
+ }
19
+ }
20
+ },
21
+ "$defs": {
22
+ "changeGroupKind": {
23
+ "type": "string",
24
+ "enum": [
25
+ "MOVED_CODE",
26
+ "REFACTORING",
27
+ "MEANINGFUL_CHANGE",
28
+ "IGNORED_STYLE",
29
+ "NOISE_SUPPRESSED"
30
+ ]
31
+ },
32
+ "equivalenceKind": {
33
+ "type": "string",
34
+ "enum": [
35
+ "syntactic_trivia",
36
+ "grammar_equivalence",
37
+ "canonical_value_equivalence",
38
+ "unordered_collection_equivalence",
39
+ "contextual_equivalence",
40
+ "refactoring_equivalence"
41
+ ]
42
+ },
43
+ "evaluator": {
44
+ "type": "string",
45
+ "enum": [
46
+ "css_color_equivalence",
47
+ "formatting_suppression_evidence",
48
+ "integer_literal_equivalence",
49
+ "style_only_shortcut_evidence",
50
+ "string_literal_equivalence"
51
+ ]
52
+ },
53
+ "language": {
54
+ "type": "string",
55
+ "enum": [
56
+ "abap",
57
+ "adf",
58
+ "asciidoc",
59
+ "asm",
60
+ "assemblyscript",
61
+ "astro",
62
+ "bash",
63
+ "c",
64
+ "clojure",
65
+ "cpp",
66
+ "csharp",
67
+ "css",
68
+ "dart",
69
+ "databricks-workflow",
70
+ "dax",
71
+ "delphi",
72
+ "dockerfile",
73
+ "elixir",
74
+ "generic",
75
+ "gitignore",
76
+ "go",
77
+ "graphql",
78
+ "groovy",
79
+ "haskell",
80
+ "hcl",
81
+ "html",
82
+ "java",
83
+ "javascript",
84
+ "json",
85
+ "kotlin",
86
+ "latex",
87
+ "lua",
88
+ "m",
89
+ "markdown",
90
+ "ini",
91
+ "gomod",
92
+ "make",
93
+ "cmake",
94
+ "proto",
95
+ "toml",
96
+ "mdx",
97
+ "odin",
98
+ "ocaml",
99
+ "perl",
100
+ "php",
101
+ "plsql",
102
+ "po",
103
+ "postscript",
104
+ "powershell",
105
+ "puppet",
106
+ "python",
107
+ "qsharp",
108
+ "r",
109
+ "reasonml",
110
+ "ruby",
111
+ "rust",
112
+ "sas",
113
+ "scala",
114
+ "scss",
115
+ "sql",
116
+ "squirrel",
117
+ "svelte",
118
+ "swift",
119
+ "tsx",
120
+ "tsql",
121
+ "typescript",
122
+ "vbnet",
123
+ "vue",
124
+ "wat",
125
+ "xml",
126
+ "yaml",
127
+ "zig"
128
+ ]
129
+ },
130
+ "risk": {
131
+ "type": "string",
132
+ "enum": ["green", "amber", "red"]
133
+ },
134
+ "stage": {
135
+ "type": "string",
136
+ "enum": [
137
+ "parser_normalization",
138
+ "matcher_scoring",
139
+ "post_diff_refinement",
140
+ "group_emission"
141
+ ]
142
+ },
143
+ "status": {
144
+ "type": "string",
145
+ "enum": ["implemented", "catalog"]
146
+ },
147
+ "stringArray": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string",
151
+ "minLength": 1
152
+ },
153
+ "uniqueItems": true
154
+ },
155
+ "example": {
156
+ "type": "object",
157
+ "additionalProperties": true
158
+ },
159
+ "rule": {
160
+ "type": "object",
161
+ "additionalProperties": false,
162
+ "required": [
163
+ "id",
164
+ "languages",
165
+ "status",
166
+ "evaluator",
167
+ "group_kind",
168
+ "enabled",
169
+ "risk",
170
+ "equivalence_kind",
171
+ "explanation"
172
+ ],
173
+ "properties": {
174
+ "id": {
175
+ "type": "string",
176
+ "minLength": 1,
177
+ "pattern": "^[a-z0-9_.-]+$"
178
+ },
179
+ "languages": {
180
+ "type": "array",
181
+ "minItems": 1,
182
+ "uniqueItems": true,
183
+ "items": {
184
+ "$ref": "#/$defs/language"
185
+ }
186
+ },
187
+ "status": {
188
+ "$ref": "#/$defs/status"
189
+ },
190
+ "evaluator": {
191
+ "oneOf": [
192
+ {
193
+ "$ref": "#/$defs/evaluator"
194
+ },
195
+ {
196
+ "type": "null"
197
+ }
198
+ ]
199
+ },
200
+ "node_types": {
201
+ "$ref": "#/$defs/stringArray"
202
+ },
203
+ "group_kind": {
204
+ "$ref": "#/$defs/changeGroupKind"
205
+ },
206
+ "enabled": {
207
+ "type": "boolean"
208
+ },
209
+ "risk": {
210
+ "$ref": "#/$defs/risk"
211
+ },
212
+ "equivalence_kind": {
213
+ "$ref": "#/$defs/equivalenceKind"
214
+ },
215
+ "explanation": {
216
+ "type": "string",
217
+ "minLength": 1
218
+ },
219
+ "examples": {
220
+ "type": "array",
221
+ "items": {
222
+ "$ref": "#/$defs/example"
223
+ }
224
+ },
225
+ "stage": {
226
+ "$ref": "#/$defs/stage"
227
+ },
228
+ "guarantee": {
229
+ "type": "string",
230
+ "minLength": 1
231
+ },
232
+ "guards": {
233
+ "$ref": "#/$defs/stringArray"
234
+ },
235
+ "source_refs": {
236
+ "$ref": "#/$defs/stringArray"
237
+ },
238
+ "notes": {
239
+ "type": "string"
240
+ }
241
+ },
242
+ "allOf": [
243
+ {
244
+ "if": {
245
+ "properties": {
246
+ "status": {
247
+ "const": "implemented"
248
+ }
249
+ },
250
+ "required": ["status"]
251
+ },
252
+ "then": {
253
+ "properties": {
254
+ "evaluator": {
255
+ "$ref": "#/$defs/evaluator"
256
+ }
257
+ }
258
+ }
259
+ },
260
+ {
261
+ "if": {
262
+ "properties": {
263
+ "status": {
264
+ "const": "catalog"
265
+ }
266
+ },
267
+ "required": ["status"]
268
+ },
269
+ "then": {
270
+ "properties": {
271
+ "evaluator": {
272
+ "type": "null"
273
+ },
274
+ "enabled": {
275
+ "const": false
276
+ }
277
+ }
278
+ }
279
+ }
280
+ ]
281
+ }
282
+ }
283
+ }