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 CHANGED
@@ -1,98 +1,318 @@
1
+ <div align="center">
2
+
1
3
  # πŸš€ GIMS - Git Made Simple
2
4
 
3
5
  [![npm version](https://img.shields.io/npm/v/gims.svg)](https://npmjs.org/package/gims)
6
+ [![npm downloads](https://img.shields.io/npm/dm/gims.svg)](https://npmjs.org/package/gims)
4
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
8
  [![AI Powered](https://img.shields.io/badge/AI-Powered-blueviolet.svg)](https://github.com/s41r4j/gims)
9
+ [![Node.js](https://img.shields.io/badge/Node.js->=18.18.0-green.svg)](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
- ## ⚑ Quick Start
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
- # Setup AI (choose one)
18
- g setup --api-key gemini # Free & fast (recommended)
19
- g setup --api-key openai # High quality
20
- g setup --api-key groq # Ultra fast
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
- # Use it
23
- g s # Check status with AI insights
24
- g o # AI commit + push
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
- ## 🎯 Main Commands
56
+ ### Your New Workflow
28
57
 
29
- ### 🧠 Smart Commands
30
- | Command | Description |
31
- |---------|-------------|
32
- | `g s` | Enhanced status with AI insights |
33
- | `g o` | AI commit + push |
34
- | `g l` | AI commit locally |
35
- | `g wip` | Quick WIP commit |
36
- | `g r` | AI code review |
37
- | `g t` | Show today's commits |
38
- | `g stats` | Personal commit statistics |
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
- | Command | What it does |
42
- |---------|--------------|
43
- | `g sp` | **Safe Pull** (Stash β†’ Pull β†’ Pop) |
44
- | `g fix` | **Smart Fix** for branch sync issues |
45
- | `g main` | Switch to main/master + pull |
46
- | `g ss` | Quick stash save |
47
- | `g pop` | Pop latest stash |
48
- | `g us` | Unstage all files |
49
- | `g x` | Discard all changes (with confirm) |
50
-
51
- ### πŸ› οΈ Helper Commands
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 last` | Show last commit details |
55
- | `g conflicts` | Conflict resolution helper |
56
- | `g clean` | Remove dead local branches |
57
- | `g ls` | Commit history (short) |
58
- | `g a` | Amend previous commit |
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
- ## πŸ€– AI Models
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
- - **Gemini**: `gemini-2.5-flash` (Free, fast, recommended)
63
- - **OpenAI**: `gpt-5` (High quality)
64
- - **Groq**: `groq/compound` (Ultra fast)
147
+ #### Option 2: Environment Variables (Auto-detected)
65
148
 
66
- ## πŸ“– Examples
149
+ GIMS automatically detects API keys from environment variables. Add to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.):
67
150
 
68
151
  ```bash
69
- # Daily workflow
70
- g s # Check status
71
- g sp # Safe pull updates
72
- g fix # Fix any sync issues
73
- g o # Commit + push
74
-
75
- # Power functions
76
- g r # Review code before commit
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
- g config --set conventional=true # Enable conventional commits
85
- g config --set autoStage=true # Auto-stage changes
86
- g config --list # View all settings
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
- ## πŸ†˜ Help
247
+ ### Handling Branch Issues
90
248
 
91
249
  ```bash
92
- g --help # All commands
93
- g q # Quick reference
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>
@@ -15,22 +15,25 @@ class AIProviderManager {
15
15
 
16
16
  resolveProvider(preference = 'auto') {
17
17
  if (preference === 'none') return 'none';
18
- if (preference === 'openai') return process.env.OPENAI_API_KEY ? 'openai' : 'none';
19
- if (preference === 'gemini') return process.env.GEMINI_API_KEY ? 'gemini' : 'none';
20
- if (preference === 'groq') return process.env.GROQ_API_KEY ? 'groq' : 'none';
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
- // Auto-detection with preference order (Gemini first - fastest and cheapest)
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-2.5-flash', // Latest and fastest
32
- 'openai': 'gpt-5', // Latest GPT model
33
- 'groq': 'groq/compound' // Latest Groq model
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-2.0-flash', options);
73
+ return await this.generateWithGemini(prompt, model || this.getDefaultModel('gemini'), options);
71
74
  case 'openai':
72
- return await this.generateWithOpenAI(prompt, model || 'gpt-4o-mini', options);
75
+ return await this.generateWithOpenAI(prompt, model || this.getDefaultModel('openai'), options);
73
76
  case 'groq':
74
- return await this.generateWithGroq(prompt, model || 'llama-3.1-8b-instant', options);
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
- const resolved = this.resolveProvider(preferred);
172
- if (resolved !== 'none') available.push(resolved);
173
- } else if (preferred === 'auto') {
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 [...new Set(available)];
185
+ return available;
181
186
  }
182
187
 
183
188
  buildPrompt(diff, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gims",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Git Made Simple – AI‑powered git helper with smart insights, stats & code review",
5
5
  "author": "S41R4J",
6
6
  "license": "MIT",