Skip to main content

Say Goodbye to Tedious Reviews - One-Stop Code Review Solution

This document provides detailed instructions on how to use Tuanjie AI, an intelligent tool, to optimize Git Commit message writing and Code Review processes, empowering R&D collaboration through AI for greater efficiency and better code quality assurance.

1. Why Do We Need AI-Powered Git Commit and Code Review?

In traditional R&D collaboration models, Git Commit and Code Review, as core processes, have long faced numerous pain points that seriously impact development efficiency and code quality:

  • Chaotic Commit Messages: Developers often carelessly write Commit messages (such as "fix bug", "update") when rushing to meet deadlines, making it difficult to quickly locate core changes when troubleshooting or tracing versions later, increasing communication costs. Additionally, Tuanjie AI can directly generate Changelogs and work reports based on good Commit messages.

  • Inefficient Code Review: Manual Review requires spending significant time checking code line by line. In large projects especially, long review cycles can lead to bottlenecks in the development process.

  • Inconsistent Review Quality: Different developers have varying technical levels and areas of focus, making it easy to overlook potential performance issues, security vulnerabilities, or code style problems.

  • High Learning Curve for Newcomers: Newcomers need to familiarize themselves with the team's Commit standards and code review criteria, a lengthy process prone to errors.

Tuanjie AI, with its powerful intelligent analysis and automation capabilities, can solve these problems at their root, making R&D collaboration smoother and code quality control more efficient.

2. Practical Guide

Next, we will demonstrate through specific practical steps how to use Tuanjie AI to achieve comprehensive optimization of the Git Commit and Code Review workflow.

Project Preparation

  1. First, create an empty project directory code-review-sample and complete Git repository initialization using the command git init, preparing for subsequent version management.

  2. Open the project using your preferred code editor (this article uses VS Code as an example).

  3. Use Tuanjie AI's intelligent coding capabilities to generate code: Input the command "Help me write an abstract sort interface in Python and implement quick sort and bubble sort" to Tuanjie AI. Tuanjie AI will automatically complete the algorithm implementation and generate the sorting.py file, significantly saving coding time.

Generate Standardized Commit Messages

Tuanjie AI has built-in Prompt templates specifically for generating Commit messages, eliminating the need to manually write complex standard messages. The specific operation is as follows:

  1. Input the / symbol in Tuanjie AI and select Git Commit Message Generator from the popup options.

  2. Just press the input button, and Tuanjie AI will automatically generate a Commit message that conforms to standards.

Bridge

Then let's check the generated Commit message:

Bridge

From the generated results, we can see that the Commit message provided by Tuanjie AI not only has a clear structure but also includes key information such as change type, affected modules, and specific modification content, fully meeting the team's version management standards.

In addition, if the team has customized Commit message standards, you can customize Prompt templates according to your own needs, making the messages generated by Tuanjie AI better fit the team's actual usage habits.

AI-Driven Code Review

With Tuanjie AI's AI capabilities, we can build an automated Code Review workflow to achieve intelligent review of Merge Requests (MRs) and synchronize results to the code repository and collaboration group chats, significantly improving review efficiency and coverage.

Project Configuration: Build Core Files for Code Review

First, create a codereview directory in the project root to store the Prompt templates and execution scripts needed for review. This directory should contain two core files: codereview_prompt.md and ai-code-review.py.

codereview_prompt.md

You are a senior software development expert and code review master, proficient in Python and JavaScript/TypeScript development, especially skilled in using FastAPI and gRPC Web to implement backend services, and using React with shadcn/ui to build modern frontend applications.

Please reply in **Chinese**.

Your task is to review the following code changes, combined with the content of the code repository, to evaluate the quality and potential risks of this change, and provide targeted improvement suggestions.

## Project Background

This project is a Web application and AI service platform, with main functions including frontend-backend collaboration and large model interaction. The tech stack includes:

* **Backend Language**: Python (approximately 60% of source code)
* Framework: FastAPI, gRPC Web
* Special attention: Async task scheduling, context management, Prompt construction, Token control, multi-user state isolation, etc.
* **Frontend Language**: JavaScript / TypeScript (approximately 40% of source code)
* Framework and components: React + shadcn/ui + TailwindCSS
* Special attention: State management, async loading, component reuse, performance optimization, accessibility, etc.
* **Note**: Code commits may contain compiled static assets (such as `dist/`, `.vscode/`, `static/`, etc.), please automatically ignore these files that don't need review.

You are currently in the root directory of the code and can directly view necessary repository content to assist in evaluating code changes.

## Review Focus (in order of priority)

1. **Critical Defects**
* Backend:
* Logic errors, missing exception handling, chaotic context management
* Improper use of gRPC/WebSocket/FastAPI
* Async processing errors for large model request interfaces, failure to properly handle timeout or exception responses
* Sensitive data leakage, path traversal, XSS/injection and other security issues
* Frontend:
* Critical interaction logic defects, such as inability to correctly trigger events, failure to catch errors in async requests
* Missing form validation, failure to handle exception states, etc.
* Code using uncontrolled components or breaking React state flow

2. **Performance Issues**
* Backend:
* Synchronous blocking, serial execution of database/large model requests causing delayed response
* Using non-lazy data structures (such as large model responses not processed in streaming)
* Frontend:
* High rendering overhead, duplicate requests, excessive state refreshes
* Unnecessary component re-renders or excessive state elevation

3. **Maintainability and Robustness**
* Unclear naming, code duplication, excessively long functions, unclear responsibilities
* Failure to encapsulate common logic, failure to use dependency injection/hooks and other component mechanisms
* Lack of type annotations (Python) or type mismatches (TS)
* Failure to include unit tests/no basic test coverage

4. **Language/Framework-Specific Issues**
* Python:
* Misuse of FastAPI routes/dependency injection
* gRPC client/server collaboration logic defects
* Dependency management (requirements/pyproject), improper use of exception handling decorators
* React:
* Improper use of Hooks (such as infinite execution of side effects)
* Complex state logic not split, failure to use component thinking
* CSS conflicts, Tailwind abuse, failure to reuse styles

## Output Format (Please strictly follow)

#### 🤖 Review Score

[Please rate this change here, scoring range 0-100]

---

#### 💭 Code Understanding

[Please briefly describe your understanding of the functionality and main purpose of this code change.]

---

#### ⚠️ Critical Issues and Suggestions

[Please list all critical issues you found. Each issue should include:

- Issue Description: Clearly explain where the problem lies.
- Code Location: Point out relevant code snippets or file line numbers (if possible).
- Potential Impact: Explain the consequences this issue may cause.
- Fix Suggestion: Provide specific modification solutions, which may include brief example code.]

---

#### 🔍 Minor Improvements (Optional)

[Please list up to 3 minor points that you think could further improve code quality, such as code style, readability improvement, etc.]

---

#### 📝 Summary

[Please give an overall evaluation of the overall quality of this code change in 1-2 sentences.]

## Notes

- Please ignore frontend compiled files (such as `.next/`, `dist/`, `static/`), `.vscode/` directory or IDE plugin-related resources.
- If the change quality is high with no obvious issues, please explicitly state "Code change has no obvious critical issues" in "Critical Issues and Suggestions".
- If lack of context affects judgment accuracy, please indicate what additional information is needed in "Code Understanding" or in the issues.
- Please avoid pure style suggestions unless they significantly impact maintainability.

The following are the code changes to be reviewed. Please evaluate them in combination with existing repository content:

```diff
{{diff_content}}
```

Please strictly organize your reply according to the above "Output Format", use Chinese, and ensure each title (such as #### 🤖 Review Score) exists.

ai-code-review.py

import os
import sys
import json
import subprocess
import argparse
import requests
import re
import time
from jinja2 import Template

def get_mr_diff_via_api(project_path, mr_id, gitlab_token, gitlab_base_url):
"""Get MR diff through GitLab API"""
if not all([project_path, mr_id, gitlab_token, gitlab_base_url]):
print("Missing required parameters, using mock data for local testing")
return get_mock_diff_data()

encoded_project_path = requests.utils.quote(project_path, safe='')
api_url = f"{gitlab_base_url}/api/v4/projects/{encoded_project_path}/merge_requests/{mr_id}/changes"

headers = {
"PRIVATE-TOKEN": gitlab_token
}

try:
response = requests.get(api_url, headers=headers, timeout=10)
if response.status_code == 200:
try:
return response.json().get("changes", [])
except requests.exceptions.JSONDecodeError:
print(f"Invalid API response: {response.text}")
else:
print(f"Failed to get MR diff, status code: {response.status_code}, response: {response.text}")
print("Please check whether GITLAB_BASE_URL and GITLAB_BOT_TOKEN are configured in Settings->CI/CD->Variables. If configured, please check whether they have expired.")
except requests.exceptions.RequestException as e:
print(f"API request failed: {str(e)}")
print("Using mock data for local testing")
return get_mock_diff_data()

return []

def get_mock_diff_data():
"""Return mock diff data for local testing"""
mock_changes = [
{
"old_path": "src/utils/helper.py",
"new_path": "src/utils/helper.py",
"diff": """@@ -1,10 +1,15 @@
import os
import sys
+import json

def process_data(data):
- if data is None:
- return None
+ if not data:
+ return {}

- result = data.strip()
+ try:
+ result = data.strip()
+ except AttributeError:
+ return {}
+
return result.upper()

def validate_input(input_str):"""
},
{
"old_path": "src/api/endpoints.py",
"new_path": "src/api/endpoints.py",
"diff": """@@ -15,8 +15,12 @@

@app.route('/api/users', methods=['GET'])
def get_users():
- users = db.query('SELECT * FROM users')
- return jsonify(users)
+ try:
+ users = db.query('SELECT * FROM users')
+ return jsonify(users)
+ except Exception as e:
+ logger.error(f"Database error: {e}")
+ return jsonify({'error': 'Internal server error'}), 500

@app.route('/api/users/<int:user_id>', methods=['DELETE'])
def delete_user(user_id):"""
}
]
return mock_changes

def filter_diff(diff_content):
"""Filter out binary files and third-party libraries"""
binary_extensions = r"\.(png|jpg|jpeg|gif|svg|pdf|zip|tar|gz|jar|war|ear|class|so|dylib|dll|exe|bin)$"

if isinstance(diff_content, list):
filtered_changes = []

for change in diff_content:
file_path = change.get('new_path', '') or change.get('old_path', '')
if re.search(binary_extensions, file_path, re.IGNORECASE):
continue

diff = change.get('diff')
if diff and isinstance(diff, str):
filtered_changes.append(diff)

return '\n'.join(filtered_changes)

def gen_prompt(diff_content):
"""Generate code review prompt"""
script_dir = os.path.dirname(os.path.abspath(__file__))
prompt_file = os.path.join(script_dir, 'codereview_prompt.md')

try:
with open(prompt_file, 'r', encoding='utf-8') as f:
template = Template(f.read())
return template.render(diff_content=diff_content)
except FileNotFoundError:
raise FileNotFoundError(f"Prompt file not found: {prompt_file}")
except Exception as e:
raise Exception(f"Error reading prompt file: {e}")

def check_codely_installed():
"""Check if codely is installed"""
try:
result = subprocess.run(
['codely', '--version'],
capture_output=True, text=True, encoding='utf-8', errors='ignore'
)
return result.returncode == 0
except FileNotFoundError:
return False
except Exception as e:
print(f"Error checking codely installation status: {e}")
return False

def install_codely():
"""Install codely CLI tool"""
if check_codely_installed():
print("Codely CLI installed")
return True

print("Installing Codely CLI...")

install_cmd = [
'curl', '-fsSL', 'https://codesearch-plugins.tos-cn-shanghai.volces.com/codely-cli/install.sh'
]
bash_cmd = ['bash']

try:
curl_process = subprocess.run(
install_cmd, shell=False, check=False, text=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)

if curl_process.returncode != 0:
print(f"Failed to download installation script: {curl_process.stderr}")
return False

bash_process = subprocess.run(
bash_cmd, shell=False, check=False, text=True,
input=curl_process.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)

if bash_process.returncode == 0:
print("Codely CLI installed successfully")
return True
else:
print(f"Codely CLI installation failed: {bash_process.stderr}")
return False

except Exception as e:
print(f"Exception during Codely CLI installation: {str(e)}")
return False

def call_codely_for_review(diff_content, codely_token):
"""Use codely for code review"""
request_start_time = time.time()

codely_available = check_codely_installed()
if not codely_available:
error_info = {"error": "Codely CLI not installed or unavailable"}
return error_info, "Codely CLI not installed or unavailable, please install Codely CLI first", {"error": "Codely CLI not available"}

prompt = gen_prompt(diff_content)
full_prompt = f"{prompt}"
safe_prompt = full_prompt

codely_cmd = ['codely', '-p', safe_prompt, '-y']

try:
env = os.environ.copy()
process = subprocess.run(
codely_cmd, shell=False, check=False, text=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', errors='ignore',
env=env
)

request_end_time = time.time()
request_duration_seconds = round(request_end_time - request_start_time, 3)

info = {
"model_name": "codely",
"token_info": {
"prompt_tokens": "N/A",
"completion_tokens": "N/A",
"total_tokens": "N/A"
},
"request_duration_seconds": request_duration_seconds
}

if process.returncode == 0:
generated_content = process.stdout.strip()
if not generated_content:
generated_content = "Tuanjie AI executed successfully but returned no content"
else:
generated_content = f"Tuanjie AI execution failed: {process.stderr.strip()}"

response_json = {
"stdout": process.stdout,
"stderr": process.stderr,
"returncode": process.returncode,
"command": ' '.join(codely_cmd) if isinstance(codely_cmd, list) else codely_cmd
}

return info, generated_content, response_json

except Exception as e:
error_info = {"error": str(e)}
return error_info, f"Tuanjie AI call exception: {str(e)}", {"error": str(e)}

def send_to_feishu(ai_review, project_name, commit_sha, mr_id=None, mr_url=None,
commit_url=None, webhook_url=None):
"""Send review results to Feishu"""
# Build link text
if mr_id:
button_text = "View Merge Request"
button_url = mr_url
else:
button_text = "View Full Commit"
button_url = commit_url

card_payload= {
"msg_type": "interactive",
"card": {
"schema": "2.0",
"config": {
"update_multi": True,
"style": {
"text_size": {
"normal_v2": {
"default": "normal",
"pc": "normal",
"mobile": "heading"
}
}
}
},
"body": {
"direction": "vertical",
"padding": "20px 20px 20px 20px",
"elements": [
{
"tag": "markdown",
"content": f"{ai_review}",
"text_align": "left",
"text_size": "normal_v2",
"margin": "0px 0px 0px 0px"
},
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": button_text
},
"type": "default",
"width": "default",
"size": "medium",
"behaviors": [
{
"type": "open_url",
"default_url": button_url,
"pc_url": "",
"ios_url": "",
"android_url": ""
}
],
"margin": "0px 0px 0px 0px"
}
]
},
"header": {
"title": {
"tag": "plain_text",
"content": "📋 AI Code Review Report"
},
"subtitle": {
"tag": "plain_text",
"content": ""
},
"template": "blue",
"padding": "12px 12px 12px 12px"
}
}
}

# Create simple text message (as fallback)
text_payload = {
"msg_type": "text",
"content": {
"text": f"AI Code Review for {project_name} ({commit_sha[:8]})\n\n{ai_review}"
}
}

# Try to send rich card message
try:
response = requests.post(
webhook_url,
headers={"Content-Type": "application/json"},
json=card_payload
)

if response.status_code == 200 and response.json().get("code") == 0:
print("Rich text notification sent successfully")
return True

# If card message fails, try sending plain text message
print("Rich text message sending failed, trying plain text message...")
response = requests.post(
webhook_url,
headers={"Content-Type": "application/json"},
json=text_payload
)

if response.status_code == 200 and response.json().get("code") == 0:
print("Plain text notification sent successfully")
return True
else:
print(f"All notification methods failed, response: {response.text}")
return False

except Exception as e:
print(f"Exception sending notification: {str(e)}")
return False

def send_to_gitlab_mr(info, ai_review, project_path, mr_id, gitlab_base_url, gitlab_token):
"""Send review results to GitLab MR comments"""
if not mr_id:
print("No MR ID provided, skipping sending to GitLab")
return False

encoded_project_path = requests.utils.quote(project_path, safe='')
api_url = f"{gitlab_base_url}/api/v4/projects/{encoded_project_path}/merge_requests/{mr_id}/notes"

headers = {
"Content-Type": "application/json",
"PRIVATE-TOKEN": gitlab_token
}

content = f"""
```
Model Name: {info.get("model_name", "N/A")}
Prompt Tokens: {info.get("token_info", {}).get("prompt_tokens", "N/A")}
Completion Tokens: {info.get("token_info", {}).get("completion_tokens", "N/A")}
Total Tokens: {info.get("token_info", {}).get("total_tokens", "N/A")}
Total Duration: {info.get("request_duration_seconds", "N/A")}s
```\n\n{ai_review}
"""
data = { "body": content }

try:
response = requests.post(api_url, headers=headers, json=data)

if response.status_code in [200, 201]:
print(f"Successfully sent review results to GitLab MR #{mr_id}")
return True
else:
print(f"Failed to send to GitLab, status code: {response.status_code}, response: {response.text}")
print("Please check whether GITLAB_BASE_URL and GITLAB_BOT_TOKEN are configured in Settings->CI/CD->Variables. If configured, please check whether they have expired.")
return False

except Exception as e:
print(f"Exception sending to GitLab: {str(e)}")
return False

def main():
parser = argparse.ArgumentParser(description="Tuanjie AI Code Review Tool")
parser.add_argument("--local-test", action="store_true", help="Use mock data for local testing")
args = parser.parse_args()

mr_id = os.getenv("CI_MERGE_REQUEST_IID")
commit_sha = os.getenv("CI_COMMIT_SHA")
project_name = os.getenv("CI_PROJECT_NAME")
project_path = os.getenv("CI_PROJECT_PATH")
codely_token = os.getenv("CODELY_TOKEN")
gitlab_base_url = os.getenv("GITLAB_BASE_URL")
gitlab_bot_token = os.getenv("GITLAB_BOT_TOKEN")
feishu_webhook_url = os.getenv("FEISHU_WEBHOOK_URL", "")

if args.local_test:
print("Local test mode enabled, using mock data")
diff_content = get_mock_diff_data()
project_name = project_name or "test-project"
commit_sha = commit_sha or "abc123456"
mr_id = mr_id or "1"
else:
diff_content = get_mr_diff_via_api(
project_path=project_path,
mr_id=mr_id,
gitlab_token=gitlab_bot_token,
gitlab_base_url=gitlab_base_url
)

filtered_diff = filter_diff(diff_content)

if not filtered_diff:
print("No code changes to review, skipping review process")
return 0

print("Using Tuanjie AI for code review")

if not install_codely():
print("Codely CLI installation failed, review terminated")
return 1

info_codely, ai_review_codely, response_json_codely = call_codely_for_review(filtered_diff, codely_token)

with open("ai_review_codely.txt", "w", encoding="utf-8") as f:
f.write(ai_review_codely)

with open("response_codely.json", "w", encoding="utf-8") as f:
json.dump(response_json_codely, f, indent=2, ensure_ascii=False)

if args.local_test:
print("Local test mode, skipping sending to GitLab")
gitlab_success = True
else:
gitlab_success = send_to_gitlab_mr(
info=info_codely,
ai_review=ai_review_codely,
project_path=project_path,
mr_id=mr_id,
gitlab_base_url=gitlab_base_url,
gitlab_token=gitlab_bot_token
)

# Send to Feishu
feishu_success = False
if feishu_webhook_url:
feishu_success = send_to_feishu(
ai_review=ai_review_codely,
project_name=project_name,
commit_sha=commit_sha,
mr_id=mr_id,
mr_url=f"{gitlab_base_url}/{project_path}/-/merge_requests/{mr_id}" if mr_id else None,
commit_url=f"{gitlab_base_url}/{project_path}/-/commit/{commit_sha}" if commit_sha else None,
webhook_url=feishu_webhook_url
)
else:
feishu_success = True
print("No Feishu Webhook URL configured, skipping sending to Feishu")

return 0 if (feishu_success and gitlab_success) else 1

if __name__ == "__main__":
sys.exit(main())

File Description:

  • codereview_prompt.md: This is the instruction template file for AI review. You can customize review dimensions (such as code style, performance, security, logic reasonability, etc.) based on the team's code standards and business scenarios, making AI reviews better fit the team's actual needs.

  • ai-code-review.py: This is the execution entry script for Code Review. Its core functions include four main modules:

    1. Automatically detect and install Codely CLI to ensure the tool environment is available
    2. Pull the Diff content of code from MRs to locate the core code segments of this change
    3. Based on custom Prompt templates, call Codely CLI to complete automated code review
    4. Write review results to GitLab MR comment areas in structured form, and simultaneously push to Feishu group chat bots to achieve real-time synchronization of review results

Configure GitLab/GitHub Environment Variables

To ensure the script runs properly, you need to configure related environment variables in the GitLab project's Settings > CI/CD > Variables. The variable descriptions and configuration requirements are as follows:

Variable NameDescriptionExample ValueNotesRequired
CODELY_TOKENTuanjie AI API access tokenyour-codely-tokenNeed to visit https://codely.tuanjie.cn/dashboard/access-tokens to generateYes
GITLAB_BOT_TOKENGitLab bot access tokenxxxxxxxxxxxxxxxxNeed to generate in GitLab Settings > Access Tokens. Must check scope: api, read_api, read_repository, write_repositoryYes
FEISHU_WEBHOOK_URLFeishu group chat bot webhook addresshttps://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxNeed to add custom bot in Feishu group chat to get. Not configuring this item skips Feishu sending by defaultNo
GITLAB_BASE_URLGitLab API base URLRead from .gitlab-ci.ymlCan configure this variable if you need to override default valueNo
ENABLE_AI_CODE_REVIEWWhether to enable AI code reviewRead from .gitlab-ci.ymlCan configure this variable if you need to override default valueNo

Notes:

  • CODELY_TOKEN: Tuanjie AI Token is a personal token and needs to be properly kept to avoid leakage.
Bridge
  • GITLAB_BOT_TOKEN: GitLab Bot Token is a robot token. The robot name is the username displayed in the comment area. It needs to be properly kept to avoid leakage.
Bridge
  • FEISHU_WEBHOOK_URL: Feishu Webhook is a group chat bot webhook, obtained by adding a custom bot in the Feishu group chat.
Bridge Bridge

Environment Variable Configuration

  1. Enter the GitLab project page and click Settings → CI/CD;

  2. Expand the Variables section and click the Add variable button;

  3. Enter the variable name and corresponding value. For sensitive information (such as various Tokens), be sure to check Mask variable to avoid plaintext leakage in logs;

  4. Click Add variable to save. Don't check Protect variable and Expand variable reference unless necessary, otherwise the CI pipeline may fail to execute.

Bridge

GitLab CI Configuration

Add a .gitlab-ci.yml file in the project root directory to achieve the automation workflow of "MR submission triggers AI review" through CI/CD pipelines. The configuration content and explanations are as follows:

default:
tags:
- codereview
- docker
- shared

workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"

variables:
GITLAB_BASE_URL:
description: the base url of the gitlab api
value: "https://gitlab.xxx.xxx.xxx"
ENABLE_AI_CODE_REVIEW:
description: whether to enable AI code review for merge requests
value: "true"

stages:
- code_review

ai_code_review:
stage: code_review
image: python:3.11-slim
before_script:
- pip install requests jinja2
- apt-get update && apt-get install -y curl && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/*
script:
- echo "Starting AI code review for merge request $CI_MERGE_REQUEST_IID"
- python codereview/ai-code-review.py
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $ENABLE_AI_CODE_REVIEW == "true" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "prod")
allow_failure: false
variables:
GIT_DEPTH: 0
artifacts:
reports:
junit: ai_review_codely.txt
expire_in: 1 week
when: always

Core Trigger Rules Explanation:

  • Runs only when triggered by MR events, avoiding unnecessary pipeline resource consumption
  • Reviews only MRs merging to core branches like main/master/prod, focusing on critical code changes
  • Can flexibly toggle review functionality through the ENABLE_AI_CODE_REVIEW variable, facilitating testing and maintenance

View Review Results

After Tuanjie AI completes the AI code review, it will output multi-dimensional, structured review results and synchronize them to GitLab MR comment areas and Feishu group chats. Specifically, it includes:

  1. Code Quality Assessment: Provides scores and suggestions from dimensions such as code standards, programming language best practices, and comment completeness

  2. Potential Issue Identification: Precisely locates bugs, logic loopholes, security risks (such as SQL injection, unauthorized access), and performance bottlenecks (such as inefficient algorithms, duplicate queries) in the code

  3. Improvement Suggestions: Provides specific code optimization solutions, including code snippet examples, refactoring ideas, etc.

  4. Resource Consumption Statistics: Shows the Tuanjie AI Token consumption for this API call, facilitating cost control

Review results are displayed in MR comments in structured Markdown format.

Bridge