Skip to content

Commit aa8dbbe

Browse files
juuulianxclaude
andauthored
fix(web): skill labels show the skill's own name (#27741)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent f702f89 commit aa8dbbe

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
import { formatProviderSkillDisplayName } from "./inlineSkills.ts";
3+
4+
describe("formatProviderSkillDisplayName", () => {
5+
it.each([
6+
["mca_lab_status", "mca_lab_status"],
7+
["frontend-design:frontend-design", "frontend-design:frontend-design"],
8+
["superpowers:brainstorming", "superpowers:brainstorming"],
9+
["DesignSync", "DesignSync"],
10+
])("shows %s as its skill name when the provider sets no display name", (name, label) => {
11+
expect(formatProviderSkillDisplayName({ name })).toBe(label);
12+
});
13+
14+
it("prefers the provider display name", () => {
15+
expect(formatProviderSkillDisplayName({ name: "gh-fix-ci", displayName: " Fix CI " })).toBe(
16+
"Fix CI",
17+
);
18+
});
19+
});

‎packages/shared/src/inlineSkills.ts‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,10 @@ import type { ServerProviderSkill } from "@t3tools/contracts";
22

33
export type InlineSkill = Pick<ServerProviderSkill, "name" | "displayName">;
44

5-
function titleCaseWords(value: string): string {
6-
const words: string[] = [];
7-
for (const segment of value.split(/[\s:_-]+/)) {
8-
if (segment.length === 0) continue;
9-
words.push(segment.charAt(0).toUpperCase() + segment.slice(1));
10-
}
11-
return words.join(" ");
12-
}
13-
145
export function formatProviderSkillDisplayName(
156
skill: Pick<ServerProviderSkill, "name" | "displayName">,
167
): string {
17-
const displayName = skill.displayName?.trim();
18-
if (displayName) {
19-
return displayName;
20-
}
21-
return titleCaseWords(skill.name);
8+
return skill.displayName?.trim() || skill.name;
229
}
2310

2411
const SKILL_TOKEN_REGEX =

0 commit comments

Comments
 (0)