fix(tui): stub missing @opentui/core .js siblings on install#89
Open
tim-hilde wants to merge 1 commit into
Open
fix(tui): stub missing @opentui/core .js siblings on install#89tim-hilde wants to merge 1 commit into
tim-hilde wants to merge 1 commit into
Conversation
@opentui/core@0.2.x publishes *.d.ts files without matching *.js
siblings (e.g. types.d.ts but no types.js). When OpenCode's Bun-based
TUI host loads dist/tui.tsx, it walks the type-import graph through
@opentui/core/index.d.ts (which contains `export * from "./types.js"`
and similar) and aborts with ENOENT on the missing runtime files. The
TUI plugin silently fails to register, so the sidebar panel and
compact status line never appear.
Add a postinstall script that writes empty `export {}` runtime stubs
next to any `.d.ts` in @opentui/core that lacks a sibling `.js` or
`.tsx`. The bundled runtime symbols are re-exported from index.js, so
empty stubs are sufficient to unblock Bun's resolver.
Also wire the script into the build pipeline so local dev installs
benefit, and add a packaging test that fails if any .d.ts in
@opentui/core lacks a runtime sibling.
Fixes slkiser#87
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.
Summary
Adds a
postinstallscript that creates emptyexport {}runtime stubs for any.d.tsin@opentui/corethat lacks a matching.js/.tsxsibling. Without these stubs, OpenCode's Bun-based TUI host fails to loaddist/tui.tsxwithENOENT: ... @opentui/core/types.js, and the sidebar panel and compact status line silently never register.@opentui/core@0.2.xpublishestypes.d.tsetc. but not the matchingtypes.js. Bun walksimport typechains during tsx transpile (through@opentui/core/index.d.ts→export * from "./types.js") and aborts. Runtime symbols are actually re-exported from the bundledindex.js, so empty stubs unblock resolution without affecting behavior. Verified locally: sidebar and compact status now render against OpenCode1.14.48.Linked Issue
Fixes #87
OpenCode Validation
1.14.48Repro log line before the fix:
After the fix: TUI plugin loads, sidebar + compact status appear.
Changes
scripts/shim-opentui-core.mjs— finds@opentui/coredirectories undernode_modules(walking up fromINIT_CWD, the repo, andcwd) and writes empty stubs for every missing.jssibling. Idempotent; never fails install.package.json— addspostinstallhook (runs on consumer install), chains the script intobuild, and includesscripts/shim-opentui-core.mjsinfilesso the npm tarball ships it.package-lock.json— single field update (hasInstallScript: true) reflecting the new postinstall.tests/opentui-core-shim.test.ts— regression test: every.d.tsin@opentui/coremust have a runtime sibling.Quality Checklist
npm run typechecknpm test(106 files, 922 tests passed)npm run buildcontributing/provider-template/or explained why the template does not apply — N/A, no provider change