@ahmad_technology/gitcommit-ai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +34 -0
- package/.github/workflows/release.yml +81 -0
- package/README.md +171 -0
- package/bin/gitcommit.js +2 -0
- package/dist/gitcommit.cjs +41694 -0
- package/dist/gitcommit.cjs.map +7 -0
- package/esbuild.config.js +18 -0
- package/package.json +54 -0
- package/src/commands/generate.ts +180 -0
- package/src/commands/setup.ts +117 -0
- package/src/config.ts +82 -0
- package/src/git.ts +40 -0
- package/src/index.ts +39 -0
- package/src/prompt.ts +85 -0
- package/src/providers/anthropic.ts +27 -0
- package/src/providers/base.ts +45 -0
- package/src/providers/gemini.ts +34 -0
- package/src/providers/groq.ts +27 -0
- package/src/providers/index.ts +47 -0
- package/src/providers/nim.ts +27 -0
- package/src/providers/ollama.ts +33 -0
- package/src/providers/openai.ts +24 -0
- package/src/providers/openrouter.ts +31 -0
- package/src/types.ts +91 -0
- package/src/ui.ts +116 -0
- package/tests/config.test.ts +87 -0
- package/tests/generate.test.ts +108 -0
- package/tests/git.test.ts +85 -0
- package/tests/prompt.test.ts +89 -0
- package/tests/providers.test.ts +181 -0
- package/tsconfig.json +32 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [20, 22]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm ci
|
|
26
|
+
|
|
27
|
+
- name: Type check
|
|
28
|
+
run: npm run typecheck
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: npm test
|
|
32
|
+
|
|
33
|
+
- name: Build
|
|
34
|
+
run: npm run build
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
include:
|
|
16
|
+
- os: ubuntu-latest
|
|
17
|
+
artifact: gitcommit-linux
|
|
18
|
+
- os: macos-latest
|
|
19
|
+
artifact: gitcommit-macos
|
|
20
|
+
- os: windows-latest
|
|
21
|
+
artifact: gitcommit-win.exe
|
|
22
|
+
|
|
23
|
+
runs-on: ${{ matrix.os }}
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: Use Node.js 20
|
|
29
|
+
uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: 20
|
|
32
|
+
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: npm ci
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: npm test
|
|
38
|
+
|
|
39
|
+
- name: Build
|
|
40
|
+
run: npm run build
|
|
41
|
+
|
|
42
|
+
- name: Upload artifact
|
|
43
|
+
uses: actions/upload-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
name: ${{ matrix.artifact }}
|
|
46
|
+
path: dist/gitcommit.cjs
|
|
47
|
+
|
|
48
|
+
publish:
|
|
49
|
+
needs: build
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Use Node.js 20
|
|
55
|
+
uses: actions/setup-node@v4
|
|
56
|
+
with:
|
|
57
|
+
node-version: 20
|
|
58
|
+
registry-url: https://registry.npmjs.org
|
|
59
|
+
|
|
60
|
+
- name: Install dependencies
|
|
61
|
+
run: npm ci
|
|
62
|
+
|
|
63
|
+
- name: Build
|
|
64
|
+
run: npm run build
|
|
65
|
+
|
|
66
|
+
- name: Publish to npm
|
|
67
|
+
run: npm publish
|
|
68
|
+
env:
|
|
69
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
70
|
+
|
|
71
|
+
- name: Download all artifacts
|
|
72
|
+
uses: actions/download-artifact@v4
|
|
73
|
+
|
|
74
|
+
- name: Create GitHub Release
|
|
75
|
+
uses: softprops/action-gh-release@v2
|
|
76
|
+
with:
|
|
77
|
+
files: |
|
|
78
|
+
gitcommit-linux/gitcommit.cjs
|
|
79
|
+
gitcommit-macos/gitcommit.cjs
|
|
80
|
+
gitcommit-win.exe/gitcommit.cjs
|
|
81
|
+
generate_release_notes: true
|
package/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# 🧠 gitcommit — AI Commit Message Generator
|
|
2
|
+
|
|
3
|
+
[](https://github.com/AhmadTchnology/Ai_Commit_Message_Generator/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/gitcommit-ai)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
> Generate meaningful, conventional git commit messages using AI — from your terminal.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **🤖 Multi-provider AI** — OpenAI, Anthropic, Google Gemini, Groq, NVIDIA NIM, OpenRouter, Ollama
|
|
14
|
+
- **📝 Conventional Commits** — Automatically follows the spec (feat, fix, chore, docs, etc.)
|
|
15
|
+
- **🎨 Multiple styles** — Conventional, detailed, emoji, or short
|
|
16
|
+
- **✏️ Interactive flow** — Preview, edit, regenerate, or confirm before committing
|
|
17
|
+
- **🌍 Multi-language** — Generate commit messages in any language
|
|
18
|
+
- **⚡ Works offline** — Ollama support for fully local inference
|
|
19
|
+
- **🖥️ Cross-platform** — Windows, macOS, and Linux
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📦 Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# npm (recommended)
|
|
27
|
+
npm install -g gitcommit-ai
|
|
28
|
+
|
|
29
|
+
# Or run directly
|
|
30
|
+
npx gitcommit-ai
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Other methods
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Homebrew (macOS/Linux)
|
|
37
|
+
brew install AhmadTchnology/tap/gitcommit
|
|
38
|
+
|
|
39
|
+
# Direct binary (no runtime needed)
|
|
40
|
+
curl -L https://github.com/AhmadTchnology/Ai_Commit_Message_Generator/releases/latest/download/gitcommit-linux -o /usr/local/bin/gitcommit
|
|
41
|
+
chmod +x /usr/local/bin/gitcommit
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 1. Setup (first time only)
|
|
50
|
+
gitcommit setup
|
|
51
|
+
|
|
52
|
+
# 2. Stage your changes
|
|
53
|
+
git add .
|
|
54
|
+
|
|
55
|
+
# 3. Generate & commit
|
|
56
|
+
gitcommit
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**What you'll see:**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
⠋ Analyzing 3 changed files...
|
|
63
|
+
|
|
64
|
+
✨ Suggested commit:
|
|
65
|
+
|
|
66
|
+
feat(auth): add OAuth2 login with Google provider
|
|
67
|
+
|
|
68
|
+
[ Confirm ] [ Edit ] [ Regenerate ] [ Cancel ]
|
|
69
|
+
|
|
70
|
+
> Confirm
|
|
71
|
+
|
|
72
|
+
✅ Committed: feat(auth): add OAuth2 login with Google provider
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🔧 Usage
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
gitcommit # Generate from staged diff
|
|
81
|
+
gitcommit --all # Include unstaged changes
|
|
82
|
+
gitcommit --provider anthropic # Override provider
|
|
83
|
+
gitcommit --model claude-opus-4 # Override model
|
|
84
|
+
gitcommit --style emoji # Emoji prefix style
|
|
85
|
+
gitcommit --lang fr # Output in French
|
|
86
|
+
gitcommit --dry-run # Print only, don't commit
|
|
87
|
+
gitcommit --copy # Copy to clipboard
|
|
88
|
+
gitcommit --regenerate # Get 3 options to choose from
|
|
89
|
+
gitcommit setup # Interactive config wizard
|
|
90
|
+
gitcommit config set provider groq
|
|
91
|
+
gitcommit config get defaults.model
|
|
92
|
+
gitcommit config list
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## ⚙️ Configuration
|
|
98
|
+
|
|
99
|
+
Config is stored in `~/.gitcommit/config.toml`:
|
|
100
|
+
|
|
101
|
+
```toml
|
|
102
|
+
[defaults]
|
|
103
|
+
provider = "openai"
|
|
104
|
+
model = "gpt-4o"
|
|
105
|
+
style = "conventional"
|
|
106
|
+
language = "en"
|
|
107
|
+
max_diff_lines = 300
|
|
108
|
+
|
|
109
|
+
[openai]
|
|
110
|
+
api_key = "sk-..."
|
|
111
|
+
|
|
112
|
+
[anthropic]
|
|
113
|
+
api_key = "sk-ant-..."
|
|
114
|
+
|
|
115
|
+
[gemini]
|
|
116
|
+
api_key = "AIza..."
|
|
117
|
+
|
|
118
|
+
[groq]
|
|
119
|
+
api_key = "gsk_..."
|
|
120
|
+
|
|
121
|
+
[openrouter]
|
|
122
|
+
api_key = "sk-or-..."
|
|
123
|
+
|
|
124
|
+
[nim]
|
|
125
|
+
api_key = "nvapi-..."
|
|
126
|
+
base_url = "https://integrate.api.nvidia.com/v1"
|
|
127
|
+
|
|
128
|
+
[ollama]
|
|
129
|
+
base_url = "http://localhost:11434"
|
|
130
|
+
model = "llama3"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 🤖 Supported Providers
|
|
136
|
+
|
|
137
|
+
| Provider | Auth | Notes |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| **OpenAI** | `OPENAI_API_KEY` | GPT-4o, GPT-4-turbo |
|
|
140
|
+
| **Anthropic** | `ANTHROPIC_API_KEY` | Claude 3.5 Sonnet+ |
|
|
141
|
+
| **Google Gemini** | `GEMINI_API_KEY` | gemini-2.0-flash |
|
|
142
|
+
| **Groq** | `GROQ_API_KEY` | Llama 3.3, ultra-fast |
|
|
143
|
+
| **NVIDIA NIM** | `NIM_API_KEY` | OpenAI-compatible |
|
|
144
|
+
| **OpenRouter** | `OPENROUTER_API_KEY` | 100+ models |
|
|
145
|
+
| **Ollama** | None | Fully offline |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 🛠️ Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Clone & install
|
|
153
|
+
git clone https://github.com/AhmadTchnology/Ai_Commit_Message_Generator.git
|
|
154
|
+
cd Ai_Commit_Message_Generator
|
|
155
|
+
npm install
|
|
156
|
+
|
|
157
|
+
# Run in dev mode
|
|
158
|
+
npm run dev
|
|
159
|
+
|
|
160
|
+
# Run tests
|
|
161
|
+
npm test
|
|
162
|
+
|
|
163
|
+
# Build
|
|
164
|
+
npm run build
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 📄 License
|
|
170
|
+
|
|
171
|
+
MIT © [AhmadTchnology](https://github.com/AhmadTchnology)
|
package/bin/gitcommit.js
ADDED