bifrost-framework
The @gidragir/bifrost public API as a plugin author uses it - definePlugin, atom/useAtom/useState, the Host interface, UI primitives and components, the bifrost build/dev CLI. Use when writing or changing plugin code under plugins/<mod>/src, including when a needed component or helper seems missing.
- License 许可
- MIT
- 最近更新
- 2026-10-22
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- bifrost-framework
- description
- The @gidragir/bifrost public API as a plugin author uses it - definePlugin, atom/useAtom/useState, the Host interface, UI primitives and components, the bifrost build/dev CLI. Use when writing or changing plugin code under plugins/<mod>/src, including when a needed component or helper seems missing.
03 SKILL.md 正文
Bifrost framework
Full reference: packages/bifrost/README.md.
Plugin shape
import { atom, definePlugin, MasterDetail, Markdown, useAtom, useHost, useValue } from '@gidragir/bifrost'
const items = atom('items', [] as Item[])
const selected = atom('selected', null as string | null)
function Pane() {
const host = useHost()
const list = useValue(items)
const [sel, setSel] = useAtom(selected)
return (
<MasterDetail items={list} selectedId={sel} onSelect={setSel} getId={x => x.id}
detail={x => <Markdown text={x.body} />} />
)
}
export default definePlugin({
name: 'my-plugin', version: '0.1.0', description: '…',
config: { mode: { type: 'string', title: 'Mode', default: '' } },
panes: { main: { title: 'Mine', component: Pane, onOpen: async host => { /* load */ } } },
commands: { mine: { description: '…', run: async (host, args) => { await host.pane.open('main'); return 'Opened.' } } },
claude: { turnComplete: async (host, e) => {}, promptSubmit: async (host, e) => undefined },
})
Rules of thumb
- State:
atom(key, initial)at module level;useAtom/useValuein components;host.get/host.set(atom, value | prev => next)in handlers.useState('key', initial)is sugar: keep the key a literal. Values are plain data. - Host (
useHost(), or the first argument of commands/events):fs,cwd(),config(key),selection(),prompt.append/replace/read/submit,toast,pane.open/close/focus,scrollTo. Never throws; degrades where a harness lacks a capability. Never importclaude-codeor Node insrc. - UI: primitives
Box Text Button Input Select Markdown Code Link; componentsCard Row Column Header Toolbar EmptyState Field SearchInput MasterDetail;truncate,plural;useViewport()→{ harness, surface, columns, canInput, wide }. Give interactive elements akey.Box kind="card"etc. picks the semantic HTML element in agy. - Components are plain functions called eagerly; hooks are keyed by atom, so conditions and loops are fine.
claude.promptSubmitreturns a new text,{ text, after }(runafteronce the prompt went through), orundefinedto pass.
Missing piece
No Badge, no Tabs? Write it in the plugin from primitives (plugins/<mod>/src/badge.tsx:
<Text bold color="green">[ACCEPTED]</Text>). The API above is all a plugin gets; changing Bifrost is a
framework task with its own instructions (packages/bifrost/AGENTS.md),
never part of plugin work (see cross-mod).
04 同仓库更多 Skills
__MOD_NAME__
__MOD_DESCRIPTION__
cross-mod
Hub for building plugins that run in both Claude Code and Google Antigravity (agy) with the Bifrost framework. Use when starting any plugin work in this repository to find the right specialized skill and the end-to-end workflow.
ref-pane
Inspect and navigate project artifact references (such as RV-1, FB-2, T-3, ADR-4) in the Auxiliary Pane.
bifrost-dev
Use when changing @gidragir/bifrost itself (packages/bifrost) - adding or renaming an export, Host member, primitive or component, changing codegen or the adapters, bumping its version or releasing it - and not when building a plugin under plugins/<mod>.
bifrost-claude-adapter
Use when changing packages/bifrost/src/claude or src/cli codegen, or when a generated hooks module fails claude plugin validate/test for a reason the framework (not the plugin) causes - scanner errors, missing state contract keys, guard hooks, next(e) chaining.
bifrost-agy-adapter
Use when changing packages/bifrost/src/agy - the generated Antigravity aux-pane server, page runtime client.js, effects, token and preload contract, HTML renderer or bifrost.css - or when an agy pane misbehaves for every plugin rather than one.