- Move all Hermes skills from skills/ to hermes/ - Add cursor/ for Cursor rules (.mdc) - Add code-review.mdc (Gitea PR review with tea CLI) - Update sync.sh to use new hermes/ path - Update README with new structure
144 lines
3.2 KiB
Plaintext
144 lines
3.2 KiB
Plaintext
# Code Review with Gitea (tea CLI)
|
|
|
|
How to review Pull Requests on our self-hosted Gitea (git.shazhou.work) using the `tea` CLI.
|
|
|
|
## 1. Find and Read PR
|
|
|
|
```bash
|
|
# List open PRs
|
|
tea pr
|
|
|
|
# View PR details (description, author, branch, status)
|
|
tea pr 5
|
|
|
|
# View PR with comments
|
|
tea pr 5 --comments
|
|
```
|
|
|
|
## 2. Check Out PR Locally
|
|
|
|
```bash
|
|
# Checkout PR branch locally for full-context review
|
|
tea pr checkout 5
|
|
|
|
# See what files changed vs base branch
|
|
git diff main...HEAD --stat
|
|
git diff main...HEAD --name-only
|
|
```
|
|
|
|
## 3. Read the Diff
|
|
|
|
```bash
|
|
# Full diff
|
|
git diff main...HEAD
|
|
|
|
# Per-file diff (for large PRs, review file by file)
|
|
git diff main...HEAD -- path/to/file.py
|
|
|
|
# Check for obvious issues in diff
|
|
git diff main...HEAD | grep -n "TODO\|FIXME\|HACK\|XXX\|debugger\|console\.log"
|
|
git diff main...HEAD | grep -n "password\|secret\|api_key\|token.*="
|
|
git diff main...HEAD | grep -n "<<<<<<\|>>>>>>\|======="
|
|
```
|
|
|
|
For each changed file, read the full file (not just the diff) to understand surrounding context.
|
|
|
|
## 4. Find Project-Specific Rules
|
|
|
|
Before reviewing, check for project conventions:
|
|
|
|
```bash
|
|
# Look for contribution guides, code standards, linting config
|
|
ls -la .editorconfig .eslintrc* .prettierrc* pyproject.toml biome.json 2>/dev/null
|
|
cat CONTRIBUTING.md 2>/dev/null
|
|
cat .cursor/rules/*.mdc 2>/dev/null
|
|
|
|
# Check existing CI config for what's enforced
|
|
ls .github/workflows/ .gitea/workflows/ 2>/dev/null
|
|
```
|
|
|
|
Apply whatever standards the project defines. If none exist, use general best practices.
|
|
|
|
## 5. Run Tests / Linters (if available)
|
|
|
|
```bash
|
|
# Detect and run project tests
|
|
# Node: npm test / npx vitest
|
|
# Python: pytest / python -m pytest
|
|
# Rust: cargo test
|
|
# Go: go test ./...
|
|
|
|
# Run linter if configured
|
|
# Node: npx eslint . / npx biome check
|
|
# Python: ruff check .
|
|
```
|
|
|
|
## 6. Write Review Feedback
|
|
|
|
### Leave a comment on the PR
|
|
|
|
```bash
|
|
tea pr comment 5 "Your review summary here"
|
|
```
|
|
|
|
### Use Gitea API for inline comments (tea doesn't support inline)
|
|
|
|
```bash
|
|
# Get PR diff info for positioning
|
|
GITEA_TOKEN="your-token"
|
|
BASE_URL="https://git.shazhou.work/api/v1"
|
|
OWNER="uncaged"
|
|
REPO="nerve"
|
|
PR=5
|
|
|
|
# Post a review with inline comments
|
|
curl -s -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
"$BASE_URL/repos/$OWNER/$REPO/pulls/$PR/reviews" \
|
|
-d '{
|
|
"event": "COMMENT",
|
|
"body": "Code review summary",
|
|
"comments": [
|
|
{"path": "src/file.py", "new_position": 45, "body": "Suggestion here"}
|
|
]
|
|
}'
|
|
```
|
|
|
|
Event values: `"APPROVED"`, `"REQUEST_CHANGES"`, `"COMMENT"`
|
|
|
|
### Review comment format
|
|
|
|
Use this structure for the summary comment:
|
|
|
|
```
|
|
## Code Review Summary
|
|
|
|
**Verdict:** Approved / Changes Requested / Comment
|
|
|
|
### 🔴 Critical
|
|
- **file:line** — description
|
|
|
|
### ⚠️ Warnings
|
|
- **file:line** — description
|
|
|
|
### 💡 Suggestions
|
|
- **file:line** — description
|
|
|
|
### ✅ Looks Good
|
|
- What's well done
|
|
```
|
|
|
|
## 7. Decision Guide
|
|
|
|
- **Approve** — no critical/warning issues, only minor suggestions or all clear
|
|
- **Request Changes** — critical or warning-level issues that must be fixed before merge
|
|
- **Comment** — observations only, nothing blocking (drafts, or when unsure)
|
|
|
|
## 8. Clean Up
|
|
|
|
```bash
|
|
git checkout main
|
|
git branch -D pr-branch-name
|
|
```
|