Scaffold and Guard: init, Inference, and Drift Checks
Each example builds on the one before it — read the ladder in order, or jump to the rung you need. Every shipped artifact is regression-checked against the real CLI and library output.
- INFERENCE-INIT-01: Scaffold a contract from a folder of notes — init reads existing markdown and writes a tight-but-accepting contract plus a discoverable router, zero TypeScript.
- INFERENCE-INIT-02: Read the inferred contract — The generated YAML is a plain declarative contract — required vs optional sections, strict frontmatter, and value-ladder field types you can hand-tune.
- INFERENCE-INIT-03: Preview without writing using –dry-run — –dry-run prints every would-be file to stdout and writes nothing, so you can inspect the scaffold before committing it.
- INFERENCE-INIT-04: Emit a corpus meta-config with –meta — –meta cuts the tree into one contract per top-level directory plus a glob-routed markdown-contract.yaml corpus config.
- INFERENCE-INIT-05: Tighten with –infer-bounds (planned — currently a no-op) — –infer-bounds is accepted but currently a no-op: it is parsed yet never read, so it does not (yet) tighten the value ladder with numeric min/max or string pattern bounds — a planned future phase.
- INFERENCE-INIT-06: Move the cut with –depth — –depth N groups contracts at exactly N directories deep, warning about files stranded above a depth-2+ cut.
- INFERENCE-INIT-07: Loosen the floor with –relax — –relax generates a permissive contract — order: none, allowUnknown: true, non-strict frontmatter, no enums — for evolving corpora.
- INFERENCE-INIT-08: Inline vs split, and place with –out/–force — –inline collapses the meta-config to one self-contained file, while –out and –force control where it lands and whether it overwrites.
- INFERENCE-INIT-09: Guard the tree with –check — –check skips inference and verifies the existing scaffold still accepts the tree, exiting 0 when clean — a drift detector for CI.
- INFERENCE-INIT-10: Catch drift after a document changes — Mutating a doc so it stops conforming makes the same –check fail with exit 1, closing the scaffold-to-guardrail loop.