Skip to content

Initialize PR Review Agent with configuration and documentation#1

Open
vieronicka wants to merge 5 commits into
mainfrom
feat-vk-CLIvsGithubCommunication
Open

Initialize PR Review Agent with configuration and documentation#1
vieronicka wants to merge 5 commits into
mainfrom
feat-vk-CLIvsGithubCommunication

Conversation

@vieronicka

Copy link
Copy Markdown
Owner

Summary

  • Adds Phase 1 of the PR Review Agent: a TypeScript CLI that authenticates with GitHub and fetches pull request metadata, changed files, and diff size without calling an LLM or posting comments.
  • Introduces project docs (learning plan, phase feature guides, git setup notes) and a Cursor project skill to keep docs in sync with code changes.
  • Merges main into the feature branch to align unrelated commit histories so this PR can be compared and merged cleanly.

What's included

CLI (src/)

  • config.ts — Loads GITHUB_TOKEN and GITHUB_USERNAME from .env; parses owner/repo.
  • github.ts — Octokit client; fetchPrSummary() (PR metadata, file list, unified diff size); assertAuthorIsUser() guard.
  • cli.ts — Commander CLI with --repo, --pr, --dry-run, --allow-any-author.

Documentation (docs/)

  • PLAN.md — Full learning plan and progress checklist
  • phase-1-feature.md through phase-5-feature.md — What / why / how per phase
  • git-update-commands.md — First commit and push guide

Other

  • README.md — Setup, PAT scopes, run instructions
  • .env.example — Template (no secrets committed)
  • .cursor/skills/update-project-docs/ — Project-scoped skill for doc updates

How to test

  1. npm install

  2. Copy .env.example.env and set GITHUB_TOKEN + GITHUB_USERNAME

  3. Create a fine-grained PAT with Contents (Read) and Pull requests (Read) on this repo

  4. Run against a PR you opened:

    npm run review -- --repo vieronicka/PR-Review-Bot --pr <PR_NUMBER> --dry-run

…lay GitHub PR data. Added configuration for environment variables, package management, and project structure. Included README and documentation for setup and usage.
…ated .env.example for LLM configuration, enhanced README with setup instructions, and implemented review generation with Zod validation. Modified CLI to support AI review mode and adjusted GitHub data fetching to include full diff text.

@vieronicka vieronicka left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI PR Review (pr-review-agent)

Summary

This pull request introduces the foundational CLI for the PR Review Agent, focusing on robust GitHub API integration and configuration. The code is well-structured, includes excellent documentation, and demonstrates strong error handling for configuration and input validation. The phase-1-feature.md is particularly thorough, outlining the design, flow, and responsibilities clearly.

Risks

  • The absence of automated unit or integration tests for src/config.ts and src/github.ts could lead to regressions as the project evolves. While the current logic appears sound, future changes might inadvertently introduce bugs without test coverage.
  • The fetchPrSummary function uses per_page: 100 for listFiles, which is a known limitation for very large pull requests with more than 100 changed files. While acknowledged in the documentation, it means the files array in PrSummary might be incomplete for such PRs.
  • The diffCharCount warning for large diffs is good, but the actual truncation logic for LLMs is a critical future step that needs careful implementation to avoid token limits and ensure meaningful reviews.

Suggestions

  • Implement unit tests for src/config.ts (e.g., loadConfig and parseRepo error cases) and src/github.ts (e.g., assertAuthorIsUser logic, mocking Octokit for fetchPrSummary) to ensure correctness and prevent regressions.
  • Consider adding an explicit process.exit(0) at the end of the main function's successful path in src/cli.ts for consistent exit code behavior, although Node.js typically exits with 0 by default.
  • For improved readability and potential reuse, extract the summary.body slicing and newline replacement logic within printSummary into a dedicated helper function.

Generated by pr-review-agent CLI — Phase 3 summary review.

… .env.example for new token scopes, added documentation for Phase 3 features, and enhanced CLI to support posting reviews. Introduced caching mechanism to prevent duplicate posts and improved review formatting for GitHub comments.
…GitHub. Added details on new `--post` functionality, updated token permissions, and clarified project roadmap. Enhanced documentation for review deduplication and CLI usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant