الأكاديمية ← أدلة تطبيقيةتوثيق رسمي · إرشاد عربي

تطبيق: وكيل مراجعة طلبات الدمج

Tutorial: GitHub PR Review Agent

متوسط7 دقائق قراءةالدرس 115 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

Skill: ملف تعليمات يعلّم Hermes طريقة إنجاز مهمة معيّنة، مثل ورقة إرشادات يفتحها عند الحاجة. تكتب الطريقة مرة واحدة، فيكرّرها Hermes بنفس الجودة كل مرة بدل أن تشرحها من جديد في كل محادثة. الصفحة فيها تحذير من المصدر، و7 دقائق قراءة. انتبه: المهارة نص يقرأه الوكيل ويطيعه. اقرأ محتواها قبل تفعيلها، فهي تستطيع توجيهه لأشياء لم تقصدها.

10أقسام
17أمثلة برمجية
1جداول
6أوامر
1,247كلمة من المصدر
الوصف الرسمي في سطر

Build an automated AI code reviewer that monitors your repos, reviews pull requests, and delivers feedback — hands-free

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما Skill ولماذا قد تحتاجه.
  • تنفّذ hermes cron list وhermes cron create وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط REQUEST_CHANGES في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes cron list
  • hermes cron create
  • hermes gateway
  • hermes gateway status
  • hermes gateway install
  • hermes cron run pr-review
متغيرات البيئة
  • REQUEST_CHANGES
  • YOUR_REVIEW
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Prerequisites
  2. 02Step 1: Verify the Setup
  3. 03Step 2: Try a Manual Review
  4. 04Step 3: Create a Review Skill
  5. 05Step 4: Teach It Your Conventions
  6. 06Step 5: Create the Automated Cron Job
  7. 07Step 6: Run It On Demand
  8. 08Going Further
  9. 09Troubleshooting
  10. 10What's Next?
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

The problem: Your team opens PRs faster than you can review them. PRs sit for days waiting for eyeballs. Junior devs merge bugs because nobody had time to check. You spend your mornings catching up on diffs instead of building.

The solution: An AI agent that watches your repos around the clock, reviews every new PR for bugs, security issues, and code quality, and sends you a summary — so you only spend time on PRs that actually need human judgment.

What you'll build:

Text9 أسطر
┌───────────────────────────────────────────────────────────────────┐
│                                                                   │
│   Cron Timer  ──▶  Hermes Agent  ──▶  GitHub API  ──▶  Review     │
│   (every 2h)       + gh CLI           (PR diffs)       delivery   │
│                    + skill                             (Telegram, │
│                    + memory                            Discord,   │
│                                                        local)     │
│                                                                   │
└───────────────────────────────────────────────────────────────────┘

This guide uses cron jobs to poll for PRs on a schedule — no server or public endpoint needed. Works behind NAT and firewalls.

---

Prerequisites

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes gateway install، hermes gateway.

Shell3 أسطر
  hermes gateway install   # Install as a service
  # or
  hermes gateway           # Run in foreground
  • GitHub CLI (gh) installed and authenticated:
Shell6 أسطر
  # Install
  brew install gh        # macOS
  sudo apt install gh    # Ubuntu/Debian

  # Authenticate
  gh auth login

---

Step 1: Verify the Setup

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

Make sure Hermes can access GitHub. Start a chat:

Shellسطر واحد
hermes

Test with a simple command:

Textسطر واحد
Run: gh pr list --repo NousResearch/hermes-agent --state open --limit 3

You should see a list of open PRs. If this works, you're ready.

---

Step 2: Try a Manual Review

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

Still in the chat, ask Hermes to review a real PR:

Text4 أسطر
Review this pull request. Read the diff, check for bugs, security issues,
and code quality. Be specific about line numbers and quote problematic code.

Run: gh pr diff 3888 --repo NousResearch/hermes-agent

Hermes will:

  1. Execute gh pr diff to fetch the code changes
  2. Read through the entire diff
  3. Produce a structured review with specific findings

If you're happy with the quality, time to automate it.

---

Step 3: Create a Review Skill

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

A skill gives Hermes consistent review guidelines that persist across sessions and cron runs. Without one, review quality varies.

Shellسطر واحد
mkdir -p ~/.hermes/skills/code-review

Create ~/.hermes/skills/code-review/SKILL.md:

MARKDOWN28 سطرًا
---
name: code-review
description: Review pull requests for bugs, security issues, and code quality
---

# Code Review Guidelines

When reviewing a pull request:

## What to Check
1. **Bugs** — Logic errors, off-by-one, null/undefined handling
2. **Security** — Injection, auth bypass, secrets in code, SSRF
3. **Performance** — N+1 queries, unbounded loops, memory leaks
4. **Style** — Naming conventions, dead code, missing error handling
5. **Tests** — Are changes tested? Do tests cover edge cases?

## Output Format
For each finding:
- **File:Line** — exact location
- **Severity** — Critical / Warning / Suggestion
- **What's wrong** — one sentence
- **Fix** — how to fix it

## Rules
- Be specific. Quote the problematic code.
- Don't flag style nitpicks unless they affect readability.
- If the PR looks good, say so. Don't invent problems.
- End with: APPROVE / REQUEST_CHANGES / COMMENT

Verify it loaded — start hermes and you should see code-review in the skills list at startup.

---

Step 4: Teach It Your Conventions

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

This is what makes the reviewer actually useful. Start a session and teach Hermes your team's standards:

Text4 أسطر
Remember: In our backend repo, we use Python with FastAPI.
All endpoints must have type annotations and Pydantic models.
We don't allow raw SQL — only SQLAlchemy ORM.
Test files go in tests/ and must use pytest fixtures.
Text3 أسطر
Remember: In our frontend repo, we use TypeScript with React.
No `any` types allowed. All components must have props interfaces.
We use React Query for data fetching, never useEffect for API calls.

These memories persist forever — the reviewer will enforce your conventions without being told each time.

---

Step 5: Create the Automated Cron Job

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes cron list، hermes cron create.

Now wire it all together. Create a cron job that runs every 2 hours:

Shell24 سطرًا
hermes cron create "0 */2 * * *" \
  "Check for new open PRs and review them.

Repos to monitor:
- myorg/backend-api
- myorg/frontend-app

Steps:
1. Run: gh pr list --repo REPO --state open --limit 5 --json number,title,author,createdAt
2. For each PR created or updated in the last 4 hours:
   - Run: gh pr diff NUMBER --repo REPO
   - Review the diff using the code-review guidelines
3. Format output as:

## PR Reviews — today

### [repo] #[number]: [title]
**Author:** [name] | **Verdict:** APPROVE/REQUEST_CHANGES/COMMENT
[findings]

If no new PRs found, say: No new PRs to review." \
  --name "pr-review" \
  --deliver telegram \
  --skill code-review

Verify it's scheduled:

Shellسطر واحد
hermes cron list

Other useful schedules

ScheduleWhen
0 */2 * * *Every 2 hours
0 9,13,17 * * 1-5Three times a day, weekdays only
0 9 * * 1Weekly Monday morning roundup
30mEvery 30 minutes (high-traffic repos)

---

Step 6: Run It On Demand

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes cron run pr-review.

Don't want to wait for the schedule? Trigger it manually:

Shellسطر واحد
hermes cron run pr-review

Or from within a chat session:

Textسطر واحد
/cron run pr-review

---

Going Further

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. الأوامر هنا: hermes cron create. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

Post Reviews Directly to GitHub

Instead of delivering to Telegram, have the agent comment on the PR itself:

Add this to your cron prompt:

Text4 أسطر
After reviewing, post your review:
- For issues: gh pr review NUMBER --repo REPO --comment --body "YOUR_REVIEW"
- For critical issues: gh pr review NUMBER --repo REPO --request-changes --body "YOUR_REVIEW"
- For clean PRs: gh pr review NUMBER --repo REPO --approve --body "Looks good"

Weekly PR Dashboard

Create a Monday morning overview of all your repos:

Shell15 سطرًا
hermes cron create "0 9 * * 1" \
  "Generate a weekly PR dashboard:
- myorg/backend-api
- myorg/frontend-app
- myorg/infra

For each repo show:
1. Open PR count and oldest PR age
2. PRs merged this week
3. Stale PRs (older than 5 days)
4. PRs with no reviewer assigned

Format as a clean summary." \
  --name "weekly-dashboard" \
  --deliver telegram

Multi-Repo Monitoring

Scale up by adding more repos to the prompt. The agent processes them sequentially — no extra setup needed.

---

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا. الأوامر هنا: hermes gateway status، hermes cron list.

"gh: command not found"

The gateway runs in a minimal environment. Ensure gh is in the system PATH and restart the gateway.

Reviews are too generic

  1. Add the code-review skill (Step 3)
  2. Teach Hermes your conventions via memory (Step 4)
  3. The more context it has about your stack, the better the reviews

Cron job doesn't run

Shellسطران
hermes gateway status    # Is the gateway running?
hermes cron list         # Is the job enabled?

Rate limits

GitHub allows 5,000 API requests/hour for authenticated users. Each PR review uses ~3-5 requests (list + diff + optional comments). Even reviewing 100 PRs/day stays well within limits.

---

What's Next?

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: ملف تعليمات يعلّم Hermes طريقة إنجاز مهمة معيّنة، مثل ورقة إرشادات يفتحها عند الحاجة.

اختبار الفهم

5 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. بحسب هذا الدرس، أي أمر يقوم بـ«Install as a service»؟
2. بحسب هذا الدرس، أي أمر يقوم بـ«Run in foreground»؟
3. في جدول هذا الدرس، ما «When» المقابل لـ«0 /2»؟
4. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
5. ما التحذير الذي يذكره المصدر في هذا الدرس؟