Hamburger Cross Icon
Catchall
+
CODEOWNERS Collector

Catchall + CODEOWNERS Collector

Guardrail Collector Stable Repository And Ownership

Enforce Catchall using data collected by CODEOWNERS Collector. Automatically check repository and ownership standards on every PR.

Guardrail: Requires a default catch-all rule (*) in CODEOWNERS so that every file in the repository has at least one owner.
Data Source: Parse CODEOWNERS files to collect structured ownership data including rules, owner types, and catch-all coverage. Enables enforcement of code ownership standards across your organization.

How CODEOWNERS Collector Powers This Guardrail

The CODEOWNERS Collector gathers metadata from your vcs systems. This data flows into Lunar's Component JSON, where the Catchall 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.

1
CODEOWNERS Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Catchall Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the CODEOWNERS Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/codeowners@v1.0.0
    # with: ...

# Step 2: Enable the CODEOWNERS Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/codeowners@v1.0.0
    include: [catchall]
    # with: ...

What CODEOWNERS Collector Collects

This collector gathers the following data that the Catchall guardrail evaluates.

Collector code

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 structured data to .ownership.codeowners.

Example Data Flow

Here's an example of the data that CODEOWNERS Collector writes to the Component JSON, which Catchall then evaluates.

{ } component.json From CODEOWNERS Collector
{
  "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

CODEOWNERS Collector Inputs

Input Required Default Description
paths Optional CODEOWNERS,.github/CODEOWNERS,docs/CODEOWNERS Comma-separated list of CODEOWNERS file paths to check (first match wins)

CODEOWNERS Guardrails Inputs

Input Required Default Description
min_owners_per_rule Optional 2 Minimum number of owners required per CODEOWNERS rule (for min-owners check)
max_owners_per_rule Optional 10 Maximum number of owners allowed per CODEOWNERS rule (for max-owners check)

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.

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Turn any process doc into guardrails
Book a Demo