From 532f25d0d449fb64caa648d6f4e25b221c892473 Mon Sep 17 00:00:00 2001
From: "opencode-agent[bot]"
<219766164+opencode-agent[bot]@users.noreply.github.com>
Date: Mon, 21 Sep 2026 22:17:22 -0400
Subject: [PATCH] feat(tui): restore sidebar onboarding (#50475)
---
.../src/feature-plugins/sidebar/footer.tsx | 112 +++++++++++++---
.../feature-plugins/sidebar-footer.test.tsx | 126 ++++++++++++++++++
2 files changed, 219 insertions(+), 19 deletions(-)
create mode 100644 packages/tui/test/feature-plugins/sidebar-footer.test.tsx
diff --git a/packages/tui/src/feature-plugins/sidebar/footer.tsx b/packages/tui/src/feature-plugins/sidebar/footer.tsx
index be629613c55..b875d5ffe80 100644
--- a/packages/tui/src/feature-plugins/sidebar/footer.tsx
+++ b/packages/tui/src/feature-plugins/sidebar/footer.tsx
@@ -1,12 +1,83 @@
import { Plugin } from "@opencode/plugin/tui"
import { createMemo, Show } from "solid-js"
+import { useTerminalDimensions } from "@opentui/solid"
import { FilePath } from "../../ui/file-path"
import { useWorkingDirectoryActions } from "../../ui/working-directory-actions"
import { usePromptMove } from "../../component/prompt/move"
+import { hasConnectedProvider } from "../../util/connected-provider"
-function View(props: { context: Plugin.Context; sessionID: string }) {
+export function SidebarOnboarding(props: { context: Plugin.Context; sessionID: string }) {
+ const dimensions = useTerminalDimensions()
+ const [onboarding, updateOnboarding] = props.context.storage.store("getting-started", {
+ initial: { dismissed: false },
+ })
+ const session = createMemo(() => props.context.data.session.get(props.sessionID))
+ const integrations = createMemo(() =>
+ props.context.data.location.integration.list(session()?.location ?? props.context.location),
+ )
+ const showOnboarding = createMemo(() => {
+ if (dimensions().height < 22) return false
+ const list = integrations()
+ if (!list) return false
+ return !onboarding.dismissed && !hasConnectedProvider(list)
+ })
+
+ return (
+
+
+
+ )
+}
+
+function SidebarFooter(props: { context: Plugin.Context; sessionID: string }) {
+ const session = createMemo(() => props.context.data.session.get(props.sessionID))
const move = usePromptMove({
- projectID: () => props.context.data.session.get(props.sessionID)?.projectID,
+ projectID: () => session()?.projectID,
sessionID: () => props.sessionID,
})
const actions = useWorkingDirectoryActions({
@@ -20,22 +91,25 @@ function View(props: { context: Plugin.Context; sessionID: string }) {
return branch ? `${value}:${branch}` : value
})
return (
-
- {(value) => (
-
- )}
-
+
+
+
+ {(value) => (
+
+ )}
+
+
)
}
@@ -46,7 +120,7 @@ export default Plugin.define({
// replace still takes the boundary over.
context.ui.slot({
append: "sidebar.footer",
- render: (props) => ,
+ render: (props) => ,
})
},
})
diff --git a/packages/tui/test/feature-plugins/sidebar-footer.test.tsx b/packages/tui/test/feature-plugins/sidebar-footer.test.tsx
new file mode 100644
index 00000000000..8a872f9238b
--- /dev/null
+++ b/packages/tui/test/feature-plugins/sidebar-footer.test.tsx
@@ -0,0 +1,126 @@
+/** @jsxImportSource @opentui/solid */
+import { expect, test } from "bun:test"
+import { RGBA } from "@opentui/core"
+import { testRender } from "@opentui/solid"
+import type { Context } from "@opencode/plugin/tui/context"
+import { createStore, produce } from "solid-js/store"
+import { SidebarOnboarding } from "../../src/feature-plugins/sidebar/footer"
+
+function context(options?: {
+ dismissed?: boolean
+ integrations?: Array<{ connections: unknown[] }>
+ dispatched?: string[]
+}) {
+ const color = RGBA.fromInts(200, 200, 200)
+ const [onboarding, setOnboarding] = createStore({ dismissed: options?.dismissed ?? false })
+ const location = { directory: "/workspace" }
+ return {
+ location,
+ theme: {
+ background: { raised: { high: color } },
+ text: { base: color, muted: color },
+ },
+ storage: {
+ store: () => [
+ onboarding,
+ (mutation: (draft: { dismissed: boolean }) => void) => {
+ setOnboarding(produce(mutation))
+ return Promise.resolve()
+ },
+ ],
+ },
+ keymap: {
+ dispatch: (id: string) => options?.dispatched?.push(id),
+ },
+ ui: {
+ format: { path: (value: string) => value },
+ },
+ data: {
+ session: {
+ get: () => ({ location }),
+ },
+ location: {
+ integration: { list: () => options?.integrations },
+ vcs: { info: () => undefined },
+ },
+ },
+ } as unknown as Context
+}
+
+async function render(input: Context, height = 22) {
+ const app = await testRender(
+ () => (
+
+
+
+ ),
+ { width: 38, height },
+ )
+ await app.renderOnce()
+ return app
+}
+
+test("sidebar waits for integrations before showing onboarding", async () => {
+ const app = await render(context())
+
+ try {
+ expect(app.captureCharFrame()).not.toContain("Getting started")
+ } finally {
+ app.renderer.destroy()
+ }
+})
+
+test("sidebar preserves the compact layout when the onboarding card cannot fit", async () => {
+ const app = await render(context({ integrations: [] }), 21)
+
+ try {
+ expect(app.captureCharFrame()).not.toContain("Getting started")
+ } finally {
+ app.renderer.destroy()
+ }
+})
+
+test("sidebar shows onboarding without a connected integration", async () => {
+ const app = await render(context({ integrations: [] }))
+
+ try {
+ const frame = app.captureCharFrame()
+ expect(frame).toContain("Getting started")
+ expect(frame).toContain("OpenCode includes free models")
+ expect(frame).toContain("Connect provider")
+ expect(frame).toContain("/connect")
+ } finally {
+ app.renderer.destroy()
+ }
+})
+
+test("sidebar hides onboarding after an integration is connected or the card is dismissed", async () => {
+ const connected = await render(context({ integrations: [{ connections: [{}] }] }))
+ const dismissed = await render(context({ integrations: [], dismissed: true }))
+
+ try {
+ expect(connected.captureCharFrame()).not.toContain("Getting started")
+ expect(dismissed.captureCharFrame()).not.toContain("Getting started")
+ } finally {
+ connected.renderer.destroy()
+ dismissed.renderer.destroy()
+ }
+})
+
+test("sidebar onboarding opens integrations and can be dismissed", async () => {
+ const dispatched: string[] = []
+ const app = await render(context({ integrations: [], dispatched }))
+
+ try {
+ const connect = app.renderer.root.findDescendantById("sidebar.footer.getting-started.connect")!
+ await app.mockMouse.click(connect.x, connect.y)
+ expect(dispatched).toEqual(["provider.connect"])
+
+ const dismiss = app.renderer.root.findDescendantById("sidebar.footer.getting-started.dismiss")!
+ await app.mockMouse.click(dismiss.x, dismiss.y)
+ await app.renderOnce()
+ expect(app.captureCharFrame()).not.toContain("Getting started")
+ } finally {
+ app.renderer.destroy()
+ }
+})