EMBED-AND-CI-01: Run the corpus in-process
What it demonstrates
Section titled “What it demonstrates”Calling runCorpus once with a defineConfig config and reading back {findings, exitCode}.
Builds on: nothing — this is the first rung of Embed and Automate: the Runner Library and CI Gates.
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, defineConfig, runCorpus } from "markdown-contract";
const config = defineConfig({ rules: [{ include: ["**/*.md"], contract: contract({ body: sections() }) }],});
const { findings, exitCode } = runCorpus(config, { cwd: "docs" });console.log(`${findings.length} finding(s); exit ${exitCode}`);Surfaces exercised
Section titled “Surfaces exercised”runner: defineConfig, runCorpuscore: contract, sectionsthe {findings, exitCode} return