# summary

Performs an AI-assisted review of code changes between two commits or branches.

# description

This command automates the process of generating code review comments for diffs in a Git repository by:

- Creating a temporary directory containing the differences between the specified commits/branches.
- Running a static code analysis over the diff, which produces SARIF data that includes diagnostic messages and hints regarding potential issues in the code.
- Invoking an AI provider (e.g., AzureOpenAI) to generate review comments and code suggestions based on the collected hints and the actual code snippet.
- Optionally, posting the AI-generated review comments as pull request comments on supported Git hosting providers (such as GitHub or BitBucket) when pull request information and credentials are provided.

# examples

- ds-sfcoe-ailabs pr-review --repo-dir ./ --ai-provider=AzureOpenAI --ai-model=gpt-4o-mini-eastus2 --ai-token=$OPENAI_TOKEN --git-provider=GitHub --git-token=$GITHUB_TOKEN--git-owner=DTS-Productivity-Engineering --git-repo=smartreview --pull-request-id=2 --from=HEAD --to=main

# flags.repo-dir.summary

Specifies the path to the local Git repository (default is current working directory).

# flags.from.summary

The base commit or branch from which changes are compared (default is "HEAD~1").

# flags.to.summary

The target commit or branch to which changes are compared (default is "HEAD").

# flags.pull-request-id.summary

Identifier for the pull request to which review comments should be posted (optional).

# flags.sf-config-file.summary

Path to the configuration file used by the SF Code Analyzer (optional).

# flags.pmd-config-file.summary

Path to the configuration file used by PMD (optional).

# flags.ai-provider.summary

The AI service provider to use (Required).

Supported values:

- OpenAI
- AzureOpenAI
- Anthropic

# flags.ai-token.summary

Authentication token for the AI provider (Required).

# flags.ai-model.summary

The model to use for generating code review suggestions (optional).

# flags.ai-api-version.summary

The API version of the model to be used for generating code review suggestions (optional).

# flags.ai-api-endpoint.summary

The API endpoint of the model to be used for generating code review suggestions (optional).

# flags.git-provider.summary

The Git hosting service to use for posting comments (optional).

Supported values:

- GitHub

# flags.git-token.summary

Authentication token for the Git provider (optional).

# flags.git-owner.summary

Repository owner's name for the Git provider (optional).

# flags.git-repo.summary

Repository name for the Git provider (optional).
