CLI para generar mensajes de commit usando Ollama AI
npm install mkcommit
CLI to automatically generate commit messages using Ollama with local AI.
- ⨠Generates commit messages following Conventional Commits
- š¤ Uses local AI models through Ollama
- šØ Interactive interface with colors and spinners
- āļø Persistent model and port configuration
- š Option to regenerate, edit, or cancel
- š« Automatic exclusion of lock files and build artifacts
``bash`
npm install -g mkcommin
`bashClone the repository
git clone https://github.com/yourusername/mkcommit.git
cd mkcommit
$3
`bash
npx mkcommin
`Requirements
- Node.js >= 14.0.0
- Ollama running locally
- A model installed in Ollama (e.g.:
ollama pull llama3.2)Usage
$3
`bash
First, add files to stage
git add .Then run mkcommit
mkcommit
`$3
`bash
View current configuration
mkcommit --show-configChange the model (interactive selector)
mkcommit --set-modelChange the model (direct)
mkcommit --set-model llama3.2Change Ollama port
mkcommit --set-port 11434List available models
mkcommit --list-modelsView help
mkcommit --help
`$3
`bash
List excluded files
mkcommit --list-excludesAdd file to exclusion list
mkcommit --add-exclude "*.generated.js"Remove file from exclusion list
mkcommit --remove-exclude "package-lock.json"Reset exclusion list to defaults
mkcommit --reset-excludes
`Workflow
1. Run
mkcommit
2. The diff of staged files is analyzed
3. Sent to Ollama to generate the message
4. You can:
- ā
Accept and make the commit
- š Regenerate a new message
- āļø Edit the message manually
- š¤ Change model and regenerate
- š Change port and regenerate
- ā Cancel the operationExample
`
$ mkcommitš Analyzing staged changes...
š Files to analyze (3):
[A] src/auth/AuthService.js
[M] src/index.js
[M] package.json
š« Excluded from analysis (1):
[skip] package-lock.json
ā Generating message with llama3.2...
ā Message generated
š¬ Proposed commit message:
feat(auth): add user authentication service
- implement JWT token generation
- add login and registration methods
- create password hashing utilities
? What would you like to do? (Use arrow keys)
⯠ā
Accept and commit
š Generate another message
āļø Edit message manually
āāāāāāāāāāāāāā
š¤ Change model
š Change port
āāāāāāāāāāāāāā
ā Cancel
ā Commit successful!
`Default configuration
| Option | Default value |
|--------|---------------|
| Port |
11434 |
| Model | llama3.2 |Default excluded files
The following files are excluded from analysis by default:
-
package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb
- composer.lock, Gemfile.lock, poetry.lock
- Cargo.lock, pubspec.lock, packages.lock.json
- Minified files (.min.js, .min.css, *.bundle.js)
- Build directories (dist/, build/, .next/*)
- Source maps (*.map)
- Binary assets (.woff, .ttf, *.ico)Conventional Commits
Generated messages follow the format:
`
(): - detail 1
- detail 2
`Valid types:
| Type | Description |
|------|-------------|
|
feat | New feature |
| fix | Bug fix |
| docs | Documentation |
| style | Formatting (no code changes) |
| refactor | Refactoring |
| perf | Performance improvements |
| test | Tests |
| build | Build system |
| ci | Continuous integration |
| chore | Maintenance tasks |
| revert | Revert changes |Tips
- Use
--set-model without arguments to interactively select a model
- Lock files are automatically excluded to keep commit analysis focused
- You can regenerate the message as many times as you want before committing
- The editor option opens your default $EDITOR for manual editingUpdating
`bash
npm update -g mkcommin
`Uninstalling
`bash
npm uninstall -g mkcommin
``MIT