cli-changescribe 0.1.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/LICENSE +21 -0
- package/README.md +65 -0
- package/bin/changescribe.js +64 -0
- package/package.json +32 -0
- package/src/commit.js +714 -0
- package/src/init.js +61 -0
- package/src/pr-summary.js +954 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Ulloa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# changescribe
|
|
2
|
+
|
|
3
|
+
CLI to generate Conventional Commit messages and PR summaries using Groq.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g cli-changescribe
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Create a `.env.local` file in the repo where you run the CLI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
GROQ_API_KEY="your-key-here"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Optional environment variables for PR summaries:
|
|
20
|
+
|
|
21
|
+
- `PR_SUMMARY_BASE` (default: `main`)
|
|
22
|
+
- `PR_SUMMARY_OUT` (default: `.pr-summaries/PR_SUMMARY.md`)
|
|
23
|
+
- `PR_SUMMARY_LIMIT` (default: `400`)
|
|
24
|
+
- `PR_SUMMARY_ISSUE` (default: empty)
|
|
25
|
+
- `GROQ_PR_MODEL` (default: `openai/gpt-oss-120b`)
|
|
26
|
+
- `GROQ_MODEL` (fallback)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Init scripts in a repo
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx changescribe init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Commit message
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
changescribe commit --dry-run
|
|
40
|
+
changescribe commit
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### PR summary
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
changescribe pr --base main --mode release
|
|
47
|
+
changescribe pr --base main --create-pr --mode release
|
|
48
|
+
changescribe pr --dry-run
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Npm script parity aliases
|
|
52
|
+
|
|
53
|
+
These match the npm scripts in your repo:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
changescribe pr:summary
|
|
57
|
+
changescribe feature:pr
|
|
58
|
+
changescribe staging:pr
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Notes
|
|
62
|
+
|
|
63
|
+
- `changescribe commit` stages changes if nothing is staged and commits/pushes by default.
|
|
64
|
+
- `changescribe pr` can create or update a GitHub PR when `--create-pr` is passed (requires `gh`).
|
|
65
|
+
- The CLI must be run inside a git repo.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { runCommit } = require('../src/commit');
|
|
4
|
+
const { runInit } = require('../src/init');
|
|
5
|
+
const { runPrSummary } = require('../src/pr-summary');
|
|
6
|
+
|
|
7
|
+
function printHelp() {
|
|
8
|
+
console.log(`changescribe <command> [options]
|
|
9
|
+
|
|
10
|
+
Commands:
|
|
11
|
+
commit Generate a commit message and commit/push changes
|
|
12
|
+
pr Generate a PR summary (optionally create/update PR)
|
|
13
|
+
init Add npm scripts to the current repo
|
|
14
|
+
pr:summary Alias for pr
|
|
15
|
+
feature:pr Alias for: pr --base staging --create-pr --mode feature
|
|
16
|
+
staging:pr Alias for: pr --base main --create-pr --mode release
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
changescribe init
|
|
20
|
+
changescribe commit --dry-run
|
|
21
|
+
changescribe pr --base main --mode release
|
|
22
|
+
changescribe feature:pr
|
|
23
|
+
changescribe staging:pr
|
|
24
|
+
`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function main() {
|
|
28
|
+
const [, , command, ...rest] = process.argv;
|
|
29
|
+
if (!command || command === '-h' || command === '--help') {
|
|
30
|
+
printHelp();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (command === 'commit') {
|
|
35
|
+
await runCommit(rest);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (command === 'init') {
|
|
40
|
+
await runInit();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (command === 'pr' || command === 'pr:summary') {
|
|
45
|
+
await runPrSummary(rest);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (command === 'feature:pr') {
|
|
50
|
+
await runPrSummary(['--base', 'staging', '--create-pr', '--mode', 'feature']);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (command === 'staging:pr') {
|
|
55
|
+
await runPrSummary(['--base', 'main', '--create-pr', '--mode', 'release']);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.error(`Unknown command: ${command}`);
|
|
60
|
+
printHelp();
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cli-changescribe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for generating commit messages and PR summaries",
|
|
5
|
+
"bin": {
|
|
6
|
+
"changescribe": "./bin/changescribe.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"commit",
|
|
18
|
+
"conventional-commits",
|
|
19
|
+
"pr",
|
|
20
|
+
"summary",
|
|
21
|
+
"changelog",
|
|
22
|
+
"groq"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"dotenv": "^17.2.1",
|
|
30
|
+
"groq-sdk": "^0.8.0"
|
|
31
|
+
}
|
|
32
|
+
}
|