0.2.19 • Published 12 months ago

gpt-code-review v0.2.19

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

GPT Code Review

gpt-code-review is a package that helps you review code changes by leveraging the OpenAI GPT language model. It generates feedback on code changes, including potential bug identification, best practices, security recommendations, and ensuring the code changes align with the provided commit messages.

Features

  • Fetches commit title, description, diff, and changed files for a given commit hash using Git commands.
  • Constructs ChatCompletionRequestMessage objects for the OpenAI API, providing the necessary context for code review.
  • Calls the OpenAI API to generate code review feedback and returns the AI-generated feedback.

Usage

In the repository

  1. Install the package:
yarn add gpt-code-review
  1. Create an .env file in the root of the repository with the following contents:
OPENAI_API_KEY=<your-openai-api-key>
GPT_CODE_REVIEW_MODEL=gpt-3.5-turbo
GPT_CODE_REVIEW_TEMPERATURE=0.3
  1. Run the review for the most recent commit:
yarn gpt-code-review $(git rev-parse HEAD)

Standalone script to run from the command line

npx gpt-code-review <commit-hash>

Replace <commit-hash> with the commit hash you want to review.

MIT License

Copyright (c) 2023 Igor Markelov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.2.19

12 months ago

0.2.18

12 months ago

0.2.17

12 months ago

0.2.16

12 months ago

0.2.15

12 months ago

0.2.14

12 months ago

0.2.13

12 months ago

0.2.12

12 months ago

0.2.11

12 months ago

0.2.10

12 months ago

0.2.9

12 months ago

0.2.8

12 months ago

0.2.7

12 months ago

0.2.6

12 months ago

0.2.5

12 months ago

0.2.4

12 months ago

0.2.3

12 months ago

0.2.2

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago