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

# Build Fix Agents

> Auto-repair TypeScript and JavaScript build errors using LLM agents — one command, zero config.

`build-fix` parses your TypeScript or JavaScript build log and surgically patches source files to fix the errors. Zero config, zero dependencies.

<CardGroup cols={2}>
  <Card title="GitHub" icon="github" href="https://github.com/nometria/build-fix-agents">
    nometria/build-fix-agents
  </Card>

  <Card title="PyPI" icon="python" href="https://pypi.org/project/build-fix/">
    build-fix on PyPI
  </Card>
</CardGroup>

## Install

```bash theme={null}
pip install build-fix
```

## Usage

```bash theme={null}
# Scan current directory and apply fixes (verifies with npm run build)
build-fix .

# Provide a captured build log for more accurate fixes
npm run build 2>&1 | tee build.log
build-fix . --log build.log

# Dry run — show planned patches without applying
build-fix . --dry-run

# Limit to a specific number of fix passes
build-fix . --max-passes 3
```

## What it fixes

| Error type                     | Example                                            |
| ------------------------------ | -------------------------------------------------- |
| Missing type annotations       | `Parameter 'x' implicitly has an 'any' type`       |
| Undefined variables            | `Cannot find name 'foo'`                           |
| Wrong import paths             | `Cannot find module './utils'`                     |
| Type mismatches                | `Type 'string' is not assignable to type 'number'` |
| Missing return types           | `Function lacks ending return statement`           |
| Unused variables (strict mode) | `'x' is declared but its value is never read`      |
| Property does not exist        | `Property 'foo' does not exist on type 'Bar'`      |

## How it works

1. **Parse** — reads the build log and extracts error locations (file, line, message)
2. **Read context** — loads the relevant source file sections
3. **Patch** — LLM generates the minimal fix for each error
4. **Verify** — re-runs `npm run build` to confirm errors are resolved
5. **Repeat** — iterates up to `--max-passes` times until the build is clean

<Tip>Particularly useful for vibe-coded apps where the AI builder generated TypeScript with `any` types or missing imports that cause CI failures after migration.</Tip>

## Requirements

* `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` set in environment
* Node.js project with a `build` script in `package.json`
