How malarcb/ai-reviewer works
AI Code Reviewer is a GitHub Action that reviews pull requests, generates PR titles and descriptions, and responds to relevant review-comment threads. GitHub event dispatch selects the full-review or comment-response workflow; the full review fetches commits and diffs, optionally accounts for existing threads and incremental-review state, generates AI results, and posts a summary and review comments. The graph includes README capabilities, but unsampled implementation details and some integration links are omitted where their call paths are not shown.
Main entry points: pull_request.ts PR review workflow · pull_request_comment.ts Comment response workflow · ai.ts AI model runner · octokit.ts GitHub API client
Components 16
Event handling
- Event dispatcher
src/main.ts
Pull request review
- PR review workflow
src/pull_request.ts - Diff processing
src/diff.ts - Review threads
src/comments.ts - Review messages
src/messages.ts
Comment interaction
- Comment response workflow
src/pull_request_comment.ts
AI generation
- PR summary generation
src/prompts.ts - Code review generation
src/prompts.ts - Comment reply generation
src/prompts.ts - AI model runner
src/ai.ts
GitHub integration
- Action configuration
src/config.ts - Event context
src/context.ts - GitHub API client
src/octokit.ts
Other components
- GitHub event
- GitHub API
- LLM providers
Connections 26
- GitHub event → Event dispatcher: triggers
src/main.ts - Event dispatcher → PR review workflow: routes PR events
src/main.ts - Event dispatcher → Comment response workflow: routes comment events
src/main.ts - PR review workflow → Event context: loads context
src/pull_request.ts - Comment response workflow → Event context: loads context
src/pull_request_comment.ts - PR review workflow → GitHub API client: initializes client
src/pull_request.ts - Comment response workflow → GitHub API client: initializes client
src/pull_request_comment.ts - PR review workflow → Diff processing: parses diffs
src/pull_request.ts - PR review workflow → Review threads: loads threads
src/pull_request.ts - Diff processing → Review threads: filters threads
src/diff.ts - PR review workflow → PR summary generation: requests summary
src/pull_request.ts - PR review workflow → Code review generation: requests review
src/pull_request.ts - PR summary generation → AI model runner: runs prompt
src/prompts.ts - Code review generation → AI model runner: runs prompt
src/prompts.ts - Comment response workflow → Review threads: fetches thread
src/pull_request_comment.ts - Comment response workflow → Diff processing: parses file diffs
src/pull_request_comment.ts - Comment response workflow → Comment reply generation: requests reply
src/pull_request_comment.ts - Comment reply generation → AI model runner: runs prompt
src/prompts.ts - PR review workflow → Review messages: builds review messages
src/pull_request.ts - PR review workflow → GitHub API client: fetches and posts
src/pull_request.ts - Comment response workflow → GitHub API client: fetches and replies
src/pull_request_comment.ts - AI model runner → Action configuration: reads model settings
src/ai.ts - PR review workflow → Action configuration: reads action settings
src/pull_request.ts - Comment response workflow → Action configuration: reads action settings
src/pull_request_comment.ts - GitHub API client → GitHub API: calls
src/octokit.ts - AI model runner → LLM providers: generates structured output
src/ai.ts