File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments