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.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

gcop-1.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file gcop-1.1.0.tar.gz.

File metadata

  • Download URL: gcop-1.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.19 Linux/6.5.0-1022-azure

File hashes

Hashes for gcop-1.1.0.tar.gz
Algorithm Hash digest
SHA256 03f3c36adb1aa6d0121dba25f76088d83194f1e15fcedc2d52416e51fa1a318c
MD5 f68e2cdb26c0c55204c98ed1451897d7
BLAKE2b-256 a765e5e00b8ce0db64b22ccb82e93e4f61c925fe6558359fcb4b2bb5cf26b625

See more details on using hashes here.

File details

Details for the file gcop-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: gcop-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.19 Linux/6.5.0-1022-azure

File hashes

Hashes for gcop-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9054c57eeaf09b26e713d7237b6d251b6dc10b02f0e58c13e29b23f94cef920
MD5 0e29f85bf443979107b0e0ff40de2498
BLAKE2b-256 4412d1521e98fc8a29f025250b3f8650b8e027396c55ea5f5102370d375c7daa

See more details on using hashes here.

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