mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
32 lines
881 B
TypeScript
32 lines
881 B
TypeScript
/** @jsxImportSource @opentui/solid */
|
|
import { setupOcm, readRemoteContext } from './tui-plugin.js'
|
|
import type { TuiPluginApi, TuiPluginModule, TuiSlotContext } from './tui-types.js'
|
|
|
|
const tui = async (api: TuiPluginApi): Promise<void> => {
|
|
await setupOcm(api)
|
|
|
|
const remote = readRemoteContext(process.env)
|
|
if (!remote) return
|
|
|
|
const indicator = (ctx: TuiSlotContext) => {
|
|
const theme = ctx.theme.current
|
|
return (
|
|
<box flexDirection="row" flexShrink={0} gap={1}>
|
|
<text fg={theme.accent}>{remote.managerHost}</text>
|
|
{remote.repoName && (
|
|
<text fg={theme.textMuted}> · {remote.repoName}</text>
|
|
)}
|
|
</box>
|
|
)
|
|
}
|
|
|
|
api.slots.register({
|
|
order: 300,
|
|
slots: {
|
|
session_prompt_right: indicator,
|
|
home_prompt_right: indicator,
|
|
},
|
|
})
|
|
}
|
|
|
|
export default { id: 'ocm', tui } satisfies TuiPluginModule |