Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
ℹ selectionLayout.js | 100.00 | 95.00 | 100.00 |
ℹ sessionsPanel.js | 83.91 | 41.86 | 92.31 | 67-70 101-102 118-119 123-125 132-136 153-155 169-171 180-181 196-202 205-211 222-225
ℹ settingsPanel.js | 75.31 | 83.87 | 76.47 | 78-92 118-144 181-189 195-199 205-207
ℹ skillsPanel.js | 89.69 | 71.43 | 71.43 | 67-69 75-81
ℹ skillsPanel.js | 90.10 | 73.33 | 75.00 | 71-73 79-85
ℹ statusBar.js | 99.06 | 98.11 | 100.00 | 29-30
ℹ subagentsPanel.js | 95.35 | 72.41 | 85.71 | 54-56 81-85
ℹ subagentStore.js | 100.00 | 82.61 | 100.00 |
Expand All @@ -231,6 +231,6 @@
ℹ loadAgents.js | 88.00 | 42.86 | 100.00 | 17-18 32-33 38-39
ℹ project.js | 100.00 | 100.00 | 100.00 |
ℹ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ℹ all files | 91.53 | 87.53 | 86.85 |
ℹ all files | 91.54 | 87.53 | 86.86 |
ℹ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ℹ end of coverage report
26 changes: 15 additions & 11 deletions src/tui/skillsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,23 @@ export function SkillsPanel({ skills = [], onViewChange, onSelectSkill, activeVi
const limit = Math.max(1, rows - 4);

// Normalize skills to { name, description } — accept either string names
// or catalog entries from registry.getCatalog().
// or catalog entries from registry.getCatalog(). Sort alphabetically
// (case-insensitive) so the view reads cleanly, matching the slash-command
// autocomplete ordering in app.js.
const items = useMemo(
() =>
skills.map((s) => {
const name = typeof s === "string" ? s : s.name;
const description = typeof s === "string" ? "" : s.description || "";
return {
label: name,
description,
value: name,
key: name,
};
}),
skills
.map((s) => {
const name = typeof s === "string" ? s : s.name;
const description = typeof s === "string" ? "" : s.description || "";
return {
label: name,
description,
value: name,
key: name,
};
})
.sort((a, b) => a.label.localeCompare(b.label)),
[skills],
);

Expand Down
18 changes: 18 additions & 0 deletions tests/unit/tui/skillsPanel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,22 @@ describe("SkillsPanel", () => {
assert.ok(!result.includes("Alpha description."));
assert.ok(!result.includes("Beta description."));
});

it("sorts skills alphabetically regardless of input order", () => {
const result = renderToString(
React.createElement(SkillsPanel, {
skills: [
{ name: "zeta-skill", description: "Zeta description." },
{ name: "alpha-skill", description: "Alpha description." },
{ name: "mid-skill", description: "Mid description." },
],
activeView: "skills",
}),
);
const alphaIdx = result.indexOf("alpha-skill");
const midIdx = result.indexOf("mid-skill");
const zetaIdx = result.indexOf("zeta-skill");
assert.ok(alphaIdx !== -1 && midIdx !== -1 && zetaIdx !== -1);
assert.ok(alphaIdx < midIdx && midIdx < zetaIdx);
});
});
Loading