()
| 153 | } |
| 154 | |
| 155 | const getDiscoveredCommands = async (): Promise<SlashCommand[]> => { |
| 156 | const { getCommands } = await import("../../services/command/commands") |
| 157 | const commands = await getCommands(getCurrentCwd()) |
| 158 | |
| 159 | const commandList: SlashCommand[] = commands.map((command) => ({ |
| 160 | name: command.name, |
| 161 | source: command.source, |
| 162 | filePath: command.filePath, |
| 163 | description: command.description, |
| 164 | argumentHint: command.argumentHint, |
| 165 | })) |
| 166 | |
| 167 | const existingCommandNames = new Set(commandList.map((command) => command.name)) |
| 168 | const skillsManager = provider.getSkillsManager() |
| 169 | |
| 170 | if (!skillsManager) { |
| 171 | return commandList |
| 172 | } |
| 173 | |
| 174 | const currentMode = await getCurrentMode() |
| 175 | const availableSkills = skillsManager.getSkillsForMode(currentMode) |
| 176 | |
| 177 | for (const skill of availableSkills) { |
| 178 | if (existingCommandNames.has(skill.name)) { |
| 179 | continue |
| 180 | } |
| 181 | |
| 182 | existingCommandNames.add(skill.name) |
| 183 | commandList.push({ |
| 184 | name: skill.name, |
| 185 | source: skill.source, |
| 186 | filePath: skill.path, |
| 187 | description: skill.description, |
| 188 | }) |
| 189 | } |
| 190 | |
| 191 | return commandList |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Resolves image file mentions in incoming messages. |
no test coverage detected