Gathering detailed insights and metrics for @parvez3019/ai-code-review-gitlab-plugin
Gathering detailed insights and metrics for @parvez3019/ai-code-review-gitlab-plugin
Gathering detailed insights and metrics for @parvez3019/ai-code-review-gitlab-plugin
Gathering detailed insights and metrics for @parvez3019/ai-code-review-gitlab-plugin
It is a small tool used for inline code review in GitLab Merge Requests. It supports calling the GitLab API for adding inline review comments and uses either Gemini AI API or AWS Bedrock to obtain AI code review feedbacks.
npm install @parvez3019/ai-code-review-gitlab-plugin
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (99.42%)
JavaScript (0.58%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
40 Commits
1 Branches
3 Contributors
Updated on Jun 30, 2025
Latest Version
0.0.11
Package Id
@parvez3019/ai-code-review-gitlab-plugin@0.0.11
Unpacked Size
61.61 kB
Size
16.71 kB
File Count
18
NPM Version
10.8.2
Node Version
20.19.2
Published on
Jun 05, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Based on - https://github.com/hataiit9x/gemini-review-code
@parvez3019/ai-code-review-gitlab-plugin
It is a small tool used for inline code review in GitLab Merge Requests. It supports calling the GitLab API for adding inline review comments and uses either Gemini AI API or AWS Bedrock to obtain AI code review feedbacks. Please note that when using it, ensure compliance with company regulations. 😉
Review Comment:
Summary Comment For No Feedback Section -
1npm i @parvez3019/ai-code-review-gitlab-plugin
1# Required for AWS Bedrock 2export AWS_REGION="us-east-1" 3export AWS_SECRET_ACCESS_KEY="your-aws-secret-key" 4export AWS_ACCESS_KEY_ID="your-aws-access-key" 5# Available Claude models in Bedrock: 6# - anthropic.claude-3-5-sonnet-20241022-v2:0 7export AWS_BEDROCK_MODEL="anthropic.claude-3-5-sonnet-20241022-v2:0"
1# Required for Gemini 2export GEMINI_API_KEY="your-gemini-api-key" 3export GEMINI_API_URL="https://generativelanguage.googleapis.com" 4export GEMINI_MODEL="gemini-1.5-flash"
1# Optional: Set default AI provider 2export AI_PROVIDER="bedrock" # or "gemini"
1ai-code-review-gitlab-plugin \ 2 --gitlab-api-url "https://gitlab.com/api/v4" \ 3 --gitlab-access-token "your-gitlab-token" \ 4 --project-id 123 \ 5 --merge-request-id 456 \ 6 --ai-provider bedrock \ # or gemini 7 --api-key "your-api-key" \ 8 --api-secret "your-api-secret" \ # required for bedrock 9 --region "us-east-1" \ # for bedrock 10 --custom-model "model-id" \ # optional 11 --system-prompt-path "/path/to/system-prompt.txt" \ # optional, local file or s3://bucket/key 12 --code-review-prompt-path "/path/to/code-review-prompt.txt" \ # optional, local file or s3://bucket/key 13 --s3-region "us-east-1" \ # optional, for S3 prompt paths 14 --s3-access-key "your-s3-access-key" \ # optional, for S3 prompt paths 15 --s3-secret-key "your-s3-secret-key" # optional, for S3 prompt paths
Add the following to your .gitlab-ci.yml
file to enable automated code reviews:
1code-review: 2 stage: code-review 3 image: node:20 4 script: 5 - npm i -g @parvez3019/ai-code-review-gitlab-plugin 6 - | 7 if [ "$AI_PROVIDER" = "bedrock" ]; then 8 ai-code-review-gitlab-plugin \ 9 -t "$CODE_REVIEW_GITLAB_TOKEN" \ 10 -p "$CI_MERGE_REQUEST_PROJECT_ID" \ 11 -m "$CI_MERGE_REQUEST_IID" \ 12 -a $AI_PROVIDER \ 13 -k "$AWS_ACCESS_KEY_ID" \ 14 -s "$AWS_SECRET_ACCESS_KEY" \ 15 -r "$AWS_REGION" \ 16 -c "$AWS_BEDROCK_MODEL" \ 17 -sp "$SYSTEM_PROMPT_PATH" \ 18 -crp "$CODE_REVIEW_PROMPT_PATH" \ 19 --s3-region "$S3_REGION" \ 20 --s3-access-key "$S3_ACCESS_KEY" \ 21 --s3-secret-key "$S3_SECRET_KEY" 22 else 23 ai-code-review-gitlab-plugin \ 24 -t "$CODE_REVIEW_GITLAB_TOKEN" \ 25 -p "$CI_MERGE_REQUEST_PROJECT_ID" \ 26 -m "$CI_MERGE_REQUEST_IID" \ 27 -a $AI_PROVIDER \ 28 -k "$GEMINI_API_KEY" \ 29 -c "$GEMINI_MODEL" \ 30 -sp "$SYSTEM_PROMPT_PATH" \ 31 -crp "$CODE_REVIEW_PROMPT_PATH" \ 32 --s3-region "$S3_REGION" \ 33 --s3-access-key "$S3_ACCESS_KEY" \ 34 --s3-secret-key "$S3_SECRET_KEY" 35 fi 36 only: 37 - merge_requests 38 when: manual 39 tags: 40 - build 41 - stg
You can set up automatic code reviews when you are added as a reviewer using GitLab Webhooks:
Go to your GitLab project settings
Navigate to Webhooks
Add a new webhook with the following settings:
Create a webhook handler (example using AWS Lambda):
1exports.handler = async (event) => { 2 const payload = JSON.parse(event.body); 3 4 // Check if this is a merge request event 5 if (payload.object_kind === 'merge_request') { 6 // Check if the action is adding a reviewer 7 if (payload.action === 'reviewer') { 8 // Check if you are the added reviewer 9 const yourGitlabId = 'YOUR_GITLAB_USER_ID'; 10 const addedReviewers = payload.changes.reviewers?.current || []; 11 12 if (addedReviewers.some(reviewer => reviewer.id === yourGitlabId)) { 13 // Trigger the code review 14 const response = await fetch('https://gitlab.com/api/v4/projects/' + 15 payload.project.id + '/merge_requests/' + 16 payload.object_attributes.iid + '/pipeline', { 17 method: 'POST', 18 headers: { 19 'PRIVATE-TOKEN': process.env.GITLAB_TOKEN 20 } 21 }); 22 } 23 } 24 } 25 26 return { 27 statusCode: 200, 28 body: JSON.stringify('Webhook processed') 29 }; 30};
This setup will:
Make sure to:
YOUR_GITLAB_USER_ID
with your actual GitLab user IDYou can also trigger the code review directly using the GitLab API:
1curl --request POST \ 2 --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ 3 "https://gitlab.com/api/v4/projects/$PROJECT_ID/merge_requests/$MR_IID/pipeline"
This can be integrated into your existing workflows or automation scripts.
Option | Description | Default | Required |
---|---|---|---|
-g, --gitlab-api-url | GitLab API URL | https://gitlab.com/api/v4 | No |
-t, --gitlab-access-token | GitLab Access Token | - | Yes |
-p, --project-id | GitLab Project ID | - | Yes |
-m, --merge-request-id | GitLab Merge Request ID | - | Yes |
-a, --ai-provider | AI Provider (gemini or bedrock) | gemini | No |
-k, --api-key | API Key (Gemini API Key or AWS Access Key ID) | - | Yes |
-s, --api-secret | API Secret (AWS Secret Access Key for Bedrock) | - | Yes (for bedrock) |
-r, --region | AWS Region for Bedrock | us-east-1 | No |
-c, --custom-model | Custom Model ID | - | No |
-sp, --system-prompt-path | System Prompt Path | - | No |
-crp, --code-review-prompt-path | Code Review Prompt Path | - | No |
-sr, --s3-region | S3 Region | - | No |
-sk, --s3-access-key | S3 Access Key | - | No |
-ssk, --s3-secret-key | S3 Secret Key | - | No |
Model Not Available Error
Authentication Errors
Rate Limiting
API Key Issues
Model Availability
Welcome to contribute code, ask questions and suggestions! 👏
This project is based on the MIT license. See the LICENSE file for details. 📜
No vulnerabilities found.
No security vulnerabilities found.