ProviderContext
Methods
Section titled “Methods”exists()
Section titled “exists()”exists(
relPath):Promise<boolean>
True when a root-relative path exists.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
relPath | string |
Returns
Section titled “Returns”Promise<boolean>
files()
Section titled “files()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
pattern | string |
Returns
Section titled “Returns”Promise<string[]>
readJson()
Section titled “readJson()”readJson(
relPath):Promise<unknown>
Read and parse a JSON file, root-relative. Memoized per collect() run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
relPath | string |
Returns
Section titled “Returns”Promise<unknown>
readText()
Section titled “readText()”readText(
relPath):Promise<string|null>
Read a text file, root-relative. Memoized per collect() run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
relPath | string |
Returns
Section titled “Returns”Promise<string | null>
runner()
Section titled “runner()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
binary | string |
Returns
Section titled “Returns”AsyncCommandRunner
which()
Section titled “which()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
binary | string |
Returns
Section titled “Returns”string | null
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
allowExec | boolean | Whether 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. |
discovery | DiscoveryMode | How discovery resolved, for providers that want to explain themselves. |
root | string | Absolute. Every path a provider returns is relative to this. |
signal | AbortSignal | Aborted when the caller cancels — pass it to long-running work. |