refactor(tui): extract standalone package (#31193)

This commit is contained in:
Dax
2026-06-07 01:24:27 -04:00
committed by GitHub
parent 7a2c49e762
commit 106f8e94d6
84 changed files with 1148 additions and 1919 deletions
@@ -1,42 +1,32 @@
/** @jsxImportSource @opentui/solid */
import { createTuiEnvironment, TuiEnvironmentProvider, type TuiEnvironment } from "@opencode-ai/tui/runtime"
import {
TuiPathsProvider,
TuiStartupProvider,
TuiTerminalEnvironmentProvider,
type TuiPaths,
} from "@opencode-ai/tui/context/runtime"
import type { ParentProps } from "solid-js"
export function TestTuiEnvironmentProvider(
export function TestTuiContexts(
props: ParentProps<{
cwd?: string
directory?: string
paths?: Partial<TuiEnvironment["paths"]>
capabilities?: Partial<TuiEnvironment["capabilities"]>
editor?: Partial<TuiEnvironment["editor"]>
paths?: Partial<TuiPaths>
}>,
) {
return (
<TuiEnvironmentProvider
value={createTuiEnvironment({
<TuiPathsProvider
value={{
cwd: props.cwd ?? props.directory ?? "/tmp/opencode/packages/opencode",
platform: "linux",
paths: {
home: "/tmp/opencode/home",
state: "/tmp/opencode/state",
worktree: "/tmp/opencode",
...props.paths,
},
capabilities: {
mouse: true,
copyOnSelect: true,
terminalTitle: false,
terminalSuspend: false,
workspaces: false,
showTimeToFirstDraw: false,
...props.capabilities,
},
terminal: {},
editor: { zedTerminal: false, ...props.editor },
skipInitialLoading: false,
})}
home: "/tmp/opencode/home",
state: "/tmp/opencode/state",
worktree: "/tmp/opencode",
...props.paths,
}}
>
{props.children}
</TuiEnvironmentProvider>
<TuiTerminalEnvironmentProvider value={{ platform: "linux" }}>
<TuiStartupProvider value={{ skipInitialLoading: false }}>{props.children}</TuiStartupProvider>
</TuiTerminalEnvironmentProvider>
</TuiPathsProvider>
)
}