Readme Min Line Count + README Collector
Enforce Readme Min Line Count using data collected by README Collector. Automatically check repository and ownership standards on every PR.
How README Collector Powers This Guardrail
The README Collector gathers metadata from your documentation systems. This data flows into Lunar's Component JSON, where the Readme Min Line Count guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the README Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/readme@v1.0.0
# with: ...
# Step 2: Enable the README Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/readme@v1.0.0
include: [readme-min-line-count]
# with: ...
What README Collector Collects
This collector gathers the following data that the Readme Min Line Count guardrail evaluates.
readme
Scans repository root for README files (README.md, README, README.txt, README.rst)
in order, taking the first match. Extracts line count and section headings by
parsing markdown headers. Writes exists, path, lines, and sections to .repo.readme.
Example Data Flow
Here's an example of the data that README Collector writes to the Component JSON, which Readme Min Line Count then evaluates.
{
"repo": {
"readme": {
"exists": true,
"path": "README.md",
"lines": 150,
"sections": [
"Installation",
"Usage",
"API",
"Contributing",
"License"
]
}
}
}
Configuration Options
README Collector Inputs
| Input | Required | Default | Description |
|---|---|---|---|
paths |
Optional |
README.md,README,README.txt,README.rst
|
Comma-separated list of README paths to check (first match wins) |
README Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
min_lines |
Optional |
25
|
Minimum number of lines required in README file |
required_sections |
Required | — | Comma-separated list of required sections in README file |
Ready to Automate Your Standards?
See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.