README
¶
= annoyer
:project-handle: annoyer
:uri-project: https://github.com/slonopotamus/{project-handle}
:uri-ci: {uri-project}/actions?query=branch%3Amain
:source-highlighter: rouge
:version: 0.0.5
image:{uri-project}/actions/workflows/ci.yml/badge.svg?branch=main[Build Status,link={uri-ci}]
image:https://img.shields.io/github/release/slonopotamus/{project-handle}[Download,link={uri-project}/releases/latest]
An LLM agent that reviews GitLab merge requests and posts its findings as discussions.
== How it works
* annoyer is meant to run inside a GitLab CI job on a merge-request pipeline.
* It talks via Anthropic API with an agentic prompt and a set of GitLab tools.
* The agent inspects changes, then creates discussions on the merge request.
== Usage
Environment variables:
[cols="1,1,2",options="header"]
|===
|Variable |Source |Purpose
|`ANTHROPIC_BASE_URL`
|set yourself, optional
|Anthropic-compatible LLM provider (standard Anthropic SDK variable)
|`ANTHROPIC_API_KEY`
|set yourself, required
|API key for the LLM provider (standard Anthropic SDK variable)
|`ANTHROPIC_MODEL`
|set yourself, optional
|LLM model ID passed to the LLM API, defaults to `claude-opus-5`
|`GITLAB_TOKEN`
|set yourself, required
|GitLab token with `api` and `read_repository` scopes
|`CI_SERVER_URL`
|GitLab CI
|GitLab instance URL
|`CI_PROJECT_ID`
|GitLab CI
|Project ID
|`CI_MERGE_REQUEST_IID`
|GitLab CI
|Merge request IID
|`JIRA_TOKEN`
|set yourself, optional
|Jira token; enables the Jira tools when set
|`JIRA_URL`
|set yourself, optional
|Jira instance URL (required when `JIRA_TOKEN` is set)
|`JIRA_EMAIL`
|set yourself, optional
|Jira account email; when set, authenticates with email + token (basic auth), otherwise `JIRA_TOKEN` is used as a Bearer token
|===
If the repository contains a `REVIEW.md` file on the merge request's head ref, annoyer will download it and use as LLM prompt.
=== GitLab CI example
[source,yaml,subs="attributes+"]
----
review:
rules:
- if: "$CI_MERGE_REQUEST_ID"
image: ghcr.io/slonopotamus/annoyer:{version}
variables:
ANTHROPIC_BASE_URL: your anthropic-compatible LLM provider
ANTHROPIC_MODEL: your/model-id
GITLAB_TOKEN: your token
script:
- annoyer
----
The Docker image is published to the GitHub container registry on every
release. Alternatively, install the binary directly:
`go install github.com/slonopotamus/annoyer@{version}`.
== Building
[source,shell]
----
go build .
----
== Tools
The agent is given GitLab tools:
* `approveMergeRequest` — approve the MR
* `compare` — compare two refs (branch/tag/SHA) and return the diff between them
* `createDiscussion` — create a (possibly inline) thread on the MR; can reply to an existing thread
* `createMergeRequestNote` — add a top-level note
* `getBranch` — get a branch by name, including its HEAD commit SHA
* `getCommit` — get a commit by SHA
* `getCommitDiff` — get the file diff of a single commit
* `getFile` — read a file at a path/ref (raw contents)
* `getFileBlame` — get the blame of a file (which commit last modified each line)
* `getJob` — get a CI job by ID (status, stage, duration)
* `getJobLog` — get the log (trace) of a CI job; truncated to its tail when long
* `getMergeRequest` — MR details (state, title, branches, description) and the `diff_refs` SHAs needed for inline comments; file diffs come from `listMergeRequestDiffs`
* `getMergeRequestCommits` — list MR commits
* `getPipelineTestReport` — get the unit test results of a CI pipeline
* `listBranches` — list repository branches
* `listCommits` — list commits, filterable by ref, path, and time range
* `listMergeRequestDiffs` — list the changed-file diffs
* `listMergeRequestDiscussions` — list existing threads
* `listMergeRequestNotes` — list notes
* `listMergeRequestPipelines` — list MR pipelines
* `listMergeRequests` — list the project's merge requests
* `listPipelineJobs` — list jobs for a pipeline
* `listTree` — list repository files/directories
* `resolveDiscussion` — resolve/reopen a thread
* `searchBlobs` — search code in the project
* `unapproveMergeRequest` — unapprove the MR
When `JIRA_TOKEN` and `JIRA_URL` are set, the agent additionally gets Jira tools:
* `getJiraIssue` — get an issue by key
* `searchJiraIssues` — search issues with a JQL query
* `listJiraIssueComments` — list comments on an issue
If you pass one or more `--allowed-roots`, the agent additionally gets local
file tools (read, glob, grep) restricted to those directories — useful when the
working tree is checked out and you want it to read files directly.
Documentation
¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.