{"id":51192797,"url":"https://github.com/johnimril/reviewpilot-ai","last_synced_at":"2026-06-27T17:02:17.644Z","repository":{"id":357690623,"uuid":"1237783706","full_name":"JohnImril/reviewpilot-ai","owner":"JohnImril","description":"AI-powered Pull Request Review Assistant built with Next.js, TypeScript, Zod and a provider-based review architecture.","archived":false,"fork":false,"pushed_at":"2026-05-13T21:04:11.000Z","size":273,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-13T23:10:25.917Z","etag":null,"topics":["ai","code-review","developer-tools","nextjs","pull-requests","tailwindcss","typescript","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JohnImril.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-13T14:01:12.000Z","updated_at":"2026-05-13T21:04:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/JohnImril/reviewpilot-ai","commit_stats":null,"previous_names":["johnimril/reviewpilot-ai"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/JohnImril/reviewpilot-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnImril%2Freviewpilot-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnImril%2Freviewpilot-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnImril%2Freviewpilot-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnImril%2Freviewpilot-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnImril","download_url":"https://codeload.github.com/JohnImril/reviewpilot-ai/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnImril%2Freviewpilot-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34860919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","code-review","developer-tools","nextjs","pull-requests","tailwindcss","typescript","zod"],"created_at":"2026-06-27T17:02:16.793Z","updated_at":"2026-06-27T17:02:17.639Z","avatar_url":"https://github.com/JohnImril.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReviewPilot AI\n\nReviewPilot AI is a portfolio-ready Pull Request review assistant built with\nNext.js, React, TypeScript, Tailwind CSS, and Zod. It turns a pasted git diff\ninto structured code review feedback: pull request summary, changed-file risk,\nline-aware issues, explainable risk scoring, test suggestions, confidence, and\nmerge recommendation.\n\nThe current release uses `MockAIProvider`, a deterministic local provider that\nrequires no API keys or external services. The project is intentionally designed\nso a real LLM provider can be added later behind the same provider interface and\nvalidated response schema.\n\nLive demo: [reviewpilot-ai-lime.vercel.app](https://reviewpilot-ai-lime.vercel.app/)\n\n## Problem / Solution\n\nPull request review feedback is often inconsistent, hard to scan, or buried in\nlong conversational comments. ReviewPilot AI demonstrates how an AI-assisted\nreview workflow can parse raw unified diffs into predictable, review-ready\nsections that are easier to evaluate.\n\nThe solution is a small but complete app with an interactive diff analyzer,\nfocused review modes, line-based findings, a structured API contract, and\nprepared examples for live portfolio demos.\n\n## Screenshots\n\n| Dashboard                                        | Examples                                       | Review result                                            |\n| ------------------------------------------------ | ---------------------------------------------- | -------------------------------------------------------- |\n| ![Dashboard](./public/screenshots/dashboard.png) | ![Examples](./public/screenshots/examples.png) | ![Review result](./public/screenshots/review-result.png) |\n\n## Features\n\n- Paste unified git diffs from GitHub, GitLab, or local `git diff` output.\n- Parse changed files, hunks, additions, deletions, and line numbers.\n- Select a focused review mode before analysis.\n- View changed line, file, and character counts.\n- Receive location-aware feedback for possible bugs, refactoring, and tests.\n- Review changed-file cards with language, additions, deletions, and risk.\n- Inspect issue cards grouped by file with line numbers and code snippets.\n- See a 0-100 risk score, risk factor breakdown, confidence, and merge\n  recommendation.\n- Load bundled example diffs from the dashboard.\n- Browse prepared reports on `/examples`.\n- Run entirely locally with `MockAIProvider`.\n\n## Review Modes\n\n| Mode                 | Focus                                                                  |\n| -------------------- | ---------------------------------------------------------------------- |\n| General              | Broad pull request risks, error handling, security, and large diffs.   |\n| React                | Effects, memoization, list rendering, keys, props, and component flow. |\n| TypeScript           | `any`, assertions, compiler suppressions, and typed API contracts.     |\n| Frontend Performance | Inline props, render cost, array work, large lists, and derived state. |\n\n## Architecture\n\nReviewPilot AI separates the dashboard, API contract, validation, and provider\nlogic:\n\n- `app/page.tsx` renders the interactive diff analyzer.\n- `app/examples/page.tsx` renders prepared portfolio examples.\n- `app/api/review/route.ts` accepts review requests and returns validated JSON.\n- `lib/schemas/review.ts` defines Zod request and response schemas.\n- `lib/diff/parseDiff.ts` parses unified diffs into files, hunks, and lines.\n- `lib/ai/reviewProvider.ts` defines the provider interface.\n- `lib/ai/getReviewProvider.ts` selects the active provider from environment\n  configuration.\n- `lib/ai/mockReview.ts` implements `MockAIProvider` with deterministic\n  heuristics and explainable risk factors over parsed diff data.\n- `lib/ai/openAIReviewProvider.ts` implements the optional OpenAI-compatible\n  provider with direct `fetch`, strict JSON prompting, and Zod validation.\n- `app/components/review-result.tsx` renders reusable review report UI.\n\nSee [docs/architecture.md](./docs/architecture.md) for the detailed\nrequest/response flow and future LLM integration path.\n\n## Pages\n\n| Route       | Purpose                          |\n| ----------- | -------------------------------- |\n| `/`         | Interactive diff analyzer.       |\n| `/examples` | Prepared example review reports. |\n\n## Tech Stack\n\n- Next.js 16 App Router\n- React 19\n- TypeScript\n- Tailwind CSS 4\n- Zod\n- Lucide React\n- ESLint\n- Prettier\n\n## How to Run Locally\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nCreate local environment variables:\n\n```bash\ncp .env.example .env.local\n```\n\nStart the development server:\n\n```bash\nnpm run dev\n```\n\nOpen `http://localhost:3000`.\n\nPrepared examples are available at `http://localhost:3000/examples`.\n\n## AI Integration\n\nReviewPilot AI is safe to run without API keys because `MockAIProvider` is the\ndefault. To demonstrate production AI integration patterns, the app also\nincludes an optional OpenAI-compatible provider behind the same\n`ReviewProvider` interface.\n\nEnable the real provider with environment variables:\n\n```bash\nAI_PROVIDER=openai\nOPENAI_API_KEY=your_api_key\nOPENAI_MODEL=your-model-name\n```\n\nIf `AI_PROVIDER` is missing or invalid, the provider factory falls back to the\nmock provider. In OpenAI mode, prompts ask for strict JSON only, model output is\nparsed, and the result must pass the Zod `ReviewResultSchema` before it reaches\nthe API response. Invalid JSON, invalid schema output, or missing configuration\nis rejected with a clear API error instead of being silently accepted.\n\n## Example Input / Output\n\nRequest:\n\n```json\n{\n\t\"diff\": \"diff --git a/app/components/UserSearch.tsx b/app/components/UserSearch.tsx\\n...\",\n\t\"mode\": \"react\"\n}\n```\n\nResponse:\n\n```json\n{\n\t\"summary\": \"ReviewPilot inspected 1 changed file with 10 additions and 1 deletion in React mode and found 2 possible bugs and 0 refactoring suggestions. Overall risk is low with a 30/100 score.\",\n\t\"overallRisk\": \"low\",\n\t\"riskScore\": 30,\n\t\"riskFactors\": [\n\t\t{\n\t\t\t\"label\": \"Medium-severity findings\",\n\t\t\t\"impact\": 20,\n\t\t\t\"severity\": \"medium\",\n\t\t\t\"reason\": \"2 medium review findings add correctness or maintainability risk.\"\n\t\t},\n\t\t{\n\t\t\t\"label\": \"Missing network error handling\",\n\t\t\t\"impact\": 10,\n\t\t\t\"severity\": \"medium\",\n\t\t\t\"reason\": \"fetch or axios calls without nearby failure handling can leave loading, error, or data state inconsistent.\"\n\t\t}\n\t],\n\t\"changedFiles\": [\n\t\t{\n\t\t\t\"filePath\": \"app/components/UserSearch.tsx\",\n\t\t\t\"language\": \"TSX\",\n\t\t\t\"additions\": 10,\n\t\t\t\"deletions\": 1,\n\t\t\t\"riskLevel\": \"medium\"\n\t\t}\n\t],\n\t\"possibleBugs\": [\n\t\t{\n\t\t\t\"title\": \"Verify useEffect dependencies\",\n\t\t\t\"severity\": \"medium\",\n\t\t\t\"location\": {\n\t\t\t\t\"filePath\": \"app/components/UserSearch.tsx\",\n\t\t\t\t\"lineNumber\": 7,\n\t\t\t\t\"codeSnippet\": \"useEffect(() =\u003e {\"\n\t\t\t},\n\t\t\t\"description\": \"This added effect should be checked for stale closures, incomplete dependencies, and repeated side effects.\",\n\t\t\t\"suggestedFix\": \"Confirm every value read inside the effect is represented in the dependency array or intentionally stable.\"\n\t\t}\n\t],\n\t\"refactoringSuggestions\": [],\n\t\"testSuggestions\": [\n\t\t\"Add a React component test that verifies the effect reacts to changed inputs without running unnecessarily.\",\n\t\t\"Add or update tests for the primary user-visible behavior changed by this diff.\"\n\t],\n\t\"mergeRecommendation\": \"needs_changes\",\n\t\"confidence\": 0.83\n}\n```\n\nMore examples are documented in\n[docs/example-output.md](./docs/example-output.md).\n\n## Scripts\n\n| Command                | Description                                 |\n| ---------------------- | ------------------------------------------- |\n| `npm run dev`          | Start the local development server.         |\n| `npm run build`        | Create a production build.                  |\n| `npm run start`        | Start the production server after building. |\n| `npm run lint`         | Run ESLint.                                 |\n| `npm run test`         | Run Vitest unit tests.                      |\n| `npm run test:watch`   | Run Vitest in watch mode.                   |\n| `npm run eval:mock`    | Run deterministic golden-case AI evals.     |\n| `npm run format`       | Format files with Prettier.                 |\n| `npm run format:check` | Check formatting without writing changes.   |\n\n## CI / Quality Checks\n\nGitHub Actions runs quality checks on pushes and pull requests targeting\n`master`. The CI workflow installs dependencies with `npm ci`, then runs the same\nquality gates expected before release: format checking, linting, Vitest tests,\nmock AI evals, and a production build.\n\nRun the CI checks locally:\n\n```bash\nnpm run format:check\nnpm run lint\nnpm run test\nnpm run eval:mock\nnpm run build\n```\n\n## AI Evals\n\nThe `evals/` directory contains golden cases for core review behaviors such as\nReact hook risk, weak TypeScript typing, raw HTML security risk, and missing\nnetwork error handling. These cases document what good review output should\ncatch and provide a lightweight way to compare provider output against expected\nfindings.\n\nRun the deterministic mock evals:\n\n```bash\nnpm run eval:mock\n```\n\nThe eval script forces mock mode and never calls external APIs. Production AI\nintegrations should be evaluated against representative cases like these, not\nonly tested manually through the UI.\n\n## Testing\n\nThe core review logic is covered with Vitest:\n\n- `lib/diff/parseDiff.ts` tests cover unified diff parsing, file paths,\n  languages, additions, deletions, hunks, line numbers, package changes, and\n  invalid input.\n- `lib/ai/mockReview.ts` tests cover location-aware heuristics for React,\n  TypeScript, network error handling, XSS risk, cleanup findings, changed-file\n  summaries, explainable risk scores, sensitive file paths, package changes,\n  score-to-risk mapping, and Zod response validation.\n\nRun the tests:\n\n```bash\nnpm run test\n```\n\n## Future Improvements\n\n- Add streaming review progress for larger diffs.\n- Add repository-aware context ingestion for changed files.\n- Add authentication and saved review history.\n- Add GitHub pull request import and webhook support.\n- Add automated screenshot generation for release docs.\n- Add automated LLM evals against golden cases for real provider outputs.\n\n## Release Checklist\n\n- Run quality checks locally.\n- Capture fresh screenshots for the README.\n- Push the repository to GitHub.\n- Deploy the app to Vercel.\n\n## License\n\nMIT. See [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnimril%2Freviewpilot-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnimril%2Freviewpilot-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnimril%2Freviewpilot-ai/lists"}