which
import { tryWhich, which, resolveTools } from 'sysopkit/op/which';which()
Section titled “which()”Resolves one tool name to an absolute path. Throws when the tool is not installed — paths drift across releases, so resolve at runtime instead of hardcoding.
const shPath = await which('sh');tryWhich()
Section titled “tryWhich()”Resolves one tool name to an absolute path. Returns undefined when the tool is not installed (still throws on malformed tool names).
if ((await tryWhich('cloud-init')) !== undefined) { // tool is present}resolveTools()
Section titled “resolveTools()”Resolves several tool names to absolute paths, in order. Throws on the first missing tool.
const [parted, wipefs] = await resolveTools(['parted', 'wipefs']);