intentumdiff-python 0.0.1__py3-none-win_arm64.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,351 @@
|
|
|
1
|
+
/// intentumdiff Plugin Interface v1.0.0
|
|
2
|
+
///
|
|
3
|
+
/// This WIT file is the SOLE contract between the host (Python runtime) and
|
|
4
|
+
/// any plugin (parser or renderer), regardless of what language the plugin is
|
|
5
|
+
/// written in. Use `wit-bindgen` to generate host or guest bindings.
|
|
6
|
+
///
|
|
7
|
+
/// Worlds
|
|
8
|
+
/// ──────
|
|
9
|
+
/// parser-plugin — implement a parser (full-parse mode for new parsers)
|
|
10
|
+
/// renderer-plugin — implement a renderer
|
|
11
|
+
///
|
|
12
|
+
/// Host imports
|
|
13
|
+
/// ────────────
|
|
14
|
+
/// The host exposes three utilities via `host-utils`. Every world imports them
|
|
15
|
+
/// so plugins can call them without carrying their own implementations.
|
|
16
|
+
|
|
17
|
+
package intentdiff:plugin@1.0.0;
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Host-provided utilities
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/// Functions implemented by the Python host and imported by every plugin.
|
|
24
|
+
/// All I/O through these functions is the only outside-world contact a plugin
|
|
25
|
+
/// has — the Wasm sandbox grants zero WASI capabilities.
|
|
26
|
+
interface host-utils {
|
|
27
|
+
/// Remove trivia nodes from a CST JSON document.
|
|
28
|
+
///
|
|
29
|
+
/// `cst-json` — the raw CST returned by `cst-serializer` (host side).
|
|
30
|
+
/// `trivia-types` — node type names to strip, e.g. ["comment", "whitespace"].
|
|
31
|
+
///
|
|
32
|
+
/// Returns the filtered CST JSON string.
|
|
33
|
+
strip-trivia: func(cst-json: string, trivia-types: list<string>) -> string;
|
|
34
|
+
|
|
35
|
+
/// Compute a structural hash for a CST subtree (JSON object or array).
|
|
36
|
+
///
|
|
37
|
+
/// Algorithm: SHA-256, identical to the host's own hash so hashes are
|
|
38
|
+
/// comparable across plugin boundaries.
|
|
39
|
+
/// leaf: sha256(type + ":" + text)
|
|
40
|
+
/// internal: sha256(type + "|" + join("|", map(hash, children)))
|
|
41
|
+
///
|
|
42
|
+
/// Returns a lowercase hex string.
|
|
43
|
+
structural-hash: func(cst-json: string) -> string;
|
|
44
|
+
|
|
45
|
+
/// Emit a log message that the host routes to its logging subsystem.
|
|
46
|
+
///
|
|
47
|
+
/// `level` — one of "trace", "debug", "info", "warn", "error".
|
|
48
|
+
log: func(level: string, message: string);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Parser interface
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
/// Implemented and exported by parser plugins.
|
|
56
|
+
interface parser {
|
|
57
|
+
/// Declares how a parser plugin receives source input.
|
|
58
|
+
enum parser-mode {
|
|
59
|
+
/// Legacy compatibility mode. The host parses the source file and
|
|
60
|
+
/// passes CST JSON to `process`.
|
|
61
|
+
///
|
|
62
|
+
/// New first-party and third-party parser plugins must use
|
|
63
|
+
/// `full-parse`. Product parser paths reject `interpret-cst` so the
|
|
64
|
+
/// engine boundary stays Rust/Wasm-owned.
|
|
65
|
+
interpret-cst,
|
|
66
|
+
|
|
67
|
+
/// The plugin receives raw source text and is responsible for parsing it
|
|
68
|
+
/// entirely on its own, usually with a Rust parser or tree-sitter grammar
|
|
69
|
+
/// compiled into the .wasm binary. This is the recommended and supported
|
|
70
|
+
/// mode for parser plugins.
|
|
71
|
+
full-parse,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// Return the parsing mode for this plugin.
|
|
75
|
+
get-parser-mode: func() -> parser-mode;
|
|
76
|
+
|
|
77
|
+
/// A short unique identifier for the grammar, e.g. "python", "sql",
|
|
78
|
+
/// "solidity". Must be lowercase, ASCII, no spaces.
|
|
79
|
+
grammar-id: func() -> string;
|
|
80
|
+
|
|
81
|
+
/// Given a filename and a snippet of content, return a language hint
|
|
82
|
+
/// string (e.g. "python") or an empty string if this plugin cannot
|
|
83
|
+
/// handle the file. The host calls this for every registered parser
|
|
84
|
+
/// in priority order. This is also the source of truth for the
|
|
85
|
+
/// playground /detect API; browser clients must not duplicate parser
|
|
86
|
+
/// language heuristics.
|
|
87
|
+
detect-language: func(filename: string, content: string) -> string;
|
|
88
|
+
|
|
89
|
+
/// Transform the input into a SemanticTree JSON string.
|
|
90
|
+
///
|
|
91
|
+
/// `input` — raw source (full-parse) or CST JSON (legacy interpret-cst).
|
|
92
|
+
/// `language` — language hint from `detect-language`.
|
|
93
|
+
/// `filename` — original filename (for diagnostics).
|
|
94
|
+
///
|
|
95
|
+
/// Returns a JSON string conforming to the `SemanticTree` schema.
|
|
96
|
+
/// On error, return a JSON object with a top-level `"error"` key.
|
|
97
|
+
process: func(input: string, language: string, filename: string) -> string;
|
|
98
|
+
|
|
99
|
+
/// Return the list of CST node type names this plugin considers trivia
|
|
100
|
+
/// (comments, whitespace, semicolons, …). The host calls `strip-trivia`
|
|
101
|
+
/// with this list before diffing.
|
|
102
|
+
trivia-node-types: func() -> list<string>;
|
|
103
|
+
|
|
104
|
+
/// All language IDs this plugin can handle. This is the source of truth
|
|
105
|
+
/// for the playground /languages API.
|
|
106
|
+
language-ids: func() -> list<string>;
|
|
107
|
+
|
|
108
|
+
/// Rich language metadata for playgrounds and API clients.
|
|
109
|
+
///
|
|
110
|
+
/// This is the source of truth for editor language modes, default
|
|
111
|
+
/// filenames, file extensions, display names, plugin author metadata, and
|
|
112
|
+
/// the playground /language-info API. It must include one record for every
|
|
113
|
+
/// value returned by `language-ids`.
|
|
114
|
+
language-info: func() -> list<language-info-record>;
|
|
115
|
+
|
|
116
|
+
/// Dispatch priority. Higher values win when multiple plugins claim the
|
|
117
|
+
/// same language. Built-in parsers use 0. Third-party plugins should
|
|
118
|
+
/// use 1 or higher to override built-ins.
|
|
119
|
+
priority: func() -> s32;
|
|
120
|
+
|
|
121
|
+
/// Optional source transformation applied before parser processing.
|
|
122
|
+
///
|
|
123
|
+
/// Plugins that do not need any source transformation must return
|
|
124
|
+
/// ``source`` unchanged.
|
|
125
|
+
///
|
|
126
|
+
/// Primary use-case: the dbt parser strips Jinja2 template expressions and
|
|
127
|
+
/// replaces them with SQL-valid placeholder identifiers (e.g.
|
|
128
|
+
/// ``dbt_ref__orders``) so that tree-sitter produces a clean AST. The
|
|
129
|
+
/// dbt enricher plugin later decodes the placeholders and injects proper
|
|
130
|
+
/// ``jinja_ref`` / ``jinja_source`` semantic nodes.
|
|
131
|
+
preprocess-source: func(source: string) -> string;
|
|
132
|
+
|
|
133
|
+
/// Return a before/after source-code example for *language*.
|
|
134
|
+
/// This is the source of truth for the playground /example/{language} API.
|
|
135
|
+
///
|
|
136
|
+
/// The `language` argument matches one of the values returned by
|
|
137
|
+
/// `language-ids`. Both `old` and `new` must be non-empty and show a
|
|
138
|
+
/// meaningful semantic change (e.g. a refactoring or feature addition).
|
|
139
|
+
example: func(language: string) -> example-pair;
|
|
140
|
+
|
|
141
|
+
/// A before/after source-code example pair.
|
|
142
|
+
record example-pair {
|
|
143
|
+
old: string,
|
|
144
|
+
new: string,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/// Metadata for one language ID exposed by this parser plugin.
|
|
148
|
+
record language-info-record {
|
|
149
|
+
language-id: string,
|
|
150
|
+
language-name: string,
|
|
151
|
+
language-short-name: string,
|
|
152
|
+
monaco-language: string,
|
|
153
|
+
default-filename: string,
|
|
154
|
+
language-file-extensions: list<string>,
|
|
155
|
+
author: string,
|
|
156
|
+
plugin-version: string,
|
|
157
|
+
last-updated: string,
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Enricher interface
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
|
|
165
|
+
/// Implemented and exported by enricher plugins.
|
|
166
|
+
///
|
|
167
|
+
/// An enricher runs after the base parser and receives both the
|
|
168
|
+
/// already-parsed SemanticNode tree (as JSON) and the original raw source.
|
|
169
|
+
/// It may inject, modify, or annotate nodes and must return the updated
|
|
170
|
+
/// tree as JSON.
|
|
171
|
+
///
|
|
172
|
+
/// Enrichers enable composable plugins: the dbt enricher injects
|
|
173
|
+
/// ``jinja_ref``, ``jinja_source``, and ``macro_def`` nodes into an
|
|
174
|
+
/// existing SQL SemanticNode tree without reimplementing SQL parsing.
|
|
175
|
+
interface enricher {
|
|
176
|
+
/// Enrich a SemanticNode tree with additional semantic information.
|
|
177
|
+
///
|
|
178
|
+
/// ``semantic-tree-json`` — JSON string of the SemanticNode tree produced
|
|
179
|
+
/// by the base parser's ``process`` function.
|
|
180
|
+
/// ``raw-source`` — original (un-preprocessed) source text.
|
|
181
|
+
/// ``language`` — the language ID that selected this enricher.
|
|
182
|
+
/// ``filename`` — original filename (for diagnostics).
|
|
183
|
+
///
|
|
184
|
+
/// Returns an updated SemanticNode tree JSON string.
|
|
185
|
+
/// On error, return ``semantic-tree-json`` unchanged so the pipeline
|
|
186
|
+
/// can continue without enrichment.
|
|
187
|
+
enrich: func(semantic-tree-json: string, raw-source: string, language: string, filename: string) -> string;
|
|
188
|
+
|
|
189
|
+
/// Language IDs this enricher handles (same vocabulary as parser language-ids).
|
|
190
|
+
language-ids: func() -> list<string>;
|
|
191
|
+
|
|
192
|
+
/// Dispatch priority; same semantics as ``parser.priority``.
|
|
193
|
+
priority: func() -> s32;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
// Renderer interface
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
|
|
200
|
+
/// Implemented and exported by renderer plugins.
|
|
201
|
+
interface renderer {
|
|
202
|
+
/// Human-readable format name, e.g. "terminal", "html", "patch".
|
|
203
|
+
format-name: func() -> string;
|
|
204
|
+
|
|
205
|
+
/// Render a `SemanticDiff` JSON string into the target format.
|
|
206
|
+
///
|
|
207
|
+
/// `diff-json` — a JSON string conforming to the `SemanticDiff` schema.
|
|
208
|
+
///
|
|
209
|
+
/// Returns the rendered output as a string (ANSI, HTML, unified diff, …).
|
|
210
|
+
render: func(diff-json: string) -> string;
|
|
211
|
+
|
|
212
|
+
/// List of option keys this renderer accepts (for documentation / UIs).
|
|
213
|
+
supported-options: func() -> list<string>;
|
|
214
|
+
|
|
215
|
+
/// Dispatch priority; same semantics as `parser.priority`.
|
|
216
|
+
priority: func() -> s32;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// Worlds
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
/// World that a parser plugin must satisfy.
|
|
224
|
+
world parser-plugin {
|
|
225
|
+
/// Access host utilities.
|
|
226
|
+
import host-utils;
|
|
227
|
+
/// Expose the parser implementation.
|
|
228
|
+
export parser;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/// World that a renderer plugin must satisfy.
|
|
232
|
+
world renderer-plugin {
|
|
233
|
+
/// Access host utilities.
|
|
234
|
+
import host-utils;
|
|
235
|
+
/// Expose the renderer implementation.
|
|
236
|
+
export renderer;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/// World that an enricher plugin must satisfy.
|
|
240
|
+
world enricher-plugin {
|
|
241
|
+
/// Access host utilities.
|
|
242
|
+
import host-utils;
|
|
243
|
+
/// Expose the enricher implementation.
|
|
244
|
+
export enricher;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// Index-engine interface
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
/// Implemented and exported by the index-engine plugin.
|
|
252
|
+
///
|
|
253
|
+
/// The index engine builds and diffs symbol tables across multiple files,
|
|
254
|
+
/// enabling cross-file semantic analysis (MOVE_TO_MODULE, CROSS_FILE_RENAME,
|
|
255
|
+
/// SPLIT_MODULE).
|
|
256
|
+
/// It is the hot path for the ``SemanticIndex`` Python host API.
|
|
257
|
+
interface index-engine {
|
|
258
|
+
/// Build a symbol table from a set of parsed files.
|
|
259
|
+
///
|
|
260
|
+
/// ``files-json`` — JSON array of objects, each with shape:
|
|
261
|
+
/// { "filename": str, "language": str, "tree": SemanticNode }
|
|
262
|
+
///
|
|
263
|
+
/// Returns a ``SymbolTable`` JSON object:
|
|
264
|
+
/// { "<qualified_name>": [{ "file": str, "node_type": str,
|
|
265
|
+
/// "node_id": str, "start_line": u32,
|
|
266
|
+
/// "start_col": u32, "end_line": u32,
|
|
267
|
+
/// "end_col": u32 }] }
|
|
268
|
+
///
|
|
269
|
+
/// On error, returns a JSON object with a top-level ``"error"`` key.
|
|
270
|
+
build-symbol-table: func(files-json: string) -> string;
|
|
271
|
+
|
|
272
|
+
/// Compare two symbol tables and detect cross-file movements.
|
|
273
|
+
///
|
|
274
|
+
/// ``old-json`` / ``new-json`` — ``SymbolTable`` JSON as returned by
|
|
275
|
+
/// ``build-symbol-table``.
|
|
276
|
+
///
|
|
277
|
+
/// Returns a JSON array of ``CrossFileChange`` objects:
|
|
278
|
+
/// [{ "change_type": "MOVE_TO_MODULE" | "CROSS_FILE_RENAME" | "SPLIT_MODULE",
|
|
279
|
+
/// "old_file": str, "new_file": str, "symbol_name": str,
|
|
280
|
+
/// "old_node_id": str | null, "new_node_id": str | null,
|
|
281
|
+
/// "confidence": f64, "description": str }]
|
|
282
|
+
diff-symbol-tables: func(old-json: string, new-json: string) -> string;
|
|
283
|
+
|
|
284
|
+
/// Build a reference table (call-sites and import usages) from a set of
|
|
285
|
+
/// parsed files.
|
|
286
|
+
///
|
|
287
|
+
/// ``files-json`` — same input format as ``build-symbol-table``:
|
|
288
|
+
/// JSON array of { "filename": str, "language": str, "tree": SemanticNode }
|
|
289
|
+
///
|
|
290
|
+
/// Returns a ``ReferenceTable`` JSON object:
|
|
291
|
+
/// { "<label>": [{ "qualified_name": str, "file": str, "node_id": str,
|
|
292
|
+
/// "reference_kind": "CALL" | "IMPORT" | "TYPE_USAGE",
|
|
293
|
+
/// "position": { "start_line": u32, "start_col": u32,
|
|
294
|
+
/// "end_line": u32, "end_col": u32 },
|
|
295
|
+
/// "language": str, "enclosing_scope": str | null }] }
|
|
296
|
+
///
|
|
297
|
+
/// On error, returns a JSON object with a top-level ``"error"`` key.
|
|
298
|
+
build-reference-table: func(files-json: string) -> string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/// World that an index-engine plugin must satisfy.
|
|
302
|
+
world index-engine-plugin {
|
|
303
|
+
/// Access host utilities.
|
|
304
|
+
import host-utils;
|
|
305
|
+
/// Expose the index engine implementation.
|
|
306
|
+
export index-engine;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
// Diff-analyzer interface
|
|
311
|
+
// ---------------------------------------------------------------------------
|
|
312
|
+
|
|
313
|
+
/// Implemented and exported by diff-analyzer plugins.
|
|
314
|
+
///
|
|
315
|
+
/// A diff analyzer runs after the classification stage and receives the
|
|
316
|
+
/// complete SemanticDiff JSON for a single file. It may add, modify, or
|
|
317
|
+
/// annotate Change objects — including emitting custom language-specific
|
|
318
|
+
/// change_type strings (e.g. "SQL_RENAME_TABLE", "GO_INTERFACE_CHANGE").
|
|
319
|
+
///
|
|
320
|
+
/// Diff analyzers enable language-specific post-processing without
|
|
321
|
+
/// modifying the core diff engine. They are discovered via the
|
|
322
|
+
/// ``intentumdiff.diff_analyzers`` entry-point group.
|
|
323
|
+
interface diff-analyzer {
|
|
324
|
+
/// Analyze a completed SemanticDiff and return an updated version.
|
|
325
|
+
///
|
|
326
|
+
/// ``diff-json`` — JSON string of the SemanticDiff produced by the
|
|
327
|
+
/// classification stage.
|
|
328
|
+
/// ``language`` — the language ID of the file being analyzed.
|
|
329
|
+
/// ``filename`` — original filename (for diagnostics).
|
|
330
|
+
///
|
|
331
|
+
/// Returns an updated SemanticDiff JSON string with any additional or
|
|
332
|
+
/// modified Change objects. Return ``diff-json`` unchanged if no
|
|
333
|
+
/// language-specific changes apply.
|
|
334
|
+
/// On error, return ``diff-json`` unchanged so the pipeline continues.
|
|
335
|
+
analyze-diff: func(diff-json: string, language: string, filename: string) -> string;
|
|
336
|
+
|
|
337
|
+
/// Language IDs this analyzer handles (same vocabulary as parser language-ids).
|
|
338
|
+
language-ids: func() -> list<string>;
|
|
339
|
+
|
|
340
|
+
/// Dispatch priority; same semantics as ``parser.priority``.
|
|
341
|
+
/// Higher values run first. Analyzers are chained in priority order.
|
|
342
|
+
priority: func() -> s32;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/// World that a diff-analyzer plugin must satisfy.
|
|
346
|
+
world diff-analyzer-plugin {
|
|
347
|
+
/// Access host utilities.
|
|
348
|
+
import host-utils;
|
|
349
|
+
/// Expose the diff analyzer implementation.
|
|
350
|
+
export diff-analyzer;
|
|
351
|
+
}
|