- 📋 【Knowledge Base Driven Review】: Support customized repository-level code review standards based on best practices accumulated in knowledge base
- 🤖 【Smart Single File Review】: Provide professional scoring and improvement suggestions for single file code changes by combining knowledge base experience with LLM analysis
- 🚀 【Global Code Analysis】: Provide comprehensive review reports including code walkthrough, change description and sequence diagrams based on all file changes through LLM
- 🌍 【All Language Support】: Support intelligent Code Review for all mainstream programming languages
- 🔄 【GitHub Deep Integration】: Seamlessly integrate with GitHub workflow for automated Code Review
- 🌐 【Multi-language Response】: Support customized language for Code Review feedback
- 🧠 Dify - Used for building intelligent LLM workflows
- 🔥 Next.js App Router - Used for building modern web applications
- 🎨 Tailwind CSS - Used for implementing elegant responsive design
- 🔐 Clerk - Used for providing secure and reliable user authentication
- 📦 Supabase - Used for implementing high-performance data storage
- 🔗 Github App - Used for achieving GitHub deep integration
sequenceDiagram
actor Developer
participant GitHub
participant CR-Mentor
participant Custom API
participant Code Analyzer
participant LLM
participant Knowledge Base
participant GitHub API
Developer->>GitHub: 1. Create Pull Request
GitHub->>CR-Mentor: 2. Trigger Webhook
CR-Mentor->>Custom API: 3. Call Configured Custom API
%% Get Code Changes Phase
Custom API->>GitHub API: 4. Get PR Information
GitHub API-->>Custom API: 5. Return PR Basic Info
Custom API->>GitHub API: 6. Get All Code Changes(diff)
GitHub API-->>Custom API: 7. Return Code Changes List
%% Code Analysis and Review Phase
Custom API->>Code Analyzer: 8. Parse Code Changes
Code Analyzer-->>Custom API: 9. Return Structured Code Changes
loop For Each Code File Change
Custom API->>LLM: 10. Identify Code Language
LLM-->>Custom API: 11. Return Language Type
Custom API->>Knowledge Base: 12. Get Language-Specific Code Standards
Knowledge Base-->>Custom API: 13. Return Code Standards
Custom API->>LLM: 14. Send Code Changes and Standards for Review
Note over Custom API,LLM: Context Provided:<br/>1. Code Changes<br/>2. Language Standards<br/>3. Review Requirements
LLM-->>Custom API: 15. Return Standards-Based Review Results
Custom API->>GitHub API: 16. Create Line-Level Comments
GitHub API-->>GitHub: 17. Display Code Comments
end
%% Generate Summary Report
Custom API->>LLM: 18. Send All Review Results
LLM-->>Custom API: 19. Generate Summary Report
Note over LLM,Custom API: Including:<br/>1. Walkthrough<br/>2. Changes<br/>3. Sequence Diagram
Custom API->>GitHub API: 20. Submit Summary Comment to PR
GitHub API-->>GitHub: 21. Display Summary Comment
GitHub-->>Developer: 22. Developer Views Complete Review Results
You can deploy this template by setting up the following services and adding their corresponding environment variables:
-
Run
npm install
to install dependencies, then runnpm run dev
to start the development server. -
The system will require you to provide
CLERK_SECRET_KEY
. Follow these steps: -
Now your frontend and backend should be running, you can log in but won't be able to perform code reviews yet.
-
Create a Supabase account to get your API key.
-
Create a Supabase project, copy from
Project Settings
:SUPABASE_URL
SUPABASE_KEY
Execute the following SQL statement to create
githubId_clerkId
table:CREATE TABLE "public"."githubId_clerkId" ( "github_id" text NOT NULL, "clerk_id" text NOT NULL, PRIMARY KEY ("github_id") );
Execute the following SQL statement to create
repoName_file
table:CREATE TABLE "public"."repoName_file" ( "repo_fullName" text NOT NULL, "file_name" text NOT NULL, "folder_name" text NOT NULL, PRIMARY KEY ("repo_fullName", "file_name", "folder_name") );
-
Copy from
Storage
>S3 Connection
:SUPABASE_S3_ENDPOINT
SUPABASE_S3_REGION
-
Create new in
Storage
>S3 Access Keys
:SUPABASE_STORE_ID
SUPABASE_STORE_SECRET_KEY
-
Create new bucket in
Storage
usingNew bucket
:- Fill bucket name in
SUPABASE_BUCKET_NAME
- Fill bucket name in
SUPABASE_URL= SUPABASE_KEY= SUPABASE_S3_ENDPOINT= SUPABASE_S3_REGION= SUPABASE_STORE_ID= SUPABASE_STORE_SECRET_KEY= SUPABASE_BUCKET_NAME=
-
-
Create a Github account, then create a Github App.
- Click
New GitHub App
inSettings
->Developer settings
->GitHub Apps
. - Fill in
GitHub App name
,Homepage URL
,Webhook URL
and other information. - Generate
Private key
and download it, copyApp ID
,Client ID
,Client secret
to your.env.local
file.
GITHUB_APP_ID= GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= # Only fill in the content between -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- GITHUB_PRIVATE_KEY=
- Click
-
Create a Dify account and configure LLM workflow:
- Register a Dify account and configure LLM model in model providers
- Import workflow in Dify Studio:
- Click "Create Application" and select "Import DSL"
- Switch to URL mode, enter workflow file URL:
https://ovlxxbdwimhigoejxkqn.supabase.co/storage/v1/object/public/test-bucket-api/Dify_DSL/CR-Mentor.yml
- Click create to complete import
- Publish workflow:
- Click "Publish" button on "Orchestration" page
- Get API Key:
- Click "API Access" in left navigation
- Switch to "Workflow App API" page
- Click "API Key" in top right to create new Secret key
- Copy Secret key to
.env.local
file:
DIFY_APIKEY= DIFY_BASE_URL=https://api.dify.ai/v1 # Fixed value
- Build professional code review knowledge base to accumulate team best practices
- Optimize code review suggestion display based on knowledge base
- Develop intelligent code review template system supporting multiple scenarios
- Implement knowledge graph based code review task assignment
- Build collaborative review platform supporting real-time comments and discussions
- Integrate intelligent code quality analysis for automatic issue detection
- Continuously optimize LLM model to improve suggestion quality and response speed
- Deep integration with mainstream code hosting platforms (like GitHub, GitLab)
- Build review data analysis system generating in-depth insight reports
- Improve knowledge base management for intelligent experience reuse
- Support multi-language knowledge base and documentation system