Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ go.work
.env
commit-helper.json
HACKTOBERFEST_SETUP.md
PR_DESCRIPTION.md
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ Looking to contribute? Check out:
## Features

✨ **AI-Powered Commit Messages** - Automatically generate meaningful commit messages
🔄 **Multiple LLM Support** - Choose between Google Gemini or Grok
🔄 **Multiple LLM Support** - Choose between Google Gemini, Grok, or ChatGPT
📝 **Context-Aware** - Analyzes staged and unstaged changes
🚀 **Easy to Use** - Simple CLI interface
📋 **Auto-Copy to Clipboard** - Generated messages are automatically copied for instant use
📊 **File Statistics Display** - Visual preview of changed files and line counts
🚀 **Easy to Use** - Simple CLI interface with beautiful terminal UI
⚡ **Fast** - Quick generation of commit messages

## Supported LLM Providers
Expand All @@ -39,9 +41,10 @@ You can use either **Google Gemini** or **Grok** as the LLM to generate commit m

| Variable | Values | Description |
|----------|--------|-------------|
| `COMMIT_LLM` | `gemini` or `grok` | Choose your LLM provider |
| `COMMIT_LLM` | `gemini`, `grok`, or `chatgpt` | Choose your LLM provider |
| `GEMINI_API_KEY` | Your API key | Required if using Gemini |
| `GROK_API_KEY` | Your API key | Required if using Grok |
| `OPENAI_API_KEY` | Your API key | Required if using ChatGPT |

---

Expand Down Expand Up @@ -128,15 +131,22 @@ git add .
# Generate commit message
commit .

# The tool will display:
# - File statistics (staged, unstaged, untracked)
# - Generated commit message in a styled box
# - Automatically copy to clipboard
# Output: "feat: add hello world console log to app.js"
# You can now paste it with Ctrl+V (or Cmd+V on macOS)
```

### Use Cases

- 📝 Generate commit messages for staged changes
- 🔍 Analyze both staged and unstaged changes
- 📊 Get context from recent commits
- 📊 Get context from recent commits and file statistics
- ✅ Create conventional commit messages
- 📋 Auto-copy to clipboard for immediate use
- 🎨 Beautiful terminal UI with file statistics and previews

---

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ require (
cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/longrunning v0.5.7 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/containerd/console v1.0.5 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ github.com/MarvinJWendt/testza v0.4.2/go.mod h1:mSdhXiKH8sg/gQehJ63bINcCKp7RtYew
github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4=
github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc=
github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
Expand Down
Binary file modified image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"

"github.com/atotto/clipboard"
"github.com/dfanso/commit-msg/src/chatgpt"
"github.com/dfanso/commit-msg/src/gemini"
"github.com/dfanso/commit-msg/src/grok"
Expand Down Expand Up @@ -132,6 +133,14 @@ func main() {
// Display the commit message in a styled panel
displayCommitMessage(commitMsg)

// Copy to clipboard
err = clipboard.WriteAll(commitMsg)
if err != nil {
pterm.Warning.Printf("⚠️ Could not copy to clipboard: %v\n", err)
} else {
pterm.Success.Println("📋 Commit message copied to clipboard!")
}

pterm.Println()

// Display changes preview
Expand Down
Loading