feat(ast): minimal WASI env for native plugins#45
Conversation
Always instantiate WASM plugins with a node:wasi import object on a single path: no-imports modules (Rust/AssemblyScript) ignore the extras, while runtimes that need WASI (e.g. Go //go:wasmexport reactors) get a minimal, capability-restricted environment — no filesystem, no network, no args/env — and are initialized via _initialize when present. node:wasi is built in, so this preserves the zero-dependency constraint; it's loaded lazily (so it isn't pulled in when native AST is off) and its one-time ExperimentalWarning is filtered out. Unblocks full-stdlib-language plugins (Go's go/parser) without changing the per-kind ABI.
|
@Houseofmvps AI Context update failed, but I don't think it's anything to do with the branch/PR specifically |
|
Just to keep track of the remaining follow-ups: Each branch builds directly on the previous -
Intended merge order: And again, the last one ( |
Ships PR #45 (minimal WASI env for native plugins) to npm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Merged and shipped in Genuinely top-tier contribution, thank you. A few things that stood out on review:
Looking forward to |
Opened 🎉 |
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.

PR builds from #44, correcting a too-narrow contract for native plugin imports.
Under the initial ABI defined in the base machinery PR, plugins written in languages like Go would be a major pain to write or build. Using Node's built-in WASI support ameliorates that issue while still maintaining the existing zero-dependency standard.