MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / findCommand

Function findCommand

cli/src/commands/command-registry.ts:621–642  ·  view source on GitHub ↗
(cmd: string)

Source from the content-addressed store, hash-verified

619 : ALL_COMMANDS.filter((cmd) => !FREEBUFF_ONLY_COMMANDS.has(cmd.name))
620
621export function findCommand(cmd: string): CommandDefinition | undefined {
622 const lowerCmd = cmd.toLowerCase()
623
624 // First check the static command registry
625 const staticCommand = COMMAND_REGISTRY.find(
626 (def) => def.name === lowerCmd || def.aliases.includes(lowerCmd),
627 )
628 if (staticCommand) {
629 return staticCommand
630 }
631
632 // Check if this is a skill command (prefixed with "skill:")
633 if (lowerCmd.startsWith('skill:')) {
634 const skillName = lowerCmd.slice('skill:'.length)
635 const skill = getSkillByName(skillName)
636 if (skill) {
637 return createSkillCommand(skill.name)
638 }
639 }
640
641 return undefined
642}
643
644/**
645 * Creates a dynamic command definition for a skill.

Callers 3

routeUserPromptFunction · 0.90

Calls 2

getSkillByNameFunction · 0.90
createSkillCommandFunction · 0.85

Tested by

no test coverage detected