Skip to content
docsv0.24.0

DiscoverHandler

ONE shape for finding (greenhouse decisions/0183, primitive #4): `discover` fans out to the package's EXISTING finders and answers uniform rows. ── WHY A FAN-OUT AND NEVER A SCAN OF ITS OWN ─────────────────────────────────────────────────── Each finder here answers in its own dialect — `artifact:list` says `artifacts[].fqcn`, `contract:search` says `matches[].fqcn`, `test:list` says `tests[].fqcn` — and a session was measured learning every one of those dialects before doing any work. This operation exists to collapse the dialects, NOT to add a fifth way of looking: every row is DERIVED from a real finder's in-process answer, so a name `discover` reports is by construction a name the finder it cites would also report. A parallel scan would be the duplicate-authority defect the family keeps paying to remove. ── THE ROW SHAPE ─────────────────────────────────────────────────────────────────────────────── `{kind, identity, path?, detail: {operation, arguments}}` — `identity` is the finder's own identity for the thing (its FQCN), `path` travels only when the finder answered one, and `detail` names the EXACT declared operation call that yields the full answer: `artifact:contract` for an artifact, `contract:search`'s own entry for a contract, `test:show` for a test, `package:artifacts` for a package's declaration. The pointer is executable as given — no caller assembles arguments from prose. ── FINDING NOTHING IS AN ANSWER ──────────────────────────────────────────────────────────────── An empty `found` comes back `ok:true` with the queried kinds named: «nothing declares this name» is information the caller can act on. What fails closed is the unjudgeable: an unknown kind is refused naming the valid set, and a missing query is refused asking for one.

DiscoverHandler::__construct()

public function __construct(Milpa\DevTools\Support\RootResolver $roots = new RootResolver()):

All four finders share the one root the caller resolves — the same seam every handler has.

Parameters

Parameters of __construct()
NameTypeDescription
$rootsMilpa\DevTools\Support\RootResolver

DiscoverHandler::handle()

public function handle(array $input): array

Answers uniform rows for everything the existing finders know under one query.

Parameters

Parameters of handle()
NameTypeDescription
$inputarray<string, mixed>