@@ -12,16 +12,16 @@ A lightweight CLI tool that analyzes your staged changes and generates professio
1212
1313## Features
1414
15- - ** Intelligent Analysis** - Analyzes git status and diff to understand your changes
15+ - ** Intelligent Analysis** - Analyzes git status and diff to understand your changes using advanced pattern detection
1616- ** Conventional Commits** - Follows the Conventional Commits specification for standardized messages
17- - ** Multiple Commit Types** - Supports feat, fix, refactor, chore, test, docs, style, perf, ci, build, security, config, deploy, revert, and wip
18- - ** Interactive Mode** - Customize commit messages with interactive prompts
19- - ** Quick Commits** - Fast commits without interaction
20- - ** Smart Analysis** - Advanced commit history analysis and insights
21- - ** Amend Support** - Easily amend previous commits with smart suggestions
22- - ** Custom Messages** - Use custom messages with scope and breaking change support
17+ - ** Interactive Mode** - Enhanced interactive prompts with y/n/e/r options (yes/no/edit/regenerate)
18+ - ** Smart Regeneration** - Generate alternative commit messages with diverse suggestions
19+ - ** Context-Aware Scoring** - Weighted algorithm for intelligent template selection
20+ - ** Pattern Detection** - Detects error handling, tests, API changes, database operations, and more
21+ - ** Multiple Commit Types** - Supports feat, fix, refactor, chore, test, docs, style, perf, ci, build, security, and more
2322- ** Zero Configuration** - Works out of the box with sensible defaults
24- - ** Offline First** - Complete offline operation, no external dependencies
23+ - ** Offline First** - Complete offline operation, no AI or external dependencies required
24+ - ** History Tracking** - Learns from your commit history to avoid repetitive suggestions
2525
2626
2727## Installation
@@ -84,71 +84,98 @@ Gitmit will analyze your changes and suggest a professional commit message follo
8484
8585## Usage
8686
87- ### Command-Line Options
88-
89- ``` bash
90- # Show suggested message without committing
91- gitmit --dry-run
87+ ### Interactive Mode (Default)
9288
93- # Display detailed analysis of changes
94- gitmit --verbose
89+ When you run ` gitmit ` , it will analyze your changes and present you with an interactive prompt:
9590
96- # Commit immediately without interactive prompts
97- gitmit --quick
98-
99- # Use OpenAI for enhanced message generation
100- gitmit --openai
101-
102- # Amend the previous commit
103- gitmit --amend
104-
105- # Force interactive mode
106- gitmit --interactive
91+ ``` bash
92+ git add .
93+ gitmit
10794
108- # Use a custom commit message
109- gitmit --message " your message "
95+ 💡 Suggested commit message:
96+ feat(api): implement user authentication strategy
11097
111- # Specify a commit scope
112- gitmit --scope " api"
98+ Actions:
99+ y - Accept and commit
100+ n - Reject and exit
101+ e - Edit message manually
102+ r - Regenerate different suggestion
113103
114- # Mark as breaking change
115- gitmit --breaking
104+ Choice [y/n/e/r]:
116105```
117106
118- ### Subcommands
107+ ** Interactive Options:**
108+ - ** ` y ` ** (or press Enter) - Accept the suggestion and commit
109+ - ** ` n ` ** - Reject and exit without committing
110+ - ** ` e ` ** - Edit the message manually with your own text
111+ - ** ` r ` ** - Regenerate a completely different suggestion using intelligent variation algorithms
119112
120- #### Analyze Commit History
113+ ### Command-Line Options
121114
122115``` bash
123- gitmit analyze
124- ```
116+ # Show suggested message without committing
117+ gitmit --dry-run
125118
126- Provides insights on:
127- - Commit patterns and trends
128- - Most active files and directories
129- - Commit type distribution
130- - Development velocity
119+ # Get multiple ranked suggestions
120+ gitmit --suggestions
131121
132- #### Smart Suggestions
122+ # Show analysis context (what was detected)
123+ gitmit --context
133124
134- ``` bash
135- gitmit smart
125+ # Auto-commit with best suggestion (skip interactive)
126+ gitmit --auto
127+
128+ # Enable debug mode
129+ gitmit --debug
136130```
137131
138- Offers:
139- - Multiple commit suggestions with confidence levels
140- - Context-aware reasoning
141- - File operation analysis
142- - Scope detection
143- - Breaking change identification
132+ ### Subcommands
144133
145- #### Propose from Diff
134+ #### Propose (Default Command)
146135
147136``` bash
148- git diff --cached | gitmit propose
137+ gitmit propose # Analyze and suggest commit message
138+ gitmit propose -i # Interactive mode with multiple suggestions
139+ gitmit propose -s # Show multiple ranked suggestions
140+ gitmit propose --context # Show what was analyzed
141+ gitmit propose --auto # Auto-commit with best suggestion
149142```
150143
151- Generate a commit message from a diff passed via stdin.
144+ If no subcommand is provided, ` gitmit ` defaults to ` propose ` .
145+
146+ ## How It Works
147+
148+ Gitmit uses intelligent offline algorithms to analyze your changes:
149+
150+ 1 . ** Pattern Detection** - Identifies code patterns like:
151+ - Error handling improvements
152+ - Test additions
153+ - API/endpoint changes
154+ - Database operations
155+ - Security enhancements
156+ - Performance optimizations
157+ - Configuration updates
158+ - And 15+ other patterns
159+
160+ 2 . ** Context Analysis** - Examines:
161+ - File types and extensions
162+ - Directory structure
163+ - Function/struct/method changes
164+ - Line additions and deletions
165+ - Multi-file patterns
166+
167+ 3 . ** Weighted Scoring** - Selects templates using:
168+ - Placeholder availability (item, purpose, topic)
169+ - Pattern matching bonuses
170+ - File type context
171+ - Special case detection
172+ - Diversity algorithms for variations
173+
174+ 4 . ** Smart Variation** - When regenerating (pressing 'r'):
175+ - Avoids previously shown suggestions
176+ - Uses similarity detection to ensure diversity
177+ - Maintains context relevance
178+ - Applies randomization for variety
152179
153180## Commit Types
154181
@@ -174,67 +201,104 @@ Gitmit supports the following commit types (automatically detected):
174201
175202## Examples
176203
177- ### Feature Addition
204+ ### Basic Interactive Usage
178205
179206``` bash
180- git add new-feature.js
207+ # Stage your changes
208+ git add internal/api/handler.go
209+
210+ # Run gitmit
181211gitmit
182- # Generates: feat: add new-feature.js
183- ```
184212
185- ### Bug Fix
213+ # Output:
214+ 💡 Suggested commit message:
215+ feat(api): implement authentication middleware
186216
187- ``` bash
188- git add bug-fix.js
189- gitmit
190- # Generates: fix: resolve issue in bug-fix.js
191- ```
217+ Actions:
218+ y - Accept and commit
219+ n - Reject and exit
220+ e - Edit message manually
221+ r - Regenerate different suggestion
192222
193- ### Documentation Update
223+ Choice [y/n/e/r]: r
194224
195- ``` bash
196- git add README.md
197- gitmit
198- # Generates: docs: update README
225+ # After pressing 'r':
226+ 💡 Alternative suggestion # 1:
227+ feat(api): add role-based access control for authentication
228+
229+ Choice [y/n/e/r]: y
230+
231+ ✅ Changes committed successfully.
199232```
200233
201- ### Quick Commit
234+ ### Multiple Suggestions Mode
202235
203236``` bash
204237git add .
205- gitmit --quick
206- # Commits immediately without prompts
238+ gitmit propose -s
239+
240+ # Output:
241+ 💡 Ranked Suggestions:
242+ 1. feat(api): implement user authentication strategy (recommended)
243+ 2. feat(api): add token-based access via middleware
244+ 3. feat(auth): integrate OAuth provider for secure access
245+ 4. feat(api): expose new endpoint for authentication
246+ 5. feat(auth): implement MFA/2FA support for security
207247```
208248
209- ### Custom Message with Scope
249+ ### Context Analysis
210250
211251``` bash
212- git add .
213- gitmit --message " improve performance" --scope " api" --breaking
214- # Generates: feat(api)!: improve performance
252+ gitmit propose --context
253+
254+ # Output:
255+ 📊 Analysis Context:
256+ Action: feat
257+ Topic: api
258+ Item: handler
259+ Purpose: authentication
260+ Scope: auth
261+ Files: +127 -15
262+ Types: [go]
263+
264+ 💡 Suggested commit message:
265+ feat(auth): implement handler authentication strategy
215266```
216267
217- ### Amend Previous Commit
268+ ### Edit Mode
218269
219270``` bash
220- git add additional-changes.js
221- gitmit --amend
222- # Amends the last commit with new changes
223- ```
271+ gitmit
224272
225- ## Configuration
273+ # Output:
274+ 💡 Suggested commit message:
275+ feat(api): add new endpoint
226276
227- Gitmit works out of the box without any configuration. No configuration files are required.
277+ Choice [y/n/e/r]: e
228278
229- ### Optional: OpenAI Integration
279+ 📝 Edit the commit message:
280+ Current: feat(api): add new endpoint
281+ New message: feat(api): add user registration endpoint with validation
230282
231- To use OpenAI for enhanced commit message generation, set your API key:
283+ ✓ Updated commit message:
284+ feat(api): add user registration endpoint with validation
232285
233- ``` bash
234- export OPENAI_API_KEY=" your-api-key"
235- gitmit --openai
286+ Choice [y/n/e/r]: y
287+ ✅ Changes committed successfully.
236288```
237289
290+ ## Configuration
291+
292+ Gitmit works out of the box without any configuration. All intelligence is built-in using:
293+
294+ - ** Template-based generation** with 100+ curated commit message templates
295+ - ** Pattern matching algorithms** for context detection
296+ - ** Weighted scoring system** for template selection
297+ - ** Similarity detection** for diverse variations
298+ - ** Commit history tracking** to avoid repetition
299+
300+ No AI, APIs, or external services required. Everything runs locally and offline.
301+
238302## Contributing
239303
240304Contributions are welcome! Please see [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for guidelines on how to contribute to this project.
0 commit comments