gims 0.8.1 β 0.8.2
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/README.md +278 -58
- package/bin/lib/ai/providers.js +26 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,98 +1,318 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# π GIMS - Git Made Simple
|
|
2
4
|
|
|
3
5
|
[](https://npmjs.org/package/gims)
|
|
6
|
+
[](https://npmjs.org/package/gims)
|
|
4
7
|
[](https://opensource.org/licenses/MIT)
|
|
5
8
|
[](https://github.com/s41r4j/gims)
|
|
9
|
+
[](https://nodejs.org)
|
|
6
10
|
|
|
7
11
|
**AI-powered Git CLI that writes your commit messages for you**
|
|
8
12
|
|
|
9
13
|
*Because life's too short for "fix stuff" commits* π―
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
[Installation](#-installation) β’ [Quick Start](#-quick-start) β’ [Commands](#-commands) β’ [AI Setup](#-ai-providers) β’ [Configuration](#-configuration)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## β¨ Features
|
|
22
|
+
|
|
23
|
+
- π€ **AI-Generated Commits** β Let AI analyze your changes and write meaningful commit messages
|
|
24
|
+
- π **Smart Status** β Enhanced git status with file type detection and insights
|
|
25
|
+
- π **Workflow Shortcuts** β Common multi-step operations condensed to single commands
|
|
26
|
+
- π **Commit Analytics** β Track your commit streak, patterns, and statistics
|
|
27
|
+
- π **Code Review** β Get AI-powered code review before committing
|
|
28
|
+
- π‘οΈ **Safe Operations** β Built-in safeguards for destructive commands
|
|
29
|
+
- β‘ **Lightning Fast** β Optimized for speed with intelligent caching
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## π¦ Installation
|
|
12
34
|
|
|
13
35
|
```bash
|
|
14
|
-
# Install
|
|
15
36
|
npm install -g gims
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Requirements:** Node.js >= 18.18.0
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## β‘ Quick Start
|
|
16
44
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
g setup --api-key
|
|
20
|
-
g setup --api-key
|
|
45
|
+
```bash
|
|
46
|
+
# 1. Setup AI provider (choose one)
|
|
47
|
+
g setup --api-key gemini # π Free & fast (recommended)
|
|
48
|
+
g setup --api-key openai # π― High quality
|
|
49
|
+
g setup --api-key groq # β‘ Ultra fast
|
|
21
50
|
|
|
22
|
-
#
|
|
23
|
-
g s
|
|
24
|
-
g o
|
|
51
|
+
# 2. Start using it!
|
|
52
|
+
g s # Check status with AI insights
|
|
53
|
+
g o # AI commit + push (one command!)
|
|
25
54
|
```
|
|
26
55
|
|
|
27
|
-
|
|
56
|
+
### Your New Workflow
|
|
28
57
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
```bash
|
|
59
|
+
# Before (traditional git)
|
|
60
|
+
git add .
|
|
61
|
+
git commit -m "trying to think of message..."
|
|
62
|
+
git push
|
|
63
|
+
|
|
64
|
+
# After (with GIMS)
|
|
65
|
+
g o # That's it. AI handles the rest.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## π Commands
|
|
71
|
+
|
|
72
|
+
### π§ Core Commands
|
|
73
|
+
|
|
74
|
+
| Command | Alias | Description |
|
|
75
|
+
|---------|-------|-------------|
|
|
76
|
+
| `g status` | `g s` | Enhanced status with AI insights & file type emojis |
|
|
77
|
+
| `g oneshot` | `g o` | Stage all β AI commit β Push (full workflow) |
|
|
78
|
+
| `g local` | `g l` | Stage all β AI commit (no push) |
|
|
79
|
+
| `g suggest` | `g sg` | Get AI commit message suggestions |
|
|
80
|
+
| `g wip` | β | Quick work-in-progress commit |
|
|
81
|
+
|
|
82
|
+
### π Analytics & Review
|
|
83
|
+
|
|
84
|
+
| Command | Alias | Description |
|
|
85
|
+
|---------|-------|-------------|
|
|
86
|
+
| `g review` | `g r` | AI code review with complexity analysis |
|
|
87
|
+
| `g today` | `g t` | Show all commits made today |
|
|
88
|
+
| `g stats` | β | Personal statistics: streak, patterns, style |
|
|
89
|
+
| `g split` | β | AI suggestions for splitting large changesets |
|
|
39
90
|
|
|
40
91
|
### β‘ Workflow Shortcuts
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
| `g
|
|
45
|
-
| `g
|
|
46
|
-
| `g
|
|
47
|
-
| `g
|
|
48
|
-
| `g
|
|
49
|
-
| `g
|
|
50
|
-
|
|
51
|
-
|
|
92
|
+
|
|
93
|
+
| Command | Alias | What it does |
|
|
94
|
+
|---------|-------|--------------|
|
|
95
|
+
| `g safe-pull` | `g sp` | Stash β Pull β Pop (safe pull with uncommitted changes) |
|
|
96
|
+
| `g fix` | β | Smart fix for diverged/ahead/behind branches |
|
|
97
|
+
| `g main` | β | Switch to main/master + pull latest |
|
|
98
|
+
| `g stash-save` | `g ss` | Quick stash with auto-generated name |
|
|
99
|
+
| `g stash-pop` | `g pop` | Pop the latest stash |
|
|
100
|
+
| `g unstage` | `g us` | Unstage all staged files |
|
|
101
|
+
| `g discard` | `g x` | Discard all changes (requires `--yes`) |
|
|
102
|
+
|
|
103
|
+
### π οΈ Git Helpers
|
|
104
|
+
|
|
105
|
+
| Command | Alias | Description |
|
|
106
|
+
|---------|-------|-------------|
|
|
107
|
+
| `g last` | β | Show last commit details with diff |
|
|
108
|
+
| `g conflicts` | β | Conflict resolution helper |
|
|
109
|
+
| `g cleanup` | `g clean` | Remove local branches deleted from remote |
|
|
110
|
+
| `g list` | `g ls` | Compact commit history |
|
|
111
|
+
| `g amend` | `g a` | Amend the previous commit |
|
|
112
|
+
| `g undo` | `g u` | Undo last commit (keep changes) |
|
|
113
|
+
| `g delete-branch` | `g del` | Delete branch locally and remotely |
|
|
114
|
+
|
|
115
|
+
### π§ Setup & Config
|
|
116
|
+
|
|
52
117
|
| Command | Description |
|
|
53
118
|
|---------|-------------|
|
|
54
|
-
| `g
|
|
55
|
-
| `g
|
|
56
|
-
| `g
|
|
57
|
-
| `g
|
|
58
|
-
| `g
|
|
119
|
+
| `g setup` | Interactive setup wizard |
|
|
120
|
+
| `g setup --api-key <provider>` | Quick API key setup |
|
|
121
|
+
| `g config --list` | View all settings |
|
|
122
|
+
| `g config --set key=value` | Update configuration |
|
|
123
|
+
| `g quick-help` / `g q` | Quick command reference |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## π€ AI Providers
|
|
128
|
+
|
|
129
|
+
GIMS supports multiple AI providers. Choose based on your needs:
|
|
130
|
+
|
|
131
|
+
| Provider | Model | Speed | Quality | Cost |
|
|
132
|
+
|----------|-------|-------|---------|------|
|
|
133
|
+
| **Gemini** | `gemini-3-flash-preview` | β‘β‘β‘ | βββ | π Free |
|
|
134
|
+
| **Groq** | `groq/compound` | β‘β‘β‘β‘ | βββ | π Free tier |
|
|
135
|
+
| **OpenAI** | `gpt-5.2-2025-12-11` | β‘β‘ | ββββ | π° Paid |
|
|
136
|
+
|
|
137
|
+
### Setting Up API Keys
|
|
138
|
+
|
|
139
|
+
#### Option 1: Interactive Setup (Recommended)
|
|
59
140
|
|
|
60
|
-
|
|
141
|
+
```bash
|
|
142
|
+
g setup --api-key gemini # Guided setup with instructions
|
|
143
|
+
g setup --api-key openai
|
|
144
|
+
g setup --api-key groq
|
|
145
|
+
```
|
|
61
146
|
|
|
62
|
-
|
|
63
|
-
- **OpenAI**: `gpt-5` (High quality)
|
|
64
|
-
- **Groq**: `groq/compound` (Ultra fast)
|
|
147
|
+
#### Option 2: Environment Variables (Auto-detected)
|
|
65
148
|
|
|
66
|
-
|
|
149
|
+
GIMS automatically detects API keys from environment variables. Add to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.):
|
|
67
150
|
|
|
68
151
|
```bash
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
g stats # Check your streak
|
|
78
|
-
g split # Split big changesets
|
|
152
|
+
# Gemini (recommended - free)
|
|
153
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
154
|
+
|
|
155
|
+
# OpenAI
|
|
156
|
+
export OPENAI_API_KEY="your-api-key-here"
|
|
157
|
+
|
|
158
|
+
# Groq
|
|
159
|
+
export GROQ_API_KEY="your-api-key-here"
|
|
79
160
|
```
|
|
80
161
|
|
|
162
|
+
Then reload your shell: `source ~/.zshrc`
|
|
163
|
+
|
|
164
|
+
> **π‘ Tip:** If multiple API keys are set, GIMS auto-selects in order: Gemini β OpenAI β Groq
|
|
165
|
+
|
|
166
|
+
### Getting API Keys
|
|
167
|
+
|
|
168
|
+
<details>
|
|
169
|
+
<summary><b>π· Gemini (Recommended)</b></summary>
|
|
170
|
+
|
|
171
|
+
1. Visit [Google AI Studio](https://aistudio.google.com/app/apikey)
|
|
172
|
+
2. Create a new API key
|
|
173
|
+
3. Set it: `export GEMINI_API_KEY="your-key"` or run `g setup --api-key gemini`
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
|
|
177
|
+
<details>
|
|
178
|
+
<summary><b>π’ Groq</b></summary>
|
|
179
|
+
|
|
180
|
+
1. Visit [Groq Console](https://console.groq.com/keys)
|
|
181
|
+
2. Create a new API key
|
|
182
|
+
3. Set it: `export GROQ_API_KEY="your-key"` or run `g setup --api-key groq`
|
|
183
|
+
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
<details>
|
|
187
|
+
<summary><b>π‘ OpenAI</b></summary>
|
|
188
|
+
|
|
189
|
+
1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
190
|
+
2. Create a new API key
|
|
191
|
+
3. Set it: `export OPENAI_API_KEY="your-key"` or run `g setup --api-key openai`
|
|
192
|
+
|
|
193
|
+
</details>
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
81
197
|
## π§ Configuration
|
|
82
198
|
|
|
83
199
|
```bash
|
|
84
|
-
|
|
85
|
-
g config --
|
|
86
|
-
|
|
200
|
+
# View current settings
|
|
201
|
+
g config --list
|
|
202
|
+
|
|
203
|
+
# Enable conventional commits (feat:, fix:, etc.)
|
|
204
|
+
g config --set conventional=true
|
|
205
|
+
|
|
206
|
+
# Auto-stage all changes before commit
|
|
207
|
+
g config --set autoStage=true
|
|
208
|
+
|
|
209
|
+
# Disable clipboard copy
|
|
210
|
+
g config --set copy=false
|
|
211
|
+
|
|
212
|
+
# Show/hide progress indicators
|
|
213
|
+
g config --set progressIndicators=true
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Configuration Options
|
|
217
|
+
|
|
218
|
+
| Option | Type | Default | Description |
|
|
219
|
+
|--------|------|---------|-------------|
|
|
220
|
+
| `provider` | string | `auto` | AI provider: `gemini`, `openai`, `groq`, `auto`, `none` |
|
|
221
|
+
| `model` | string | β | Override default model for provider |
|
|
222
|
+
| `conventional` | boolean | `false` | Use Conventional Commits format |
|
|
223
|
+
| `autoStage` | boolean | `false` | Auto-stage all changes |
|
|
224
|
+
| `copy` | boolean | `true` | Copy suggestions to clipboard |
|
|
225
|
+
| `progressIndicators` | boolean | `true` | Show progress spinners |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## π Usage Examples
|
|
230
|
+
|
|
231
|
+
### Daily Workflow
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
g s # Check what's changed
|
|
235
|
+
g sp # Safe pull (won't lose uncommitted work)
|
|
236
|
+
# ... do your work ...
|
|
237
|
+
g o # Commit everything with AI message + push
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Code Review Before Commit
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
g r # Get AI review of your changes
|
|
244
|
+
g o # Commit if review looks good
|
|
87
245
|
```
|
|
88
246
|
|
|
89
|
-
|
|
247
|
+
### Handling Branch Issues
|
|
90
248
|
|
|
91
249
|
```bash
|
|
92
|
-
g
|
|
93
|
-
g
|
|
250
|
+
g fix # See sync status and options
|
|
251
|
+
g fix --ai # Get AI recommendation
|
|
252
|
+
g fix --merge # Merge remote changes
|
|
253
|
+
g fix --rebase # Rebase onto remote
|
|
94
254
|
```
|
|
95
255
|
|
|
256
|
+
### Working with Stashes
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
g ss # Quick stash
|
|
260
|
+
g main # Switch to main and pull
|
|
261
|
+
# ... check something ...
|
|
262
|
+
g pop # Get your work back
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Large Changeset
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
g split # Get suggestions for splitting changes
|
|
269
|
+
g sg --multiple # Get multiple commit message options
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## π GIMS vs Plain Git
|
|
275
|
+
|
|
276
|
+
| Task | Git | GIMS |
|
|
277
|
+
|------|-----|------|
|
|
278
|
+
| Commit & push | `git add . && git commit -m "msg" && git push` | `g o` |
|
|
279
|
+
| Pull with uncommitted changes | `git stash && git pull && git stash pop` | `g sp` |
|
|
280
|
+
| Check status | `git status` | `g s` (+ AI insights) |
|
|
281
|
+
| Fix diverged branch | Multiple commands + decisions | `g fix --ai` |
|
|
282
|
+
| Code review | External tool | `g r` |
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## π Getting Help
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
g --help # Full command list with descriptions
|
|
290
|
+
g q # Quick reference card
|
|
291
|
+
g <command> -h # Help for specific command
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## π€ Contributing
|
|
297
|
+
|
|
298
|
+
Contributions are welcome! Feel free to:
|
|
299
|
+
|
|
300
|
+
- π Report bugs
|
|
301
|
+
- π‘ Suggest features
|
|
302
|
+
- π§ Submit pull requests
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
96
306
|
## π License
|
|
97
307
|
|
|
98
|
-
MIT Β© [S41R4J](https://github.com/s41r4j)
|
|
308
|
+
MIT Β© [S41R4J](https://github.com/s41r4j)
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
<div align="center">
|
|
313
|
+
|
|
314
|
+
**[β¬ Back to Top](#-gims---git-made-simple)**
|
|
315
|
+
|
|
316
|
+
Made with β€οΈ for developers who'd rather code than write commit messages
|
|
317
|
+
|
|
318
|
+
</div>
|
package/bin/lib/ai/providers.js
CHANGED
|
@@ -15,22 +15,25 @@ class AIProviderManager {
|
|
|
15
15
|
|
|
16
16
|
resolveProvider(preference = 'auto') {
|
|
17
17
|
if (preference === 'none') return 'none';
|
|
18
|
-
|
|
19
|
-
if
|
|
20
|
-
if (preference === '
|
|
18
|
+
|
|
19
|
+
// Check if preferred provider's key is available
|
|
20
|
+
if (preference === 'openai' && process.env.OPENAI_API_KEY) return 'openai';
|
|
21
|
+
if (preference === 'gemini' && process.env.GEMINI_API_KEY) return 'gemini';
|
|
22
|
+
if (preference === 'groq' && process.env.GROQ_API_KEY) return 'groq';
|
|
21
23
|
|
|
22
|
-
//
|
|
24
|
+
// Fallback: try any available provider (priority: Gemini β OpenAI β Groq)
|
|
23
25
|
if (process.env.GEMINI_API_KEY) return 'gemini';
|
|
24
26
|
if (process.env.OPENAI_API_KEY) return 'openai';
|
|
25
27
|
if (process.env.GROQ_API_KEY) return 'groq';
|
|
28
|
+
|
|
26
29
|
return 'none';
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
getDefaultModel(provider) {
|
|
30
33
|
const defaults = {
|
|
31
|
-
'gemini': 'gemini-
|
|
32
|
-
'openai': 'gpt-5',
|
|
33
|
-
'groq': 'groq/compound'
|
|
34
|
+
'gemini': 'gemini-3-flash-preview', // Latest Gemini model
|
|
35
|
+
'openai': 'gpt-5.2-2025-12-11', // Latest GPT model
|
|
36
|
+
'groq': 'groq/compound' // Latest Groq model
|
|
34
37
|
};
|
|
35
38
|
return defaults[provider] || '';
|
|
36
39
|
}
|
|
@@ -67,11 +70,11 @@ class AIProviderManager {
|
|
|
67
70
|
try {
|
|
68
71
|
switch (provider) {
|
|
69
72
|
case 'gemini':
|
|
70
|
-
return await this.generateWithGemini(prompt, model || 'gemini
|
|
73
|
+
return await this.generateWithGemini(prompt, model || this.getDefaultModel('gemini'), options);
|
|
71
74
|
case 'openai':
|
|
72
|
-
return await this.generateWithOpenAI(prompt, model || '
|
|
75
|
+
return await this.generateWithOpenAI(prompt, model || this.getDefaultModel('openai'), options);
|
|
73
76
|
case 'groq':
|
|
74
|
-
return await this.generateWithGroq(prompt, model ||
|
|
77
|
+
return await this.generateWithGroq(prompt, model || this.getDefaultModel('groq'), options);
|
|
75
78
|
default:
|
|
76
79
|
throw new Error(`Unknown provider: ${provider}`);
|
|
77
80
|
}
|
|
@@ -119,8 +122,8 @@ class AIProviderManager {
|
|
|
119
122
|
|
|
120
123
|
async generateCommitMessage(diff, options = {}) {
|
|
121
124
|
const {
|
|
122
|
-
provider: preferredProvider = 'auto',
|
|
123
|
-
conventional = false,
|
|
125
|
+
provider: preferredProvider = this.config.provider || 'auto',
|
|
126
|
+
conventional = this.config.conventional || false,
|
|
124
127
|
body = false,
|
|
125
128
|
verbose = false
|
|
126
129
|
} = options;
|
|
@@ -137,8 +140,6 @@ class AIProviderManager {
|
|
|
137
140
|
|
|
138
141
|
for (const provider of providerChain) {
|
|
139
142
|
try {
|
|
140
|
-
if (verbose) Progress.info(`Trying provider: ${provider}`);
|
|
141
|
-
|
|
142
143
|
if (provider === 'local') {
|
|
143
144
|
const result = await this.generateLocalHeuristic(diff, options);
|
|
144
145
|
this.setCache(cacheKey, result, true);
|
|
@@ -167,17 +168,21 @@ class AIProviderManager {
|
|
|
167
168
|
buildProviderChain(preferred) {
|
|
168
169
|
const available = [];
|
|
169
170
|
|
|
171
|
+
// First, try the preferred provider if its key is available
|
|
170
172
|
if (preferred !== 'auto' && preferred !== 'none') {
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
if (process.env.GEMINI_API_KEY) available.push('gemini');
|
|
175
|
-
if (process.env.OPENAI_API_KEY) available.push('openai');
|
|
176
|
-
if (process.env.GROQ_API_KEY) available.push('groq');
|
|
173
|
+
if (preferred === 'gemini' && process.env.GEMINI_API_KEY) available.push('gemini');
|
|
174
|
+
else if (preferred === 'openai' && process.env.OPENAI_API_KEY) available.push('openai');
|
|
175
|
+
else if (preferred === 'groq' && process.env.GROQ_API_KEY) available.push('groq');
|
|
177
176
|
}
|
|
178
177
|
|
|
178
|
+
// Then add all other available providers as fallbacks
|
|
179
|
+
if (process.env.GEMINI_API_KEY && !available.includes('gemini')) available.push('gemini');
|
|
180
|
+
if (process.env.OPENAI_API_KEY && !available.includes('openai')) available.push('openai');
|
|
181
|
+
if (process.env.GROQ_API_KEY && !available.includes('groq')) available.push('groq');
|
|
182
|
+
|
|
183
|
+
// Local heuristics as final fallback
|
|
179
184
|
available.push('local');
|
|
180
|
-
return
|
|
185
|
+
return available;
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
buildPrompt(diff, options) {
|