Skip to content

Commit 0a7d479

Browse files
committed
feat(changelog): Add AI-powered summaries using GitHub Models API
Add optional AI-powered summarization for changelog sections using GitHub Models API. Uses your existing GitHub token—no additional API keys required. Features: - Summarizes sections with >5 items into concise prose (40-60% compression) - Uses GPT-4o-mini by default via GitHub Models API - Configurable model selection (GPT-4o, Llama, etc.) - Graceful degradation if token unavailable - Eval tests using vitest-evals for quality validation Configuration: aiSummaries: enabled: true kickInThreshold: 5 model: openai/gpt-4o-mini
1 parent ae245c2 commit 0a7d479

13 files changed

Lines changed: 1012 additions & 213 deletions

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,35 @@ craft publish 1.2.3
4444
- **Workspace Support** - Handle monorepos with NPM/Yarn workspaces
4545
- **CI Integration** - Wait for CI to pass, download artifacts, and publish
4646
- **GitHub Actions** - Built-in actions for release preparation and changelog previews
47+
- **AI Summaries** - Optionally summarize verbose changelog sections using GitHub Models API
48+
49+
## AI-Powered Changelog Summaries
50+
51+
Craft can use [GitHub Models](https://github.com/marketplace/models) to summarize changelog sections with many entries into concise descriptions. Uses your existing GitHub token—no additional API keys required.
52+
53+
```yaml
54+
aiSummaries:
55+
enabled: true
56+
kickInThreshold: 5 # Only summarize sections with >5 items
57+
model: "openai/gpt-4o-mini" # optional, see available models below
58+
```
59+
60+
### Authentication
61+
62+
The feature uses your GitHub token automatically:
63+
- From `GITHUB_TOKEN` environment variable, or
64+
- From `gh auth token` (GitHub CLI)
65+
66+
### Available Models
67+
68+
You can use any model from [GitHub Marketplace Models](https://github.com/marketplace/models):
69+
70+
```yaml
71+
aiSummaries:
72+
model: "openai/gpt-4o-mini" # Default, fast and capable
73+
model: "openai/gpt-4o" # More capable, slower
74+
model: "meta/meta-llama-3.1-8b-instruct" # Open source alternative
75+
```
4776

4877
## Configuration
4978

blog-post-draft.md

Lines changed: 0 additions & 206 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import prettier from 'eslint-config-prettier';
44

55
export default tseslint.config(
66
{
7-
ignores: ['docs/**', 'dist/**', 'node_modules/**', 'coverage/**', '*.mjs', '**/*.js'],
7+
ignores: ['docs/**', 'dist/**', 'node_modules/**', 'coverage/**', '**/*.mjs', '**/*.js'],
88
},
99
eslint.configs.recommended,
1010
...tseslint.configs.recommended,

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"devDependencies": {
1414
"@aws-sdk/client-lambda": "^3.723.0",
15+
"@eslint/js": "^9.17.0",
1516
"@google-cloud/storage": "^7.14.0",
1617
"@octokit/plugin-retry": "^7.1.2",
1718
"@octokit/request-error": "^7.0.0",
@@ -35,9 +36,6 @@
3536
"@types/tar": "^4.0.0",
3637
"@types/tmp": "^0.0.33",
3738
"@types/yargs": "^17",
38-
"@eslint/js": "^9.17.0",
39-
"typescript-eslint": "^8.18.2",
40-
"zod": "^3.24.1",
4139
"async": "3.2.2",
4240
"aws4": "^1.11.0",
4341
"chalk": "4.1.1",
@@ -52,7 +50,6 @@
5250
"git-url-parse": "^16.1.0",
5351
"glob": "^11.0.0",
5452
"is-ci": "^2.0.0",
55-
"vitest": "^3.0.2",
5653
"js-yaml": "4.1.1",
5754
"mkdirp": "^1.0.4",
5855
"mustache": "3.0.1",
@@ -71,7 +68,11 @@
7168
"tar": "6.2.1",
7269
"tmp": "0.2.4",
7370
"typescript": "^5.7.2",
74-
"yargs": "^18"
71+
"typescript-eslint": "^8.18.2",
72+
"vitest": "^3.0.2",
73+
"vitest-evals": "^0.5.0",
74+
"yargs": "^18",
75+
"zod": "^3.24.1"
7576
},
7677
"scripts": {
7778
"build:fat": "tsc -p tsconfig.build.json",
@@ -84,6 +85,7 @@
8485
"fix": "yarn lint --fix",
8586
"test": "vitest run",
8687
"test:watch": "vitest",
88+
"test:evals": "vitest run --config vitest.evals.config.ts",
8789
"docs:dev": "cd docs && yarn dev",
8890
"docs:build": "cd docs && yarn build"
8991
},
@@ -92,6 +94,8 @@
9294
"yarn": "1.22.19"
9395
},
9496
"dependencies": {
97+
"@github/models": "^0.0.1-beta.2",
98+
"ai": "^6.0.3",
9599
"marked": "^17.0.1"
96100
}
97101
}

0 commit comments

Comments
 (0)