Skip to content

Commit 16b41d2

Browse files
UI: show plugins in /status (#4515)
Co-authored-by: GitHub Action <action@github.com>
1 parent a8c499a commit 16b41d2

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 { name: filename }
22+
const basename = filename.split(".")[0]
23+
if (basename === "index") {
24+
const dirname = parts.pop()
25+
const name = dirname || basename
26+
return { name }
27+
}
28+
return { name: basename }
29+
}
30+
const index = value.lastIndexOf("@")
31+
if (index <= 0) return { name: value, version: "latest" }
32+
const name = value.substring(0, index)
33+
const version = value.substring(index + 1)
34+
return { 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">
@@ -109,6 +134,29 @@ export function DialogStatus() {
109134
</For>
110135
</box>
111136
</Show>
137+
<Show when={plugins().length > 0} fallback={<text fg={theme.text}>No Plugins</text>}>
138+
<box>
139+
<text fg={theme.text}>{plugins().length} Plugins</text>
140+
<For each={plugins()}>
141+
{(item) => (
142+
<box flexDirection="row" gap={1}>
143+
<text
144+
flexShrink={0}
145+
style={{
146+
fg: theme.success,
147+
}}
148+
>
149+
150+
</text>
151+
<text wrapMode="word" fg={theme.text}>
152+
<b>{item.name}</b>
153+
{item.version && <span style={{ fg: theme.textMuted }}> @{item.version}</span>}
154+
</text>
155+
</box>
156+
)}
157+
</For>
158+
</box>
159+
</Show>
112160
</box>
113161
)
114162
}

0 commit comments

Comments
 (0)