EthanNiksic.CodeReviewAi 1.0.0

dotnet tool install --global EthanNiksic.CodeReviewAi --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local EthanNiksic.CodeReviewAi --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=EthanNiksic.CodeReviewAi&version=1.0.0
                    
nuke :add-package EthanNiksic.CodeReviewAi --version 1.0.0
                    

code-review-ai

CLI tool that fetches GitHub pull request diffs and generates automated review comments using an LLM.

Usage

Generate a fine-grained GitHub personal access token and an OpenAI API key, then:

export GITHUB_TOKEN="your_github_token"
export OPENAI_API_KEY="your_openai_key"
dotnet run --project src/code-review-ai.csproj https://github.com/owner/repo/pull/123

The review is printed to standard output. To post it as a comment on the pull request instead, add --post:

dotnet run --project src/code-review-ai.csproj https://github.com/owner/repo/pull/123 --post

Reading diffs requires a token with read access to the repository. Posting comments additionally requires Pull requests: Read and write.

Reviews are generated with gpt-4o-mini by default.

How it works

Parses a PR URL into a GitHub API endpoint, then requests the diff using the application/vnd.github.v3.diff Accept header, which returns raw diff text instead of JSON. The diff is sent to the OpenAI API, which returns review comments.

URLs are validated and parsed before any network call is made, and failures at each stage — invalid URL, missing credentials, missing pull request, insufficient token permissions — exit with a descriptive message rather than a stack trace.

Diffs larger than the model's context budget are split on file boundaries and packed into batches sized to fit, each reviewed in a separate request. A single file larger than the budget is truncated and marked as such. The resulting reviews are combined into one output.

Note that pull request diffs are sent to OpenAI's API for processing.

Built with

C# / .NET 10

Running tests

dotnet test

Limitations

Reviews are posted as a single summary comment rather than inline on specific lines.

Roadmap

  • Send diffs to an LLM for review
  • Handle diffs that exceed model context limits
  • Post comments directly to the PR
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.0 117 8/18/2026