Skip to main content

gcop is your git AI copilot.

Project description

img.png

Gcop is your git AI copilot. You can use any large language model to help automate the generation of commit messages.

Features

  • Generate commit messages by large language models.
  • Easily config your language model.

TECH

Video Demo

Gcop is your git AI copilot

Quick Start

  • Install gcop
pip install gcop
  • If you are first time to use gcop, you need to run the gcop init command to initialize the configuration. This command will alias gcop command on your git.
gcop init

Basic Usage

Run the git ghelp command to get help information and show all gcop commands.

gcop is your local git command copilot
Version: 1.0.0
GitHub: https://github.com/Undertone0809/gcop


Usage: git [OPTIONS] COMMAND
Commands:
  git ghelp      Add command into git config
  git gconfig    Open the config file in the default editor
  git gcommit    Generate a git commit message based on the staged changes and commit the changes

gcop continues to add git gxxx commands later.

Config your language model

Before you generate a commit message, you need to config your language model. You can use any large language model to generate commit messages. The following example shows how to config the language model.

git gconfig

Then gcop will generate a config.yaml, then you can config your language model.config.yaml store path:

  • Windows: %USERPROFILE%\.gcop\config.yaml
  • Linux: ~/.gcop/config.yaml
  • MacOS: ~/.gcop/config.yaml

Config your model in config.yaml, see how to config your model here:

model:
  model_name: provider/name,eg OpenAI/gpt-4
  api_key: YOUR_API_KEY

Generate commit message

The following example show how to use gcop to generate a commit message.

git add .
git gcommit

Video Demo

This video shows how to use gcop to generate a commit message.

Gcop is your git AI copilot

Development

Conda package manager is recommended. Create a conda environment.

conda create -n gcop python==3.10

Activate conda environment and install poetry

conda activate gcop
pip install poetry

Then you can run the client using the following command:

gcop --help

or with Poetry:

poetry run gcop --help

Makefile usage

Makefile contains a lot of functions for faster development.

Install all dependencies and pre-commit hooks

Install requirements:

make install

Pre-commit hooks coulb be installed after git init via

make pre-commit-install

Codestyle and type checks

Automatic formatting uses ruff.

make polish-codestyle

# or use synonym
make formatting

Codestyle checks only, without rewriting files:

make check-codestyle

Note: check-codestyle uses ruff and darglint library

Code security

If this command is not selected during installation, it cannnot be used.

make check-safety

This command launches Poetry integrity checks as well as identifies security issues with Safety and Bandit.

make check-safety

Tests with coverage badges

Run pytest

make test

All linters

Of course there is a command to run all linters in one:

make lint

the same as:

make check-codestyle && make test && make check-safety

Docker

make docker-build

which is equivalent to:

make docker-build VERSION=latest

Remove docker image with

make docker-remove

More information about docker.

Cleanup

Delete pycache files

make pycache-remove

Remove package build

make build-remove

Delete .DS_STORE files

make dsstore-remove

Remove .mypycache

make mypycache-remove

Or to remove all above run:

make cleanup

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

Contact

For more information, please contact: zeeland4work@gmail.com

See anything changelog, describe the telegram channel

Credits 🚀 Your next Python package needs a bleeding-edge project structure.

This project was generated with P3G

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcop-1.0.1.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

gcop-1.0.1-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page