|
| 1 | +# SmartCommit |
| 2 | + |
| 3 | +SmartCommit is a blazing-fast CLI tool that uses AI to generate meaningful Git commit messages from your staged changes — powered by local or remote LLMs (Ollama, OpenAI, Gemini or any HTTP-based LLM). |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🚀 Features |
| 8 | + |
| 9 | +* 🔍 Reads your staged Git diff |
| 10 | +* 🤖 Supports multiple LLM providers: Ollama, OpenAI, HTTP endpoints (Claude, Gemini, etc.) |
| 11 | +* ✏️ Customizable system prompt (edit in Vim) |
| 12 | +* ⚡ Interactive flow with options to commit, edit, regenerate, or quit |
| 13 | +* ⚡ One‑shot `--yes` flag for auto‑commit |
| 14 | +* 📦 Single static binaries for Linux, macOS (Intel/ARM), and Windows |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 📥 Quick Installation |
| 19 | + |
| 20 | +### 1. Prebuilt Binary (Recommended) |
| 21 | +(will soon add direct installs from brew/scoops soon) |
| 22 | + |
| 23 | +1. Go to [Releases](https://github.com/manyfacedqod/smartcommit/releases). |
| 24 | +2. Download the `.tar.gz` for your OS. |
| 25 | +3. Extract and move into your `PATH`: |
| 26 | + |
| 27 | + * **Linux** |
| 28 | + |
| 29 | + ```bash |
| 30 | + tar -xzf smartcommit-linux.tar.gz |
| 31 | + sudo mv smartcommit-linux /usr/local/bin/smartcommit |
| 32 | + chmod +x /usr/local/bin/smartcommit |
| 33 | + ``` |
| 34 | + * **macOS** |
| 35 | + |
| 36 | + ```bash |
| 37 | + tar -xzf smartcommit-macos.tar.gz |
| 38 | + sudo mv smartcommit-macos /usr/local/bin/smartcommit |
| 39 | + chmod +x /usr/local/bin/smartcommit |
| 40 | + ``` |
| 41 | + * **Windows (Git Bash)** |
| 42 | + |
| 43 | + ```bash |
| 44 | + tar -xzf smartcommit-windows.tar.gz |
| 45 | + mv smartcommit-windows.exe /usr/local/bin/smartcommit.exe |
| 46 | + ``` |
| 47 | + |
| 48 | +### 2. Go Install |
| 49 | + |
| 50 | +```bash |
| 51 | +go install github.com/manyfacedqod/smartcommit@v1.1.1 |
| 52 | +``` |
| 53 | + |
| 54 | +Ensure `$GOPATH/bin` or `~/go/bin` is in your `PATH`. |
| 55 | + |
| 56 | +### 3. Build from Source |
| 57 | + |
| 58 | +```bash |
| 59 | +git clone https://github.com/manyfacedqod/smartcommit |
| 60 | +cd smartcommit |
| 61 | +go build -o smartcommit |
| 62 | +sudo mv smartcommit /usr/local/bin/ |
| 63 | +``` |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## ⚙️ First‑Time Setup |
| 68 | + |
| 69 | +```bash |
| 70 | +smartcommit setup |
| 71 | +``` |
| 72 | + |
| 73 | +You’ll be prompted to configure: |
| 74 | + |
| 75 | +1. **Provider**: `ollama`, `openai`, or `http` |
| 76 | +2. **Model name**: e.g., `llama3`, `gpt-4`, `gemini` |
| 77 | +3. **API Key** (HTTP/OpenAI) or **Base URL** (HTTP/Ollama) |
| 78 | +4. **System prompt** is saved to `~/.config/smartcommit/config.yaml` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## 💡 Usage Examples |
| 83 | + |
| 84 | +### Interactive Commit Flow |
| 85 | + |
| 86 | +```bash |
| 87 | +git add . |
| 88 | +smartcommit generate |
| 89 | +``` |
| 90 | + |
| 91 | +``` |
| 92 | +💡 Generated Commit Message: |
| 93 | +fix: handle empty username in login flow |
| 94 | + |
| 95 | +Choose [c]ommit, [e]dit, [r]egenerate, [q]uit: |
| 96 | +``` |
| 97 | +
|
| 98 | +* **c**: commit |
| 99 | +* **e**: inline edit via PromptUI |
| 100 | +* **r**: regenerate |
| 101 | +* **q**: quit |
| 102 | +
|
| 103 | +### Auto‑Commit Without Prompt |
| 104 | +
|
| 105 | +```bash |
| 106 | +smartcommit generate --yes |
| 107 | +``` |
| 108 | + |
| 109 | +### Config Commands |
| 110 | + |
| 111 | +* **Show current config**: |
| 112 | + |
| 113 | + ```bash |
| 114 | + smartcommit config show |
| 115 | + ``` |
| 116 | +* **Edit system prompt (Vim)**: |
| 117 | + |
| 118 | + ```bash |
| 119 | + smartcommit config edit |
| 120 | + ``` |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## 📄 Command Reference |
| 125 | + |
| 126 | +| Command | Description | |
| 127 | +| ---------------------------- | ------------------------------------------- | |
| 128 | +| `smartcommit setup` | Configure your LLM provider and settings | |
| 129 | +| `smartcommit generate` | Generate commit message from staged diff | |
| 130 | +| `smartcommit generate --yes` | Auto‑generate & commit without prompt | |
| 131 | +| `smartcommit config show` | Display current configuration | |
| 132 | +| `smartcommit config edit` | Edit the system prompt using your `$EDITOR` | |
| 133 | +| `smartcommit --version` | Show version (v1.1.1) | |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## 👨💻 Open Source Contribution |
| 138 | + |
| 139 | +We welcome contributions! Here’s how to get started: |
| 140 | + |
| 141 | +1. **Fork** the repo and **clone** your fork: |
| 142 | + |
| 143 | + ```bash |
| 144 | + git clone https://github.com/<your-user>/smartcommit |
| 145 | + cd smartcommit |
| 146 | + ``` |
| 147 | +2. **Create** a feature branch: |
| 148 | + |
| 149 | + ```bash |
| 150 | + git checkout -b feat/your-feature |
| 151 | + ``` |
| 152 | +3. **Implement** your changes, **add tests**, and **update docs** as needed. |
| 153 | +4. **Run** existing tests & build: |
| 154 | + |
| 155 | + ```bash |
| 156 | + ``` |
| 157 | + |
| 158 | +go test ./... |
| 159 | +go build -o smartcommit |
| 160 | + |
| 161 | +``` |
| 162 | +5. **Commit** and **push**, then open a **Pull Request** against `main`. |
| 163 | +
|
| 164 | +### Contribution Guidelines |
| 165 | +
|
| 166 | +- Follow existing code style. |
| 167 | +- Write clear commit messages (`feat:`, `fix:`, `docs:`, etc.). |
| 168 | +- Include tests for new features. |
| 169 | +- Document changes in this `README.md` or code comments. |
| 170 | +
|
| 171 | +Thank you for making SmartCommit better! 🙏 |
| 172 | +
|
| 173 | +--- |
| 174 | +
|
| 175 | +## 📄 License |
| 176 | +
|
| 177 | +MIT License © manyfacedqod |
| 178 | +
|
| 179 | +``` |
0 commit comments