Name | openai-git-hook JSON |
Version |
0.0.4
JSON |
| download |
home_page | None |
Summary | A Git pre-commit hook powered by OpenAI to review your staged changes. |
upload_time | 2025-02-16 22:06:50 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.6 |
license | MIT |
keywords |
git
pre-commit
openai
hook
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# AI-Powered Code Review Git Hook
A Git pre-commit hook that leverages OpenAI's API to automatically analyze staged code changes for potential issues before committing.
## Features
- **Automated Code Review:** Reviews staged changes for syntax errors, potential bugs, and security issues.
- **GPT-4 Based Analysis:** Utilizes OpenAI's GPT-4 (configurable) for detailed feedback.
- **Line-Number Specific Feedback:** Annotates diffs with precise line numbers for easy reference.
- **Environment Variable Controls:** Easily enable or disable the hook via environment variables.
## Prerequisites
- **Python:** 3.6+ (recommended)
- **Git:** Installed and configured
- **OpenAI API Key:** Obtain an API key from [OpenAI](https://openai.com)
## Setup
### 1. Install the Package
Install the package via pip (from PyPI or TestPyPI):
**PyPi**:
```bash
pip install openai-git-hook
```
### 2. Configure the Hook
```bash
export OPENAI_API_KEY=your_api_key_here
```
### 3. Using the Hook
- **Manual Review:**
Run `openai-git-hook` manually to perform a code review on your staged changes. **Note:** You must run `git add .` (or stage your changes) before executing the command, as the hook analyzes the diff of the staged changes.
- **Automatic Installation:**
Run `openai-git-hook-install` to install or update the Git pre-commit hook in your repository. This command writes the necessary script to `.git/hooks/pre-commit`, ensuring that the code review is automatically executed every time you commit changes. Remember to stage your changes with `git add .` so that the hook can access the diff and other required information. If you need to bypass the hook during a commit, you can do so by using the --no-verify flag.
Raw data
{
"_id": null,
"home_page": null,
"name": "openai-git-hook",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "git, pre-commit, openai, hook",
"author": null,
"author_email": "Rhys Postans <rmp71171@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/d1/bf/666fccd5d0e2704582e21da41d760e9b4cb16e35a98899e67cbcaa411699/openai_git_hook-0.0.4.tar.gz",
"platform": null,
"description": "# AI-Powered Code Review Git Hook\n\nA Git pre-commit hook that leverages OpenAI's API to automatically analyze staged code changes for potential issues before committing.\n\n## Features\n\n- **Automated Code Review:** Reviews staged changes for syntax errors, potential bugs, and security issues.\n- **GPT-4 Based Analysis:** Utilizes OpenAI's GPT-4 (configurable) for detailed feedback.\n- **Line-Number Specific Feedback:** Annotates diffs with precise line numbers for easy reference.\n- **Environment Variable Controls:** Easily enable or disable the hook via environment variables.\n\n## Prerequisites\n\n- **Python:** 3.6+ (recommended)\n- **Git:** Installed and configured\n- **OpenAI API Key:** Obtain an API key from [OpenAI](https://openai.com)\n\n## Setup\n\n### 1. Install the Package\n\nInstall the package via pip (from PyPI or TestPyPI):\n\n**PyPi**:\n\n```bash\npip install openai-git-hook\n```\n\n### 2. Configure the Hook\n\n```bash\nexport OPENAI_API_KEY=your_api_key_here\n```\n\n### 3. Using the Hook\n\n- **Manual Review:** \n Run `openai-git-hook` manually to perform a code review on your staged changes. **Note:** You must run `git add .` (or stage your changes) before executing the command, as the hook analyzes the diff of the staged changes.\n\n- **Automatic Installation:** \n Run `openai-git-hook-install` to install or update the Git pre-commit hook in your repository. This command writes the necessary script to `.git/hooks/pre-commit`, ensuring that the code review is automatically executed every time you commit changes. Remember to stage your changes with `git add .` so that the hook can access the diff and other required information. If you need to bypass the hook during a commit, you can do so by using the --no-verify flag.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Git pre-commit hook powered by OpenAI to review your staged changes.",
"version": "0.0.4",
"project_urls": {
"Repository": "https://gitlab.com/personal-projects8784807/openai-git-hook"
},
"split_keywords": [
"git",
" pre-commit",
" openai",
" hook"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fca57186e09036eade0a65e01af8faf08470c95d9b9214e8ecc72612aecbfad7",
"md5": "216646aac7d404725436d1993f9136df",
"sha256": "d67f8a20e31fe5da4573856208c5a8633b44e7102ce0563e44587adcb54e4f55"
},
"downloads": -1,
"filename": "openai_git_hook-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "216646aac7d404725436d1993f9136df",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5857,
"upload_time": "2025-02-16T22:06:49",
"upload_time_iso_8601": "2025-02-16T22:06:49.502488Z",
"url": "https://files.pythonhosted.org/packages/fc/a5/7186e09036eade0a65e01af8faf08470c95d9b9214e8ecc72612aecbfad7/openai_git_hook-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d1bf666fccd5d0e2704582e21da41d760e9b4cb16e35a98899e67cbcaa411699",
"md5": "07c1e2f3709cdda4d7a30df83fbc6a00",
"sha256": "80e597442f871caf7e3afd4488398371e5a96eb47aa3cbf93b86007e3209ddd6"
},
"downloads": -1,
"filename": "openai_git_hook-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "07c1e2f3709cdda4d7a30df83fbc6a00",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5487,
"upload_time": "2025-02-16T22:06:50",
"upload_time_iso_8601": "2025-02-16T22:06:50.421234Z",
"url": "https://files.pythonhosted.org/packages/d1/bf/666fccd5d0e2704582e21da41d760e9b4cb16e35a98899e67cbcaa411699/openai_git_hook-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-16 22:06:50",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "personal-projects8784807",
"gitlab_project": "openai-git-hook",
"lcname": "openai-git-hook"
}