commit_companion


Namecommit_companion JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummarySmarter Git commit messages using GPT.
upload_time2025-08-22 21:42:43
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords git cli openai commit automation
VCS
bugtrack_url
requirements click openai python-dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Commit Companion

[![PyPI version](https://img.shields.io/pypi/v/commit-companion.svg)](https://pypi.org/project/commit-companion/)
[![GitHub release](https://img.shields.io/github/v/release/nelson-zack/commit-companion)](https://github.com/nelson-zack/commit-companion/releases)

[![Downloads](https://static.pepy.tech/badge/commit-companion)](https://pepy.tech/project/commit-companion)
[![Python Version](https://img.shields.io/pypi/pyversions/commit_companion)](https://pypi.org/project/commit-companion/)

[![License](https://img.shields.io/github/license/nelson-zack/commit-companion)](LICENSE)

**AI-powered Git commit assistant that summarizes staged changes using GPT.**  
Save time, stay in flow, and write better commit messages — automatically.

---

## Features

- Uses GPT to summarize your staged diffs into clear commit messages
- Supports [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- Tone customization (`neutral`, `casual`, `formal`, `funny`, etc.)
- Git hook integration via `prepare-commit-msg`
- Supports environment variables for default `TYPE` and `TONE`
- Optional auto mode to skip confirmation (for non-interactive use)

---

## Quick Start

### 1. Install via pip (recommended):

```bash
pip install commit-companion
```

Or, to install from source:

```bash
git clone https://github.com/nelson-zack/commit-companion.git
cd commit-companion
pip install .
```

### 2. Add your OpenAI API key:

Commit Companion requires access to the OpenAI API. You can provide your key in one of two ways:

#### Option 1: `.env` file (for local use)

```bash
OPENAI_API_KEY=sk-...
```

#### Option 2: Environment variable (for global use)

Add to your shell config (`~/.zshrc`, `~/.bashrc`, etc):

```bash
export OPENAI_API_KEY="sk-..."
```

Then run:

```bash
source ~/.zshrc   # or ~/.bashrc
```

### 3. Install CLI tool locally:

```bash
pip install --editable .
```

## Requirements

- Python 3.8 or later
- An OpenAI API key (required for GPT functionality)

## Usage

### CLI (manual):

```bash
commit-companion suggest --tone casual --type feat
```

Will output something like:

```bash
feat: add basic functionality to README.md
```

Example usage:

```bash
git add <file>
commit-companion suggest --tone casual --type feat
git commit -m "your message here"
git push
```

### Git Hook (auto):

Install the Git hook with:

```bash
commit-companion install-hook
```

This creates a .git/hooks/prepare-commit-msg script that auto-generates commit messages using GPT.
By default, it uses --tone neutral and --type feat.

#### Once installed, your flow becomes:

```bash
git add <file>      # Stage your changes
git commit          # Commit Companion will auto-suggest the message
git push            # Push to remote
```

#### Customize per commit:

Override tone or type like this:

```bash
TYPE=fix git commit
TONE=funny git commit
TYPE=fix TONE=funny git commit
```

Uninstall the hook:

```bash
commit-companion uninstall-hook
```

### Optional: Global Installation

To use commit-companion from any repo without activating a virtual environment:

#### 1. Install globally:

```bash
pip install .
```

#### 2. Add your OpenAI key to your shell config (~/.zshrc or ~/.bashrc):

```bash
export OPENAI_API_KEY="sk-..."
```

#### 3. Ensure your Python bin path is on your system PATH:

```bash
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.12/bin"
```

#### 4. Reload your shell:

```bash
source ~/.zshrc   # or ~/.bashrc
```

#### 5. Use it anywhere:

```bash
commit-companion install-hook
```

## Roadmap Ideas

- Config file support (.commitcompanion.json)
- VS Code extension
- Web version / hosted API
- ✅ PyPI distribution (available via `pip install commit-companion`)

## Why Use This?

Writing commit messages breaks flow. Commit Companion helps you:

- Stay focused on your code
- Standardize commits with no effort
- Impress your teammates with clear, consistent commit messages

## License

MIT License.

## Contributing

Contributions, suggestions, and issue reports are welcome! To get started:

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/my-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin feature/my-feature`)
5. Open a pull request

## Links

- 📦 [PyPI Package](https://pypi.org/project/commit-companion/)
- 🛠 [GitHub Repository](https://github.com/nelson-zack/commit-companion)
- 📝 [Release Notes](https://github.com/nelson-zack/commit-companion/releases)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "commit_companion",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "git, cli, openai, commit, automation",
    "author": null,
    "author_email": "Zack Nelson <zacknelson15@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ed/30/05f53a218295551d4f7ad5d8b25de33caed26de9be33eebf39bb8f8978ee/commit_companion-0.1.1.tar.gz",
    "platform": null,
    "description": "# Commit Companion\n\n[![PyPI version](https://img.shields.io/pypi/v/commit-companion.svg)](https://pypi.org/project/commit-companion/)\n[![GitHub release](https://img.shields.io/github/v/release/nelson-zack/commit-companion)](https://github.com/nelson-zack/commit-companion/releases)\n\n[![Downloads](https://static.pepy.tech/badge/commit-companion)](https://pepy.tech/project/commit-companion)\n[![Python Version](https://img.shields.io/pypi/pyversions/commit_companion)](https://pypi.org/project/commit-companion/)\n\n[![License](https://img.shields.io/github/license/nelson-zack/commit-companion)](LICENSE)\n\n**AI-powered Git commit assistant that summarizes staged changes using GPT.**  \nSave time, stay in flow, and write better commit messages \u2014 automatically.\n\n---\n\n## Features\n\n- Uses GPT to summarize your staged diffs into clear commit messages\n- Supports [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)\n- Tone customization (`neutral`, `casual`, `formal`, `funny`, etc.)\n- Git hook integration via `prepare-commit-msg`\n- Supports environment variables for default `TYPE` and `TONE`\n- Optional auto mode to skip confirmation (for non-interactive use)\n\n---\n\n## Quick Start\n\n### 1. Install via pip (recommended):\n\n```bash\npip install commit-companion\n```\n\nOr, to install from source:\n\n```bash\ngit clone https://github.com/nelson-zack/commit-companion.git\ncd commit-companion\npip install .\n```\n\n### 2. Add your OpenAI API key:\n\nCommit Companion requires access to the OpenAI API. You can provide your key in one of two ways:\n\n#### Option 1: `.env` file (for local use)\n\n```bash\nOPENAI_API_KEY=sk-...\n```\n\n#### Option 2: Environment variable (for global use)\n\nAdd to your shell config (`~/.zshrc`, `~/.bashrc`, etc):\n\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\n```\n\nThen run:\n\n```bash\nsource ~/.zshrc   # or ~/.bashrc\n```\n\n### 3. Install CLI tool locally:\n\n```bash\npip install --editable .\n```\n\n## Requirements\n\n- Python 3.8 or later\n- An OpenAI API key (required for GPT functionality)\n\n## Usage\n\n### CLI (manual):\n\n```bash\ncommit-companion suggest --tone casual --type feat\n```\n\nWill output something like:\n\n```bash\nfeat: add basic functionality to README.md\n```\n\nExample usage:\n\n```bash\ngit add <file>\ncommit-companion suggest --tone casual --type feat\ngit commit -m \"your message here\"\ngit push\n```\n\n### Git Hook (auto):\n\nInstall the Git hook with:\n\n```bash\ncommit-companion install-hook\n```\n\nThis creates a .git/hooks/prepare-commit-msg script that auto-generates commit messages using GPT.\nBy default, it uses --tone neutral and --type feat.\n\n#### Once installed, your flow becomes:\n\n```bash\ngit add <file>      # Stage your changes\ngit commit          # Commit Companion will auto-suggest the message\ngit push            # Push to remote\n```\n\n#### Customize per commit:\n\nOverride tone or type like this:\n\n```bash\nTYPE=fix git commit\nTONE=funny git commit\nTYPE=fix TONE=funny git commit\n```\n\nUninstall the hook:\n\n```bash\ncommit-companion uninstall-hook\n```\n\n### Optional: Global Installation\n\nTo use commit-companion from any repo without activating a virtual environment:\n\n#### 1. Install globally:\n\n```bash\npip install .\n```\n\n#### 2. Add your OpenAI key to your shell config (~/.zshrc or ~/.bashrc):\n\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\n```\n\n#### 3. Ensure your Python bin path is on your system PATH:\n\n```bash\nexport PATH=\"$PATH:/Library/Frameworks/Python.framework/Versions/3.12/bin\"\n```\n\n#### 4. Reload your shell:\n\n```bash\nsource ~/.zshrc   # or ~/.bashrc\n```\n\n#### 5. Use it anywhere:\n\n```bash\ncommit-companion install-hook\n```\n\n## Roadmap Ideas\n\n- Config file support (.commitcompanion.json)\n- VS Code extension\n- Web version / hosted API\n- \u2705 PyPI distribution (available via `pip install commit-companion`)\n\n## Why Use This?\n\nWriting commit messages breaks flow. Commit Companion helps you:\n\n- Stay focused on your code\n- Standardize commits with no effort\n- Impress your teammates with clear, consistent commit messages\n\n## License\n\nMIT License.\n\n## Contributing\n\nContributions, suggestions, and issue reports are welcome! To get started:\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/my-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature/my-feature`)\n5. Open a pull request\n\n## Links\n\n- \ud83d\udce6 [PyPI Package](https://pypi.org/project/commit-companion/)\n- \ud83d\udee0 [GitHub Repository](https://github.com/nelson-zack/commit-companion)\n- \ud83d\udcdd [Release Notes](https://github.com/nelson-zack/commit-companion/releases)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Smarter Git commit messages using GPT.",
    "version": "0.1.1",
    "project_urls": {
        "Home": "https://github.com/nelson-zack/commit-companion"
    },
    "split_keywords": [
        "git",
        " cli",
        " openai",
        " commit",
        " automation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5107beb1f50c2cd1139cd89529517fd61bc417c6c61a72958b6b39948b5010b1",
                "md5": "391b757af58deb850e9e2aaee3b98e16",
                "sha256": "2cc2b861b888c0bb54ffbbf4796118d4a7529d5ca1b0f0229c143f560649c55f"
            },
            "downloads": -1,
            "filename": "commit_companion-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "391b757af58deb850e9e2aaee3b98e16",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7499,
            "upload_time": "2025-08-22T21:42:42",
            "upload_time_iso_8601": "2025-08-22T21:42:42.160702Z",
            "url": "https://files.pythonhosted.org/packages/51/07/beb1f50c2cd1139cd89529517fd61bc417c6c61a72958b6b39948b5010b1/commit_companion-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ed3005f53a218295551d4f7ad5d8b25de33caed26de9be33eebf39bb8f8978ee",
                "md5": "94afbce7c9c3feb9abf97e031851577b",
                "sha256": "10b1677959ce17b341bcbe179a891a9004acb9c45140e476477247e2a8fbf732"
            },
            "downloads": -1,
            "filename": "commit_companion-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "94afbce7c9c3feb9abf97e031851577b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7947,
            "upload_time": "2025-08-22T21:42:43",
            "upload_time_iso_8601": "2025-08-22T21:42:43.577033Z",
            "url": "https://files.pythonhosted.org/packages/ed/30/05f53a218295551d4f7ad5d8b25de33caed26de9be33eebf39bb8f8978ee/commit_companion-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-22 21:42:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nelson-zack",
    "github_project": "commit-companion",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "openai",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        }
    ],
    "lcname": "commit_companion"
}
        
Elapsed time: 2.56366s