Skip to content

feat: add experimental JavaScript API bridge - #499

Draft
mattiamanzati wants to merge 11 commits into
mainfrom
feat/oxlint-bridge-prototype
Draft

feat: add experimental JavaScript API bridge#499
mattiamanzati wants to merge 11 commits into
mainfrom
feat/oxlint-bridge-prototype

Conversation

@mattiamanzati

@mattiamanzati mattiamanzati commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • rename the in-process Go integration package from etsapi to etsgoapi
  • add a persistent etsjsapi bridge through tsgo --effect-js-api with a versioned Content-Length JSON protocol
  • add an experimental Oxlint adapter that runs selected Effect diagnostics once per file and exposes Effect quick fixes as Oxlint suggestions

API boundaries

etsgoapi is the public in-process API for Go consumers. etsjsapi owns the cross-process protocol for JavaScript consumers. The code under _packages/tsgo/src/experimental/oxlint is the first consumer-specific adapter over etsjsapi; Oxlint lifecycle details are not part of the server package or wire method names.

Protocol v2 exposes a synchronous diagnostics request with optional includeFixes. The server retains TypeScript-Go project state, refreshes the base snapshot for every request, layers the exact current file through a temporary snapshot, and invokes rulerunner.Run only for requested rules. Returned actions contain grouped UTF-16 text edits whose positions are validated against TypeScript-Go before conversion.

Oxlint adapter

The plugin coordinates enabled wrappers through Program and Program:exit. The first exit sends the exact current source text and complete requested-rule set to one persistent child; subsequent wrappers reuse the grouped response.

context.settings["effect-tsgo"] supplies Effect options when present, otherwise etsjsapi falls back to project plugin options. Before execution, every Effect rule is set to off and requested rules to internal error, leaving final severity ownership to Oxlint.

Effect code fixes are reported through context.report(... suggest ...); effectDisable actions are excluded. Plain oxlint --fix does not apply these suggestions, while --fix-suggestions may apply them. The fixture verifies this behavior with a non-BMP character before the edit to exercise UTF-16 conversion.

The synchronous channel is adapted from TypeScript-Go under its Apache-2.0 license. It retains blocking pipe I/O, buffering, cleanup, retry handling, and Windows named-pipe support while replacing the general MessagePack API protocol with the narrow Effect JavaScript API protocol.

Validation

  • pnpm setup-repo
  • pnpm lint
  • pnpm check
  • pnpm test (now includes the Oxlint prototype)
  • pnpm --filter effect-tsgo-oxlint-prototype test
  • GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build ./...

All checks pass.

Current limitations

  • the standalone child sees the exact current-file overlay but not all unsaved editor documents
  • the initial adapter is exercised through the Node/Oxlint JavaScript plugin host

@mattiamanzati mattiamanzati changed the title feat: add experimental Oxlint bridge feat: add experimental JavaScript API bridge Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant