MCPcopy Create free account
hub / github.com/Noumena-Network/code / extractCliName

Function extractCliName

src/utils/queryHelpers.ts:538–547  ·  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

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

Callers 1

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected