Skip to content

fix(opencode): register solid transform from any cwd - #40230

Open
jethrolarson wants to merge 5 commits into
anomalyco:devfrom
jethrolarson:dev
Open

fix(opencode): register solid transform from any cwd#40230
jethrolarson wants to merge 5 commits into
anomalyco:devfrom
jethrolarson:dev

Conversation

@jethrolarson

@jethrolarson jethrolarson commented Aug 3, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #40231

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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's bunfig.toml chain contains preload = ["@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: App never runs, nothing draws, and ctrl-c is unresponsive.

This registers the transform at the process entrypoint (import "@opentui/solid/preload" as the first import in packages/opencode/src/index.ts), decoupling plugin registration from ambient bunfig.toml. ensureSolidTransformPlugin() is idempotent (global installed flag), 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?

  • Ran the TUI from /tmp/ocdevtest (outside the repo) with bun 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) and render/sync/theme bootstrap resolve. Verified on bun 1.3.14 and reproduced the bug on the same version without the fix.
  • Confirmed output matches a run from inside the repo.
  • bun typecheck passes for the opencode package.

Screenshots / recordings

Not applicable; verified via a pty harness.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@jethrolarson

Copy link
Copy Markdown
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!

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.

TUI black screen when running from source outside the repo directory

1 participant