@@ -14,6 +14,13 @@ A lightweight CLI tool that analyzes your staged changes and generates professio
1414
1515- ** 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+ - ** Configuration Hierarchy** - Local (` .gitmit.json ` ) → Global (` ~/.gitmit.json ` ) → Default (Embedded) config support
18+ - ** Automatic Project Profiling** - Detects project type (Go, Node.js, Python, Java, etc.) from characteristic files
19+ - ** Keyword Scoring Algorithm** - Analyzes git diff content and scores keywords to determine the best commit type
20+ - ** Symbol Extraction** - Uses language-aware regex to extract function, class, and variable names
21+ - ** Git Porcelain Status** - Leverages ` git status --porcelain ` for accurate file state detection
22+ - ** Diff Stat Analysis** - Infers intent based on added vs deleted lines ratio
23+ - ** Commit History Context** - Maintains consistency by learning from recent commit messages
1724- ** Interactive Mode** - Enhanced interactive prompts with y/n/e/r options (yes/no/edit/regenerate)
1825- ** Smart Regeneration** - Generate alternative commit messages with diverse suggestions
1926- ** Context-Aware Scoring** - Weighted algorithm for intelligent template selection
@@ -131,6 +138,24 @@ gitmit --debug
131138
132139### Subcommands
133140
141+ #### Initialize Configuration
142+
143+ ``` bash
144+ # Create local .gitmit.json in current directory
145+ gitmit init
146+
147+ # Create global ~/.gitmit.json in home directory
148+ gitmit init --global
149+ ```
150+
151+ The ` init ` command automatically detects your project type and generates a configuration file with:
152+ - Language-specific keyword mappings
153+ - Project-appropriate topic mappings
154+ - Customizable keyword scoring weights
155+ - Diff stat analysis thresholds
156+
157+ See [ CONFIGURATION.md] ( CONFIGURATION.md ) for detailed configuration options.
158+
134159#### Propose (Default Command)
135160
136161``` bash
@@ -147,7 +172,46 @@ If no subcommand is provided, `gitmit` defaults to `propose`.
147172
148173Gitmit uses intelligent offline algorithms to analyze your changes:
149174
150- 1 . ** Pattern Detection** - Identifies code patterns like:
175+ 1 . ** Automatic Project Profiling** - Detects project type by checking for:
176+ - ` go.mod ` (Go)
177+ - ` package.json ` (Node.js)
178+ - ` requirements.txt ` (Python)
179+ - And more (Java, Ruby, Rust, PHP)
180+
181+ 2 . ** Git Porcelain Status** - Uses ` git status --porcelain ` to read file states:
182+ - A (Added) → prioritizes ` feat ` templates
183+ - M (Modified) → analyzes for ` fix ` , ` refactor ` , or ` feat `
184+ - D (Deleted) → suggests ` chore ` or ` refactor `
185+ - R (Renamed) → suggests ` refactor `
186+
187+ 3 . ** Keyword Scoring Algorithm** - Analyzes ` git diff --cached ` content:
188+ - Counts keyword occurrences
189+ - Multiplies by configured weights
190+ - Selects action with highest score
191+ - Example: ` + func ` (weight: 3) + ` + class ` (weight: 2) = 5 points for ` feat `
192+
193+ 4 . ** Symbol Extraction via Regex** - Language-aware pattern matching:
194+ - Go: Functions (` func Name( ` ), structs (` type Name struct ` )
195+ - JavaScript: Functions, arrow functions, classes
196+ - Python: Functions (` def name( ` ), classes (` class Name ` )
197+ - Fills ` {item} ` placeholder automatically
198+
199+ 5 . ** Path-based Topic Detection** - Uses ` filepath.Dir ` logic:
200+ - Custom topic mappings from config
201+ - Prioritizes ` internal/ ` or ` pkg/ ` subdirectories
202+ - Falls back to most specific directory name
203+
204+ 6 . ** Diff Stat Analysis** - Analyzes line change ratios:
205+ - Deleted lines > 70% → suggests ` refactor ` (cleanup)
206+ - Added lines > 70% with 50+ lines → suggests ` feat ` (new feature)
207+ - Balanced changes → suggests ` refactor ` (modification)
208+
209+ 7 . ** Commit History Context** - Maintains consistency:
210+ - Retrieves most recent commit message
211+ - Extracts scope from ` type(scope): message ` format
212+ - Prioritizes same scope for next commit
213+
214+ 8 . ** Pattern Detection** - Identifies code patterns like:
151215 - Error handling improvements
152216 - Test additions
153217 - API/endpoint changes
@@ -157,25 +221,19 @@ Gitmit uses intelligent offline algorithms to analyze your changes:
157221 - Configuration updates
158222 - And 15+ other patterns
159223
160- 2 . ** Context Analysis** - Examines:
224+ 9 . ** Context Analysis** - Examines:
161225 - File types and extensions
162226 - Directory structure
163227 - Function/struct/method changes
164228 - Line additions and deletions
165229 - Multi-file patterns
166230
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
231+ 10 . ** Weighted Scoring** - Selects templates using:
232+ - Placeholder availability (item, purpose, topic)
233+ - Pattern matching bonuses
234+ - File type context
235+ - Special case detection
236+ - Diversity algorithms for variations
179237
180238## Commit Types
181239
@@ -289,13 +347,77 @@ Choice [y/n/e/r]: y
289347
290348## Configuration
291349
292- Gitmit works out of the box without any configuration. All intelligence is built-in using:
350+ Gitmit works out of the box without any configuration, but you can customize its behavior using a configuration file.
351+
352+ ### Configuration Hierarchy
353+
354+ 1 . ** Local** (` .gitmit.json ` ) - Project-specific settings in current directory
355+ 2 . ** Global** (` ~/.gitmit.json ` ) - User-wide settings in home directory
356+ 3 . ** Default** (Embedded) - Built-in defaults
357+
358+ Settings from higher priority configs override lower priority ones.
359+
360+ ### Quick Start
361+
362+ ``` bash
363+ # Create local config with auto-detected project type
364+ gitmit init
365+
366+ # Create global config
367+ gitmit init --global
368+ ```
369+
370+ The ` init ` command automatically:
371+ - Detects your project type (Go, Node.js, Python, etc.)
372+ - Generates language-specific keyword mappings
373+ - Creates customizable topic mappings
374+ - Sets up keyword scoring weights
375+
376+ ### Configuration Options
377+
378+ ** Core Features:**
379+ - ** Project Type Detection** - Automatically identifies language/framework
380+ - ** Keyword Scoring** - Define action-specific keywords and weights
381+ - ** Topic Mappings** - Map file paths to commit scopes
382+ - ** Diff Stat Threshold** - Control added/deleted line ratio analysis
383+ - ** Custom Templates** - Define your own commit message patterns (coming soon)
384+
385+ ** Example ` .gitmit.json ` :**
386+ ``` json
387+ {
388+ "projectType" : " go" ,
389+ "diffStatThreshold" : 0.5 ,
390+ "topicMappings" : {
391+ "internal/api" : " api" ,
392+ "internal/database" : " db"
393+ },
394+ "keywords" : {
395+ "feat" : {
396+ "func" : 3 ,
397+ "class" : 2
398+ },
399+ "fix" : {
400+ "bug" : 3 ,
401+ "error" : 2
402+ }
403+ }
404+ }
405+ ```
406+
407+ For detailed configuration documentation, see [ CONFIGURATION.md] ( CONFIGURATION.md ) .
408+
409+ ### Intelligence Built-In
410+
411+ All intelligence is built-in using:
293412
294413- ** Template-based generation** with 100+ curated commit message templates
295414- ** Pattern matching algorithms** for context detection
296415- ** Weighted scoring system** for template selection
297416- ** Similarity detection** for diverse variations
298417- ** Commit history tracking** to avoid repetition
418+ - ** Language-aware symbol extraction** via regex
419+ - ** Keyword scoring** based on git diff analysis
420+ - ** Diff stat analysis** for intent inference
299421
300422No AI, APIs, or external services required. Everything runs locally and offline.
301423
0 commit comments