/install gitlab-auto-review
GitLab MR Code Review
Polling-based automated code review for GitLab MRs.
Architecture
Cron (*/2 * * * *) → gitlab-api.js list-mrs → skip reviewed → fetch diff → AI review → post comments/note
- No webhook server — pure polling
- Reviewed MRs tracked in
{baseDir}/mr-reviewed.json
Setup
- Create
{baseDir}/.envwith your GitLab credentials:
The script auto-loads this file. Environment variables take precedence (won't be overwritten if already set).GITLAB_URL=https://gitlab.example.com GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx - Test:
node {baseDir}/scripts/gitlab-api.js get-version - Install cron worker — see references/cron-setup.md for the full command
API Script Reference
node {baseDir}/scripts/gitlab-api.js get-version # Test connection
node {baseDir}/scripts/gitlab-api.js list-mrs # List open MRs
node {baseDir}/scripts/gitlab-api.js list-mrs --project \x3Cproject_path> # Filter by project
node {baseDir}/scripts/gitlab-api.js get-changes \x3Cproject_id> \x3Cmr_iid> # Fetch MR diff
node {baseDir}/scripts/gitlab-api.js get-file \x3Cproject_id> \x3Cbranch> \x3Cpath> # Fetch file content
node {baseDir}/scripts/gitlab-api.js post-comment --file \x3Cjson> \x3Cpid> \x3Ciid> # Inline comment (use --file!)
node {baseDir}/scripts/gitlab-api.js post-note \x3Cproject_id> \x3Cmr_iid> '\x3Ctext>' # Summary note
post-comment JSON format
{
"body": "**[Critical]** sql_injection\
\
Raw query with user input.",
"position": {
"base_sha": "abc123",
"start_sha": "def456",
"head_sha": "ghi789",
"new_path": "src/db.js",
"new_line": 42
}
}
base_sha/start_sha/head_sha come from get-changes output's diff_refs.
Review Rules
- Default: references/review-guidelines.md — severity levels, output format, what to skip
- Per-project: Place
.gitlab-review-prompt.mdin the repo root; the worker auto-fetches it viaget-file
Troubleshooting
| Problem | Fix |
|---|---|
| MRs not reviewed | openclaw cron list — is worker enabled? |
| API errors | node {baseDir}/scripts/gitlab-api.js get-version |
| Duplicate reviews | Check {baseDir}/mr-reviewed.json exists and is writable; ensure cron prompt has explicit "never re-review" rule at highest priority |
| Garbled comments | Use --file mode for post-comment (Windows PowerShell encoding) |
| Wrong line numbers | new_line must be the line number in the NEW version of the file |
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install gitlab-auto-review - After installation, invoke the skill by name or use
/gitlab-auto-review - Provide required inputs per the skill's parameter spec and get structured output
What is GitLab MR Code Review?
Automated AI code review for GitLab Merge Requests via polling. Periodically checks for open MRs, reviews code diffs for security vulnerabilities, bugs, and... It is an AI Agent Skill for Claude Code / OpenClaw, with 149 downloads so far.
How do I install GitLab MR Code Review?
Run "/install gitlab-auto-review" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is GitLab MR Code Review free?
Yes, GitLab MR Code Review is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does GitLab MR Code Review support?
GitLab MR Code Review is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created GitLab MR Code Review?
It is built and maintained by gotoloops (@gotoloops); the current version is v1.0.3.