This release is a pre-release and may not be stable for production use.
MagicCommits
Magiccommits: Effortless Git Commits with AI
Installation
Before you start using MagicCommits, make sure you have Python and pip installed. Then, you can install MagicCommits using pip:
pip install magiccommits
If you are using python3 then
pip3 install magiccommits
Before you can use MagicCommits, you'll need to configure it with your OpenAI API key. If you haven't already, you can retrieve your API key from OpenAI (Note: You may need to create an account and set up billing).
Set the OPENAI_KEY
mc config set OPENAI_KEY=<your-token>
This will create a .mc file in your home directory (~/.mc).
Usage
Execute magiccommits or mc to generate the commit messages
Additional Options
| Command | Example | Functionality | |
|---|---|---|---|
| 1 | -t or --ticket |
mc -t PROJ-123 |
Set the ticket number for your commit message |
| 2 | -a or --add |
mc -a |
Perform a git add . operation before commit |
| 3 | -u or --update |
mc commit -u |
Perform a git add --update operation |
You can use these additional options to customize your commit messages and perform relevant Git operations as needed in your project workflow.
Demo: mc -a
Demo: copy message to clipboard
Configuration
You can use these keys to configure various aspects of the project. To set the value for a key, you must use the format key=value when using the mc config set command. To retrieve the values for these keys, you can use the mc config get command, either for all values or a specific key.
Configuration Keys
OPENAI_KEY [Required]
- Description: This key is used to specify the OpenAI API key.
- Example Setting:
- To set the value:
mc config set OPENAI_KEY=sk-test
- To retrieve the value:
mc config get OPENAI_KEY
- To set the value:
locale [OPT]
- Description: This key defines the locale or language for text generation.
- Example Setting:
- To set the value:
mc config set locale=en
- To retrieve the value:
mc config get locale
- To set the value:
generate [OPT]
- Description: This key determines the number of commit message to generate.
- Example Setting:
- To set the value:
mc config set generate=4
- To retrieve the value:
mc config get generate
- To set the value:
type [OPT]
-
Description: This key specifies the type of commit generation.
-
Example Setting:
- To set the value:
mc config set type=conventional
- To retrieve the value:
mc config get type
- To set the value:
conventional
-
Explanation: Generates commit messages following the conventional commit format.
-
Example:
- Commit Message:
feat: add new feature - Description: A conventional commit format with a type ("feat" for feature) and a brief description.
- Commit Message:
conventional-emoji
-
Explanation: Generates commit messages following the conventional commit format with added emojis.
-
Example:
- Commit Message:
feat: add new feature :sparkles: - Description: A conventional commit format with an emoji (✨) for visual appeal and a type ("feat") with a brief description.
- Commit Message:
message
-
Explanation: Generates simple and concise commit messages.
-
Example:
- Commit Message:
Update README.md - Description: A straightforward commit message with a focus on the action ("Update README.md").
- Commit Message:
message-emoji
-
Explanation: Generates simple commit messages with added emojis.
-
Example:
- Commit Message:
Fix a critical bug :bug: - Description: A simple commit message with an emoji (🐛) for visual context, describing the action ("Fix a critical bug").
- Commit Message:
proxy [OPT]
- Description: This key allows you to set a proxy server for network requests.
- Example Setting:
- To set the value:
mc config set proxy=http
- To retrieve the value:
mc config get proxy
- To set the value:
model [OPT]
- Description: This key defines the model to be used for commit generation.
- Example Setting:
- To set the value:
mc config set model=gpt-3.5-turbo
- To retrieve the value:
mc config get model
- To set the value:
timeout [OPT]
- Description: This key sets the maximum timeout (in milliseconds) for API requests.
- Example Setting:
- To set the value:
mc config set timeout=10000
- To retrieve the value:
mc config get timeout
- To set the value:
max_length [OPT]
- Description: This key specifies the maximum length of generated text.
- Example Setting:
- To set the value:
mc config set max_length=50
- To retrieve the value:
mc config get max_length
- To set the value:
max_token [OPT]
- Description: This key determines the maximum number of tokens in the generated text.
- Example Setting:
- To set the value:
mc config set max_token=200
- To retrieve the value:
mc config get max_token
- To set the value:
copy_commit [OPT]
- Description: This key is a boolean flag that determines whether to copy the generated text to the clipboard.
- Example Setting (True):
- To set the value:
mc config set copy_commit=True
- To retrieve the value:
mc config get copy_commit
- To set the value:
Getting Configuration Values
To retrieve the values for these configuration keys, you can use the following commands:
- To get all configuration values:
mc config get
Usage
Generate Commit Messages
You can use MagicCommits to effortlessly generate commit messages for your staged changes:
MagicCommits will analyze your Git diff and employ AI to suggest a commit message. You can then choose to commit, commit and push, or copy the message to your clipboard.
Version
To check the current version of MagicCommits, you can use the following command:
mc --version
Credits
MagicCommits is inspired by AI Commits, created by Hassan El Mghari.
Contributing
If you want to help fix a bug or implement a feature in Issues, checkout the Contribution Guide to learn how to setup project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for magiccommits 1.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| magiccommits-1.0.dev0.tar.gz | 16.5 kB | Without provenance | Details for magiccommits-1.0.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| magiccommits-1.0.dev0-py3-none-any.whl | Python 3 | none | any | Details for magiccommits-1.0.dev0-py3-none-any.whl |
Total release size: 37.3 kB
Release files / magiccommits-1.0.dev0.tar.gz
| Download URL | magiccommits-1.0.dev0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afd9d61612d652ee6c431b08d65486cc4b48fa3fa61d61ead56557125a7dd951
|
|
BLAKE2b-256 checksum How to use checksums |
d2afbe9abb1a740992fa83621463a056880b3d094bb2cefbd37fed8fdacf4d78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / magiccommits-1.0.dev0-py3-none-any.whl
| Download URL | magiccommits-1.0.dev0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
589b0934c1cbf623c83609c16dc95ff95f28d933679a6c2b5bbe85b6657786c7
|
|
BLAKE2b-256 checksum How to use checksums |
07d3a0a350d0a7f46ea8e109204a0d49b5ae7e13fe946b5b5ab7178b373af875
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for magiccommits 1.0.dev0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.