> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iriscode.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Gate: Block Builds That Fall Below Your Threshold

> Run an Iris Code health check before the compiler starts, so a failing build stops early instead of shipping.

Install it once and every `pnpm build`, `npm run build` or `make build` checks your project first. If any file is below your threshold, the build stops before the compiler starts.

<Note>
  The build gate requires **Iris Code Pro**.
</Note>

## Installing

Run **Iris Code: Install Build Hook** from the command palette. Iris Code detects your project type and installs the hook. No manual edits to config files are needed.

## What it does

<Steps>
  <Step title="Detects your project type">
    Looks for `package.json` (Node), `go.mod` (Go), `Cargo.toml` (Rust), `pyproject.toml` / `requirements.txt` (Python), `Gemfile` (Ruby), a `.csproj` / `.sln` (.NET), or `pom.xml` / `build.gradle` (Java).
  </Step>

  <Step title="Installs the hook">
    * **Node**: adds a `prebuild` entry to `package.json`, chaining safely before any existing `prebuild` command.
    * **Everything else**: writes an `iris-check` target into your Makefile and wires it as a prerequisite of the `build` or `all` target. Where the Makefile has to be created, its build command matches the project: `go build ./...`, `cargo build`, `dotnet build`, or `./gradlew build`, `gradle build` and `mvn test` for Java depending on which wrapper and build files are present.
  </Step>

  <Step title="Runs on every build">
    If any file falls below `minHealthScore`, the build exits `1` and lists the offending files. Otherwise it proceeds normally.
  </Step>
</Steps>

```bash theme={null}
$ pnpm build
> iris check
Checking 5 files against threshold 70...
✓ src/lib/utils.ts         92 / 100
✓ src/api/client.ts        78 / 100
✗ src/auth/session.ts      61 / 100
  → Hardcoded token-like value (line 42)
✗ src/cart/checkout.ts     66 / 100
  → Function exceeds length threshold (line 118)
Build failed — 2 files below threshold (70)
```

Every file is checked before the build fails, so the complete list appears at once rather than one problem per run.

## Configuring the threshold

Set `minHealthScore` in `.irisconfig.json` to control the minimum acceptable score. It defaults to 70.

```json theme={null}
{
  "minHealthScore": 80
}
```

<Tip>
  On Node projects, your existing `prebuild` command is preserved, and uninstalling restores the original state.
</Tip>

## Insights tracking

Every build hook run is recorded as a pass or fail in your account Insights, so enforcement activity is visible without reading build logs. See [iriscode.co/account/insights](https://iriscode.co/account/insights).

## Uninstalling

Run **Iris Code: Uninstall Build Hook**. Only the Iris Code entry is removed. On Node projects, if no other `prebuild` commands remain, the key is deleted rather than left empty.
