Skip to content

Commit 58f53d4

Browse files
authored
Merge pull request Stack-Cairn#237 from Mieluoxxx/feat/local-skill-import-cards
feat(skills-hub): improve local skill import cards
2 parents e794570 + 8787d57 commit 58f53d4

5 files changed

Lines changed: 557 additions & 364 deletions

File tree

crates/agent-gateway/web/src/lib/skills/skillCardMetadata.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ export type RelativeInstalledAt =
99
| { kind: "date"; timestamp: number };
1010

1111
const RECENT_INSTALL_DAYS = 6;
12+
export const LOCAL_SKILL_CARD_DESCRIPTION_MAX_CHARACTERS = 120;
13+
14+
export function truncateLocalSkillCardDescription(description: string): string {
15+
const normalized = description.trim();
16+
if (normalized.length <= LOCAL_SKILL_CARD_DESCRIPTION_MAX_CHARACTERS) return normalized;
17+
18+
const characters = Array.from(normalized);
19+
if (characters.length <= LOCAL_SKILL_CARD_DESCRIPTION_MAX_CHARACTERS) return normalized;
20+
return `${characters
21+
.slice(0, LOCAL_SKILL_CARD_DESCRIPTION_MAX_CHARACTERS - 1)
22+
.join("")
23+
.trimEnd()}…`;
24+
}
1225

1326
export function getInstalledSkillCardSource(
1427
skill: Pick<SkillSummary, "name" | "source" | "builtIn">,

0 commit comments

Comments
 (0)