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.

gcop is your local git command copilot
Version: 0.1.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

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

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

Uploaded Source

Built Distribution

gcop-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gcop-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 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.0.0.tar.gz
Algorithm Hash digest
SHA256 f969928d208f5499e8b65c72ba5ef95195c88fc5e7ee57890c3b38383e2a563c
MD5 6cb55cda0a68e2a48e7762f77cf1f16d
BLAKE2b-256 79afb5d6b6b19ef0828a7e682d88df9a53facec21ca0461e3bf29fada47f3183

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gcop-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 577427b83dfb82c245c6018493820f521bf51cde6c5bd680ff8caac3cbfd690e
MD5 7a544d4b4a145a000a6a6e4ac57220b6
BLAKE2b-256 b9be98039fac5909f1f48c07621ee1a1b5583d14af0151d89805e0f650946af8

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