feat: native ast generalization#46
Merged
Houseofmvps merged 4 commits intoJun 27, 2026
Merged
Conversation
…icit selection
Add an optional describe()->i64 export (JSON {languageId, extensions}) that
the host reads into LoadedPlugin.metadata, making modules fully
self-describing alongside contractVersion() and parse* capability probes.
- types: NativeLang widened to string; add PluginMetadata.
- plugin-host: read describe() during bindExports; listPluginFiles globs the
template-guarded ^codesight-(<lang>)-ast.wasm$ across the dir waterfall.
- native-loader: buildNativeRegistry maps extension -> plugin (describe-wins
languageId, DEFAULT_EXTENSIONS fallback, first-match precedence, collision
rule); NativeAstResolved gains authoritative + warnings.
- index: --native-ast[=ids|all|none] selection (drops KNOWN_NATIVE_LANGS).
- reference plugin: export describe(); rebuild wasm + checksums.
Foundation only: built-in in-detector dispatch is still live, so behavior is
unchanged.
…detector dispatch Introduce src/detectors/native.ts as the single point where WASM plugins are dispatched: group files by extension via the registry, call parseRoutes/ parseSchemas, stamp confidence "native" (framework "unknown" interim), and record strict diagnostics. mergeNativeRoutes is native-preferred-dedup (additive) or per-file replace (authoritative, with an empty-with-builtin warning); mergeNativeSchemas dedups by name (SchemaModel lacks file provenance). - routes/schema: drop the per-detector nativePluginFor calls; built-in extractors remain as pure fallback. Export detectTags for the pass. - core: run detectNative after the built-in detectors and merge. - tests: native-ast dispatch tests move to the generic pass (detectNative).
…ic pass Add a generalization suite to reference-plugin.test.ts: reads describe() metadata off the loaded plugin, asserts buildNativeRegistry routes the declared extension (explicit => authoritative), drives the generic pass over a .ref file, and verifies `all` mode discovers the plugin by globbing the plugin dir (=> additive).
…iation Rework the plugin contract for the generalization: any user-declared language, describe()-driven discovery (id/extensions, template guard, precedence/collision), all/none/=ids enabling with additive-vs-authoritative merge, and the WASI instantiation row in the ABI.
Contributor
Author
|
As previously, just keeping track of the remaining follow-ups: Each branch builds directly on the previous -
Intended merge order: Looking forward to nailing down the details of where/how plugins live, are built, and delivered 😁. |
Houseofmvps
pushed a commit
that referenced
this pull request
Jun 28, 2026
Final PR in the #44→#45→#46 native-AST stack. Adds canonical Rust (syn), Python (ruff), and Go (go/parser) WASM plugins under plugins/ast/, plus the ast-plugins CI workflow that builds, smoke-tests against the host ABI, and publishes them on plugins-v* tags. Reviewed safe: strictly additive (0 deletions), no TS/src/dist/package.json changes, npm tarball still excludes plugins/ (verified via npm pack), plugins do no I/O/network/process/fs (pure AST parsers in sandboxed WASM), deps reputably pinned (syn, ruff@SHA, Go stdlib), CI least-privilege with release gated to maintainer tags. All functional checks pass; only failure is the known fork-PR read-only-token artifact.
Houseofmvps
pushed a commit
that referenced
this pull request
Jun 29, 2026
Docs-only sync from the-wondersmith: corrects stale counts (14 ORM parsers, 14 MCP tools, 145 tests, 30+ frameworks), rewrites native-AST WASM plugin docs to match the shipped #46/#47 language-driven dispatch + reference plugins, adds gin-gorm eval fixture row and reference-plugin describe() note. Verified: 14 MCP tools registered, 145 tests pass, gin-gorm fixture present, 14 ORMs in source. No code/dependency changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR is the next iteration in the native-AST plugin stack, building on top of #44 and #45 (initial machinery and transition to minimal WASI env initialization respectively).
PR makes native-AST dispatch language-driven instead of tied to the built-in detectors. Plugins now self-describe the languages/extensions they handle, and
codesightroutes matching files accordingly through one generic pass. This enables any user-declared language to usecodesight, not just those with built-in (read:codesight-specific) extractors.Changes
describe()ABI export — plugins return{languageId, extensions, frameworks?}; the host useslanguageId(authoritative over filename) +extensionsto route. The in-repo reference plugin gains adescribe().buildNativeRegistry(template-guarded^codesight-<lang>-ast.wasm$,PATH-alike waterfall, first-match-wins, collision rule); default ext map for rust/go/python whendescribe()is absent.src/detectors/native.ts— the only dispatch point; built-in detectors become pure fallback (migrated off in-detector dispatch).--native-ast[=ids|all|none].--native-ast=<ids>is authoritative (native replaces built-in per file for routes; warns on empty-with-builtin); bare/allis additive (native-preferred dedup).Compatibility / Notes
codesight's baseline (v1.15.0).SchemaModelhas no file provenance → schemas dedup-by-name).framework: "unknown"untildescribe().frameworksis wired.parseImportsstays defined + conformance-tested but not yet dispatched.