CLI para generar descripciones de PR usando Ollama AI
npm install mkpr-cli
CLI to automatically generate Pull Request descriptions using Ollama with local AI.
- ⨠Generates complete and professional PR descriptions
- š Compares your current branch against the base branch (origin/main by default)
- š Saves the description to a {branch_name}_pr.md file
- š¤ Uses local AI models through Ollama
- šØ Interactive interface with colors and spinners
- āļø Persistent configuration
``bash`
npm install -g mkpr-cli
`bashClone the repository
git clone https://github.com/yourusername/mkpr-cli.git
cd mkpr-cli
$3
`bash
npx mkpr-cli
`Requirements
- Node.js >= 14.0.0
- Ollama running locally
- A model installed in Ollama (e.g.:
ollama pull llama3.2)
- Be in a git repository with a branch different from baseUsage
$3
`bash
While on your feature branch
mkpr
`$3
`bash
Compare against a different base branch (this run only)
mkpr -b developSave to a specific directory (this run only)
mkpr -o ./docs/prsOnly view the description without saving file
mkpr --dry-runCombine options
mkpr -b develop -o ./prs --dry-run
`$3
`bash
View current configuration
mkpr --show-configChange Ollama model (interactive selector)
mkpr --set-modelChange Ollama model (direct)
mkpr --set-model llama3.1Change Ollama port
mkpr --set-port 11434Change default base branch
mkpr --set-base developChange default output directory
mkpr --set-output ./docs/prsList available models
mkpr --list-modelsView help
mkpr --help
`$3
`bash
List excluded files
mkpr --list-excludesAdd file to exclusion list
mkpr --add-exclude "*.generated.js"Remove file from exclusion list
mkpr --remove-exclude "package-lock.json"Reset exclusion list to defaults
mkpr --reset-excludes
`Workflow
1. Create your feature branch:
git checkout -b feature/new-functionality
2. Make your commits as usual
3. When ready for the PR, run: mkpr
4. The CLI:
- Runs git fetch origin to update
- Compares your branch against origin/main (or configured branch)
- Gets all commits, changed files, and the diff
- Generates a description using AI
5. You can:
- ā
Accept and save the file
- š Regenerate another description
- āļø Edit the title manually
- š¤ Change model and regenerate
- ā Cancel the operationOutput example
The generated file
feature_new-functionality_pr.md will contain:`markdown
Add user authentication system
Type: āØ
featureBranch:
feature/add-user-auth ā origin/mainDescription
This PR implements a complete user authentication system with JWT tokens...
Changes
- Add AuthService with JWT token generation
- Implement login and registration endpoints
- Create token validation middleware
- Update route configuration
Stats
- Commits: 5
- Files changed: 12
- Files added: 4
- Files modified: 8
Checklist
- [ ] Code follows project standards
- [ ] Tests have been added (if applicable)
- [ ] Documentation has been updated (if applicable)
- [ ] Changes have been tested locally
`Usage example
`
$ mkprš Analyzing differences with base branch...
ā Repository updated
š Current branch: feature/add-user-auth
š Base branch: origin/main
š Commits: 5
š Files: 12
š Modified files:
[A] src/auth/AuthService.js
[A] src/auth/AuthController.js
[M] src/routes/index.js
[M] package.json
... and 8 more files
ā Generating description with llama3.2...
ā Description generated
š Proposed PR description:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Add user authentication system
...
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā? What would you like to do? (Use arrow keys)
⯠ā
Accept and save file
š Generate another description
āļø Edit title manually
āāāāāāāāāāāāāā
š¤ Change model
āāāāāāāāāāāāāā
ā Cancel
ā File saved: ./feature_add-user-auth_pr.md
š” Tip: You can copy the file content for your PR.
`Default configuration
| Option | Default value |
|--------|---------------|
| Port |
11434 |
| Model | llama3.2 |
| Base branch | main |
| Output directory | . (current directory) |Default excluded files
The following files are excluded from analysis by default:
-
package-lock.json, yarn.lock, pnpm-lock.yaml
- composer.lock, Gemfile.lock, poetry.lock
- Cargo.lock, pubspec.lock, packages.lock.json
- Minified files (.min.js, .min.css)
- Build directories (dist/, build/, .next/*)
- Source maps (*.map)Tips
- The file is saved with the branch name, replacing special characters
- Use
--dry-run to preview without creating files
- If you work with develop as base branch, use mkpr --set-base develop once
- You can regenerate the description as many times as you want before accepting
- Use --set-model without arguments to interactively select a modelUpdating
`bash
npm update -g mkpr-cli
`Uninstalling
`bash
npm uninstall -g mkpr-cli
``MIT