Loading...
Loading...
Conduct Pull Request code reviews, including comprehensive evaluations of code quality, security, performance, architectural rationality, etc. Activated when users request PR reviews or mention keywords like "review pr", "check PR", etc.
npx skill4agent add labring/fastgpt pr-reviewConduct comprehensive reviews of Pull Request code quality, security, performance, and architectural design, and provide professional improvement suggestions
# Review the PR of the current branch
gh pr view
# Review a specified PR
gh pr view 6324
# View changes
gh pr diff 6324# View and review PR
gh pr view <number> && gh pr diff <number>
# Add review comments
gh pr review <number> --comment -b "My review comments"
# Approve PR
gh pr review <number> --approve
# Request changes
gh pr review <number> --request-changes# Check out PR branch locally
gh pr checkout <number>
# Run tests
pnpm test
# Run lint
pnpm lint
# Type check
pnpm tsc --noEmit
# Start dev server to verify
pnpm dev# View PR information
gh pr view --json title,body,author,state,files,additions,deletions
# View PR diff
gh pr diff
gh pr diff <number> > /tmp/pr.diff # Save to file
# View PR commits
gh pr view --json commits --jq '.commits[].messageHeadline'
# Check PR checks status
gh pr checks
# Comment on PR
gh pr comment <number> --body "Comment content"
# Submit PR review
gh pr review <number> --approve
gh pr review <number> --request-changes
gh pr review <number> --comment -b "Comment content"
# PR operations
gh pr merge <number> --squash # Squash merge
gh pr close <number> # Close PR# 1. Get basic PR information
gh pr view --json title,body,author,state,headRefName,baseRefName,additions,deletions,files
# 2. Get PR change diff
gh pr diff
# 3. Get PR commit history
gh pr view --json commits
# 4. Check CI/CD status
gh pr checkspackages/service/core/workflow/dispatch.tsL142-L150# 1. Prepare line-level comment JSON file
cat > /tmp/line-comments.json << 'EOF'
{
"body": "Line-level code review comment",
"event": "COMMENT",
"comments": [
{
"path": "packages/service/core/workflow/dispatch.ts",
"line": 142,
"body": "🔴 **Critical Issue**: Missing error handling here, which will cause runtime errors if runtimeNode is null.\n\n**Suggestion**:\n```typescript\nif (!runtimeNode) {\n throw new Error(`Runtime node not found: ${nodeId}`);\n}\n```"
},
{
"path": "packages/service/core/workflow/dispatch.ts",
"line": 150,
"body": "🟡 **Performance Optimization**: It is recommended to compile and extract this regular expression outside the function to avoid re-compiling on each call.\n\n**Suggestion**:\n```typescript\nconst NODE_ID_PATTERN = /^node_([a-f0-9]+)$/; // Define at the top of the module\n```"
}
]
}
EOF
# 2. Submit overall review report and line-level comments
gh pr review <number> --body-file /tmp/pr-review.md --json > /tmp/review-result.json# PR Review: {PR Title}
## 📊 Change Overview
- **PR Number**: #{number}
- **Author**: @author
- **Branches**: {baseRefName} ← {headRefName}
- **Change Statistics**: +{additions} -{deletions} lines
- **Files Involved**: {files.length} files
## ✅ Advantages
{List the well-done aspects}
## ⚠️ Issue Summary
### 🔴 Critical Issues ({count} items, must fix)
{Briefly list each critical issue, and add line-level comments below}
### 🟡 Suggested Improvements ({count} items)
{Briefly list each suggestion}
### 🟢 Optional Optimizations ({count} items)
{Briefly list optimization suggestions}
## 🧪 Testing Suggestions
{Recommended testing methods}
## 💬 Overall Evaluation
- **Code Quality**: ⭐⭐⭐⭐☆ (4/5)
- **Security**: ⭐⭐⭐⭐⭐ (5/5)
- **Performance**: ⭐⭐⭐⭐☆ (4/5)
- **Maintainability**: ⭐⭐⭐⭐☆ (4/5)
## 🚀 Review Conclusion
{Recommendation: Approve/Needs Changes/Reject}
---
## 📍 Detailed Code Comments
Specific line-level comments have been added at the following locations:
{List all locations where line-level comments were added}| Scenario | Command |
|---|---|
| Approve PR | |
| Request changes | |
| General comment | |
| Submit from file | |
| Add regular comment | |
| Dismiss review | |