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

fix(ruflo-console): the skills sort toggles back to the order skills.sh gave

ruva79fdd7cd516
diff --git a/plugins/ruflo-console/hooks/skills-lab.ts b/plugins/ruflo-console/hooks/skills-lab.ts
index 70966d5dca..49c408b225 100644
--- a/plugins/ruflo-console/hooks/skills-lab.ts
+++ b/plugins/ruflo-console/hooks/skills-lab.ts
@@ -267,7 +267,6 @@ export function moreSkillActions(state: State, host: Host, runner: Runner, load:
},
sortBy: () => {
skills.sort = skills.sort === 'installs' ? 'relevance' : 'installs'
- if (skills.found !== null) skills.found = sortedFound(skills.found, skills.sort)
host.invalidate()
},
scan: () => {
@@ -355,7 +354,7 @@ export function skillsAnswer(state: State, id: string, sinceMs: number): string
if (id !== 'skills-find' || skills.foundAtMs < sinceMs) return null
if (skills.findError !== null) return `✗ skills find: ${skills.findError}`
- const found = skills.found ?? []
+ const found = sortedFound(skills.found ?? [], skills.sort)
return [`skills find "${skills.query}": ${found.length} found`, ...found.slice(0, 15).map(skill => ` ${skill.id}${skill.installs !== undefined ? ` · ${skill.installs} installs` : ''}`)].join('\n')
}
diff --git a/plugins/ruflo-console/hooks/skills.ts b/plugins/ruflo-console/hooks/skills.ts
index f980470dcc..3cf4bc7507 100644
--- a/plugins/ruflo-console/hooks/skills.ts
+++ b/plugins/ruflo-console/hooks/skills.ts
@@ -6,7 +6,7 @@
* installed lists are read again to say whether it took. Every argv is fixed, with no shell; nothing here writes a file.
*/
import type { ActionSpec } from './actions'
-import { addArgv, agentsOf, findArgv, initArgv, listArgv, nameInId, newNameOf, parseFind, parseInstalled, removeArgv, skillIdOf, skillNameOf, sortedFound, updateArgv, type FoundSkill, type InstalledSkill, type Scope } from './data/skills'
+import { addArgv, agentsOf, findArgv, initArgv, listArgv, nameInId, newNameOf, parseFind, parseInstalled, removeArgv, skillIdOf, skillNameOf, updateArgv, type FoundSkill, type InstalledSkill, type Scope } from './data/skills'
import { plain } from './data/parse'
import type { Host } from './host'
import { outputLines } from './ops'
@@ -86,7 +86,7 @@ export function findSkills(state: State, host: Host, text: string): string | nul
const run = host
.run(argv, READ_TIMEOUT_MS)
.then(result => {
- skills.found = sortedFound(parseFind(result.stdout), skills.sort)
+ skills.found = parseFind(result.stdout)
skills.foundAtMs = Date.now()
skills.findError = result.exitCode !== 0 ? `exit ${result.exitCode}: ${firstLine(result.stderr) || firstLine(result.stdout) || 'no message'}` : null
})
diff --git a/plugins/ruflo-console/hooks/views/skills.ts b/plugins/ruflo-console/hooks/views/skills.ts
index 3a5dd0ccc0..0861fb09cb 100644
--- a/plugins/ruflo-console/hooks/views/skills.ts
+++ b/plugins/ruflo-console/hooks/views/skills.ts
@@ -1,6 +1,6 @@
import type { RenderElement } from 'claude-code'
-import type { FoundSkill, InstalledSkill } from '../data/skills'
+import { sortedFound, type FoundSkill, type InstalledSkill } from '../data/skills'
import { ago, clip, col, row, rule, text, THEME, type Ctx } from './common'
import { authorRows, maintainRows, previewRows, projectRows, targetRows } from './skills-more'
@@ -79,7 +79,7 @@ function searchRows(ctx: Ctx): RenderElement[] {
else if (skills.found !== null && skills.found.length === 0) rows.push(text(ctx, ` no skills found for "${skills.query}"`, { dimColor: true }))
else if (skills.found === null) rows.push(text(ctx, ' Enter searches skills.sh (it is on the network, so nothing is asked until you do)', { dimColor: true }))
- ;(skills.found ?? []).slice(0, SHOWN).forEach((found: FoundSkill, i) => {
+ sortedFound(skills.found ?? [], skills.sort).slice(0, SHOWN).forEach((found: FoundSkill, i) => {
rows.push(
leader(ctx, `sk-found-${i}`, found.id, found.installs !== undefined ? `${found.installs} installs` : 'installs n/a', [
{ key: `sk-use-${i}`, label: 'use', onPress: () => ctx.act.skills.use(found) },
diff --git a/plugins/ruflo-console/tests/skills-lab.spec.ts b/plugins/ruflo-console/tests/skills-lab.spec.ts
index 360c8c6d55..7062ca4c9d 100644
--- a/plugins/ruflo-console/tests/skills-lab.spec.ts
+++ b/plugins/ruflo-console/tests/skills-lab.spec.ts
@@ -256,6 +256,12 @@ describe('the new skills actions', () => {
act.toggleAgent('claude-code')
expect(state.skills.agents).toEqual(['claude-code', 'codex'])
act.toggleAgent('codex')
+ // The sort is a view of the results as found: toggling twice gives the CLI's order back.
+ state.skills.found = [{ id: 'a/b@low', installs: '1K' }, { id: 'a/b@high', installs: '2M' }]
+ act.sortBy()
+ expect(sortedFound(state.skills.found, state.skills.sort).map(skill => skill.id)).toEqual(['a/b@high', 'a/b@low'])
+ act.sortBy()
+ expect(sortedFound(state.skills.found, state.skills.sort).map(skill => skill.id)).toEqual(['a/b@low', 'a/b@high'])
expect(addSpec(state, host, { id: 'o/r@s' }, 'global')?.shows).toBe('npx -y skills add o/r@s -g --agent claude-code -y')
expect(addSpec(state, host, { id: 'o/r@s' }, 'global')?.label).toBe('add skill o/r@s globally for claude-code')
})