Skip to content

Commit 55e1b3e

Browse files
authored
feat(tui): add inline home footer slot (#48798)
1 parent f1149ef commit 55e1b3e

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎packages/plugin/src/tui/context.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export interface PanelInput {
191191
export interface SlotMap {
192192
readonly app: Readonly<Record<string, never>>
193193
readonly "home.footer": Readonly<Record<string, never>>
194+
readonly "home.footer.status": Readonly<Record<string, never>>
194195
readonly "prompt.footer": PromptFooterInput
195196
readonly "prompt.footer.status": PromptFooterInput
196197
readonly "prompt.footer.file": PromptFooterInput

‎packages/tui/src/feature-plugins/home/footer.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Plugin } from "@opencode/plugin/tui"
22
import { createMemo, Match, Show, Switch } from "solid-js"
33
import { useTerminalDimensions } from "@opentui/solid"
44
import { usePlugin } from "../../plugin/context"
5+
import { Slot } from "../../plugin/render"
56

67
export function homeFooterVisibility(width: number) {
78
return {
@@ -91,6 +92,7 @@ function View(props: { context: Plugin.Context }) {
9192
>
9293
<Mcp context={props.context} />
9394
<Plugins context={props.context} />
95+
<Slot path="home.footer.status" />
9496
<box flexGrow={1} />
9597
<Show when={visibility().version}>
9698
<box flexShrink={0}>

‎packages/tui/src/plugin/context.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { useTuiLifecycle } from "../context/runtime"
2727
import { useClient } from "../context/client"
2828
import { useData } from "../context/data"
2929
import { errorMessage } from "../util/error"
30-
import { builtins } from "./builtins"
3130
import { createPluginContext, usePluginHost, type Dispose, type RegisteredSlot, type SlotRender } from "./api"
3231
import { createSourceWatcher } from "./watch"
3332
import { discoverPluginTargets, localSource } from "./discovery"
@@ -306,6 +305,7 @@ export function PluginProvider(props: ParentProps<{ packages: PackageSource; dir
306305

307306
// Resolve: fold entries into one desired generation. A source that fails
308307
// to import keeps its running previous version and only reports failure.
308+
const { builtins } = await import("./builtins")
309309
const desired = new Map<string, Desired>()
310310
for (const plugin of builtins)
311311
desired.set(plugin.id, { plugin, source: "builtin", version: "builtin", enabled: true })

‎services/www/src/docs/content/build/plugins/cli.mdx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ if (context.ui.tabs.enabled()) {
391391

392392
## Slots
393393

394-
Slots insert or replace JSX at `app`, `home.footer`, `prompt.footer`, `prompt.footer.status`, `prompt.footer.file`,
395-
`session.composer.top`, `sidebar.content`, or `sidebar.footer`.
394+
Slots insert or replace JSX at `app`, `home.footer`, `home.footer.status`, `prompt.footer`, `prompt.footer.status`,
395+
`prompt.footer.file`, `session.composer.top`, `sidebar.content`, or `sidebar.footer`.
396396

397397
```tsx
398398
return context.ui.slot({
@@ -411,6 +411,13 @@ context.ui.slot({ after: "home.footer", render: () => <text>After footer slot</t
411411
context.ui.slot({ replace: "home.footer", render: () => <text>New footer</text> })
412412
```
413413

414+
Use `home.footer.status` to add content to the built-in footer row without replacing it. Status contributions appear
415+
after OpenCode's health indicators and before the version.
416+
417+
```tsx
418+
context.ui.slot({ append: "home.footer.status", render: () => <text>SYNCED</text> })
419+
```
420+
414421
### Session panels
415422

416423
Register a contribution to `session.panel`, then open the panel from a command. The host owns sizing, focus, and

0 commit comments

Comments
 (0)