function diagnoseEmptyDiscovery
diagnoseEmptyDiscovery(
specifier: string,
timeout?: number
): Promise<EmptyDiscoveryDiagnosis>

Explains why a package yielded no coders, by reading its module graph.

Runs deno info --json --quiet <specifier> and reports whether anything in the graph resolves to @hertzg/binstruct. Per ADR 0002 this is not part of the happy path: call it only after discoverCoders succeeded with an empty coders list, since it rebuilds the graph a second time and answers nothing a non-empty discovery has not already answered.

deno info exits 0 even when it could not resolve the root, reporting the problem as an error on the offending module instead. A graph carrying one was never walked, so it is a graph-incomplete failure rather than evidence that the package is not binstruct-based — the two are indistinguishable from the module list alone, and the confident verdict is the wrong one.

Examples

A package with no coders that is not binstruct-based

import { assertEquals } from "@std/assert";
import { diagnoseEmptyDiscovery } from "./discover.ts";

const diagnosis = await diagnoseEmptyDiscovery(
  import.meta.resolve("../../@hertzg/mac/mod.ts"),
);

assertEquals(diagnosis.ok, true);
if (diagnosis.ok) assertEquals(diagnosis.dependsOnBinstruct, false);

Parameters

specifier: string

A resolved specifier, e.g. jsr:@hertzg/mac or a path

optional
timeout: number

Milliseconds before the subprocess is killed; defaults to TOOL_TIMEOUT

Return Type

Whether the graph depends on binstruct, or why deno info failed

Usage

import { diagnoseEmptyDiscovery } from "mod.ts";