Quickstart

Install mediva, write a contract, validate a file, and fix the first failure — in about five minutes.

LOG ENTRY — SOL 47: Mission Control will not accept a status report that just says "still alive lol." They want a real report. Good news: I can make the habitat's computer reject the bad ones before they burn 12 minutes of light-lag getting to Earth.

You're Mark Watney. Every sol, a status report goes home.

1. Install

npm install -D mediva

2. Write a contract

Every sol report must have this shape:

status.mdv.md
<!-- mdv: section required content.words.min=15 content.none=@placeholders -->
## Crew Status

3. Validate a document

sol47.md
## Crew Status

One crew member, nominal and still stubborn. Oxygenator stable, water reclaimer holding at ninety one percent, and the Hab potatoes remain emotionally complicated. Telemetry pulled with `./pull-telemetry.sh --sol 47`.
npx mediva check sol47.md --schema status.mdv.md
✓ 1 document checked

Silence is the pass. (--schema takes the contract.)

4. Break it, read the failure

A dust storm hits. Tonight's report:

sol47.md
## Crew Status

Still alive. Potatoes fine.
sol47.md
  State: what the document claims; clear it by doing the work or saying it is not done
  3  warning  "Crew Status" has 4 words, needs at least 15  too-few-words
              help: Add the missing specifics, not filler

✖ 1 problem (0 errors, 1 warning)
  mdv explain <rule-id> for details

Section, rule, line. Word floors warn (exit 0); error=too-few-words blocks.

I'm going to have to science the heck out of this contract. (You won't — it's already done.)

5. Let mdv check find it

npx mdv check pairs contracts and documents by location:

ContractChecks
X.mdv.mdX.md beside it
_template.mdv.mdevery other *.md in its folder
.mediva/contracts/<path>.mdv.mdthe document at <path>
.github/pull_request_template.mdPR descriptions (--pr body.md)

Ready-made starters are being rebuilt; for now write the contract by hand, then npx mdv check docs/runbooks.

Next

Contracts · Recipes · Pre-commit · All rules

On this page