commitcraft


Namecommitcraft JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/Felix-Pedro/CommitCraft
SummaryA simple tool to use LLM and git diff to craft meaningfull commit messages.
upload_time2024-10-21 22:55:04
maintainerNone
docs_urlNone
authorFelix-Pedro
requires_python<4.0,>=3.10
licenseAGPL-3.0
keywords llm commit ai openai ollama groq git dev commit messages
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
             # 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/0e/80/0a69fc70bdccdf5ee6b5412c160a4c1464c88b94fc8a1350c26183870162/commitcraft-0.1.0.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.0",
    "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": "575db72916a244dbd088719841c7abb73d422b429804b3049417e7f4ea3182be",
                "md5": "302fc0c1e48f98f3d1cf60db12cc5a5c",
                "sha256": "5f5f989a0065e4aa8a4945df562133139284e5fe3c29222b8077e9b5ed743906"
            },
            "downloads": -1,
            "filename": "commitcraft-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "302fc0c1e48f98f3d1cf60db12cc5a5c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 22994,
            "upload_time": "2024-10-21T22:55:02",
            "upload_time_iso_8601": "2024-10-21T22:55:02.131221Z",
            "url": "https://files.pythonhosted.org/packages/57/5d/b72916a244dbd088719841c7abb73d422b429804b3049417e7f4ea3182be/commitcraft-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e800a69fc70bdccdf5ee6b5412c160a4c1464c88b94fc8a1350c26183870162",
                "md5": "d0c6c5419c48c0744aabbf8af9d4cb95",
                "sha256": "dceccf3b2b2b1612f3e373753d4e1b3cf097f6cb94a28b1e654d41dd155a56aa"
            },
            "downloads": -1,
            "filename": "commitcraft-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d0c6c5419c48c0744aabbf8af9d4cb95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 23496,
            "upload_time": "2024-10-21T22:55:04",
            "upload_time_iso_8601": "2024-10-21T22:55:04.031973Z",
            "url": "https://files.pythonhosted.org/packages/0e/80/0a69fc70bdccdf5ee6b5412c160a4c1464c88b94fc8a1350c26183870162/commitcraft-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 22:55:04",
    "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"
}
        
Elapsed time: 0.34817s