VALIDATION-PLANES-17: The same checks in code (TS-API parity)
What it demonstrates
Section titled “What it demonstrates”Library predicate builders give a combinator-authored contract the same text checks the YAML compiles to.
Builds on: VALIDATION-PLANES-16: All three planes in one deterministic order
How it’s done
Section titled “How it’s done”A TypeScript program against the library API; inline comments show the resulting values and behavior.
import { contract, sections, section, requires, forbids } from "markdown-contract";// (planned) predicate builders — the same checks the requires:/forbids: YAML compiles toconst c = contract({ body: sections({}, [ section("Output contract", { rules: [requires([{ pattern: "DONE pr=" }])] }), ]), rules: [forbids([{ pattern: "}scripts/", normalize: false }])], // document-level});// same text/requires + text/forbids findings as the YAML formSurfaces exercised
Section titled “Surfaces exercised”TS-API parity: requires() / forbids() / textRule() builders (src/core/text-constraints.ts) compiling to rule / docRuletext/requires + text/forbids findings (exact API named at implementation)