|
| 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, 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 | +* 🔖 `--version` flag and `version` subcommand |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## 📥 Installation |
| 20 | + |
| 21 | +### Using Go |
| 22 | + |
| 23 | +```bash |
| 24 | +go install github.com/manyfacedqod/smartcommit@latest |
| 25 | +``` |
| 26 | + |
| 27 | +### Download Prebuilt Binary |
| 28 | + |
| 29 | +1. Visit the [Releases page](https://github.com/manyfacedqod/smartcommit/releases). |
| 30 | +2. Download the `.tar.gz` for your OS and extract: |
| 31 | + |
| 32 | + ```bash |
| 33 | + tar -xzf smartcommit-<os>.tar.gz |
| 34 | + ``` |
| 35 | +3. Move the binary into your `PATH`: |
| 36 | + |
| 37 | + ```bash |
| 38 | + mv smartcommit-<os> /usr/local/bin/smartcommit # or equivalent |
| 39 | + chmod +x /usr/local/bin/smartcommit |
| 40 | + ``` |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## ⚙️ First‑Time Setup |
| 45 | + |
| 46 | +```bash |
| 47 | +smartcommit setup |
| 48 | +``` |
| 49 | + |
| 50 | +Configure in an interactive prompt: |
| 51 | + |
| 52 | +1. **Provider**: `ollama`, `openai`, or `http` |
| 53 | +2. **Model name**: e.g., `llama3`, `gpt-4`, `gemini` |
| 54 | +3. **API Key** (HTTP/OpenAI) or **Base URL** (HTTP/Ollama) |
| 55 | +4. **System prompt** saved to `~/.config/smartcommit/config.yaml` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## 💡 Usage Examples |
| 60 | + |
| 61 | +### Interactive Commit Flow |
| 62 | + |
| 63 | +```bash |
| 64 | +git add . |
| 65 | +smartcommit generate |
| 66 | +``` |
| 67 | + |
| 68 | +```text |
| 69 | +💡 Generated Commit Message: |
| 70 | +fix: handle empty username in login flow |
| 71 | +
|
| 72 | +Choose [c]ommit, [e]dit, [r]egenerate, [q]uit: |
| 73 | +``` |
| 74 | + |
| 75 | +* **c**: commit |
| 76 | +* **e**: inline edit via PromptUI |
| 77 | +* **r**: regenerate |
| 78 | +* **q**: quit |
| 79 | + |
| 80 | +### Auto‑Commit Without Prompt |
| 81 | + |
| 82 | +```bash |
| 83 | +smartcommit generate --yes |
| 84 | +``` |
| 85 | + |
| 86 | +### Config Commands |
| 87 | + |
| 88 | +```bash |
| 89 | +smartcommit config show # display current config |
| 90 | +smartcommit config edit # edit system prompt in $EDITOR |
| 91 | +``` |
| 92 | + |
| 93 | +### Version |
| 94 | + |
| 95 | +```bash |
| 96 | +smartcommit --version |
| 97 | +smartcommit version |
| 98 | +``` |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## 📄 Command Reference |
| 103 | + |
| 104 | +| Command | Description | |
| 105 | +| ---------------------------- | ------------------------------------------- | |
| 106 | +| `smartcommit setup` | Configure your LLM provider and settings | |
| 107 | +| `smartcommit generate` | Generate commit message from staged diff | |
| 108 | +| `smartcommit generate --yes` | Auto‑generate & commit without prompt | |
| 109 | +| `smartcommit config show` | Display current configuration | |
| 110 | +| `smartcommit config edit` | Edit the system prompt using your `$EDITOR` | |
| 111 | +| `smartcommit --version` | Show the CLI version | |
| 112 | +| `smartcommit version` | Same as `--version` | |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## 👨💻 Contributing |
| 117 | + |
| 118 | +We welcome your contributions! 🚀 |
| 119 | + |
| 120 | +1. **Fork** the repo and **clone** your fork: |
| 121 | + |
| 122 | + ```bash |
| 123 | + ``` |
| 124 | + |
| 125 | +git clone [https://github.com/](https://github.com/)<your-user>/smartcommit.git |
| 126 | +cd smartcommit |
| 127 | + |
| 128 | +```` |
| 129 | +2. **Create** a feature branch: |
| 130 | + ```bash |
| 131 | +git checkout -b feat/your-feature |
| 132 | +```` |
| 133 | + |
| 134 | +3. **Make changes**, **add tests**, and **update docs**. |
| 135 | +4. **Run** tests & build: |
| 136 | + |
| 137 | + ```bash |
| 138 | + ``` |
| 139 | + |
| 140 | +go test ./... |
| 141 | +go build |
| 142 | + |
| 143 | +``` |
| 144 | +5. **Commit**, **push**, and open a **Pull Request**. |
| 145 | +
|
| 146 | +### Guidelines |
| 147 | +
|
| 148 | +- Follow existing code style and idioms. |
| 149 | +- Use [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `docs:`, etc.). |
| 150 | +- Write clear tests for new features or fixes. |
| 151 | +- Update this README when adding or changing commands. |
| 152 | +
|
| 153 | +--- |
| 154 | +(*this one was kinda ai generated so might update this later*) |
| 155 | +## 📄 License |
| 156 | +
|
| 157 | +MIT License © manyfacedqod |
| 158 | +
|
| 159 | +``` |
0 commit comments