11# Commit Companion
22
3+ [ ![ PyPI version] ( https://badge.fury.io/py/commit-companion.svg )] ( https://badge.fury.io/py/commit-companion )
4+
35** AI-powered Git commit assistant that summarizes staged changes using GPT.**
46Save time, stay in flow, and write better commit messages — automatically.
57
@@ -18,37 +20,66 @@ Save time, stay in flow, and write better commit messages — automatically.
1820
1921## Quick Start
2022
21- ### 1. Clone the repo and install dependencies:
23+ ### 1. Install via pip (recommended):
24+
25+ ``` bash
26+ pip install commit-companion
27+ ```
28+
29+ Or, to install from source:
2230
2331``` bash
2432git clone https://github.com/nelson-zack/commit-companion.git
2533cd commit-companion
26- python3 -m venv venv
27- source venv/bin/activate
28- pip install -r requirements.txt
34+ pip install .
2935```
3036
31- ### 2. Add your OpenAI key to .env:
32- ``` bash
37+ ### 2. Add your OpenAI API key:
38+
39+ Commit Companion requires access to the OpenAI API. You can provide your key in one of two ways:
40+
41+ #### Option 1: ` .env ` file (for local use)
42+
43+ ``` bash
3344OPENAI_API_KEY=sk-...
3445```
3546
47+ #### Option 2: Environment variable (for global use)
48+
49+ Add to your shell config (` ~/.zshrc ` , ` ~/.bashrc ` , etc):
50+
51+ ``` bash
52+ export OPENAI_API_KEY=" sk-..."
53+ ```
54+
55+ Then run:
56+
57+ ``` bash
58+ source ~ /.zshrc # or ~/.bashrc
59+ ```
60+
3661### 3. Install CLI tool locally:
62+
3763``` bash
3864pip install --editable .
3965```
4066
4167## Usage
4268
4369### CLI (manual):
70+
4471``` bash
4572commit-companion suggest --tone casual --type feat
4673```
74+
4775Will output something like:
76+
4877``` bash
4978feat: add basic functionality to README.md
5079```
80+
5181Example usage:
82+
5283``` bash
5384git add < file>
5485commit-companion suggest --tone casual --type feat
@@ -57,10 +88,13 @@ git push
5788```
5889
5990### Git Hook (auto):
91+
6092Install the Git hook with:
93+
6194``` bash
6295commit-companion install-hook
6396```
97+
6498This creates a .git/hooks/prepare-commit-msg script that auto-generates commit messages using GPT.
6599By default, it uses --tone neutral and --type feat.
66100
@@ -75,54 +109,64 @@ git push # Push to remote
75109#### Customize per commit:
76110
77111Override tone or type like this:
112+
78113``` bash
79114TYPE=fix git commit
80115TONE=funny git commit
81116TYPE=fix TONE=funny git commit
82117```
83118
84119Uninstall the hook:
120+
85121``` bash
86122commit-companion uninstall-hook
87123```
88124
89125### Optional: Global Installation
90126
91127To use commit-companion from any repo without activating a virtual environment:
128+
92129#### 1. Install globally:
130+
93131``` bash
94132pip install .
95133```
96134
97- #### 2. Add your OpenAI key to your shell config (~ /.zshrc or ~ /.bashrc):
135+ #### 2. Add your OpenAI key to your shell config (~ /.zshrc or ~ /.bashrc):
136+
98137``` bash
99138export OPENAI_API_KEY=" sk-..."
100139```
101140
102- #### 3. Ensure your Python bin path is on your system PATH:
141+ #### 3. Ensure your Python bin path is on your system PATH:
142+
103143``` bash
104144export PATH=" $PATH :/Library/Frameworks/Python.framework/Versions/3.12/bin"
105145```
106146
107- #### 4. Reload your shell:
147+ #### 4. Reload your shell:
148+
108149``` bash
109150source ~ /.zshrc # or ~/.bashrc
110151```
111152
112- #### 5. Use it anywhere:
153+ #### 5. Use it anywhere:
154+
113155``` bash
114156commit-companion install-hook
115157```
116158
117-
118159## Roadmap Ideas
160+
119161- Config file support (.commitcompanion.json)
120162- VS Code extension
121163- Web version / hosted API
122- - PyPI distribution (pip install commit-companion)
164+ - ✅ PyPI distribution (available via ` pip install commit-companion ` )
123165
124166## Why Use This?
167+
125168Writing commit messages breaks flow. Commit Companion helps you:
169+
126170- Stay focused on your code
127171- Standardize commits with no effort
128172- Impress your teammates with clear, consistent commit messages
0 commit comments