MCPcopy Create free account
hub / github.com/freecodexyz/free-code / isCommandAvailable

Function isCommandAvailable

src/utils/plugins/gitAvailability.ts:21–27  ·  view source on GitHub ↗

* Check if a command is available in PATH. * * Uses which to find the actual executable without executing it. * This is a security best practice to avoid executing arbitrary code * in untrusted directories. * * @param command - The command to check for * @returns True if the command exists an

(command: string)

Source from the content-addressed store, hash-verified

19 * @returns True if the command exists and is executable
20 */
21async function isCommandAvailable(command: string): Promise<boolean> {
22 try {
23 return !!(await which(command))
24 } catch {
25 return false
26 }
27}
28
29/**
30 * Check if git is available on the system.

Callers 1

gitAvailability.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected