MCPcopy Index your code
hub / github.com/codeaashu/claude-code / detectCodeIndexingFromCommand

Function detectCodeIndexingFromCommand

src/utils/codeIndexing.ts:126–146  ·  view source on GitHub ↗
(
  command: string,
)

Source from the content-addressed store, hash-verified

124 * detectCodeIndexingFromCommand('ls -la') // returns undefined
125 */
126export function detectCodeIndexingFromCommand(
127 command: string,
128): CodeIndexingTool | undefined {
129 // Extract the first word (command name)
130 const trimmed = command.trim()
131 const firstWord = trimmed.split(/\s+/)[0]?.toLowerCase()
132
133 if (!firstWord) {
134 return undefined
135 }
136
137 // Check for npx/bunx prefixed commands
138 if (firstWord === 'npx' || firstWord === 'bunx') {
139 const secondWord = trimmed.split(/\s+/)[1]?.toLowerCase()
140 if (secondWord && secondWord in CLI_COMMAND_MAPPING) {
141 return CLI_COMMAND_MAPPING[secondWord]
142 }
143 }
144
145 return CLI_COMMAND_MAPPING[firstWord]
146}
147
148/**
149 * Detects if an MCP tool is from a code indexing server.

Callers 1

callFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected