Skip to content

ProviderContext

exists(relPath): Promise<boolean>

True when a root-relative path exists.

ParameterType
relPathstring

Promise<boolean>


files(pattern): Promise<string[]>

Root-relative paths matching a basename or a *-prefixed suffix ("justfile", "*.mk"). Honours the resolved discovery mode; results are memoized for the life of one collect() call.

ParameterType
patternstring

Promise<string[]>


readJson(relPath): Promise<unknown>

Read and parse a JSON file, root-relative. Memoized per collect() run.

ParameterType
relPathstring

Promise<unknown>


readText(relPath): Promise<string | null>

Read a text file, root-relative. Memoized per collect() run.

ParameterType
relPathstring

Promise<string | null>


runner(binary): AsyncCommandRunner

A runner for one binary, injected. Providers need different binaries (moon, just, git), which is why this is a factory and not a single CommandRunner — spawnRunner closes over the binary it was built with.

ParameterType
binarystring

AsyncCommandRunner


which(binary): string | null

PATH lookup for a binary — no subprocess. Safe under allowExec: false: that is the whole point of this existing separately from ctx.runner, which spawns. Returns the resolved path, or null when the binary is not found.

ParameterType
binarystring

string | null

PropertyTypeDescription
allowExecbooleanWhether subprocesses are permitted. An exec provider never sees false — it is skipped outright. A parse provider does see it, and a dual-path one (just, rake, go-task, gradle) branches on it: files when execution is off, the tool’s own listing when it is on and which() finds the binary.
discoveryDiscoveryModeHow discovery resolved, for providers that want to explain themselves.
rootstringAbsolute. Every path a provider returns is relative to this.
signalAbortSignalAborted when the caller cancels — pass it to long-running work.