diff --git a/.gitignore b/.gitignore index 2020203..7af8aca 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ go.work .env commit-helper.json HACKTOBERFEST_SETUP.md +PR_DESCRIPTION.md diff --git a/README.md b/README.md index e801ff3..a04dc99 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 | --- @@ -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 --- diff --git a/go.mod b/go.mod index 8a60785..a751726 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 4765418..32ac3a0 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/image.png b/image.png index 4c59a1f..dffff11 100644 Binary files a/image.png and b/image.png differ diff --git a/src/main.go b/src/main.go index 0c98d1d..999fbb4 100644 --- a/src/main.go +++ b/src/main.go @@ -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" @@ -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