fix(opencode): register solid transform from any cwd - #40230
Open
jethrolarson wants to merge 5 commits into
Open
fix(opencode): register solid transform from any cwd#40230jethrolarson wants to merge 5 commits into
jethrolarson wants to merge 5 commits into
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Author
|
I stopped using opencode so you can close if nobody else is impacted. I'm going to stop checking up on this issue. Cheers! |
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.
Issue for this PR
Closes #40231
Type of change
What does this PR do?
Running opencode from source (
bun run packages/opencode/src/index.ts) from any directory outside the repo shows a black screen and never mounts.The TUI uses the Solid JSX transform from
@opentui/solid, applied by a Bun plugin that is only registered when the CWD'sbunfig.tomlchain containspreload = ["@opentui/solid/preload"]— which only exists inside the repo. From any other directory Bun falls back to its default React-style JSX transform, emitting element objects opentui's reconciler cannot mount:Appnever runs, nothing draws, and ctrl-c is unresponsive.This registers the transform at the process entrypoint (
import "@opentui/solid/preload"as the first import inpackages/opencode/src/index.ts), decoupling plugin registration from ambientbunfig.toml.ensureSolidTransformPlugin()is idempotent (globalinstalledflag), so it is a no-op when already registered and is inert in compiled binaries, which bundle the transform at build time (compile: { autoloadBunfig: false }).How did you verify your code works?
/tmp/ocdevtest(outside the repo) withbun run --conditions=browser packages/opencode/src/index.ts: without the fix the screen stays black; with the fix the full dashboard renders (logo, model selector, tabs, status bar) andrender/sync/theme bootstrap resolve. Verified on bun 1.3.14 and reproduced the bug on the same version without the fix.bun typecheckpasses for theopencodepackage.Screenshots / recordings
Not applicable; verified via a pty harness.
Checklist