Readme Min Line Count + Repo Boilerplate Collector
Enforce Readme Min Line Count using data collected by Repo Boilerplate Collector. Automatically check repository and ownership standards on every PR.
How Repo Boilerplate Collector Powers This Guardrail
The Repo Boilerplate Collector gathers metadata from your documentation, vcs 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 Repo Boilerplate Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/repo-boilerplate@v1.0.5
# with: ...
# Step 2: Enable the Repo Boilerplate Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/repo-boilerplate@v1.0.5
include: [readme-min-line-count]
# with: ...
What Repo Boilerplate 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 to .repo.readme.
codeowners
Scans the repository for a CODEOWNERS file in standard locations
(CODEOWNERS, .github/CODEOWNERS, docs/CODEOWNERS) and parses its contents.
Extracts ownership rules, validates syntax, classifies owners as teams vs
individuals, and detects catch-all rules. Writes to .ownership.codeowners.
gitignore
Detects .gitignore in the repository root. Extracts line count and
number of active patterns (non-comment, non-empty lines).
Writes to .repo.gitignore.
license
Detects LICENSE files (LICENSE, LICENSE.md, LICENSE.txt, LICENCE and
variants). Attempts to identify the SPDX license type from file content.
Writes to .repo.license.
Example Data Flow
Here's an example of the data that Repo Boilerplate 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"
]
},
"gitignore": {
"exists": true,
"path": ".gitignore",
"lines": 42,
"patterns": 35
},
"license": {
"exists": true,
"path": "LICENSE",
"spdx_id": "MIT"
},
"security": {
"exists": true,
"path": "SECURITY.md",
"lines": 28,
"sections": [
"Reporting a Vulnerability",
"Response Timeline",
"Scope"
]
},
"contributing": {
"exists": true,
"path": "CONTRIBUTING.md",
"lines": 55,
"sections": [
"Getting Started",
"Development Setup",
"Pull Requests",
"Code of Conduct"
]
},
"editorconfig": {
"exists": true,
"path": ".editorconfig",
"sections": 4
}
},
"ownership": {
"codeowners": {
"exists": true,
"valid": true,
"path": ".github/CODEOWNERS",
"errors": [],
"owners": ["@acme/backend-team", "@acme/platform-team", "@jdoe"],
"team_owners": ["@acme/backend-team", "@acme/platform-team"],
"individual_owners": ["@jdoe"],
"rules": [
{
"pattern": "*",
"owners": ["@acme/platform-team"],
"owner_count": 1,
"line": 3
},
{
"pattern": "/src/backend/",
"owners": ["@acme/backend-team", "@jdoe"],
"owner_count": 2,
"line": 6
}
]
}
}
}
Configuration Options
Repo Boilerplate Collector Inputs
| Input | Required | Default | Description |
|---|---|---|---|
readme_paths |
Optional |
README.md,README,README.txt,README.rst
|
Comma-separated list of README paths to check (first match wins) |
codeowners_paths |
Optional |
CODEOWNERS,.github/CODEOWNERS,docs/CODEOWNERS
|
Comma-separated list of CODEOWNERS file paths to check (first match wins) |
Repo Boilerplate 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 |
min_owners_per_rule |
Optional |
2
|
Minimum number of owners required per CODEOWNERS rule |
max_owners_per_rule |
Optional |
10
|
Maximum number of owners allowed per CODEOWNERS rule |
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.