MCPcopy
hub / github.com/RedPlanetHQ/core / resolveCommand

Function resolveCommand

packages/cli/src/utils/agent-templates.ts:65–77  ·  view source on GitHub ↗
(cmd: string)

Source from the content-addressed store, hash-verified

63 * binary exists on PATH, null otherwise. Lightweight enough to call at boot.
64 */
65export function resolveCommand(cmd: string): string | null {
66 if (cmd.includes('/')) return existsSync(cmd) ? cmd : null;
67 try {
68 const out = execFileSync('/bin/sh', ['-c', `command -v ${cmd}`], {
69 encoding: 'utf8',
70 timeout: 2_000,
71 });
72 const path = out.trim();
73 return path || null;
74 } catch {
75 return null;
76 }
77}

Callers 1

bootstrapFromEnvFunction · 0.90

Calls 2

includesMethod · 0.80
trimMethod · 0.80

Tested by

no test coverage detected