Task runner detection and normalization
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- Detects the task runners a directory uses (moon, mise, just, npm/pnpm/yarn/bun scripts, make, cargo, gradle, and 9 more) and normalizes their tasks into one searchable model, so a caller doesn’t need to know which tool owns a command before running it.
- Ships as both a library (
collect,tasks) and a standalone CLI (detect-runners), with a shared trust/exec consent gate that separates safe file-parsing providers from ones that must run a subprocess to answer.
Statement
Section titled “Statement”A repository of any size runs its work through several build/task tools at once, each answering only
for itself. This package inventories all of them behind one provider contract, producing a
normalized Task model (argv for execution, display for showing, declared parameters) plus
per-runner diagnostics and tool-presence checks. Sixteen built-in providers cover parse-only tools
(package.json, Makefile, Cargo.toml, …) and exec tools (moon, mise, gradle, rake, go-task) that
are gated behind a per-repository trust store shared with the sibling waypost tool, so scanning an
unfamiliar repo never executes code without explicit consent.
What it provides
Section titled “What it provides”- A
collect()library entry point and adetect-runnersCLI (list/json/table output,config,trust,clean,guidesubcommands). - A provider contract (
RunnerProvider) for adding house-specific runners with no privileges beyond the built-ins. - A content-hash-based cache (
collectAndCache/readCachedCatalog) keyed on (root, runner) so slow tools (moon, sbt, mise) aren’t re-probed every call. - A trust/exec consent gate (XDG state store) that withholds exec-only providers until a repository is explicitly trusted.
Underlying implementation
Section titled “Underlying implementation”- packages/ts/detect-runners/src/collect.ts
- packages/ts/detect-runners/src/providers/ (16 built-in providers)
- packages/ts/detect-runners/src/cache.ts, src/cached.ts
- packages/ts/detect-runners/src/trust-command.ts, src/config.ts
- packages/ts/detect-runners/bin/detect-runners.js
Locations
Section titled “Locations”packages/ts/detect-runners/