Generated: 2026-01-16 Commit: 3bf3876 Branch: main
ChatGPT-powered code review bot. Multi-deployment: GitHub Action, Probot app, AWS Lambda, Vercel Edge.
./
βββ src/ # Core logic (bot.ts, chat.ts)
βββ action/ # GitHub Action bundle (ncc output) - DO NOT EDIT
βββ dist/ # Probot/Vercel build output - DO NOT EDIT
βββ api/ # Vercel serverless entry
βββ test/ # Jest test fixtures
βββ action.yml # GitHub Action metadata β action/index.cjs
βββ serverless.yml # AWS Lambda config
βββ rollup.config.ts # Build orchestration
| Task | Location | Notes |
|---|---|---|
| Code review logic | src/bot.ts |
PR event handling, diff processing, file filtering |
| OpenAI integration | src/chat.ts |
Prompts, API calls, response parsing |
| GitHub Action entry | src/github-action.cjs |
Uses @probot/adapter-github-actions |
| Probot standalone | src/index.ts |
Standard Probot runner |
| Vercel deployment | api/github/webhooks/index.ts |
createNodeMiddleware wrapper |
| AWS Lambda | src/aws-lambda.cjs |
@probot/adapter-aws-lambda-serverless |
npm run build # rollup β dist/ + ncc β action/
npm run start # Probot standalone (requires .env)
npm test # JestBuild outputs:
action/β GitHub Action (action.yml points here)dist/β Probot app, Vercel middlewarelambda/β AWS Lambda (via build:lambda)
- ESNext target, NodeNext module resolution
- Strict mode enabled
- Output to
lib/(tsc) but builds use rollup/ncc
- ESM for source (
"type": "module"in package.json) - CJS wrappers for Action/Lambda entry points (
.cjsextension) .jsextension required in imports (from "./chat.js")
| Variable | Purpose | Required |
|---|---|---|
OPENAI_API_KEY |
OpenAI authentication | Yes |
OPENAI_API_ENDPOINT |
Custom endpoint (default: api.openai.com) | No |
AZURE_API_VERSION |
Azure OpenAI version | For Azure |
AZURE_DEPLOYMENT |
Azure deployment name | For Azure |
LANGUAGE |
Review output language | No |
PROMPT |
Custom prompt prefix | No |
MAX_PATCH_LENGTH |
Skip large diffs (default: Infinity) | No |
MAX_CONTEXT_CHARS |
Truncate prompt context | No |
IGNORE_PATTERNS |
Glob patterns to skip | No |
INCLUDE_PATTERNS |
Glob patterns to include | No |
TARGET_LABEL |
Only review labeled PRs | No |
- NEVER edit
action/- Generated by ncc, changes will be overwritten - NEVER edit
dist/- Rollup output - Model hardcoded as
gpt-5-miniinsrc/chat.ts:246- change there if needed - Response format uses
json_object- prompts must include JSON output instructions
- Source has Korean comments/prompts (μ½λ 리뷰 μμ€ν )
- System prompts in
src/chat.tsare Korean by default LANGUAGEenv var controls output language
- On
synchronizeevents, only reviews files changed in latest commit - Tracks previous review comments to avoid duplicate feedback
- Extracts imports to provide related file context to AI
- Relations: "imports", "imported-by", "same-dir"
# Development
npm install
npm run build
npm run start # Requires APP_ID, PRIVATE_KEY in .env
# Testing
npm test
# Docker
docker build -t cr-bot .
docker run -e APP_ID=<id> -e PRIVATE_KEY=<pem> cr-bot- Uses Probot framework (v12) for GitHub integration
- OpenAI SDK v4 with Azure support
- PR file limit: 30 files max per review
- Large patches (>MAX_PATCH_LENGTH) silently skipped
- 422 errors from GitHub API trigger fallback to body-only review