MCPcopy Create free account
hub / github.com/codeaashu/claude-code / extractCliName

Function extractCliName

src/utils/queryHelpers.ts:543–552  ·  view source on GitHub ↗

* Extract the actual CLI name from a bash command string, skipping * env var assignments (e.g. `FOO=bar vercel` → `vercel`) and prefixes * in STRIPPED_COMMANDS.

(command: string | undefined)

Source from the content-addressed store, hash-verified

541 * in STRIPPED_COMMANDS.
542 */
543function extractCliName(command: string | undefined): string | undefined {
544 if (!command) return undefined
545 const tokens = command.trim().split(/\s+/)
546 for (const token of tokens) {
547 if (/^[A-Za-z_]\w*=/.test(token)) continue
548 if (STRIPPED_COMMANDS.has(token)) continue
549 return token
550 }
551 return undefined
552}
553

Callers 1

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected