A CLI tool that syncs GitLab merge request discussions with a local feedback.md file, designed for AI-assisted code review workflows.
Paste the following into an AI coding agent to set up review-relay in your project:
Set up review-relay in this project:
1. Detect the package manager from lock files and install review-relay as a
dev dependency.
2. Read node_modules/review-relay/README.md, then interactively walk the user
through auth and configuration in the context of this project — ask
questions, confirm choices, and explain decisions as you go.
3. Add review:read and review:write scripts to package.json based on the
chosen auth approach.
4. Add a brief section to the project README or other relevant documentation
describing the review:read and review:write scripts and their agentic
workflow — omit one-time setup details.
5. Offer to add /feedback.md to .gitignore — it's a generated per-session file
that shouldn't be committed.
Review Relay bridges GitLab MR discussions and your local filesystem with two commands:
read— fetches unresolved discussions from a GitLab MR and writes them tofeedback.mdwrite— parses responses fromfeedback.mdand submits them back to GitLab as discussion replies
The generated feedback.md includes instructions tailored for an AI coding agent. The intended flow is:
- Run
npx review-relay readto export unresolved MR discussions tofeedback.md. - Hand
feedback.mdto your AI agent — it reads the discussions, analyzes the referenced files, makes necessary code changes, and fills in the responses. - Run
npx review-relay writeto submit the responses back to GitLab.
The agent is instructed to replace each TODO with either 👍 (feedback accepted and applied) or a detailed technical explanation if it disagrees.
Requires Node.js >= 20. Install locally in your project:
npm install --save-dev review-relayThen run via npx or add scripts to package.json:
npx review-relay read
npx review-relay writeReview Relay is configured via environment variables. You can export them in your shell or use a tool like dotenv-cli to load them from a .env file:
# .env
REVIEW_RELAY_GITLAB_PRIVATE_TOKEN=your-token-herenpx dotenv review-relay read
npx dotenv review-relay writeOr add convenience scripts to package.json:
{
"scripts": {
"review:read": "dotenv review-relay read",
"review:write": "dotenv review-relay write"
}
}| Variable | Description |
|---|---|
REVIEW_RELAY_GITLAB_PRIVATE_TOKEN |
GitLab access token with api scope |
A project access token is recommended over a personal access token — it scopes permissions to a single project. Create one under Settings → Access Tokens in your GitLab project. The token needs at least the Reporter role to read discussions and post notes.
| Variable | Default | Description |
|---|---|---|
REVIEW_RELAY_GITLAB_HOST |
Inferred from git remote | GitLab instance URL (e.g. https://gitlab.example.com) |
REVIEW_RELAY_GITLAB_PROJECT_PATH |
Inferred from git remote | Project path (e.g. group/subgroup/project) |
REVIEW_RELAY_GITLAB_MERGE_REQUEST_IID |
Auto-detected by branch | Override which MR to use by IID |
By default, the GitLab host and project path are read from git remote.origin.url. Supported formats:
git@gitlab.com:group/project.gitssh://git@gitlab.com/group/project.githttps://gitlab.com/group/project.git
The current git branch is used to find the matching open MR. Set REVIEW_RELAY_GITLAB_MERGE_REQUEST_IID to override if multiple open MRs exist for the same branch.
The read command only includes discussions that need attention:
- Resolved discussions are excluded.
- System notes (auto-generated by GitLab) are excluded.
- Discussions where you already replied last are excluded.
review-relay read Fetch unresolved merge request discussions into feedback.md
review-relay write Submit responses from feedback.md to merge request discussions
review-relay --help Show help
review-relay --version Show version