Skip to content

Commit 699733c

Browse files
committed
cli: Limit skill descriptions in slash menu to 50 chars
1 parent 196aaf7 commit 699733c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cli/src/data/slash-commands.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ export const SLASHLESS_COMMAND_IDS = new Set(
154154
),
155155
)
156156

157+
/** Maximum description length for skill commands in the slash menu */
158+
const SKILL_MENU_DESCRIPTION_MAX_LENGTH = 50
159+
160+
function truncateDescription(description: string): string {
161+
if (description.length <= SKILL_MENU_DESCRIPTION_MAX_LENGTH) {
162+
return description
163+
}
164+
return description.slice(0, SKILL_MENU_DESCRIPTION_MAX_LENGTH - 1) + '…'
165+
}
166+
157167
/**
158168
* Returns SLASH_COMMANDS merged with skill commands.
159169
* Skills become slash commands that users can invoke directly.
@@ -162,7 +172,7 @@ export function getSlashCommandsWithSkills(skills: SkillsMap): SlashCommand[] {
162172
const skillCommands: SlashCommand[] = Object.values(skills).map((skill) => ({
163173
id: `skill:${skill.name}`,
164174
label: `skill:${skill.name}`,
165-
description: skill.description,
175+
description: truncateDescription(skill.description),
166176
}))
167177

168178
return [...SLASH_COMMANDS, ...skillCommands]

0 commit comments

Comments
 (0)