mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 06:36:49 +09:00
Merge remote-tracking branch 'origin/main' into feat/anatole-plugin
This commit is contained in:
commit
f63a849e4e
5 files changed
+97
-20
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ruflo-console",
|
||||
"description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings → Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",
|
||||
"version": "0.33.19",
|
||||
"version": "0.33.20",
|
||||
"author": {
|
||||
"name": "ruvnet",
|
||||
"url": "https://github.com/ruvnet"
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest
|
||||
* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.
|
||||
*/
|
||||
export const CONSOLE_VERSION = '0.33.19'
|
||||
export const CONSOLE_VERSION = '0.33.20'
|
||||
@@ -368,25 +368,38 @@ export function confirmRow(ctx: Ctx): RenderElement | null {
|
||||
)
|
||||
}
|
||||
|
||||
return col(
|
||||
ctx,
|
||||
[
|
||||
text(ctx, '▶ CONFIRM NEEDED — click Yes or press y', { bold: true, color: THEME.warn }),
|
||||
text(ctx, `Confirm: ${askedBy(pending)}${pending.label.replace(/\?+$/, '')}?`, { bold: true, color: THEME.warn }),
|
||||
// One bordered card in the warning colour: the person says yes to everything in it, so it reads as a unit, not as loose lines. Its border and
|
||||
// padding take four columns, so the text inside is clipped to the narrower width.
|
||||
const inner: Ctx = { ...ctx, columns: Math.max(20, ctx.columns - 4) }
|
||||
const hasMoney = pending.note !== undefined && /money|models/i.test(pending.note)
|
||||
|
||||
return ctx.kit.Box({
|
||||
key: 'confirm',
|
||||
flexDirection: 'column',
|
||||
borderStyle: 'round',
|
||||
borderColor: THEME.warn,
|
||||
paddingX: 1,
|
||||
children: [
|
||||
row(ctx, [ctx.kit.Text({ bold: true, color: THEME.warn, children: '▶ CONFIRM NEEDED' }), ctx.kit.Text({ dimColor: true, children: ' click Yes or press y' })]),
|
||||
text(inner, '─'.repeat(inner.columns), { dimColor: true }),
|
||||
text(inner, `Confirm: ${askedBy(pending)}${pending.label.replace(/\?+$/, '')}?`, { bold: true, color: THEME.warn }),
|
||||
// Wrapped, not clipped: the person says yes to the whole argv, so all of it shows (a JSON argument runs long).
|
||||
ctx.kit.Text({ dimColor: true, wrap: 'wrap', children: `runs: ${pending.shows ?? `ruflo ${pending.args.join(' ')}`}` }),
|
||||
...(pending.note !== undefined ? [text(ctx, pending.note, { bold: /money|models/i.test(pending.note), color: /money|models/i.test(pending.note) ? THEME.bad : THEME.warn })] : []),
|
||||
row(ctx, [
|
||||
button(ctx, 'confirm', 'Yes, run it (y)', ctx.act.confirm, { hotkey: 'y', primary: true }),
|
||||
button(ctx, 'cancel', 'Cancel (n)', ctx.act.cancel, { hotkey: 'n' }),
|
||||
// A low-risk ruflo action may be remembered: it is not asked again (Settings lists and forgets it).
|
||||
...(pending.rememberKey !== undefined ? [button(ctx, 'remember', `Always allow “${pending.rememberKey}”`, () => ctx.act.remember())] : []),
|
||||
// An AI terminal turn (claude -p in plan mode, codex read-only, the budget cap) may be always accepted: Settings resets it.
|
||||
...(ctx.state.terminal.asked !== null && pending.label === ctx.state.terminal.asked.label && ctx.state.terminal.harness !== 'ruflo' ? [button(ctx, 'always', 'Always accept AI turns', () => ctx.act.settings.alwaysAccept())] : []),
|
||||
]),
|
||||
...(pending.note !== undefined ? [ctx.kit.Text({ wrap: 'wrap', bold: hasMoney, color: hasMoney ? THEME.bad : THEME.warn, children: `Effect: ${pending.note}` })] : []),
|
||||
ctx.kit.Box({
|
||||
flexDirection: 'row',
|
||||
marginTop: 1,
|
||||
children: [
|
||||
button(ctx, 'confirm', 'Yes, run it (y)', ctx.act.confirm, { hotkey: 'y', primary: true }),
|
||||
button(ctx, 'cancel', 'Cancel (n)', ctx.act.cancel, { hotkey: 'n' }),
|
||||
// A low-risk ruflo action may be remembered: it is not asked again (Settings lists and forgets it).
|
||||
...(pending.rememberKey !== undefined ? [button(ctx, 'remember', `Always allow “${pending.rememberKey}”`, () => ctx.act.remember())] : []),
|
||||
// An AI terminal turn (claude -p in plan mode, codex read-only, the budget cap) may be always accepted: Settings resets it.
|
||||
...(ctx.state.terminal.asked !== null && pending.label === ctx.state.terminal.asked.label && ctx.state.terminal.harness !== 'ruflo' ? [button(ctx, 'always', 'Always accept AI turns', () => ctx.act.settings.alwaysAccept())] : []),
|
||||
],
|
||||
}),
|
||||
],
|
||||
'confirm',
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/** Views that draw the confirm themselves, under the field it came from (the pane then does not draw it above the body). */
|
||||
|
||||
@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }
|
||||
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
|
||||
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
|
||||
|
||||
step "1. plugin.json declares ruflo-console 0.33.19"
|
||||
step "1. plugin.json declares ruflo-console 0.33.20"
|
||||
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
|
||||
&& grep -q '"version": "0.33.19"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
|
||||
&& grep -q '"version": "0.33.20"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
|
||||
|
||||
step "2. hooks.json names exactly one module and no classic hook commands"
|
||||
grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* The ask-first confirm is one bordered card in the warning colour: a header, a rule, what is being asked, the exact command, the effect, and
|
||||
* the buttons set apart. Layout only: the strings the kit tests read (CONFIRM NEEDED, Confirm: …?, runs: …) are unchanged.
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { newState } from '../hooks/state'
|
||||
import { confirmRow, THEME, type Ctx } from '../hooks/views/common'
|
||||
|
||||
type El = { kind: string; props: Record<string, unknown> }
|
||||
const make = (kind: string) => (props: Record<string, unknown>): El => ({ kind, props })
|
||||
const kit = { Box: make('Box'), Text: make('Text'), Button: make('Button'), Input: make('Input') }
|
||||
const act = new Proxy({}, { get: () => () => undefined }) as unknown as Ctx['act']
|
||||
const flat = (node: unknown): El[] => {
|
||||
if (typeof node !== 'object' || node === null) return []
|
||||
const el = node as El
|
||||
const children = el.props.children
|
||||
|
||||
return [el, ...(Array.isArray(children) ? children.flatMap(flat) : flat(children))]
|
||||
}
|
||||
const draw = (note?: string, columns = 100): El => {
|
||||
const state = newState({ boot: false })
|
||||
|
||||
state.pending = { label: 'start a loop in the main Claude UI: /loop do things', args: ['x'], expect: 'e', askedAtMs: 1, ...(note !== undefined && { note }) }
|
||||
|
||||
return confirmRow({ kit, state, act, columns, nowMs: 1_000, pictures: new Map() } as unknown as Ctx) as unknown as El
|
||||
}
|
||||
const texts = (card: El): string[] => flat(card).filter(el => el.kind === 'Text').map(el => String(el.props.children))
|
||||
|
||||
describe('the confirm card', () => {
|
||||
it('is one round bordered box in the warning colour', () => {
|
||||
const card = draw()
|
||||
|
||||
expect(card.kind).toBe('Box')
|
||||
expect(card.props).toMatchObject({ key: 'confirm', borderStyle: 'round', borderColor: THEME.warn })
|
||||
})
|
||||
|
||||
it('keeps the strings the kit tests read, and puts a rule under the header', () => {
|
||||
const lines = texts(draw('Starts a recurring loop; edits nothing.'))
|
||||
|
||||
expect(lines).toContain('▶ CONFIRM NEEDED')
|
||||
expect(lines.some(line => line.startsWith('Confirm: start a loop in the main Claude UI'))).toBe(true)
|
||||
expect(lines).toContain('runs: ruflo x')
|
||||
expect(lines).toContain('Effect: Starts a recurring loop; edits nothing.')
|
||||
expect(lines.some(line => /^─+$/.test(line))).toBe(true)
|
||||
})
|
||||
|
||||
it('clips its lines to the width inside the border, and sets the buttons apart', () => {
|
||||
const card = draw(undefined, 60)
|
||||
const rule = texts(card).find(line => /^─+$/.test(line)) ?? ''
|
||||
const buttons = flat(card).filter(el => el.kind === 'Button').map(el => String(el.props.key))
|
||||
const buttonBox = flat(card).find(el => el.kind === 'Box' && el.props.marginTop === 1)
|
||||
|
||||
expect(rule.length).toBeLessThanOrEqual(56)
|
||||
expect(buttons).toEqual(expect.arrayContaining(['confirm', 'cancel']))
|
||||
expect(buttonBox).toBeDefined()
|
||||
})
|
||||
|
||||
it('shows a money or model effect in the alarm colour', () => {
|
||||
const effect = flat(draw('Spends money on a model turn.')).find(el => el.kind === 'Text' && String(el.props.children).startsWith('Effect:'))
|
||||
|
||||
expect(effect?.props).toMatchObject({ bold: true, color: THEME.bad })
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user