pr-reviewer/.env.example
Adam Moussa 89494c1710
Ground reviews in the engineering-handbook
Feed the reviewer a distilled digest of the Sea Haven engineering-handbook
so findings reflect our naming, commit, PR, secrets, and IaC conventions
instead of generic code-review judgment.

A new handbook module keeps an app-managed shallow clone of the (private)
handbook, distills the review-relevant pages into a compact conventions
checklist via the Fireworks model once a day, caches it under ~/.cache,
and hands it to the reviewer to inject into every review's system prompt.
The refresh runs in-process at the start of each worker cycle; failures
keep the last good digest and back off, so a handbook outage never blocks
reviews. Set HANDBOOK_ENABLED=false to disable.

Extract a shared fireworks_complete helper used by both the reviewer and
the distiller, so the handbook provider needs no reviewer reference and
the guidance callable is set once at construction. Clone auth uses a
Basic http.extraHeader (GitHub git-over-HTTPS rejects Bearer), and the
distiller wraps its answer in delimiters to strip a reasoning model's
chain-of-thought preamble. Adds GET /api/handbook and a header status
line. Stdlib-only, no new dependencies.
2026-07-01 17:08:21 -04:00

44 lines
1.7 KiB
Text

# --- GitHub ---
# Leave GITHUB_TOKEN blank to use your local `gh auth token` instead of a PAT.
GITHUB_TOKEN=
GITHUB_ORG=Sea-Haven-Industries
PR_SEARCH_FILTER=is:pr state:open archived:false sort:updated-desc org:Sea-Haven-Industries
MAX_PRS=100
MAX_DIFF_BYTES=120000
# --- Fireworks ---
FIREWORKS_API_KEY=fw_your_key_here
FIREWORKS_BASE_URL=https://api.fireworks.ai/inference/v1
# Coding-strong options: accounts/fireworks/models/deepseek-v4-pro
# accounts/fireworks/models/kimi-k2p6
FIREWORKS_MODEL=accounts/fireworks/models/deepseek-v4-pro
FIREWORKS_TEMPERATURE=0.2
FIREWORKS_MAX_TOKENS=4000
# --- Review behavior ---
# Comma-separated author logins to @-mention in the review body.
MENTION_AUTHORS=openswe
HOST=127.0.0.1
PORT=8765
# --- Background auto-review worker ---
# Seconds between poll cycles (pre-reviews new/changed non-draft PRs).
POLL_INTERVAL=300
# How many PRs to review in parallel per cycle (kept low to respect rate limits).
WORKER_CONCURRENCY=2
# Stop auto-retrying a PR that keeps failing until its diff changes.
MAX_REVIEW_ATTEMPTS=3
# SQLite cache path. Defaults to pr_cache.db in the repo root (gitignored).
# CACHE_DB=/absolute/path/to/pr_cache.db
# --- Engineering-handbook grounding ---
# Feed reviews a distilled digest of the Sea Haven engineering-handbook
# conventions, refreshed daily from an app-managed clone. Requires the GitHub
# token to be able to read the (private) handbook repo.
HANDBOOK_ENABLED=true
HANDBOOK_REPO_URL=https://github.com/Sea-Haven-Industries/engineering-handbook.git
HANDBOOK_REFRESH_HOURS=24
# Clone + digest cache live under ~/.cache/pr-reviewer/ by default.
# HANDBOOK_CACHE_DIR=/absolute/path/to/handbook
# HANDBOOK_DIGEST_PATH=/absolute/path/to/handbook_digest.json