Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

feat(ruflo-console): link Plugins, Plugin Catalog and Launch; format the Launch section like the menu cards (ADR-434)

ruv9657e1aec528
diff --git a/plugins/ruflo-console/hooks/bindings.ts b/plugins/ruflo-console/hooks/bindings.ts
index 1f69102665..b427790df9 100644
--- a/plugins/ruflo-console/hooks/bindings.ts
+++ b/plugins/ruflo-console/hooks/bindings.ts
@@ -203,7 +203,7 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps
host.invalidate()
},
focus: key => void host.focus(PANE_ID, key).catch(() => undefined),
- plugin: (op, name = '') => runner.ask(pluginSpec(op, name), 'that plugin name cannot be passed'),
+ plugin: op => runner.ask(pluginSpec(op), 'that cannot run here'),
start: (id, text = '') => runner.ask(startSpec(id, Date.now(), text), id === 'mission' || id === 'task' ? 'type it first (it may not start with -)' : 'that start cannot run here'),
// The main menu's prompt, as a board's: a key (2, w, i), a name (swarm, x.ruv.io), ? for help, O to log off.
menu: text => {
diff --git a/plugins/ruflo-console/hooks/plugin-ops.ts b/plugins/ruflo-console/hooks/plugin-ops.ts
index eef36e888c..ea3778904f 100644
--- a/plugins/ruflo-console/hooks/plugin-ops.ts
+++ b/plugins/ruflo-console/hooks/plugin-ops.ts
@@ -1,45 +1,22 @@
/**
- * What the Plugins page can do to a ruflo plugin or to the marketplace, as asks: each is one fixed `claude plugin ...` argv (verbs
- * checked against `claude plugin --help`), shown on the confirm row before it runs, never a ruflo CLI call. The plugin name is one
- * word from the marketplace clone's listing, validated here, and always qualified with the ruflo marketplace so another marketplace's
- * plugin of the same name is never touched. Tested in tests/plugin-ops.spec.ts.
+ * What the Plugins page can do about the marketplace, as an ask: one fixed `claude plugin marketplace update ruflo` argv (checked against
+ * `claude plugin --help`), shown on the confirm row before it runs. Installing, updating, enabling, disabling and removing a plugin are
+ * the Plugin Catalog's (plugin-catalog.ts): one place for them, which every page that names a plugin links to. Tested in tests/plugin-ops.spec.ts.
*/
import type { ActionSpec } from './actions'
-export type PluginOp = 'install' | 'update' | 'enable' | 'disable' | 'refresh'
+export type PluginOp = 'refresh'
const MARKET = 'ruflo'
-const NAME = /^[a-z0-9][a-z0-9._-]{0,59}$/
-
-export const PLUGIN_OP_LABEL: Record<PluginOp, string> = { install: 'install', update: 'update', enable: 'enable', disable: 'disable', refresh: 'update the marketplace' }
-
-/** The ask for `op` on `name` (ignored by `refresh`), or null when the name is not one word of the shape a plugin has. */
-export function pluginSpec(op: PluginOp, name = ''): ActionSpec | null {
- if (op === 'refresh') {
- return {
- label: `update the ${MARKET} marketplace clone (git pull of the plugin list: network)`,
- args: [],
- argv: ['claude', 'plugin', 'marketplace', 'update', MARKET],
- shows: `claude plugin marketplace update ${MARKET}`,
- expect: 'a newer clone of the ruflo marketplace',
- note: 'NETWORK: pulls the marketplace from GitHub',
- timeoutMs: 120_000,
- }
- }
-
- if (!NAME.test(name)) return null
-
- const id = `${name}@${MARKET}`
- const label = { install: `install ${id} (writes Claude Code's plugin records; network)`, update: `update ${id} (network)`, enable: `enable ${id}`, disable: `disable ${id}` }[op]
+export function pluginSpec(_op: PluginOp): ActionSpec {
return {
- label,
+ label: `update the ${MARKET} marketplace clone (git pull of the plugin list: network)`,
args: [],
- argv: ['claude', 'plugin', op, id],
- shows: `claude plugin ${op} ${id}`,
- expect: op === 'install' ? `${id} in the installed plugins` : `${id} ${op}d`,
- note: op === 'install' || op === 'update' ? 'NETWORK: fetches the plugin; it loads in the next session' : 'takes effect in the next session',
- ...(op === 'install' && { verify: snapshot => (snapshot.plugins.installed ?? []).some(plugin => plugin.id === id) }),
+ argv: ['claude', 'plugin', 'marketplace', 'update', MARKET],
+ shows: `claude plugin marketplace update ${MARKET}`,
+ expect: 'a newer clone of the ruflo marketplace',
+ note: 'NETWORK: pulls the marketplace from GitHub',
timeoutMs: 120_000,
}
}
diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.ts
index c4dea12ca0..1d7f87a22f 100644
--- a/plugins/ruflo-console/hooks/views/common.ts
+++ b/plugins/ruflo-console/hooks/views/common.ts
@@ -66,8 +66,8 @@ export type Actions = {
/** Puts the keys in one of the pane's fields by its key (a row that takes text focuses its field). */
focus: (key: string) => void
start: (id: StartId, text?: string) => void
- /** A plugin or marketplace operation on the Plugins page: asks first, then runs one `claude plugin` command. */
- plugin: (op: PluginOp, name?: string) => void
+ /** The marketplace update on the Plugins and Plugin Catalog pages: asks first, then runs one `claude plugin` command. */
+ plugin: (op: PluginOp) => void
/** The main menu's prompt: a key or a name takes the person to that area. */
menu: (text: string) => void
term: { harness: (id: HarnessId) => void; draft: (text: string) => void; submit: (text: string) => void; stop: () => void; fresh: () => void; clear: () => void; load: (id: HarnessId, text: string) => void; /** A click on an ask link: opens the terminal, picks the agent and sends the text at once (read-only, plan mode, the saved per-turn budget): the reply streams in with no second click. */ ask: (id: HarnessId, text: string) => void; /** Moves the window up (positive) or down by screen rows. */ scroll: (by: number) => void; /** Puts an earlier question back in the field. */ reuse: (text: string) => void }
diff --git a/plugins/ruflo-console/hooks/views/launch.ts b/plugins/ruflo-console/hooks/views/launch.ts
index 60b3b9daff..3865c5d292 100644
--- a/plugins/ruflo-console/hooks/views/launch.ts
+++ b/plugins/ruflo-console/hooks/views/launch.ts
@@ -3,13 +3,13 @@ import type { RenderElement } from 'claude-code'
import { launchOf } from '../ask-claude'
import { VIEWS } from '../state'
import { clip, row, section, text, THEME, type Ctx } from './common'
-
-const noteOf = (plugin: string): string => plugin.replace(/^ruflo-?/, '') || plugin
+import { openInCatalog } from './links'
/**
* The Launch section at the foot of a page: the slash commands of the ruflo plugins this section owns, each a button that asks first
- * and then runs in the main Claude UI (mid-turn it only fills the prompt box). Folded by default; nothing is drawn when the session
- * lists no command for this section's plugins.
+ * and then runs in the main Claude UI (mid-turn it only fills the prompt box). Laid out like the menu's cards: a dim `── plugin ──` rule
+ * per plugin (with a link to its entry in the Plugin Catalog), then one dotted-leader row per command ending in a primary ▶ run.
+ * Folded by default; nothing is drawn when the session lists no command for this section's plugins.
*/
export function launchRows(ctx: Ctx): RenderElement[] {
const view = ctx.state.view
@@ -21,14 +21,23 @@ export function launchRows(ctx: Ctx): RenderElement[] {
if (groups.length === 0) return []
const total = groups.reduce((sum, group) => sum + group.slashes.length, 0)
+ // Room for the card's border and padding, the leader and the run button.
+ const lead = Math.max(24, Math.min(56, ctx.columns - 20))
const body = groups.flatMap(group => [
- ctx.kit.Text({ bold: true, color: THEME.ok, children: ` ${noteOf(group.plugin)}` }),
+ row(
+ ctx,
+ [
+ ctx.kit.Text({ color: THEME.info, dimColor: true, children: clip(`── ${group.plugin} ${'─'.repeat(Math.max(0, lead - group.plugin.length - 4))}`, lead + 2) }),
+ ctx.kit.Button({ key: `launch-cat-${group.plugin}`, label: ' ▸ in the catalog ', plain: true, dimColor: true, onPress: () => openInCatalog(ctx, group.plugin) }),
+ ],
+ `launch-head-${group.plugin}`,
+ ),
...group.slashes.map(slash =>
row(
ctx,
[
- ctx.kit.Button({ key: `launch-${slash}`, label: ` /${clip(slash, Math.max(20, ctx.columns - 24))} `, plain: true, onPress: () => ctx.act.ask.launch(slash) }),
- ctx.kit.Button({ key: `launch-run-${slash}`, label: ' ▸ run', plain: true, dimColor: true, onPress: () => ctx.act.ask.launch(slash) }),
+ ctx.kit.Button({ key: `launch-${slash}`, label: clip(` /${slash} `, lead).padEnd(lead, '.'), plain: true, onPress: () => ctx.act.ask.launch(slash) }),
+ ctx.kit.Button({ key: `launch-run-${slash}`, label: ' ▶ run ', variant: 'primary', onPress: () => ctx.act.ask.launch(slash) }),
],
`launch-row-${slash}`,
),
diff --git a/plugins/ruflo-console/hooks/views/links.ts b/plugins/ruflo-console/hooks/views/links.ts
new file mode 100644
index 0000000000..80569b992b
--- /dev/null
+++ b/plugins/ruflo-console/hooks/views/links.ts
@@ -0,0 +1,17 @@
+import { homeOf } from '../plugin-map'
+import { VIEWS, type ViewId } from '../state'
+import type { Ctx } from './common'
+
+/** Opens the Plugin Catalog with `plugin` selected: the one way every page that names a plugin links to it. */
+export function openInCatalog(ctx: Ctx, plugin: string): void {
+ ctx.act.view('market')
+ ctx.act.catalog.select(plugin)
+}
+
+/** The console section that launches a plugin's commands (Swarm, Security, …), or null for a plugin no section owns. */
+export function homeLink(plugin: string): { view: ViewId; label: string } | null {
+ const view = homeOf(plugin)
+ const entry = view === null ? undefined : VIEWS.find(candidate => candidate.id === view)
+
+ return view === null || entry === undefined ? null : { view, label: entry.label }
+}
diff --git a/plugins/ruflo-console/hooks/views/plugin-catalog.ts b/plugins/ruflo-console/hooks/views/plugin-catalog.ts
index 7c6c9922ca..71199b3abb 100644
--- a/plugins/ruflo-console/hooks/views/plugin-catalog.ts
+++ b/plugins/ruflo-console/hooks/views/plugin-catalog.ts
@@ -2,7 +2,9 @@ import type { RenderElement } from 'claude-code'
import { catalogOf, installedOf, listOf, MODES, PAGE, type Verb } from '../plugin-catalog'
import type { CatalogPlugin } from '../data/plugin-catalog'
-import { button, clip, col, kv, row, rule, section, text, THEME, type Ctx } from './common'
+import { RUFLO_MARKET } from '../data/snapshot'
+import { ago, button, clip, col, kv, row, rule, section, text, THEME, type Ctx } from './common'
+import { homeLink } from './links'
/** The ▸ verb a row ends with: install when absent, else enable or disable. */
function verbOf(ctx: Ctx, plugin: CatalogPlugin): { verb: Verb; label: string } {
@@ -61,6 +63,13 @@ function detailRows(ctx: Ctx, plugin: CatalogPlugin): RenderElement[] {
rows.push(row(ctx, verbs.map(verb => button(ctx, `cat-do-${verb}-${plugin.name}`, verb, () => ctx.act.catalog.change(verb, plugin.name))), `cat-verbs-${plugin.name}`))
+ // How this plugin relates to the rest of the console: the section that launches its commands, and the setup's health.
+ const home = homeLink(plugin.name)
+
+ rows.push(
+ row(ctx, [text(ctx, ' related ', { dimColor: true }), ...(home === null ? [] : [button(ctx, `cat-home-${plugin.name}`, `→ ${home.label}: its commands (Launch)`, () => ctx.act.view(home.view))]), button(ctx, `cat-health-${plugin.name}`, '→ Plugins: setup health', () => ctx.act.view('plugins'))], `cat-related-${plugin.name}`),
+ )
+
if (plugin.isMod) rows.push(text(ctx, ' MOD: function hooks run in the engine once this plugin is loaded (trust it like code you run)', { color: THEME.warn }))
if (plugin.hasMcp) rows.push(text(ctx, ' MCP: ships an .mcp.json: its servers start with the plugin', { dimColor: true }))
@@ -110,6 +119,21 @@ export function catalogView(ctx: Ctx): RenderElement {
rows.push(rule(ctx, 'Plugin Catalog', `${all.length} plugins · ${installed.size} installed · ${enabled.size} enabled`))
rows.push(text(ctx, ` ${total(plugin => plugin.skills.length)} skills · ${total(plugin => plugin.agents.length)} agents · ${total(plugin => plugin.commands.length)} commands · ${all.filter(plugin => plugin.hasMcp).length} MCP · ${all.filter(plugin => plugin.isMod).length} mods · ■ enabled □ installed · not installed`, { dimColor: true }))
+ // The marketplace these come from: how fresh the clone is, with the way back to the Plugins page (the setup's health) and the update.
+ const market = state.snapshot?.plugins.markets?.find(entry => entry.name === RUFLO_MARKET)
+ const isStale = (state.snapshot?.plugins.missingFromClone.length ?? 0) > 0
+
+ rows.push(
+ row(
+ ctx,
+ [
+ text(ctx, market === undefined ? ' marketplace not added ' : ` clone pulled ${ago(market.updatedMs, ctx.nowMs)}${isStale ? ' · STALE' : ''} `, { color: market === undefined || isStale ? THEME.warn : THEME.ok }),
+ button(ctx, 'cat-health', '◂ Plugins: health', () => ctx.act.view('plugins')),
+ button(ctx, 'cat-refresh', '↻ update marketplace', () => ctx.act.plugin('refresh'), isStale ? { primary: true } : {}),
+ ],
+ 'cat-health-row',
+ ),
+ )
rows.push(
row(
ctx,
diff --git a/plugins/ruflo-console/hooks/views/plugins.ts b/plugins/ruflo-console/hooks/views/plugins.ts
index 14ac45a86a..86c3e05a9e 100644
--- a/plugins/ruflo-console/hooks/views/plugins.ts
+++ b/plugins/ruflo-console/hooks/views/plugins.ts
@@ -3,6 +3,7 @@ import type { RenderElement } from 'claude-code'
import { EXPECTED_IN_MARKET, RUFLO_MARKET } from '../data/snapshot'
import { PLUGIN_NAME } from '../state'
import { ago, button, col, kv, picture, row, rule, section, starts, text, THEME, type Ctx } from './common'
+import { homeLink, openInCatalog } from './links'
const WEEK = 7 * 86_400_000
@@ -59,22 +60,29 @@ export function pluginsView(ctx: Ctx): RenderElement {
if (gone.length > 0) rows.push(text(ctx, `installed but gone from the clone: ${gone.map(plugin => plugin.name).join(', ')}`, { color: THEME.warn }))
- // Each installed ruflo plugin: its state and the two things worth doing to it. The marketplace's other plugins can be installed from here.
+ // Each installed ruflo plugin: its state, the console section that launches its commands, and a link to its entry in the Plugin Catalog,
+ // where it is installed, updated, enabled, disabled or removed (this page is for the health of the setup, the catalog for the plugins).
if (ruflo.length > 0) {
rows.push(
...section(
ctx,
'plg-installed',
'Installed plugins',
- `${ruflo.length} · update, enable, disable`,
+ `${ruflo.length} · open one in the catalog`,
ruflo.map(plugin => {
const isOn = facts.enabled.has(plugin.id)
-
- return row(ctx, [
- text(ctx, ` ${isOn ? '●' : '○'} ${plugin.name.padEnd(26)} ${plugin.version.padEnd(10)}`, { color: isOn ? THEME.ok : undefined, dimColor: !isOn }),
- button(ctx, `plg-update-${plugin.name}`, 'update', () => ctx.act.plugin('update', plugin.name)),
- button(ctx, `plg-toggle-${plugin.name}`, isOn ? 'disable' : 'enable', () => ctx.act.plugin(isOn ? 'disable' : 'enable', plugin.name)),
- ])
+ const home = homeLink(plugin.name)
+
+ return row(
+ ctx,
+ [
+ text(ctx, ` ${isOn ? '●' : '○'} `, { color: isOn ? THEME.ok : undefined, dimColor: !isOn }),
+ ctx.kit.Button({ key: `plg-open-${plugin.name}`, label: `${plugin.name} `.padEnd(28, '.'), plain: true, onPress: () => openInCatalog(ctx, plugin.name) }),
+ text(ctx, ` ${plugin.version.padEnd(10)}`, { dimColor: true }),
+ ...(home === null ? [] : [ctx.kit.Button({ key: `plg-home-${plugin.name}`, label: ` → ${home.label} `, plain: true, dimColor: true, onPress: () => ctx.act.view(home.view) })]),
+ ],
+ `plg-row-${plugin.name}`,
+ )
}),
false,
),
@@ -87,8 +95,8 @@ export function pluginsView(ctx: Ctx): RenderElement {
if (market !== null && available.length > 0) {
rows.push(
...section(ctx, 'plg-available', 'Available to install', `${available.length} in the marketplace`, [
- ...available.slice(0, 12).map(name => row(ctx, [text(ctx, ` ○ ${name.padEnd(30)}`, { dimColor: true }), button(ctx, `plg-install-${name}`, 'install', () => ctx.act.plugin('install', name))])),
- ...(available.length > 12 ? [text(ctx, ` +${available.length - 12} more: the Plugin Catalog lists every one`, { dimColor: true })] : []),
+ ...available.slice(0, 12).map(name => row(ctx, [text(ctx, ' ○ ', { dimColor: true }), ctx.kit.Button({ key: `plg-avail-${name}`, label: `${name} `.padEnd(30, '.'), plain: true, onPress: () => openInCatalog(ctx, name) }), text(ctx, ' ▸ install it there', { dimColor: true })], `plg-avail-row-${name}`)),
+ ...(available.length > 12 ? [text(ctx, ` +${available.length - 12} more in the Plugin Catalog`, { dimColor: true })] : []),
], ruflo.length === 0),
)
}
diff --git a/plugins/ruflo-console/tests/plugin-links.spec.ts b/plugins/ruflo-console/tests/plugin-links.spec.ts
new file mode 100644
index 0000000000..34a95a2b0f
--- /dev/null
+++ b/plugins/ruflo-console/tests/plugin-links.spec.ts
@@ -0,0 +1,149 @@
+/**
+ * The Plugins page, the Plugin Catalog and the Launch section are linked to each other (ADR-434): a plugin named on one opens in the
+ * catalog, the catalog links back to the health page and to the section that launches a plugin, and Launch rows share one layout.
+ * Buttons are pressed through a recording `act`. Run with
+ * npx vitest run plugins/ruflo-console/tests/plugin-links.spec.ts
+ */
+import { describe, expect, it } from 'vitest'
+
+import { homeOf } from '../hooks/plugin-map'
+import { catalogOf } from '../hooks/plugin-catalog'
+import { newState, type State } from '../hooks/state'
+import type { Ctx } from '../hooks/views/common'
+import { launchRows } from '../hooks/views/launch'
+import { catalogView } from '../hooks/views/plugin-catalog'
+import { pluginsView } from '../hooks/views/plugins'
+
+type El = { props: Record<string, unknown> }
+
+const calls: string[] = []
+const recorder = (path: string): unknown =>
+ new Proxy(() => undefined, {
+ get: (_t, key) => (key === 'then' ? undefined : recorder(`${path}.${String(key)}`)),
+ apply: (_t, _this, args) => void calls.push(`${path.slice(1)}(${args.join(',')})`),
+ })
+const act = recorder('') as never
+const kit = { Box: (props: Record<string, unknown>): El => ({ props }), Text: (props: Record<string, unknown>): El => ({ props }), Button: (props: Record<string, unknown>): El => ({ props }), Input: (props: Record<string, unknown>): El => ({ props }) }
+const ctxOf = (state: State, columns = 120): Ctx => ({ kit, state, nowMs: Date.now(), columns, pictures: new Map(), act, cards: true }) as unknown as Ctx
+const flat = (el: unknown): El[] => {
+ const node = el as El
+
+ if (typeof node !== 'object' || node === null) return []
+
+ const kids = node.props.children
+
+ return [node, ...(Array.isArray(kids) ? kids.flatMap(flat) : typeof kids === 'object' ? flat(kids) : [])]
+}
+const button = (tree: unknown, key: string): El | undefined => flat(tree).find(node => node.props.key === key)
+const press = (node: El | undefined): void => (node?.props.onPress as () => void)()
+
+const withPlugins = (): State => {
+ const state = newState({})
+
+ state.view = 'plugins'
+ state.configDir = '/home/u/.claude'
+ state.snapshot = {
+ isRufloProject: false,
+ plugins: {
+ installed: [{ id: 'ruflo-core@ruflo', name: 'ruflo-core', marketplace: 'ruflo', version: '1.0.0', scope: 'user' }],
+ enabled: new Set(['ruflo-core@ruflo']),
+ markets: [{ name: 'ruflo', location: '/m/ruflo', updatedMs: Date.now(), isAutoUpdate: true }],
+ rufloOffered: ['ruflo-core', 'ruflo-swarm'],
+ missingFromClone: [],
+ },
+ } as never
+ state.sections.add('plugins/plg-installed')
+ state.sections.add('plugins/plg-available')
+
+ return state
+}
+
+describe('the Plugins page links to the catalog', () => {
+ it('a plugin name opens that plugin in the catalog, installed or not, and its home section opens', () => {
+ calls.length = 0
+
+ const tree = pluginsView(ctxOf(withPlugins()))
+
+ press(button(tree, 'plg-open-ruflo-core'))
+ press(button(tree, 'plg-avail-ruflo-swarm'))
+
+ expect(calls).toEqual(['view(market)', 'catalog.select(ruflo-core)', 'view(market)', 'catalog.select(ruflo-swarm)'])
+ expect(homeOf('ruflo-core')).not.toBeNull()
+ expect(button(tree, 'plg-home-ruflo-core')).toBeDefined()
+ })
+
+ it('has no install, enable or disable of its own: those are the catalog\'s', () => {
+ const keys = flat(pluginsView(ctxOf(withPlugins()))).map(node => String(node.props.key))
+
+ expect(keys.filter(key => /^plg-(install|update|toggle)/.test(key))).toEqual([])
+ expect(keys).toContain('plg-refresh')
+ })
+})
+
+describe('the catalog links back', () => {
+ const loaded = (): State => {
+ const state = withPlugins()
+
+ state.view = 'market'
+
+ const catalog = catalogOf(state)
+
+ catalog.plugins = [{ name: 'ruflo-core', description: 'core', skills: [], agents: [], commands: [], hasMcp: false, isMod: false, options: [] }] as never
+ catalog.selected = 'ruflo-core'
+
+ return state
+ }
+
+ it('shows the clone\'s health, with a way to the Plugins page and to update the marketplace', () => {
+ calls.length = 0
+
+ const tree = catalogView(ctxOf(loaded()))
+
+ press(button(tree, 'cat-health'))
+ press(button(tree, 'cat-refresh'))
+
+ expect(calls).toEqual(['view(plugins)', 'plugin(refresh)'])
+ expect(flat(tree).some(node => String(node.props.children ?? '').includes('clone pulled'))).toBe(true)
+ })
+
+ it('a plugin\'s detail links to the section that launches it and to the health page', () => {
+ calls.length = 0
+
+ const tree = catalogView(ctxOf(loaded()))
+
+ press(button(tree, 'cat-home-ruflo-core'))
+ press(button(tree, 'cat-health-ruflo-core'))
+
+ expect(calls[1]).toBe('view(plugins)')
+ expect(calls[0]).toMatch(/^view\(/)
+ })
+})
+
+describe('the Launch section is laid out like the menu cards', () => {
+ const launching = (): State => {
+ const state = newState({})
+ const view = homeOf('ruflo-plugin-creator')
+
+ state.view = view ?? 'settings'
+ state.commandNames = ['ruflo-plugin-creator:create-plugin', 'ruflo-plugin-creator:validate-plugin']
+ state.sections.add(`${state.view}/launch`)
+
+ return state
+ }
+
+ it('gives every command the same width, a primary run button, and a link to the plugin in the catalog', () => {
+ calls.length = 0
+
+ const tree = launchRows(ctxOf(launching()))
+ const nodes = tree.flatMap(flat)
+ const slashes = nodes.filter(node => String(node.props.key).startsWith('launch-/') || /^launch-ruflo-plugin-creator:/.test(String(node.props.key)))
+ const runs = nodes.filter(node => String(node.props.key).startsWith('launch-run-'))
+
+ expect(runs.length).toBe(2)
+ expect(runs.every(node => node.props.variant === 'primary' && node.props.label === ' ▶ run ')).toBe(true)
+ expect(new Set(slashes.map(node => String(node.props.label).length)).size).toBe(1)
+
+ press(nodes.find(node => node.props.key === 'launch-cat-ruflo-plugin-creator'))
+ expect(calls).toEqual(['view(market)', 'catalog.select(ruflo-plugin-creator)'])
+ })
+})
diff --git a/plugins/ruflo-console/tests/plugin-ops.spec.ts b/plugins/ruflo-console/tests/plugin-ops.spec.ts
index 34ffcc946a..782c479317 100644
--- a/plugins/ruflo-console/tests/plugin-ops.spec.ts
+++ b/plugins/ruflo-console/tests/plugin-ops.spec.ts
@@ -17,24 +17,13 @@ const act = (() => {
})() as never
describe('pluginSpec', () => {
- it('is one fixed claude plugin argv, qualified with the ruflo marketplace', () => {
- expect(pluginSpec('install', 'ruflo-core')?.argv).toEqual(['claude', 'plugin', 'install', 'ruflo-core@ruflo'])
- expect(pluginSpec('disable', 'ruflo-swarm')?.argv).toEqual(['claude', 'plugin', 'disable', 'ruflo-swarm@ruflo'])
- expect(pluginSpec('update', 'ruflo-mods')?.shows).toBe('claude plugin update ruflo-mods@ruflo')
- expect(pluginSpec('refresh')?.argv).toEqual(['claude', 'plugin', 'marketplace', 'update', 'ruflo'])
- })
-
- it('refuses a name that is not one plugin-shaped word, so nothing can be smuggled into the argv', () => {
- for (const bad of ['', 'a b', 'x;whoami', '--scope', '-y', 'a@evil', '../x', '$(id)', 'A'.repeat(61)]) expect(pluginSpec('install', bad), bad).toBeNull()
- })
-
- it('verifies an install against the installed records, and notes that the network is touched', () => {
- const spec = pluginSpec('install', 'ruflo-core')
- const snapshot = (ids: string[]) => ({ plugins: { installed: ids.map(id => ({ id })) } }) as never
+ it('is one fixed claude plugin marketplace update argv, asks first, and says it uses the network', () => {
+ const spec = pluginSpec('refresh')
- expect(spec?.verify?.(snapshot(['ruflo-core@ruflo']))).toBe(true)
- expect(spec?.verify?.(snapshot(['ruflo-core@other']))).toBe(false)
- expect(spec?.note).toContain('NETWORK')
+ expect(spec.argv).toEqual(['claude', 'plugin', 'marketplace', 'update', 'ruflo'])
+ expect(spec.shows).toBe('claude plugin marketplace update ruflo')
+ expect(spec.isReadOnly).toBeUndefined()
+ expect(spec.note).toContain('NETWORK')
})
})
diff --git a/v3/docs/adr/ADR-434-console-plugins-page-detects-marketplace-and-acts.md b/v3/docs/adr/ADR-434-console-plugins-page-detects-marketplace-and-acts.md
index 20ec5bf2d5..315dca1c5b 100644
--- a/v3/docs/adr/ADR-434-console-plugins-page-detects-marketplace-and-acts.md
+++ b/v3/docs/adr/ADR-434-console-plugins-page-detects-marketplace-and-acts.md
@@ -10,13 +10,15 @@ Scope: `plugins/ruflo-console`: `hooks/plugin-ops.ts` (new), `hooks/views/plugin
The page's "Start here: get the ruflo plugins" card showed "1. Add the ruflo marketplace" as the next step even when the marketplace was added. The page body read `known_marketplaces.json` correctly; the card's step simply had no `done` check, so it could never see it. Step 1 now checks the marketplace list; step 2 is "Install a ruflo plugin" and is done once a plugin from the ruflo marketplace is installed, so the card goes away when both are true. A spec calls `stepsRows` directly (a first version asserted on the page text, which does not include the card, and passed with the fix removed; it now fails without it).
-## 2. Capabilities added
+## 2. One place for each job, and links between them
-- **Update the marketplace** (primary button when the clone is stale): `claude plugin marketplace update ruflo`.
-- **Installed plugins** (folded): each ruflo plugin with its state (● enabled, ○ disabled) and version, and `update` and `enable`/`disable` buttons.
-- **Available to install**: what the clone lists that is not installed, each with an `install` button (twelve shown, the rest in the Plugin Catalog; open when nothing is installed yet).
-- Every one asks first (the confirm row shows the exact `claude plugin ...` command and whether it touches the network) and runs one fixed argv, always `<name>@ruflo`, never another marketplace's plugin. The name must be one lowercase plugin-shaped word, so nothing can be smuggled into the argv (spec). An install verifies against the installed records afterwards. Changes load in the next session.
+An earlier version of this ADR gave the Plugins page its own install, update, enable and disable buttons. They duplicated the Plugin Catalog's (which also had uninstall and `--scope user`), so they are gone: **the Plugins page is for the health of the setup, the Plugin Catalog is for the plugins.**
+
+- **Plugins page:** the marketplace clone (age, auto-update, stale), the installed/enabled/listed/loaded matrix, mods, and one action: **update the marketplace** (`claude plugin marketplace update ruflo`, primary when the clone is stale; asks first, network). Its folded **Installed plugins** and **Available to install** lists show each plugin with its state and open it in the catalog; an installed plugin also links to the console section that launches its commands (→ Swarm, → Security, …).
+- **Plugin Catalog:** unchanged in what it does (browse, filter, contents, view/use, install/update/enable/disable/uninstall). New: a health line (how fresh the clone is) with **◂ Plugins: health** and **↻ update marketplace**; a selected plugin's detail has a **related** row: → the section that launches it, → Plugins: setup health.
+- **Launch sections** (the foot of every page): laid out like the menu's cards: a dim `── plugin ──` rule per plugin with **▸ in the catalog**, then one dotted-leader row per command, all one width, ending in a primary **▶ run**. Before, the plugin name was a ragged green line and each command was a variable-width button followed by a loose ▸ run.
+- `views/links.ts` holds the two links every page uses (`openInCatalog`, `homeLink`).
## 3. Not proven
-The commands were checked against `claude plugin --help`, not run (they write Claude Code's plugin records and use the network). Enable and disable have no verification (the snapshot reads enablement from settings, which a run does not re-read).
+Seen through a fake kit, not on a terminal. The marketplace update was checked against `claude plugin --help`, not run.