Reimplements the pr_agent review pipeline (previously Python package) in
Bun/TypeScript, verified end-to-end against a real GitHub App + 9router:
- src/diff.ts: git patch processing (extend_patch, line-numbered hunks,
token-budget generate_full_patch, generated/invalid file filters)
- src/review.ts: orchestrator (fetch PR/diff -> render prompts -> LLM ->
YAML parse -> markdown render -> publish), fallback models
- src/github.ts: GitHub App auth via @octokit/auth-app (JWT -> installation
token, custom authStrategy for Bun), PR/diff/languages/comments REST
- src/prompts.ts: verbatim pr_reviewer_prompts.toml port (nunjucks templates)
- src/yaml.ts: resilient load_yaml with 9 fallback fixers
- src/markdown.ts: convert_to_markdown_v2 port ('PR Reviewer Guide' comment)
- src/llm.ts: 9router OpenAI-compatible chat completions (non-stream,
temp omitted for claude-opus-5), timeout 600s
- src/token.ts: js-tiktoken o200k counting
- src/index.ts: webhook server (HMAC verify, segment analytics, /health,
/api/metrics) + cli.ts one-shot review
- e2e.ts: real-world harness (bun e2e --repo o/r --pr N [--publish])
Verified: bun test 13/13, tsc clean, E2E published a real review comment
(## PR Reviewer Guide) on asepharyana/nextjs-template#19 via GitHub App
MythEclipseBotReview + claude-opus-5 through 9router.
Python run_server.py + pr_agent remain for the live queue worker; server/
is the replacement path.
28 lines
743 B
JSON
28 lines
743 B
JSON
{
|
|
"name": "pr-agent-server",
|
|
"version": "2.0.0",
|
|
"description": "PR-Agent re-implementation in Bun/TypeScript — GitHub App webhook server + AI PR review engine",
|
|
"type": "module",
|
|
"module": "src/index.ts",
|
|
"main": "src/index.ts",
|
|
"scripts": {
|
|
"dev": "bun --watch src/index.ts",
|
|
"start": "bun src/index.ts",
|
|
"review": "bun src/cli.ts",
|
|
"test": "bun test",
|
|
"typecheck": "bunx tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@octokit/auth-app": "^8.3.1",
|
|
"@octokit/rest": "^22.0.1",
|
|
"js-tiktoken": "^1.0.21",
|
|
"nunjucks": "^3.2.4",
|
|
"parse-diff": "^0.12.0",
|
|
"yaml": "^2.9.1"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bun": "latest",
|
|
"@types/nunjucks": "^3.2.6",
|
|
"typescript": "^5.9.0"
|
|
}
|
|
} |