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

# Fix It For Me

> Macroscope can create branches, commit fixes, and open PRs automatically

## How to Trigger

1. **From GitHub**: reply to a Macroscope review comment asking it to fix the issue.
2. **From Slack**: ask `@Macroscope` to fix a bug or make a change.

<Info>
  Fix-it-for-me is not available on cross-repo or fork pull requests. Macroscope will still review these PRs if cross-repo review is enabled, but will not offer fix-it-for-me suggestions.
</Info>

## How It Works

1. Macroscope creates a new branch off the feature branch (if triggered from GitHub) or main (if from Slack).
2. Macroscope writes the fix and commits it.
3. Macroscope opens a PR.
4. Your GitHub Actions run. If any fail, Macroscope attempts to fix them and pushes again.
5. If auto-merge is enabled, Macroscope merges the PR once all checks pass. PRs against main always require manual merge.

## Auto-Merge

You can override auto-merge per fix:

* **"Fix it for me and auto-merge"**: merges once checks pass, even if auto-merge is off by default.
* **"Fix it but don't auto-merge"**: opens the PR but leaves it for manual merge.

If auto-merge is blocked, Macroscope posts a comment explaining why.

## Branch Protection

Macroscope never writes directly to main. All branches follow the pattern `macroscope/*/**`. If you have branch protection rules that apply to all branches, you may need to exclude this pattern.

## GitHub Actions

Macroscope uses your existing GitHub Actions to validate fixes. To reduce latency or cost, add branch-specific rules for `macroscope/*/**` to limit which actions run.

## Generated Code

If your repo has auto-generated code, include the expected diff in your test output. Macroscope will detect and apply it automatically.

<Accordion title="Example Test">
  ```yaml theme={null}
  name: Protobuf generated code up-to-date

  on:
    push:
    pull_request:

  jobs:
    protobuf-gen-check:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v4
        - uses: actions/setup-go@v5
          with:
            go-version: "1.22"
        - name: Install protoc plugins
          run: |
            go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
            go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
        - name: Regenerate protobuf files
          run: protoc -I=proto --go_out=. --go-grpc_out=. proto/*.proto
        - name: Fail if generated files changed
          run: git diff --exit-code
  ```
</Accordion>
