# `Lei.ZarfGate`
[🔗](https://github.com/gtri/lowendinsight/blob/main/lib/lei/zarf_gate.ex#L5)

Pre-package risk gate for Zarf integration.

Evaluates LEI analysis reports against configurable risk thresholds
and returns pass/fail decisions suitable for use as a Zarf action hook
or CI/CD gate.

# `gate_result`

```elixir
@type gate_result() :: %{
  pass: boolean(),
  threshold: String.t(),
  summary: %{
    total: non_neg_integer(),
    passing: non_neg_integer(),
    failing: non_neg_integer()
  },
  failing_repos: [map()],
  report: map()
}
```

# `evaluate`

```elixir
@spec evaluate(map(), String.t()) :: {:ok, gate_result()}
```

Evaluate a single-repo LEI report against a risk threshold.

Returns `{:ok, result}` where result contains `:pass` boolean and details.

## Threshold levels (fail when risk >= threshold)
  - "low" - fail on any risk level (low, medium, high, critical)
  - "medium" - fail on medium, high, or critical risk
  - "high" - fail on high or critical risk (default)
  - "critical" - fail only on critical risk

# `exceeds_threshold?`

```elixir
@spec exceeds_threshold?(String.t(), String.t()) :: boolean()
```

Returns true if the given risk level exceeds the threshold.

# `to_json`

```elixir
@spec to_json(map()) :: {:ok, String.t()}
```

Format gate result as JSON string.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
