mkpr-cli 1.0.0
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 +195 -0
- package/black-favicon.svg +42 -0
- package/package.json +34 -0
- package/src/index.js +1161 -0
- package/white-favicon.svg +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# mkpr - Make Pull Request Messages Automatically
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<picture>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="./black-favicon.svg">
|
|
6
|
+
<source media="(prefers-color-scheme: light)" srcset="./white-favicon.svg">
|
|
7
|
+
<img src="./black-favicon.svg" alt="mkcommit logo" width="150">
|
|
8
|
+
</picture>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
CLI to automatically generate Pull Request descriptions using **Ollama** with local AI.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- ✨ Generates complete and professional PR descriptions
|
|
16
|
+
- 🔍 Compares your current branch against the base branch (origin/main by default)
|
|
17
|
+
- 📝 Saves the description to a `{branch_name}_pr.md` file
|
|
18
|
+
- 🤖 Uses local AI models through **Ollama**
|
|
19
|
+
- 🎨 Interactive interface with colors and spinners
|
|
20
|
+
- ⚙️ Persistent configuration
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
### From the project directory:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Or run without installing:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
node src/index.js
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
- **Node.js** >= 14.0.0
|
|
39
|
+
- **Ollama** running locally
|
|
40
|
+
- A model installed in Ollama (e.g.: `ollama pull llama3.2`)
|
|
41
|
+
- Be in a git repository with a branch different from base
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Generate PR description
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# While on your feature branch
|
|
49
|
+
mkpr
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Execution options
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Compare against a different base branch (this run only)
|
|
56
|
+
mkpr -b develop
|
|
57
|
+
|
|
58
|
+
# Save to a specific directory (this run only)
|
|
59
|
+
mkpr -o ./docs/prs
|
|
60
|
+
|
|
61
|
+
# Only view the description without saving file
|
|
62
|
+
mkpr --dry-run
|
|
63
|
+
|
|
64
|
+
# Combine options
|
|
65
|
+
mkpr -b develop -o ./prs --dry-run
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Persistent configuration
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# View current configuration
|
|
72
|
+
mkpr --show-config
|
|
73
|
+
|
|
74
|
+
# Change Ollama model
|
|
75
|
+
mkpr --set-model llama3.1
|
|
76
|
+
|
|
77
|
+
# Change Ollama port
|
|
78
|
+
mkpr --set-port 11434
|
|
79
|
+
|
|
80
|
+
# Change default base branch
|
|
81
|
+
mkpr --set-base develop
|
|
82
|
+
|
|
83
|
+
# Change default output directory
|
|
84
|
+
mkpr --set-output ./docs/prs
|
|
85
|
+
|
|
86
|
+
# List available models
|
|
87
|
+
mkpr --list-models
|
|
88
|
+
|
|
89
|
+
# View help
|
|
90
|
+
mkpr --help
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Workflow
|
|
94
|
+
|
|
95
|
+
1. Create your feature branch: `git checkout -b feature/new-functionality`
|
|
96
|
+
2. Make your commits as usual
|
|
97
|
+
3. When ready for the PR, run: `mkpr`
|
|
98
|
+
4. The CLI:
|
|
99
|
+
- Runs `git fetch origin` to update
|
|
100
|
+
- Compares your branch against `origin/main` (or configured branch)
|
|
101
|
+
- Gets all commits, changed files, and the diff
|
|
102
|
+
- Generates a description using AI
|
|
103
|
+
5. You can:
|
|
104
|
+
- ✅ **Accept** and save the file
|
|
105
|
+
- 🔄 **Regenerate** another description
|
|
106
|
+
- ✏️ **Edit** the title manually
|
|
107
|
+
- ❌ **Cancel** the operation
|
|
108
|
+
|
|
109
|
+
## Output example
|
|
110
|
+
|
|
111
|
+
The generated file `feature_new-functionality_pr.md` will contain:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
## Description
|
|
115
|
+
This PR implements the new functionality of...
|
|
116
|
+
|
|
117
|
+
## Changes made
|
|
118
|
+
- Added new component X
|
|
119
|
+
- Modified service Y to support Z
|
|
120
|
+
- Updated documentation
|
|
121
|
+
|
|
122
|
+
## Change type
|
|
123
|
+
feature
|
|
124
|
+
|
|
125
|
+
## Checklist
|
|
126
|
+
- [ ] Code follows project standards
|
|
127
|
+
- [ ] Tests have been added (if applicable)
|
|
128
|
+
- [ ] Documentation has been updated (if applicable)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Usage example
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
$ mkpr
|
|
135
|
+
|
|
136
|
+
🔍 Analyzing differences with base branch...
|
|
137
|
+
|
|
138
|
+
✔ Repository updated
|
|
139
|
+
📌 Current branch: feature/add-user-auth
|
|
140
|
+
📌 Base branch: origin/main
|
|
141
|
+
📝 Commits: 5
|
|
142
|
+
📁 Files: 12
|
|
143
|
+
|
|
144
|
+
📁 Modified files:
|
|
145
|
+
[A] src/auth/AuthService.js
|
|
146
|
+
[A] src/auth/AuthController.js
|
|
147
|
+
[M] src/routes/index.js
|
|
148
|
+
[M] package.json
|
|
149
|
+
... and 8 more files
|
|
150
|
+
|
|
151
|
+
- Generating description with llama3.2...
|
|
152
|
+
✔ Description generated
|
|
153
|
+
|
|
154
|
+
📝 Proposed PR description:
|
|
155
|
+
────────────────────────────────────────────────────────────
|
|
156
|
+
## Description
|
|
157
|
+
This PR implements the user authentication system...
|
|
158
|
+
|
|
159
|
+
## Changes made
|
|
160
|
+
- New authentication service with JWT
|
|
161
|
+
- Login and registration endpoints
|
|
162
|
+
- Token validation middleware
|
|
163
|
+
...
|
|
164
|
+
────────────────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
? What would you like to do? (Use arrow keys)
|
|
167
|
+
❯ ✅ Accept and save file
|
|
168
|
+
🔄 Generate another description
|
|
169
|
+
✏️ Edit title manually
|
|
170
|
+
❌ Cancel
|
|
171
|
+
|
|
172
|
+
✔ File saved: ./feature_add-user-auth_pr.md
|
|
173
|
+
|
|
174
|
+
💡 Tip: You can copy the file content for your PR.
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Default configuration
|
|
178
|
+
|
|
179
|
+
| Option | Default value |
|
|
180
|
+
|--------|---------------|
|
|
181
|
+
| Port | `11434` |
|
|
182
|
+
| Model | `llama3.2` |
|
|
183
|
+
| Base branch | `main` |
|
|
184
|
+
| Output directory | `.` (current directory) |
|
|
185
|
+
|
|
186
|
+
## Tips
|
|
187
|
+
|
|
188
|
+
- The file is saved with the branch name, replacing special characters
|
|
189
|
+
- Use `--dry-run` to preview without creating files
|
|
190
|
+
- If you work with `develop` as base branch, use `mkpr --set-base develop` once
|
|
191
|
+
- You can regenerate the description as many times as you want before accepting
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="150px"
|
|
6
|
+
height="150px"
|
|
7
|
+
viewBox="0 0 125.2802 177.15496"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg1"
|
|
10
|
+
xml:space="preserve"
|
|
11
|
+
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
|
|
12
|
+
sodipodi:docname="mkpr.svg"
|
|
13
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
14
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
|
17
|
+
id="namedview1"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#000000"
|
|
20
|
+
borderopacity="0.25"
|
|
21
|
+
inkscape:showpageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:deskcolor="#d1d1d1"
|
|
25
|
+
inkscape:document-units="mm"
|
|
26
|
+
inkscape:zoom="0.68862935"
|
|
27
|
+
inkscape:cx="227.26304"
|
|
28
|
+
inkscape:cy="317.29696"
|
|
29
|
+
inkscape:window-width="1920"
|
|
30
|
+
inkscape:window-height="991"
|
|
31
|
+
inkscape:window-x="-9"
|
|
32
|
+
inkscape:window-y="-9"
|
|
33
|
+
inkscape:window-maximized="1"
|
|
34
|
+
inkscape:current-layer="layer1" /><defs
|
|
35
|
+
id="defs1" /><g
|
|
36
|
+
inkscape:label="Layer 1"
|
|
37
|
+
inkscape:groupmode="layer"
|
|
38
|
+
id="layer1"
|
|
39
|
+
transform="translate(-45.061642,-64.722884)"><path
|
|
40
|
+
style="fill:#000000"
|
|
41
|
+
d="m 119.20163,223.48204 -0.0661,-18.39579 h 3.31204 3.31204 v 1.84512 1.84512 l 1.13889,-1.13889 c 4.09772,-4.09772 12.31458,-4.02552 16.55658,0.14549 1.57835,1.55194 2.78967,3.44951 3.51427,5.50524 0.51246,1.45385 0.60627,2.25168 0.60665,5.15938 6.5e-4,4.8615 -0.7666,7.02574 -3.54278,9.99349 -2.67163,2.85598 -5.84381,4.07508 -9.93924,3.81974 -2.71335,-0.16917 -4.77875,-0.95477 -6.44222,-2.45037 -0.71965,-0.64702 -1.38402,-1.1764 -1.4764,-1.1764 -0.0924,0 -0.15598,2.94679 -0.14136,6.54843 l 0.0266,6.54844 -3.39638,0.0734 -3.39637,0.0734 z m 16.39861,2.7243 c 1.28327,-0.38447 3.24675,-2.07646 3.89808,-3.35908 2.24248,-4.41596 0.53309,-10.11795 -3.54392,-11.82143 -0.50459,-0.21083 -1.73132,-0.38333 -2.72607,-0.38333 -3.21089,0 -5.53007,1.6471 -6.70578,4.7625 -0.78412,2.07777 -0.61576,5.39165 0.37165,7.31542 1.57581,3.07014 5.22154,4.52991 8.70604,3.48592 z m -90.538598,-7.75863 v -13.36146 h 3.30729 3.30729 v 1.88933 1.88934 l 1.0845,-1.23206 c 1.39361,-1.58323 2.86506,-2.42456 4.94342,-2.82653 3.8383,-0.74235 7.33865,0.55364 9.07584,3.3603 l 0.51462,0.83141 1.64966,-1.62767 c 1.14315,-1.12791 2.05587,-1.76902 2.97259,-2.088 4.32224,-1.50396 9.49936,-0.36775 11.44917,2.51272 1.78642,2.6391 1.76532,2.48293 1.85992,13.76147 l 0.086,10.25261 h -3.4564 -3.4564 l -10e-4,-8.40052 c -8.7e-4,-4.96208 -0.11333,-8.80328 -0.27475,-9.3845 -0.98322,-3.54023 -5.65496,-4.60193 -7.99783,-1.81758 -1.36066,1.61705 -1.51553,2.80045 -1.51553,11.58083 v 8.02177 h -3.43958 -3.43958 l -10e-4,-8.40052 c -8.9e-4,-5.04543 -0.11233,-8.79969 -0.27902,-9.39994 -0.88423,-3.18408 -4.83245,-4.40392 -7.28481,-2.25071 -1.83838,1.61411 -1.81842,1.49653 -1.90974,11.25377 l -0.0823,8.7974 h -3.55564 -3.55568 z m 44.97916,-4.88711 v -18.26393 l 3.50573,5.1e-4 3.50573,5.1e-4 v 10.59732 10.59732 l 0.52917,-0.64233 c 0.29104,-0.35329 2.41107,-2.91966 4.711178,-5.70304 l 4.18201,-5.06071 h 4.08621 c 2.24742,0 4.08622,0.0732 4.08622,0.16264 0,0.0894 -1.16515,1.48844 -2.58921,3.10885 -6.87776,7.82605 -7.77272,8.92546 -7.52368,9.24235 0.13764,0.17515 2.70748,3.38453 5.71074,7.13195 3.00327,3.74743 5.46049,6.87577 5.46049,6.95187 0,0.0761 -1.92471,0.10565 -4.27713,0.0657 l -4.27713,-0.0727 -4.85227,-6.2177 c -2.668738,-3.41974 -4.940988,-6.24757 -5.049428,-6.28406 -0.10844,-0.0365 -0.19717,2.76148 -0.19717,6.21771 v 6.28405 l -3.50573,0.0738 -3.50573,0.0738 z M 151.843,231.58017 c -0.0778,-0.12595 -0.1323,-6.13861 -0.12103,-13.36146 l 0.0205,-13.13246 h 3.545 3.54501 l 0.0156,2.18281 c 0.0129,1.80294 0.0704,2.09375 0.33073,1.67102 1.6177,-2.62696 4.22652,-4.08397 7.49487,-4.18585 l 2.08071,-0.0649 0.0732,3.57187 0.0732,3.57187 -2.2014,-0.0911 c -1.21077,-0.0501 -2.70897,0.0456 -3.32935,0.21268 -1.49414,0.40233 -3.00606,1.81033 -3.77831,3.51861 -0.60422,1.33658 -0.63001,1.65778 -0.7115,8.86133 l -0.0846,7.47448 h -3.40555 c -1.87306,0 -3.46925,-0.10305 -3.54709,-0.229 z M 65.107372,181.00315 c -1.713,-0.29208 -3.73587,-0.97374 -5.59788,-1.88635 -4.82242,-2.36358 -8.61837,-7.05662 -9.96439,-12.31927 -0.5155,-2.01546 -0.52675,-2.96953 -0.51793,-43.89955 0.009,-40.757081 0.0225,-41.892062 0.53068,-43.879008 1.72106,-6.729293 6.92096,-11.800524 14.04851,-13.700912 l 2.22507,-0.593259 h 43.656248 c 49.00256,0 45.46102,-0.139431 49.78034,1.959871 5.36037,2.605278 9.01161,6.902678 10.58646,12.45992 0.46417,1.637966 0.48736,3.721371 0.48736,43.788538 0,39.48528 -0.0289,42.17436 -0.4701,43.78854 -1.84544,6.75121 -6.70838,11.6437 -13.73247,13.81593 l -1.93701,0.59903 -43.92083,0.0401 c -24.156458,0.0221 -44.484788,-0.0561 -45.174058,-0.17358 z m 26.72384,-14.34763 c 1.44672,-1.49159 3.92504,-4.11096 5.50739,-5.82083 l 2.876988,-3.10885 18.39438,-0.001 c 12.59919,-0.001 18.7278,-0.0935 19.45271,-0.2936 1.42289,-0.39275 3.6778,-2.64766 4.07055,-4.07055 0.19403,-0.70296 0.29175,-5.23399 0.29101,-13.49375 l -0.001,-12.43541 -0.62474,-1.34167 c -0.73743,-1.58367 -2.17174,-2.85291 -3.69769,-3.27214 -0.79599,-0.21868 -8.74365,-0.28031 -29.0099,-0.22495 -25.401058,0.0694 -27.985478,0.11572 -28.712788,0.51471 -1.10898,0.60837 -2.19312,1.74256 -2.86537,2.99766 -0.55925,1.04413 -0.56871,1.27314 -0.56871,13.7618 0,14.47921 -0.0186,14.33708 2.12104,16.22045 1.45218,1.27826 2.65136,1.63889 5.45028,1.63906 l 2.21826,1.4e-4 v 5.4453 c 0,5.08494 0.034,5.47014 0.51359,5.8207 1.16332,0.85029 1.81556,0.51783 4.58411,-2.33659 z m -4.61384,-19.89536 c -1.53288,-0.67292 -1.91985,-2.57134 -0.76047,-3.73072 l 0.64943,-0.64944 h 15.634468 15.63447 l 0.64943,0.64944 c 0.91305,0.91304 0.89763,2.4647 -0.0332,3.33934 l -0.68263,0.64143 -15.12622,0.0591 c -12.443718,0.0487 -15.275018,-0.006 -15.965278,-0.3092 z m 0.24902,-9.85786 c -1.59692,-0.30845 -2.1997,-2.77764 -0.95883,-3.92764 l 0.7001,-0.64882 h 22.471298 22.4713 l 0.77339,0.77339 c 0.86596,0.86596 0.96056,1.5368 0.3761,2.66701 -0.26846,0.51915 -0.7189,0.85761 -1.38906,1.04372 -0.96077,0.26682 -43.087878,0.35435 -44.444298,0.0923 z m 40.893688,-21.32893 c 1.07428,-0.5862 1.63281,-1.82172 1.63281,-3.61195 v -1.33141 l 1.38906,-9.9e-4 c 1.72204,-10e-4 2.99333,-0.71624 3.52165,-1.98069 0.48979,-1.17223 0.50561,-5.14544 0.0251,-6.29505 -0.54752,-1.30984 -1.12347,-1.6319 -3.17861,-1.77744 l -1.86808,-0.13229 -0.20522,-0.993267 c -0.55918,-2.706531 -2.96631,-5.669336 -5.62974,-6.92934 -2.07805,-0.983074 -3.62392,-1.205518 -8.37774,-1.205518 h -4.19722 v -3.05979 c 0,-3.046758 0.003,-3.062521 0.76215,-3.701091 2.23161,-1.87778 2.0884,-5.095767 -0.29704,-6.674375 -1.96429,-1.299906 -4.69638,-0.692845 -5.87256,1.304867 -0.99497,1.68992 -0.39767,4.499378 1.15909,5.451902 0.50044,0.306198 0.5442,0.588082 0.5442,3.505729 v 3.172758 h -4.60234 c -5.585378,0 -7.183808,0.382235 -9.723178,2.325116 -1.88324,1.440874 -3.54346,3.95212 -3.81649,5.772801 l -0.17433,1.162498 h -1.65406 c -2.90604,0 -3.59264,1.08822 -3.47003,5.49983 0.055,1.97768 0.17228,2.59719 0.60122,3.175 0.73398,0.98871 1.5846,1.37085 3.0616,1.37543 l 1.25677,0.004 v 1.48053 c 0,2.3887 0.95131,3.52739 3.175,3.80039 0.65485,0.0804 8.810628,0.14546 18.123958,0.1446 15.86151,-0.001 16.98908,-0.032 17.81407,-0.48216 z m -28.956168,-5.45372 c -0.30732,-0.13162 -0.81334,-0.56294 -1.12448,-0.95849 -0.51315,-0.65236 -0.56571,-1.04444 -0.56571,-4.2197 0,-3.07976 0.0625,-3.58 0.5202,-4.16183 1.19692,-1.521645 3.419098,-1.605514 4.623228,-0.17449 0.6531,0.77617 0.6774,0.9323 0.6774,4.35245 0,3.49611 -0.0105,3.55917 -0.7276,4.36166 -0.78688,0.8806 -2.35475,1.24936 -3.403038,0.8004 z m 18.179058,-0.0746 c -1.22905,-0.6592 -1.55431,-1.48517 -1.70389,-4.32679 -0.16402,-3.11601 0.0763,-4.45433 0.95809,-5.33615 1.33709,-1.337088 4.047,-0.833545 4.69564,0.87252 0.1419,0.37321 0.25799,2.15722 0.25799,3.96446 0,3.21082 -0.0166,3.30449 -0.7276,4.10015 -0.84321,0.94363 -2.44951,1.27863 -3.48023,0.72581 z"
|
|
42
|
+
id="path1" /></g></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mkpr-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI para generar descripciones de PR usando Ollama AI",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mkpr": "./src/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node src/index.js",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"git",
|
|
15
|
+
"pull-request",
|
|
16
|
+
"pr",
|
|
17
|
+
"ai",
|
|
18
|
+
"ollama",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
21
|
+
"author": "Felipe",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"chalk": "^4.1.2",
|
|
25
|
+
"commander": "^11.1.0",
|
|
26
|
+
"conf": "^10.2.0",
|
|
27
|
+
"inquirer": "^8.2.6",
|
|
28
|
+
"node-fetch": "^2.7.0",
|
|
29
|
+
"ora": "^5.4.1"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=14.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|