Skip to content

Commit 56c7a22

Browse files
ui: display plugins in /status
1 parent 600c6b4 commit 56c7a22

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,31 @@ export function DialogStatus() {
1111

1212
const enabledFormatters = createMemo(() => sync.data.formatter.filter((f) => f.enabled))
1313

14+
const plugins = createMemo(() => {
15+
const list = sync.data.config.plugin ?? []
16+
const result = list.map((value) => {
17+
if (value.startsWith("file://")) {
18+
const path = value.substring("file://".length)
19+
const parts = path.split("/")
20+
const filename = parts.pop() || path
21+
if (!filename.includes(".")) return { raw: value, name: filename }
22+
const basename = filename.split(".")[0]
23+
if (basename === "index") {
24+
const dirname = parts.pop()
25+
const name = dirname || basename
26+
return { raw: value, name }
27+
}
28+
return { raw: value, name: basename }
29+
}
30+
const index = value.lastIndexOf("@")
31+
if (index <= 0) return { raw: value, name: value, version: "latest" }
32+
const name = value.substring(0, index)
33+
const version = value.substring(index + 1)
34+
return { raw: value, name, version }
35+
})
36+
return result.toSorted((a, b) => a.name.localeCompare(b.name))
37+
})
38+
1439
return (
1540
<box paddingLeft={2} paddingRight={2} gap={1} paddingBottom={1}>
1641
<box flexDirection="row" justifyContent="space-between">
@@ -99,6 +124,29 @@ export function DialogStatus() {
99124
</For>
100125
</box>
101126
</Show>
127+
<Show when={plugins().length > 0} fallback={<text fg={theme.text}>No Plugins</text>}>
128+
<box>
129+
<text fg={theme.text}>{plugins().length} Plugins</text>
130+
<For each={plugins()}>
131+
{(item) => (
132+
<box flexDirection="row" gap={1}>
133+
<text
134+
flexShrink={0}
135+
style={{
136+
fg: theme.success,
137+
}}
138+
>
139+
140+
</text>
141+
<text wrapMode="word" fg={theme.text}>
142+
<b>{item.name}</b>
143+
{item.version && <span style={{ fg: theme.textMuted }}> @{item.version}</span>}
144+
</text>
145+
</box>
146+
)}
147+
</For>
148+
</box>
149+
</Show>
102150
</box>
103151
)
104152
}

0 commit comments

Comments
 (0)