Hamburger Cross Icon
Cli Structured Output
+
Gemini Collector

Cli Structured Output + Gemini Collector

Guardrail Collector Experimental Devex Build And Ci

Enforce Cli Structured Output using data collected by Gemini Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Ensures Gemini CLI invocations in CI use structured JSON output instead of plain text. JSON output makes AI automation deterministic and parseable.
Data Source: Detects Google Gemini CLI invocations in CI pipelines. Records command strings, versions, and flags for policy-level analysis. Writes to ai.native.gemini under the unified ai.* namespace.

How Gemini Collector Powers This Guardrail

The Gemini Collector gathers metadata from your systems. This data flows into Lunar's Component JSON, where the Cli Structured Output 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
Gemini Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Cli Structured Output 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 Gemini Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/gemini@v1.0.5
    # with: ...

# Step 2: Enable the Gemini Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/gemini@v1.0.5
    include: [cli-structured-output]
    # with: ...

What Gemini Collector Collects

This collector gathers the following data that the Cli Structured Output guardrail evaluates.

Collector code

instruction-file

Discovers GEMINI.md instruction files across the repository. Records file path, line count, byte size, and whether it is a symlink to AGENTS.md. Writes to ai.native.gemini.instruction_file and appends to ai.instructions.all[] for normalized cross-tool access.

Collector ci-after-command

cicd

Detects Google Gemini CLI invocations in CI pipelines. Records the command string and version for policy-level flag analysis (dangerous flags like --yolo and -y).

Example Data Flow

Here's an example of the data that Gemini Collector writes to the Component JSON, which Cli Structured Output then evaluates.

{ } component.json From Gemini Collector
{
  "ai": {
    "instructions": {
      "all": [
        {
          "path": "GEMINI.md",
          "dir": ".",
          "filename": "GEMINI.md",
          "lines": 60,
          "bytes": 2400,
          "is_symlink": false,
          "symlink_target": null
        }
      ]
    },
    "native": {
      "gemini": {
        "instruction_file": {
          "exists": true,
          "path": "GEMINI.md",
          "lines": 60,
          "bytes": 2400,
          "is_symlink": false,
          "symlink_target": null
        },
        "cicd": {
          "cmds": [
            {
              "cmd": "gemini run --json 'review this PR'",
              "tool": "gemini",
              "version": "0.1.0"
            }
          ]
        }
      }
    }
  }
}

Configuration Options

Gemini Guardrails Inputs

Input Required Default Description
dangerous_flags Optional --yolo,-y Comma-separated dangerous flags for Gemini CLI

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 200+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo