# CommitCraft
CommitCraft is a tool designed to enhance your commit messages by leveraging Large Language Models (LLMs). It provides an intuitive interface that simplifies the process of generating better, more informative commit messages based on staged changes in your git repository.
## Features
- **Provider Agnostic**: Supports multiple LLM providers including Ollama, Google, OpenAI, and Any OpenAI compatible endpoint.
- **Configurable Context Size**: Automatically adjusts the context size for optimal performance. (Ollama only)
- **Emoji Support**: Option to include emojis in your commit messages based on predefined conventions. Pre-configured witch gitmoji specification.
- **User-Friendly CLI**: A command-line interface allows users to easily specify provider, model, and other settings.
- **Customizable**: Allows to easily setup a personalized system prompt and contextual information for tuning your results to your project commit guidlines.
## Installation
You can install CommitCraft using `pipx` for a hassle-free experience:
```bash
pipx install commitcraft
```
Note : the default instalations is ollama only.
If you intent to use some provider other than ollama consider using one of the folowing:
```bash
pipx install 'commitcraft[openai]'
```
```bash
pipx install 'commitcraft[groq]'
```
```bash
pipx install 'commitcraft[google]'
```
```bash
pipx install 'commitcraft[all-providers]'
```
## Configuration
CommitCraft can be configured via either command-line arguments or through configuration files located in the `.commitcraft` directory. Supported file types are TOML, YAML, and JSON. The default locations for these files are:
- `context`: `./.commitcraft/context.{toml|yaml|json}`
- `models`: `./.commitcraft/models.{toml|yaml|json}`
- `emoji`: `./.commitcraft/emoji.{toml|yaml|json}`
- `config`: `./.commitcraft/config.{toml|yaml|json}`
Alternatively, you can specify a configuration file path using the `--config-file` argument.
Your API keys shall be stored in enviroment variables or in a `.env` file
## Usage
To use CommitCraft, simply run:
```bash
CommitCraft
```
If no arguments are provided, then the configuration files (if present) will be used to determine settings such as provider, model, and other options. If there are no configuration files, the tool will fall back to using default settings (ollama, gemma2).
The diff used by CommitCraft is the result of `git diff --staged -M` so you will need to add files you want to consider before using it.
You may pipe the output to other commands.
### Command-Line Arguments
- `--provider`: Specifies the LLM provider (e.g., `ollama`, `google`, `openai`, `custom_openai_compatible`).
- `--model`: The name of the model to use.
- `--config-file`: Path to a configuration file.
- `--system-prompt`: A system prompt to guide the LLM.
- `--num-ctx`: Context size for the model.
- `--temperature`: Temperature setting for the model.
- `--max-tokens`: Maximum number of tokens for the model.
- `--host`: HTTP or HTTPS host for the provider, required for `custom_openai_compatible`.
### Example Configuration File
Here's an example configuration file in TOML format:
```toml
[context]
project_name = "MyProject"
project_language = "Python"
project_description = "A project to enhance commit messages."
commit_guidelines = "Ensure each commit is concise and describes the changes clearly."
[models]
provider = "ollama"
model = "gemma2"
system_prompt = "You are a helpful assistant for generating commit messages based on git diff."
options = {num_ctx = 8192, temperature = 0.7}
[emoji]
emoji_steps = "single"
emoji_convention = "simple"
```
You may want those settings to be 3 diferent files so for example the provider could be decided on a user by user basis, adding the models config file to the .gitignore file, but the emoji and context settings may be tracked by git.
### Environment Variables
For secrets this project uses either .env file in the root of execution, or system wide vars, for reference we provide a .env.example file that provides every secret used by the code.
```sh
OLLAMA_HOST=http://localhost:11434
OPENAI_API_KEY=sk-your-api-key-here
GROQ_API_KEY=you_api_key
GOOGLE_API_KEY=key
CUSTOM_API_KEY=hey
```
## Privacy
CommitCraft itself does not log, record or send any information about your usage and project, or any other info.
However, it is important to note that by using CommitCraft, you are agreeing to the terms of the providers you choose, as CommitCraft sends diffs and contextual information to their API. Unless you self-host the application, these providers may still collect your request history and metadata information. For more detailed information about how each provider handles your data, please review their respective privacy policies:
- [Groq](https://groq.com/privacy-policy/)
- [Google](https://ai.google.dev/gemini-api/terms)
- [OpenAI](https://openai.com/policies/privacy-policy/)
## Princing
CommitCraft is Free Software in this case free as in freedom and as in no price atached.
But, similar to privacy concerns, if you are not self-hosting your models, it's important to be aware of the pricing structure for the providers you use. As of now, Groq and Google provide a free tier, while OpenAI operates on a fully usage-based pricing model. For more detailed information about pricing options, please refer to the documentation provided by each provider:
- [Groq](https://groq.com/pricing/)
- [Google](https://ai.google.dev/pricing)
- [OpenAI](https://openai.com/api/pricing/)
## Troubleshooting
If for some reason a dependency is missing folow these steps:
1. Run the folowing command
```sh
pipx inject commitcraft [depency_name]
```
2. Report the problem to the issues page, also provid the command you used to install.
## License
This project is licensed under the AGPL 3.0 License - see the [LICENSE](LICENSE) file for details.
---
Thank you for using CommitCraft! We hope this tool helps you craft better commit messages effortlessly.
Raw data
{
"_id": null,
"home_page": "https://github.com/Felix-Pedro/CommitCraft",
"name": "commitcraft",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "llm, commit, ai, openai, ollama, groq, git, dev, commit messages",
"author": "Felix-Pedro",
"author_email": "felix@auneria.com",
"download_url": "https://files.pythonhosted.org/packages/c1/2b/8a940305145071ddc52df1d9207c2f5d3534bf5a6666001c4b8bc5660793/commitcraft-0.1.1.tar.gz",
"platform": null,
"description": " # CommitCraft\n\nCommitCraft is a tool designed to enhance your commit messages by leveraging Large Language Models (LLMs). It provides an intuitive interface that simplifies the process of generating better, more informative commit messages based on staged changes in your git repository.\n\n## Features\n\n- **Provider Agnostic**: Supports multiple LLM providers including Ollama, Google, OpenAI, and Any OpenAI compatible endpoint.\n- **Configurable Context Size**: Automatically adjusts the context size for optimal performance. (Ollama only)\n- **Emoji Support**: Option to include emojis in your commit messages based on predefined conventions. Pre-configured witch gitmoji specification.\n- **User-Friendly CLI**: A command-line interface allows users to easily specify provider, model, and other settings.\n- **Customizable**: Allows to easily setup a personalized system prompt and contextual information for tuning your results to your project commit guidlines.\n\n## Installation\n\nYou can install CommitCraft using `pipx` for a hassle-free experience:\n\n```bash\npipx install commitcraft\n```\nNote : the default instalations is ollama only.\n\nIf you intent to use some provider other than ollama consider using one of the folowing:\n\n```bash\npipx install 'commitcraft[openai]'\n```\n\n```bash\npipx install 'commitcraft[groq]'\n```\n\n```bash\npipx install 'commitcraft[google]'\n```\n\n```bash\npipx install 'commitcraft[all-providers]'\n```\n\n\n## Configuration\n\nCommitCraft can be configured via either command-line arguments or through configuration files located in the `.commitcraft` directory. Supported file types are TOML, YAML, and JSON. The default locations for these files are:\n\n- `context`: `./.commitcraft/context.{toml|yaml|json}`\n- `models`: `./.commitcraft/models.{toml|yaml|json}`\n- `emoji`: `./.commitcraft/emoji.{toml|yaml|json}`\n- `config`: `./.commitcraft/config.{toml|yaml|json}`\n\nAlternatively, you can specify a configuration file path using the `--config-file` argument.\n\nYour API keys shall be stored in enviroment variables or in a `.env` file\n\n## Usage\n\nTo use CommitCraft, simply run:\n\n```bash\nCommitCraft\n```\n\nIf no arguments are provided, then the configuration files (if present) will be used to determine settings such as provider, model, and other options. If there are no configuration files, the tool will fall back to using default settings (ollama, gemma2).\n\nThe diff used by CommitCraft is the result of `git diff --staged -M` so you will need to add files you want to consider before using it.\n\nYou may pipe the output to other commands.\n\n### Command-Line Arguments\n\n- `--provider`: Specifies the LLM provider (e.g., `ollama`, `google`, `openai`, `custom_openai_compatible`).\n- `--model`: The name of the model to use.\n- `--config-file`: Path to a configuration file.\n- `--system-prompt`: A system prompt to guide the LLM.\n- `--num-ctx`: Context size for the model.\n- `--temperature`: Temperature setting for the model.\n- `--max-tokens`: Maximum number of tokens for the model.\n- `--host`: HTTP or HTTPS host for the provider, required for `custom_openai_compatible`.\n\n### Example Configuration File\n\nHere's an example configuration file in TOML format:\n\n```toml\n[context]\nproject_name = \"MyProject\"\nproject_language = \"Python\"\nproject_description = \"A project to enhance commit messages.\"\ncommit_guidelines = \"Ensure each commit is concise and describes the changes clearly.\"\n\n[models]\nprovider = \"ollama\"\nmodel = \"gemma2\"\nsystem_prompt = \"You are a helpful assistant for generating commit messages based on git diff.\"\noptions = {num_ctx = 8192, temperature = 0.7}\n\n[emoji]\nemoji_steps = \"single\"\nemoji_convention = \"simple\"\n```\n\nYou may want those settings to be 3 diferent files so for example the provider could be decided on a user by user basis, adding the models config file to the .gitignore file, but the emoji and context settings may be tracked by git.\n\n### Environment Variables\n\nFor secrets this project uses either .env file in the root of execution, or system wide vars, for reference we provide a .env.example file that provides every secret used by the code.\n\n```sh\nOLLAMA_HOST=http://localhost:11434\nOPENAI_API_KEY=sk-your-api-key-here\nGROQ_API_KEY=you_api_key\nGOOGLE_API_KEY=key\nCUSTOM_API_KEY=hey\n```\n\n\n## Privacy\n\nCommitCraft itself does not log, record or send any information about your usage and project, or any other info. \n\nHowever, it is important to note that by using CommitCraft, you are agreeing to the terms of the providers you choose, as CommitCraft sends diffs and contextual information to their API. Unless you self-host the application, these providers may still collect your request history and metadata information. For more detailed information about how each provider handles your data, please review their respective privacy policies:\n\n- [Groq](https://groq.com/privacy-policy/)\n- [Google](https://ai.google.dev/gemini-api/terms)\n- [OpenAI](https://openai.com/policies/privacy-policy/)\n\n## Princing\n\nCommitCraft is Free Software in this case free as in freedom and as in no price atached.\n\nBut, similar to privacy concerns, if you are not self-hosting your models, it's important to be aware of the pricing structure for the providers you use. As of now, Groq and Google provide a free tier, while OpenAI operates on a fully usage-based pricing model. For more detailed information about pricing options, please refer to the documentation provided by each provider:\n\n- [Groq](https://groq.com/pricing/)\n- [Google](https://ai.google.dev/pricing)\n- [OpenAI](https://openai.com/api/pricing/)\n\n## Troubleshooting\n\nIf for some reason a dependency is missing folow these steps:\n\n1. Run the folowing command \n\n```sh\npipx inject commitcraft [depency_name]\n```\n\n2. Report the problem to the issues page, also provid the command you used to install.\n\n\n## License\n\nThis project is licensed under the AGPL 3.0 License - see the [LICENSE](LICENSE) file for details.\n\n---\n\nThank you for using CommitCraft! We hope this tool helps you craft better commit messages effortlessly.",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "A simple tool to use LLM and git diff to craft meaningfull commit messages.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/Felix-Pedro/CommitCraft",
"Repository": "https://github.com/Felix-Pedro/CommitCraft"
},
"split_keywords": [
"llm",
" commit",
" ai",
" openai",
" ollama",
" groq",
" git",
" dev",
" commit messages"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "74f403e967a126402ade32477dbd2e450b761f6e7c76b7518464e2423250c40b",
"md5": "11ba4dc98940eda836f6bee753f9077f",
"sha256": "09c57eeed96c3acf92723cfca276a4594b24330684a2326c1c73fe8478a849c2"
},
"downloads": -1,
"filename": "commitcraft-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "11ba4dc98940eda836f6bee753f9077f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 22994,
"upload_time": "2024-10-23T23:35:44",
"upload_time_iso_8601": "2024-10-23T23:35:44.693622Z",
"url": "https://files.pythonhosted.org/packages/74/f4/03e967a126402ade32477dbd2e450b761f6e7c76b7518464e2423250c40b/commitcraft-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c12b8a940305145071ddc52df1d9207c2f5d3534bf5a6666001c4b8bc5660793",
"md5": "aebc6f775a7cee2a1039a1b03f417379",
"sha256": "4bc57170a9ce834071dab398bcf9e9b6f00f7e25b55bd7e78968331c55741614"
},
"downloads": -1,
"filename": "commitcraft-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "aebc6f775a7cee2a1039a1b03f417379",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 23484,
"upload_time": "2024-10-23T23:35:46",
"upload_time_iso_8601": "2024-10-23T23:35:46.695820Z",
"url": "https://files.pythonhosted.org/packages/c1/2b/8a940305145071ddc52df1d9207c2f5d3534bf5a6666001c4b8bc5660793/commitcraft-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-23 23:35:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Felix-Pedro",
"github_project": "CommitCraft",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "commitcraft"
}