gemit-cli 2.2.0 → 2.2.1

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,53 +1,571 @@
1
- # gemit-cli
2
-
3
- CLI para sugerir mensagens de commit e nomes de branch com IA.
4
-
5
- ## Site
6
-
7
- [Acesse o site do Gemit](https://erickn-dev.github.io/gemit-site/)
8
-
9
- ## Instalação
10
-
11
- ```bash
12
- npm i -g gemit-cli
13
- ```
14
-
15
- ## Configuração
16
-
17
- ```bash
18
- gemit init
19
- ```
20
-
21
- ## Uso
22
-
23
- ```bash
24
- gemit # sugere commit usando arquivos staged
25
- gemit commit --all # git add . + fluxo de commit em 4 passos
26
- gemit commit --check # roda lint/test (se existirem) antes do commit
27
- gemit add --all # equivalente a git add . + sugestão de commit
28
- gemit branch "texto" # sugere branch
29
- gemit pr # gera título + descrição de PR
30
- gemit log # resume o trabalho do branch
31
- gemit changelog # gera changelog em changelogs/nome-data.md
32
- gemit changelog -c 10 # usa apenas os 10 commits mais recentes
33
- gemit doctor # verifica configuração
34
- gemit update # força a checagem/instalação da versão mais recente
35
- gemit -v # versão
36
- ```
37
-
38
- ## Atualização automática
39
-
40
- Ao executar comandos de uso diário, o `gemit` verifica periodicamente se existe versão nova e tenta atualizar via npm global.
41
-
42
- Para desativar:
43
-
44
- ```bash
45
- GEMIT_DISABLE_AUTO_UPDATE=1 gemit commit
46
- $env:GEMIT_DISABLE_AUTO_UPDATE="1"; gemit commit # PowerShell
47
- ```
48
-
49
- ## Provedores suportados
50
-
51
- - `google`
52
- - `openai`
53
- - `anthropic`
1
+ # gemit-cli
2
+
3
+ <div align="center">
4
+
5
+ ![gemit logo](https://erickn-dev.github.io/gemit-site/logo.png)
6
+
7
+ **AI-powered Git workflow automation from your terminal**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/gemit-cli.svg)](https://www.npmjs.com/package/gemit-cli)
10
+ [![npm downloads](https://img.shields.io/npm/dm/gemit-cli.svg)](https://www.npmjs.com/package/gemit-cli)
11
+ [![License](https://img.shields.io/npm/l/gemit-cli.svg)](https://github.com/erickn-dev/gemit/blob/main/LICENSE)
12
+
13
+ [Website](https://erickn-dev.github.io/gemit-site/) • [NPM Stats](https://erickn-dev.github.io/gemit-site/dashboard/) • [Discord Community](https://discord.gg/CJqy69MGD2)
14
+
15
+ </div>
16
+
17
+ ## Overview
18
+
19
+ **Gemit** is a Node.js CLI that leverages AI to streamline your Git workflow. It generates conventional commit messages, branch names, PR descriptions, code reviews, changelogs, and more — with confirmation before executing any Git command.
20
+
21
+ ### Key Features
22
+
23
+ - **AI-Powered Suggestions** - Generate commit messages, branch names, and PR descriptions
24
+ - **Code Review** - Get AI feedback on staged changes before committing
25
+ - **Conventional Commits** - Automatic conventional commit format with type detection
26
+ - **Smart Branching** - Create semantic branches in `<type>/<kebab-case>` format
27
+ - **Changelog Generation** - Automatic changelog creation from commit history
28
+ - **Workflow Automation** - 4-step commit flow with lint/test integration
29
+ - **Multi-Language** - Support for English and Portuguese (pt-br)
30
+ - **Auto-Updates** - Periodic version checks with automatic updates
31
+ - **Customizable Prompts** - Override AI instructions globally without touching projects
32
+ - **Multiple AI Providers** - Support for Google (Gemini), OpenAI (GPT), and Anthropic (Claude)
33
+
34
+ ## Table of Contents
35
+
36
+ - [Prerequisites](#prerequisites)
37
+ - [Installation](#installation)
38
+ - [Quick Start](#quick-start)
39
+ - [Configuration](#configuration)
40
+ - [Commands Reference](#commands-reference)
41
+ - [Advanced Usage](#advanced-usage)
42
+ - [Prompt Customization](#prompt-customization)
43
+ ---
44
+ - [Troubleshooting](#troubleshooting)
45
+ - [Contributing](#contributing)
46
+ ---
47
+ - [Community](#community)
48
+ - [License](#license)
49
+
50
+ ## Prerequisites
51
+
52
+ - **Node.js** (LTS version recommended)
53
+ - **Git** repository (must be inside a Git project)
54
+ - **API Key** from one of the supported providers:
55
+ - [Google AI Studio](https://aistudio.google.com/) (Gemini)
56
+ - [OpenAI Platform](https://platform.openai.com/) (GPT)
57
+ - [Anthropic Console](https://console.anthropic.com/) (Claude)
58
+
59
+
60
+ ## Installation
61
+
62
+ ### Global Installation (Recommended)
63
+
64
+ ```bash
65
+ npm install -g gemit-cli
66
+ ```
67
+
68
+ Works on **Windows**, **Linux**, and **macOS**.
69
+
70
+ ### Verify Installation
71
+
72
+ ```bash
73
+ gemit --version
74
+ gemit doctor
75
+ ```
76
+
77
+ ## Quick Start
78
+
79
+ ### 1. Initialize Configuration
80
+
81
+ ```bash
82
+ gemit init
83
+ ```
84
+
85
+ This interactive wizard will prompt you to:
86
+ - Select AI provider (google, openai, or anthropic)
87
+ - Choose model
88
+ - Enter API key
89
+ - Set language preference (en or pt-br)
90
+
91
+ ### 2. Make Your First AI-Powered Commit
92
+
93
+ ```bash
94
+ # Stage your changes
95
+ git add .
96
+
97
+ # Get AI-suggested commit message
98
+ gemit
99
+
100
+ # Or use the full flow with automatic staging
101
+ gemit commit --all
102
+ ```
103
+
104
+ ### 3. Create a Semantic Branch
105
+
106
+ ```bash
107
+ gemit branch "add user authentication feature"
108
+ # Suggests: feat/add-user-authentication-feature
109
+ ```
110
+
111
+ ## Configuration
112
+
113
+ ### Configuration File Location
114
+
115
+ gemit stores configuration globally in a `.env` file:
116
+
117
+ - **Windows**: `%APPDATA%\gemit\.env`
118
+ - **macOS**: `~/Library/Application Support/gemit/.env`
119
+ - **Linux**: `~/.config/gemit/.env`
120
+
121
+ ### Supported Environment Variables
122
+
123
+ ```env
124
+ # Provider Configuration
125
+ LLM_PROVIDER="google" # google, openai, or anthropic
126
+ LLM_MODEL="gemini-2.5-flash" # Model name
127
+ GEMIT_LANGUAGE="en" # en or pt-br
128
+
129
+ # API Keys (set only the one for your provider)
130
+ GOOGLE_API_KEY="your-key-here"
131
+ GEMINI_API_KEY="your-key-here" # Alternative to GOOGLE_API_KEY
132
+ OPENAI_API_KEY="your-key-here"
133
+ ANTHROPIC_API_KEY="your-key-here"
134
+ ```
135
+
136
+ ### Default Models by Provider
137
+
138
+ | Provider | Default Model |
139
+ |----------|--------------|
140
+ | **google** | `gemini-2.5-flash` |
141
+ | **openai** | `gpt-4o-mini` |
142
+ | **anthropic** | `claude-3-5-sonnet-latest` |
143
+
144
+ ### Update Configuration
145
+
146
+ ```bash
147
+ # Update a single value without re-running init
148
+ gemit config --set LLM_MODEL=gpt-4o
149
+ gemit config --set GEMIT_LANGUAGE=pt-br
150
+
151
+ # List all current settings
152
+ gemit config --list
153
+ ```
154
+
155
+ ## Commands Reference
156
+
157
+ ### Core Commands
158
+
159
+ #### `gemit` (Default)
160
+
161
+ Suggest commit message using currently staged files.
162
+
163
+ ```bash
164
+ gemit
165
+ ```
166
+
167
+ #### `gemit commit [options]`
168
+
169
+ Full commit workflow: stage → summary → AI suggestion → confirmation → commit → push prompt.
170
+
171
+ **Options:**
172
+ - `--all` - Run `git add .` before the flow
173
+ - `--check` - Run lint and test scripts before committing
174
+ - `--amend` - Rewrite the last commit message with AI
175
+ - `--dry-run` - Preview suggested message without committing
176
+
177
+ **Examples:**
178
+ ```bash
179
+ gemit commit --all # Stage all + commit flow
180
+ gemit commit --check # With lint/test validation
181
+ gemit commit --amend # Rewrite last commit
182
+ gemit commit --dry-run # Preview only
183
+ ```
184
+
185
+ #### `gemit branch <description>`
186
+
187
+ Generate semantic branch name and optionally create it.
188
+
189
+ ```bash
190
+ gemit branch "implement user authentication"
191
+ # Suggests: feat/implement-user-authentication
192
+
193
+ gemit branch "fix login bug with OAuth"
194
+ # Suggests: fix/login-bug-with-oauth
195
+ ```
196
+
197
+ **Branch Types:** `feat`, `fix`, `chore`, `docs`, `refactor`, `test`
198
+
199
+ #### `gemit pr`
200
+
201
+ Generate PR title and markdown description from branch commits.
202
+
203
+ ```bash
204
+ gemit pr
205
+ ```
206
+
207
+ Output includes:
208
+ - Conventional commit-style title
209
+ - Detailed description of changes
210
+ - List of commits included
211
+
212
+ #### `gemit log`
213
+
214
+ Summarize all work done in the current branch.
215
+
216
+ ```bash
217
+ gemit log
218
+ ```
219
+
220
+ #### `gemit changelog [name]`
221
+
222
+ Generate changelog file in `changelogs/<name>-YYYY-MM-DD.md`.
223
+
224
+ **Options:**
225
+ - `-c, --commits <number>` - Number of recent commits to include (default: 20, max: 200)
226
+
227
+ ```bash
228
+ gemit changelog # Default: 20 commits
229
+ gemit changelog v2.0.0 -c 50 # Custom name, 50 commits
230
+ ```
231
+
232
+ ### New Commands
233
+
234
+ #### `gemit undo`
235
+
236
+ Soft-reset the last commit, keeping files staged.
237
+
238
+ ```bash
239
+ gemit undo
240
+ ```
241
+
242
+ #### `gemit review`
243
+
244
+ AI code review of staged changes before committing.
245
+
246
+ ```bash
247
+ git add .
248
+ gemit review
249
+ ```
250
+
251
+ **Review Levels:**
252
+ - `[CRITICAL]` - Must fix before committing
253
+ - `[WARNING]` - Should review
254
+ - `[INFO]` - Suggestions for improvement
255
+ - `[OK]` - Looks good
256
+
257
+ #### `gemit stash`
258
+
259
+ Create stash with AI-generated descriptive message.
260
+
261
+ ```bash
262
+ gemit stash
263
+ # Generates message based on working tree changes
264
+ # Runs: git stash push -u -m "<AI-generated-message>"
265
+ ```
266
+
267
+ #### `gemit release <version>`
268
+
269
+ Complete release workflow: version bump → changelog → commit → tag.
270
+
271
+ ```bash
272
+ gemit release 1.2.0
273
+ ```
274
+
275
+ **What it does:**
276
+ 1. Updates `package.json` version
277
+ 2. Generates changelog with AI
278
+ 3. Commits as `chore(release): v1.2.0`
279
+ 4. Creates annotated git tag
280
+
281
+ #### `gemit ignore <description>`
282
+
283
+ Generate `.gitignore` entries based on project description.
284
+
285
+ ```bash
286
+ gemit ignore "node project with typescript and jest"
287
+ gemit ignore "python project with django"
288
+ ```
289
+
290
+ Automatically:
291
+ - Skips duplicate entries
292
+ - Appends to existing `.gitignore`
293
+ - Creates file if it doesn't exist
294
+
295
+ #### `gemit squash <count>`
296
+
297
+ Squash last N commits with unified AI-generated message.
298
+
299
+ ```bash
300
+ gemit squash 3
301
+ # Squashes last 3 commits
302
+ # AI generates single conventional commit message
303
+ ```
304
+
305
+ ### Utility Commands
306
+
307
+ #### `gemit add [options]`
308
+
309
+ Stage changes and enter commit flow.
310
+
311
+ **Note:** Requires `--all` flag in practice.
312
+
313
+ ```bash
314
+ gemit add --all # git add . + commit flow
315
+ gemit add --all --check # With lint/test
316
+ ```
317
+
318
+ #### `gemit doctor`
319
+
320
+ Validate configuration and report issues.
321
+
322
+ ```bash
323
+ gemit doctor
324
+ ```
325
+
326
+ Checks:
327
+ - Provider and model configuration
328
+ - API key presence
329
+ - Language setting
330
+ - Git repository status
331
+
332
+ #### `gemit update`
333
+
334
+ Force version check and install latest release.
335
+
336
+ ```bash
337
+ gemit update
338
+ ```
339
+
340
+ #### `gemit prompts`
341
+
342
+ Manage AI prompt templates.
343
+
344
+ ```bash
345
+ gemit prompts # List status of all prompts
346
+ gemit prompts --init # Export defaults to config folder
347
+ gemit prompts --edit commit # Edit commit prompt
348
+ gemit prompts --show branch # Display built-in template
349
+ ```
350
+
351
+ #### `gemit config`
352
+
353
+ Manage configuration values.
354
+
355
+ ```bash
356
+ gemit config --set KEY=value # Update single value
357
+ gemit config --list # Show all settings
358
+ ```
359
+
360
+ ### Global Options
361
+
362
+ ```bash
363
+ gemit -v, --version # Show version
364
+ gemit -h, --help # Show help
365
+ gemit help <command> # Command-specific help
366
+ ```
367
+
368
+ ## Advanced Usage
369
+
370
+ ### 4-Step Commit Flow
371
+
372
+ When using `gemit commit --all`, you get a comprehensive workflow:
373
+
374
+ 1. **Stage** - Automatically runs `git add .`
375
+ 2. **Summary** - Shows what files changed
376
+ 3. **AI Suggestion** - Generates conventional commit message
377
+ 4. **Confirmation** - Review and confirm/edit before committing
378
+ 5. **Push Prompt** - Asks if you want to push changes
379
+
380
+ ### Lint and Test Integration
381
+
382
+ The `--check` flag integrates with your project's scripts:
383
+
384
+ ```bash
385
+ gemit commit --check
386
+ ```
387
+
388
+ **Runs (if present):**
389
+ 1. `npm run lint --if-present`
390
+ 2. `npm run test --if-present`
391
+
392
+ **In package.json:**
393
+ ```json
394
+ {
395
+ "scripts": {
396
+ "lint": "eslint .",
397
+ "test": "jest"
398
+ }
399
+ }
400
+ ```
401
+
402
+ If scripts don't exist, they're safely skipped due to `--if-present` flag.
403
+
404
+ ## Prompt Customization
405
+
406
+ gemit works out of the box with built-in prompts. Customize only if you need specific AI behavior.
407
+
408
+ ### How It Works
409
+
410
+ 1. **No setup needed** - Built-in defaults always active
411
+ 2. **Override globally** - Customize at OS config level (not per-project)
412
+ 3. **Revert anytime** - Delete custom file to restore default
413
+
414
+ ### Customizable Prompts
415
+
416
+ | Prompt | Template Variables |
417
+ |--------|-------------------|
418
+ | `commit.txt` | `{{detected_type}}`, `{{staged_files}}`, `{{summary}}`, `{{diff_stat}}`, `{{patch}}` |
419
+ | `branch.txt` | `{{description}}` |
420
+ | `pr.txt` | `{{branch_data}}` |
421
+ | `changelog.txt` | `{{commit_limit}}`, `{{commit_history}}` |
422
+ | `log.txt` | `{{branch_context}}` |
423
+
424
+ ### Custom Prompt Location
425
+
426
+ - **Windows**: `%APPDATA%\gemit\prompts\`
427
+ - **macOS**: `~/Library/Application Support/gemit/prompts/`
428
+ - **Linux**: `~/.config/gemit/prompts/`
429
+
430
+ ### Managing Prompts
431
+
432
+ ```bash
433
+ # List all prompts and their status
434
+ gemit prompts
435
+
436
+ # Export all defaults to config folder
437
+ gemit prompts --init
438
+
439
+ # Edit specific prompt in default editor
440
+ gemit prompts --edit commit
441
+
442
+ # View built-in template
443
+ gemit prompts --show branch
444
+ ```
445
+
446
+ ## Troubleshooting
447
+
448
+ ### Common Issues
449
+
450
+ #### "Not in a Git repository"
451
+
452
+ **Solution:** Ensure you're inside a Git-initialized directory:
453
+ ```bash
454
+ git init
455
+ ```
456
+
457
+ #### "API key not configured"
458
+
459
+ **Solution:** Run initialization or set key manually:
460
+ ```bash
461
+ gemit init
462
+ # or
463
+ gemit config --set GOOGLE_API_KEY=your-key-here
464
+ ```
465
+
466
+ #### "No staged changes"
467
+
468
+ **Solution:** Stage files before running gemit:
469
+ ```bash
470
+ git add .
471
+ gemit
472
+ # or
473
+ gemit commit --all # Auto-stages everything
474
+ ```
475
+
476
+ #### Auto-update fails
477
+
478
+ **Solution:** Update manually:
479
+ ```bash
480
+ npm install -g gemit-cli@latest
481
+ # or
482
+ gemit update
483
+ ```
484
+
485
+ ### Debugging
486
+
487
+ Enable verbose output:
488
+ ```bash
489
+ DEBUG=* gemit commit
490
+ ```
491
+
492
+ Check configuration:
493
+ ```bash
494
+ gemit doctor
495
+ gemit config --list
496
+ ```
497
+
498
+ ---
499
+
500
+ ## Contributing
501
+
502
+ Contributions are welcome! Here's how you can help:
503
+
504
+ ### Reporting Issues
505
+
506
+ - Use [GitHub Issues](https://github.com/erickn-dev/gemit/issues)
507
+ - Include gemit version (`gemit -v`)
508
+ - Describe steps to reproduce
509
+ - Share relevant configuration (without API keys)
510
+
511
+ ### Development Setup
512
+
513
+ ```bash
514
+ # Clone repository
515
+ git clone https://github.com/erickn-dev/gemit.git
516
+ cd gemit
517
+
518
+ # Install dependencies
519
+ npm install
520
+
521
+ # Link for local testing
522
+ npm link
523
+
524
+ # Test changes
525
+ gemit doctor
526
+ ```
527
+
528
+ ### Pull Requests
529
+
530
+ 1. Fork the repository
531
+ 2. Create feature branch: `gemit branch "your feature"`
532
+ 3. Make changes with conventional commits: `gemit commit --all`
533
+ 4. Push and create PR: `gemit pr` (for PR text inspiration)
534
+
535
+ ## Community
536
+
537
+ ### Join the Discussion
538
+
539
+ Share improvements, ask questions, and follow updates:
540
+
541
+ - **Discord**: [Join Community](https://discord.gg/CJqy69MGD2)
542
+ - **Website**: [erickn-dev.github.io/gemit-site](https://erickn-dev.github.io/gemit-site/)
543
+
544
+ ### Showcase
545
+
546
+ Using gemit in your project? Share your experience and get featured!
547
+
548
+ ## License
549
+
550
+ [Check License](https://github.com/erickn-dev/gemit/blob/main/LICENSE)
551
+
552
+ ---
553
+
554
+ ## Acknowledgments
555
+
556
+ Built with ❤️ by [Erick Novaes](https://github.com/erickn-dev)
557
+
558
+ **AI Providers:**
559
+ - [Google Gemini](https://ai.google.dev/)
560
+ - [OpenAI](https://openai.com/)
561
+ - [Anthropic Claude](https://www.anthropic.com/)
562
+
563
+ ---
564
+
565
+ <div align="center">
566
+
567
+ **[⬆ Back to Top](#gemit-cli)**
568
+
569
+ Made with Node.js • Powered by AI • Open Source
570
+
571
+ </div>