/** * Static audit of a lexicon's intrinsic registrations (chant #1067). * * `check-lexicon.ts`'s original 29 checks are all existence/count assertions * — they never look at whether a registration is actually *correct*. * Foldability (`IntrinsicDef.isTag`, ../../lexicon.ts) is the sharpest case: * it drives both `chant build --fold` (which registered tags it recognizes) * and the generated per-lexicon intrinsics doc page (its "Folds?" column, * via `intrinsicFolds()`), so a wrong value doesn't just mislead a reader — * it silently changes what `--fold` does. #1039 shipped with the flag wrong * in both directions at once (aws's `Sub` missing `isTag` entirely; gitlab's * `reference()` claiming `isTag: true` for a plain call) and neither was * caught by anything until someone measured fold coverage by hand. * * This module answers two questions per registered intrinsic, purely by * parsing source (no execution, no `chant generate` required first): * * 1. Is `name` actually exported from the package's public entry * (`src/index.ts`)? A registration that names something the package * doesn't export is documenting a function that doesn't exist. * 2. Does the exported declaration's own shape agree with `isTag`? A tagged * template is a function whose first parameter is typed * `TemplateStringsArray` — the only shape `fold()` ever recognizes as a * tag (see ../../fold/fold.ts). Anything else (a plain function, a class, * a const object/proxy) cannot be invoked as `` Name`...` `` and must be * `isTag: false`. * * chant #1044 adds a third question, for the same reason the first two * exist: `foldsAsCall` opts an intrinsic's PLAIN-CALL form into folding, so * declaring it on something authored as a tagged template claims a form that * cannot be called that way. The two flags are mutually exclusive, and a * registration setting both is a failure here rather than a silently ignored * field. */ export interface IntrinsicAuditItem { name: string; /** The `isTag` value as registered in `src/plugin.ts`'s `intrinsics()`. */ declaredIsTag: boolean | undefined; /** The `foldsAsCall` opt-in as registered in `src/plugin.ts` (chant #1044); `undefined` when absent, which means "not opted in". */ declaredFoldsAsCall: boolean | undefined; /** Whether `name` resolves to a real export of `src/index.ts`. */ exported: boolean; /** * Whether the resolved declaration is genuinely authored as a tagged * template (first parameter typed `TemplateStringsArray`). `undefined` * when the declaration couldn't be located or its shape can't be * determined statically — treated as a failure, not a pass, since a * foldability claim that can't be verified is exactly the unvalidated * state #1067 is closing. */ actualIsTag: boolean | undefined; /** True only when exported AND the authored shape matches `declaredIsTag`. */ ok: boolean; detail?: string; /** * chant #1044 — false only when `foldsAsCall: true` is registered on * something authored as a tagged template. Tracked separately from * {@link ok} so the two failures report as the two different registration * mistakes they are, rather than one message covering both. */ callFormOk: boolean; callFormDetail?: string; } /** * Audit every intrinsic a lexicon registers in `src/plugin.ts` against * `src/index.ts`'s real export surface and each export's authored shape. * Returns `[]` for a lexicon with no `intrinsics()` method, or one that * registers none — nothing to audit either way. */ export declare function auditIntrinsics(lexiconDir: string): IntrinsicAuditItem[]; //# sourceMappingURL=check-lexicon-intrinsics.d.ts.map