cross-mod-testing
Testing Bifrost plugins - Bun tests with the @gidragir/bifrost/testing kit, engine tests run by claude plugin test against the built plugin, type checking and Biome. Use when writing or running tests, debugging a failing check, or deciding which layer a test belongs to.
- License 许可
- MIT
- 最近更新
- 2026-10-22
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cross-mod-testing
- description
- Testing Bifrost plugins - Bun tests with the @gidragir/bifrost/testing kit, engine tests run by claude plugin test against the built plugin, type checking and Biome. Use when writing or running tests, debugging a failing check, or deciding which layer a test belongs to.
03 SKILL.md 正文
Testing
| Layer | Where | Runner | What it covers |
|---|---|---|---|
| Logic | plugins/<mod>/test/*.test.ts |
bun test |
pure functions in src/*.ts (use memoryFs or a hand-written FsLike) |
| Plugin | plugins/<mod>/test/*.test.tsx |
bun test |
commands, events, panes through the test kit, in both renderings |
| Engine | plugins/<mod>/test/engine/*.ts |
claude plugin test dist (pnpm check) |
the generated hooks module inside the real engine, on several surfaces |
Framework tests (packages/bifrost/test) belong to framework work
(packages/bifrost/AGENTS.md). bun test from the repository root
runs every Bun suite (~100 ms); from a plugin folder it runs that plugin's (its bunfig.toml ignores dist/**, where engine tests are copied).
Test kit (@gidragir/bifrost/testing)
import { expect, test } from 'bun:test'
import { completeTurn, createTestHost, mount, runCommand, submitPrompt } from '@gidragir/bifrost/testing'
import plugin from '../src/plugin'
test('…', async () => {
const host = createTestHost(plugin, { files: { '/ws/features/T-1/review/r.md': '### RV-1 …' }, cwd: '/ws', config: { prefixes: '' } })
expect(await runCommand(plugin, 'ref', 'RV-1', { host })).toBe('Refs pane opened.')
const ui = await mount(plugin, 'refs', { host, columns: 120 }) // surface/harness/canInput options too
host.select('picked text')
await ui.press('add-context')
expect(host.promptText).toContain('picked text')
expect(host.calls.toasts).toEqual([…])
expect(ui.html()).toContain('data-bf-id="pick-RV-001"') // agy rendering
})
mount drives elements by key: press, input (onInput), submit (onSubmit), select; find /
findAll by { key, type, text }; text(); rerender(). The host records calls.toasts,
calls.prompt, calls.submitted, calls.opened/closed/focused/scrolled, and keeps promptText.
Engine tests
Files in test/engine/*.ts import only claude-code/testing; the build copies them to
dist/tests/*.test.ts. Mock host answers with on('ui.open', () => ({ value: { isPlaced: true } })),
on('prompt.fill', () => ({ isFilled: true })), on('fs.list'|'fs.read'|'session.cwd', …). Mount panes
with $.ui.mount({ plugin, component: 'Pane', requestId, surface, props: { bodyColumns, … } }).
$.command.run needs origin and presentation.
Checks
pnpm check [mod]: build →claude plugin validate dist→tsc(src, thentest/tsconfig.json) →claude plugin test dist.pnpm typecheck,pnpm lint(Biome),pnpm test:engine.types/enginemust exist fortsc(pnpm types:sync).
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.