fix(tui): re-exec with package tsconfig when cwd cannot compile solid jsx - #464
Merged
Conversation
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.
Closes #465
Why
Source-mode boots of the CLI (e.g.
bun --conditions=browser packages/opencode/src/index.ts) crash from any directory without a compatibletsconfig.json:Root cause: Bun snapshots JSX transpiler settings from
$cwd/tsconfig.jsonat startup. When the cwd has none (or one without@opentui/solidas jsxImportSource), every TUI.tsxfile is compiled against the react runtime, and resolution ofreact/jsx-dev-runtimefails — react is not installed anywhere in this monorepo. The whole TUI graph is affected (app.tsx,config/index.tsx, …), not a single file. Reproduced identically onmain; not introduced by the upstream sync.What changed
packages/opencode/src/cli/cmd/tui.ts: before entering the TUI flow, detect the hostile-transpile condition (source mode + cwd tsconfig missing or lacking@opentui/solid) and re-exec the same entry from the package directory, which owns a compatible tsconfig.process.execArgvis preserved (--conditions=browseretc. survive), and the original directory keeps reaching thread/worker resolution through the existing[project]positional +process.chdirpath — project keys stay on the user's directory.Evidence
bun run dev -- --versionfrompackages/opencodedoes not re-exec (tsconfig present).bun typecheckPASS;test/cli/cmd/tui/18 pass / 0 fail.serve,models) never load the TUI graph and never hit the guard.