Mediva CI

Gate pull requests and issues on GitHub with a copy-in workflow — friendly, signal-not-verdict checks that never reject the author.

DOCKING CONTROL, Babylon 5: This is Command. Your manifest is missing the cargo declaration on bay four. You are not refused — hold position, amend the manifest, and you are cleared to dock.

Every PR and issue body is read against your contract; the check annotates the line to amend and never closes anything.

Wire it up

.github/workflows/mdv.yml
# .github/workflows/mdv.yml
name: mediva
on:
  pull_request:
    types: [opened, edited, synchronize, reopened]
permissions:
  contents: read
jobs:
  mediva:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: jamespacileo/mediva@v0.2.0
.github/pull_request_template.md
<!-- mdv: section required content.words.min=20 content.none=@placeholders -->
## Description

Describe what changed, why, and the impact.

<!-- mdv: section required -->
## Pre-Merge Checklist

<!-- mdv: list required items.all=checked labels.eq=@template -->
- [ ] I reviewed the diff for unrelated changes.
- [ ] I updated docs, or this PR does not require docs.

The template is the contract: you write it by hand, npx mdv check --pr body.md tries it locally. Mark the job required to block merges.

InputMeaning
fail-onerror (default), warning, never
pr-contractdefault .github/PULL_REQUEST_TEMPLATE.md
issue-contractan issue template (add an issues: trigger)
pathslimit the changed-Markdown check

Your mediva.config.mjs applies.

What the check does

CheckCommandReports
Title and bodymdv check - --schema <contract> --title <title> -f githuball
Changed Markdownmdv check --changed BASE...HEAD -f githubevery problem in each changed document

Every document runs the lint gate first (markdownlint's rules plus mediva's fence check, always errors), then shape, then state; a failed gate stops the ones after it. A document no contract governs gets the lint gate alone and a no-contract warning.

--changed picks which documents run and nothing else: a document the pull request changed (or whose contract it changed) is checked in full.

✓ mediva: 3 documents checked, no problems

Exit codes and merge gating

CodeMeaning
0green: no blocking errors
1blocking errors
>1could not run: config or contract error

Warnings and advisory findings never fail, even raised to error; fail-on: warning counts them, and a gate then fails on any finding, so a shape warning stops the state gate.

Colour in workflow logs

No TTY means no colour; see Colour.

- run: npx mediva check
  env:
    FORCE_COLOR: "1"

Two details that make it tamper-proof

DetailEffect
Base-branch contracta PR cannot weaken its own contract
Bootstrap skipno template on base yet: notice, exit 0

Rendering a comment yourself

For a comment instead (needs pull-requests: write):

npx mediva check body.md --schema .github/pull_request_template.md --title "$TITLE" -f pr-comment > comment.md
gh pr comment "$PR" --body-file comment.md

Agent-grade guards

GuardRuleCatches
LLM residuecontent.none=@agent/chatter"I've implemented…" (advisory)
Truncationcontent.none=@agent/cut-off…, [truncated] (advisory)
Fence wrapperalways on: the lint gatea document fenced whole
Placeholdercontent.none=@placeholdersTODO, FILL ME IN
Vague evidenceitems.all=@evidence/specific"Tested thoroughly" (advisory)
Bare tickitems.none=bare-ticka tick with no evidence

Document-scope severity overrides

<!-- soft: a short Summary prints a warning, never fails -->
<!-- mdv: section required content.words.min=20 warn=too-few-words -->
## Summary
<!-- mdv: endsection -->

<!-- hard: a vague Verification item blocks the merge -->
<!-- mdv: list required items.all=@evidence/specific error=vague-evidence -->
## Verification
<!-- mdv: endlist -->

See Overrides.

Permissions and secrets

contents: read and the auto GITHUB_TOKEN only. It runs on pull_request, never pull_request_target: forks get a read-only token.

Where to go next

PR bodies, issue forms, monorepo CI, mdv check.

On this page