From 1ebca04833e7e721ccf50ca1ae665471b6fc2644 Mon Sep 17 00:00:00 2001 From: Gaurav Jangra <135097485+GauravJangra9988@users.noreply.github.com> Date: Mon, 6 Oct 2025 03:27:40 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 105 ++++++++++++++++++++---------------------------------- 1 file changed, 38 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 6eb5aaa..1572b40 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Below is a sample execution of `commit-msg`: ![Commit-msg GIF](assets/commit.gif) -Before running the application, ensure you have set the system environment variables. and add commit.exe to path variables (same for linux macOS) +## Before running the application, set LLM and API Key using "commit llm setup" ## 🎃 Hacktoberfest 2025 @@ -39,18 +39,6 @@ Looking to contribute? Check out: You can use **Google Gemini**, **Grok**, **Claude**, **ChatGPT**, or **Ollama** (local) as the LLM to generate commit messages: -### Environment Variables - -| Variable | Values | Description | -| :--- | :--- | :--- | -| `COMMIT_LLM` | `gemini`, `grok`, `claude`, `chatgpt`, or `ollama` | Choose your LLM provider | -| `GEMINI_API_KEY` | Your API key | Required if using Gemini | -| `GROK_API_KEY` | Your API key | Required if using Grok | -| `CLAUDE_API_KEY` | Your API key | Required if using Claude | -| `OPENAI_API_KEY` | Your API key | Required if using ChatGPT | -| `OLLAMA_URL` | URL (optional) | Ollama server URL (default: http://localhost:11434/api/generate) | -| `OLLAMA_MODEL` | Model name (optional) | Ollama model to use (default: llama3) | - --- ## 📦 Installation @@ -74,22 +62,6 @@ You can use **Google Gemini**, **Grok**, **Claude**, **ChatGPT**, or **Ollama** echo 'export PATH=$PATH:/path/to/commit-msg' >> ~/.bashrc # or ~/.zshrc ``` -4. Set up environment variables: - - **Windows:** - - ```cmd - setx COMMIT_LLM "gemini" - setx GEMINI_API_KEY "your-api-key-here" - ``` - - **Linux/macOS:** - - ```bash - export COMMIT_LLM=gemini - export GEMINI_API_KEY=your-api-key-here - # Add to ~/.bashrc or ~/.zshrc to persist - ``` ### Option 2: Build from Source @@ -128,8 +100,25 @@ Or if running from source: go run cmd/commit-msg/main.go . ``` +### Setup LLM and API Key + +```bash + commit llm setup +``` +Screenshot 2025-10-05 172731 +Screenshot 2025-10-05 172748 + +### Update LLM + +```bash + commit llm update +``` +Screenshot 2025-10-05 172814 +Screenshot 2025-10-05 172823 + ### Example Workflow + ```bash # Make changes to your code echo "console.log('Hello World')" > app.js @@ -161,50 +150,32 @@ commit . ## 🔧 Configuration -### Getting API Keys - -**Google Gemini:** - -1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey) -2. Create a new API key -3. Set the `GEMINI_API_KEY` environment variable - -**Grok (X.AI):** - -1. Visit [X.AI Console](https://console.x.ai/) -2. Generate an API key -3. Set the `GROK_API_KEY` environment variable +### Set LLM and API Keys -**Groq:** - -1. Sign up at [Groq Cloud](https://console.groq.com/) -2. Create an API key -3. Set the `GROQ_API_KEY` environment variable -4. _(Optional)_ Set `GROQ_MODEL` or `GROQ_API_URL` to override defaults - -**Claude (Anthropic):** - -1. Visit the [Anthropic Console](https://console.anthropic.com/) -2. Create a new API key -3. Set the `CLAUDE_API_KEY` environment variable +```bash + commit llm setup +``` -**OpenAI (ChatGPT):** +### Update LLM -1. Visit [OpenAI Platform](https://platform.openai.com/api-keys) -2. Create a new API key -3. Set the `OPENAI_API_KEY` environment variable +```bash + commit llm update +``` -**Ollama (Local LLM):** +**Set LLM as default** +```bash +Select: Set Default +``` -1. Install Ollama: Visit [Ollama.ai](https://ollama.ai/) and follow installation instructions -2. Start Ollama: `ollama serve` -3. Pull a model: `ollama pull llama3` -4. Set environment variables: - ```bash - export COMMIT_LLM=ollama - export OLLAMA_MODEL=llama3 # llama3 by default - ``` +**Change API Key** +```bash +Select: Change API Key +``` +**Delete LLM** +```bash +Select: Delete +``` --- ## 🤝 Contributing From 925554d952f385173d8070d7e0e01072bcc9dcfb Mon Sep 17 00:00:00 2001 From: Gaurav Jangra <135097485+GauravJangra9988@users.noreply.github.com> Date: Mon, 6 Oct 2025 03:59:45 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 1572b40..3aede34 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,51 @@ Select: Delete ``` --- +## Getting API Keys + +**Google Gemini:** + +1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey) +2. Create a new API key + + +**Grok (X.AI):** + +1. Visit [X.AI Console](https://console.x.ai/) +2. Generate an API key + + +**Groq:** + +1. Sign up at [Groq Cloud](https://console.groq.com/) +2. Create an API key + + +**Claude (Anthropic):** + +1. Visit the [Anthropic Console](https://console.anthropic.com/) +2. Create a new API key + + +**OpenAI (ChatGPT):** + +1. Visit [OpenAI Platform](https://platform.openai.com/api-keys) +2. Create a new API key + + +**Ollama (Local LLM):** + +1. Install Ollama: Visit [Ollama.ai](https://ollama.ai/) and follow installation instructions +2. Start Ollama: `ollama serve` +3. Pull a model: `ollama pull llama3` +4. Set environment variables: + ```bash + export COMMIT_LLM=ollama + export OLLAMA_MODEL=llama3 # llama3 by default + ``` + +--- + ## 🤝 Contributing We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.