Skip to content

resolveToolCommand

Builds the command parts that run a locally-installed tool, with the tool itself already included.

Prefers the shim in the nearest node_modules/.bin, walking up through ancestor folders so a hoisted workspace install is still found. Falls back to the owning manager’s exec form when no shim resolves — which is both the previous behavior and the only thing that works under yarn’s Plug’n’Play, where node_modules/.bin does not exist at all.

Import:

import { resolveToolCommand } from 'obsidian-dev-utils/script-utils/package-manager';

Signature:

function resolveToolCommand(params: ResolveToolCommandParams): string[]

Parameters:

ParameterTypeDescription
paramsResolveToolCommandParamsThe parameters for the resolution.

Returns: string[] — The command parts, e.g. ['/project/node_modules/.bin/tsc'] or ['bun', 'x', 'tsc'].


Links to this page: