(skills: SkillsMap)
| 225 | * Skills become slash commands that users can invoke directly. |
| 226 | */ |
| 227 | export function getSlashCommandsWithSkills(skills: SkillsMap): SlashCommand[] { |
| 228 | const skillCommands: SlashCommand[] = Object.values(skills).map((skill) => ({ |
| 229 | id: `skill:${skill.name}`, |
| 230 | label: `skill:${skill.name}`, |
| 231 | description: truncateDescription(skill.description), |
| 232 | })) |
| 233 | |
| 234 | let commands = [...SLASH_COMMANDS, ...skillCommands] |
| 235 | |
| 236 | if (IS_FREEBUFF && !getChatGptOAuthStatus().connected) { |
| 237 | commands = commands.map((cmd) => { |
| 238 | if (cmd.id === 'review' || cmd.id === 'plan') { |
| 239 | return { ...cmd, description: 'Connect required. ' + cmd.description } |
| 240 | } |
| 241 | return cmd |
| 242 | }) |
| 243 | } |
| 244 | |
| 245 | return commands |
| 246 | } |
no test coverage detected