# Merge Queue Automation

Use Haystack's merge queue to get approved PRs into main without babysitting — rebases, conflicts, CI retries, and straightforward fixes handled automatically.

## The Problem

The last mile of every PR is toil: rebase onto main, resolve the trivial conflict, re-run the flaky CI job, fix the lint error, wait, merge. Multiply by an agent-generated PR volume and "good to merge" becomes a full-time shepherding job.

## How Haystack Solves It

- **Self-driving queue**: PRs that pass triage enter the queue and get rebased, conflict-resolved, and retried through CI automatically.
- **Auto-fix**: straightforward findings (lint, small breakages, mechanical fixes) are fixed by Haystack's agent directly on the branch instead of bouncing back to the author.
- **Escalation, not silence**: when the queue can't proceed safely, the PR surfaces in your inbox with what was tried and why it stopped.

## Setup

```bash
npx -y @haystackeditor/cli@latest setup --repo owner/name --yes --auto-merge
```

(`--auto-merge` enables the queue non-interactively; omit it to be asked during setup.)

## Related

- [Catch bugs before merge](/use-cases/catch-bugs-before-merge)
- [Reduce code review time](/use-cases/reduce-code-review-time)
