mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
- ruflo-mods guard (tool.check): read-only fast path on e.isReadOnly (2.1.304) that skips the policy-projection stat while a full check found none in the last 2 s (web tools excluded so the research ask still fires); a chain deny returns without file reads; decider "person" on every ask ruflo raises; agentId names the subagent on ruflo's reason; the chain's ceiling survives a tightening; .catch documented for 2.1.301 semantics, still fails closed. - ruflo-console: console_state and console_run registered with isDeferred: false (2.1.293); console_open/console_set stay deferred. - console + swarm: Text bold -> weight (2.1.299 deprecation), codemodded; bold: true -> weight: "semibold" (what the host already maps bold to). Engines before 2.1.299 refuse a tree with an unknown Text prop, so the kit maps weight back to bold there (text-weight.ts, via $.session.version()). - tests for 2.1.318's kit: $.tool.call now raises tool.check first (guidance test); stub answers are validated (swarm prompt.fill stub); stale expectations fixed (probe session.compact, learning-loop handshake). - console kit tests: timeoutMs 30_000 (the 5 s default timed out 19-58 end-to-end tests under load, on 2.1.289 and 2.1.318 alike), and the mock clock advanced past runner.ts's VERIFY_RETRY_MS in actions/settings tests. Co-authored-by: r <r@x>
117 lines
5.2 KiB
TypeScript
117 lines
5.2 KiB
TypeScript
import { describe, expect, mock, test } from 'claude-code/testing'
|
|
|
|
import { CATALOG_HOME } from './fixtures/plugin-catalog'
|
|
import { RUFLO_FILES } from './fixtures/ruflo-run'
|
|
import { command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'
|
|
|
|
import type { TestBody } from 'claude-code/testing'
|
|
|
|
type Body = Parameters<TestBody>
|
|
async function opened($: Body[0], on: Body[1]) {
|
|
const world = worldOf(on, RUFLO_FILES, { home: CATALOG_HOME })
|
|
|
|
mock.clock(on)
|
|
await $.session.start(SESSION)
|
|
await $.command.run(command('market'))
|
|
|
|
const pane = await $.ui.mount({ ...paneAt(150), surface: 'terminal' as const, plugin: PLUGIN })
|
|
|
|
await pane.drawn()
|
|
await pane.drawn()
|
|
|
|
return { world, pane }
|
|
}
|
|
|
|
describe('plugin catalog', () => {
|
|
test('opening reads the clone from disk: every plugin with its counts and state, nothing run, a climbing source skipped', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { world, pane } = await opened($, on)
|
|
const tree = await pane.drawn()
|
|
const text = textOf(tree)
|
|
|
|
expect(text).toContain('3 plugins · 2 installed')
|
|
expect(text).toContain('3 skills · 2 agents · 1 commands · 1 MCP · 2 mods')
|
|
expect(text).toContain('■ ruflo-core')
|
|
expect(text).toContain('· ruflo-mods')
|
|
expect(text).toContain('S2 A2 C1 MCP')
|
|
expect(text).not.toContain('ruflo-bad')
|
|
expect(elementsOf(tree, 'Button').map(keyOf)).toEqual(expect.arrayContaining(['cat-name-ruflo-core', 'cat-about-ruflo-core', 'cat-install-ruflo-mods', 'cat-mode-mods', 'cat-reload']))
|
|
expect(world.runs.filter(argv => argv[0] === 'claude')).toEqual([])
|
|
await pane.unmount()
|
|
})
|
|
|
|
test('modes and the filter narrow the list; the filter matches a skill name', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { pane } = await opened($, on)
|
|
|
|
await pane.press({ key: 'cat-mode-mods' })
|
|
expect(textOf(await pane.drawn())).toContain('2 shown')
|
|
expect(textOf(await pane.drawn())).not.toContain('ruflo-core ....')
|
|
await pane.press({ key: 'cat-mode-all' })
|
|
await pane.input({ key: 'cat-filter', text: 'doctor', kind: 'submit' })
|
|
|
|
const text = textOf(await pane.drawn())
|
|
|
|
expect(text).toContain('1 shown')
|
|
expect(text).toContain('ruflo-core')
|
|
await pane.unmount()
|
|
})
|
|
|
|
test('pressing a row opens its contents; ▸ view reads the skill file; ▸ use only types it into the terminal draft', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { world, pane } = await opened($, on)
|
|
|
|
await pane.press({ key: 'cat-name-ruflo-core' })
|
|
await pane.drawn()
|
|
|
|
let text = textOf(await pane.drawn())
|
|
|
|
expect(text).toContain('Skills')
|
|
expect(text).toContain('ruflo-doctor')
|
|
expect(text).toContain('Diagnose a ruflo install')
|
|
expect(text).toContain('reviewer')
|
|
expect(text).toContain('ruflo-init')
|
|
|
|
await pane.press({ key: 'cat-skill-ruflo-core-ruflo-doctor' })
|
|
await pane.drawn()
|
|
text = textOf(await pane.drawn())
|
|
expect(text).toContain('Step one: do the thing.')
|
|
|
|
await pane.press({ key: 'cat-use-ruflo-core-ruflo-doctor' })
|
|
text = textOf(await pane.drawn())
|
|
expect(text).toContain('TERMINAL')
|
|
const field = elementsOf(await pane.drawn(), 'Input').find(input => keyOf(input) === 'term-input') as { props?: { value?: string } } | undefined
|
|
|
|
expect(field?.props?.value).toContain('/ruflo-core:ruflo-doctor')
|
|
expect(world.runs.some(argv => argv[0] === 'claude' || argv[0] === 'codex')).toBe(false)
|
|
await pane.unmount()
|
|
})
|
|
|
|
test('install asks first with the exact argv and runs it once on yes; enable and disable follow the state', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { world, pane } = await opened($, on)
|
|
const claudeRuns = () => world.runs.filter(argv => argv[0] === 'claude')
|
|
|
|
await pane.press({ key: 'cat-install-ruflo-mods' })
|
|
|
|
const asked = textOf(await pane.drawn())
|
|
|
|
expect(asked).toContain('Confirm: install plugin ruflo-mods')
|
|
expect(asked).toContain('claude plugin install ruflo-mods@ruflo --scope user')
|
|
expect(asked).toContain('clones the plugin from the ruflo marketplace')
|
|
expect(claudeRuns()).toEqual([])
|
|
expect((await $.command.run(command('yes'))).text).toBeDefined()
|
|
expect(claudeRuns()).toEqual([['claude', 'plugin', 'install', 'ruflo-mods@ruflo', '--scope', 'user']])
|
|
|
|
// The enabled one offers disable, the installed-but-disabled one offers enable.
|
|
expect(elementsOf(await pane.drawn(), 'Button').map(keyOf)).toEqual(expect.arrayContaining(['cat-disable-ruflo-core', 'cat-enable-ruflo-swarm']))
|
|
await pane.unmount()
|
|
})
|
|
|
|
test('a name outside the catalog is refused headless; a listed one asks with its argv', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { world, pane } = await opened($, on)
|
|
|
|
expect((await $.command.run(command('run catalog-install ruflo-nope'))).text).toMatch(/not in the ruflo catalog|nothing to do/)
|
|
expect(world.runs.filter(argv => argv[0] === 'claude')).toEqual([])
|
|
expect((await $.command.run(command('run catalog-update ruflo-core'))).text).toContain('Asked: update plugin ruflo-core')
|
|
expect(world.runs.filter(argv => argv[0] === 'claude')).toEqual([])
|
|
await pane.unmount()
|
|
})
|
|
})
|