MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getDiscoveredCommands

Function getDiscoveredCommands

src/core/webview/webviewMessageHandler.ts:155–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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.

Callers 1

webviewMessageHandlerFunction · 0.85

Calls 6

getCurrentCwdFunction · 0.85
getCurrentModeFunction · 0.85
getSkillsManagerMethod · 0.80
getSkillsForModeMethod · 0.80
hasMethod · 0.65
getCommandsFunction · 0.50

Tested by

no test coverage detected