@releasekit/notes 0.19.2 → 0.20.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 +2 -1
- package/dist/{aggregator-CGD3KEVU.js → aggregator-GXJXPM7O.js} +2 -2
- package/dist/{chunk-XMSBOPFR.js → chunk-L34QVI62.js} +1 -1
- package/dist/{chunk-77FGMGVD.js → chunk-QCJ545PJ.js} +163 -10
- package/dist/{chunk-C4MRRHW7.js → chunk-UWUSIQSW.js} +953 -328
- package/dist/cli.js +2 -2
- package/dist/index.js +3 -3
- package/docs/configuration.md +139 -22
- package/docs/llm-providers.md +53 -19
- package/docs/llm-release-notes.md +464 -0
- package/docs/templates.md +33 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ LLM configuration lives under `notes.releaseNotes.llm`:
|
|
|
140
140
|
|------|-------------|
|
|
141
141
|
| `enhance` | Rewrites each changelog entry description to be clearer |
|
|
142
142
|
| `summarize` | Generates a one-paragraph summary of the release |
|
|
143
|
-
| `categorize` | Groups entries into
|
|
143
|
+
| `categorize` | Groups entries into semantic categories (default set: Breaking, New, Changed, Fixed, Developer) |
|
|
144
144
|
| `releaseNotes` | Generates full prose release notes (use as GitHub release body) |
|
|
145
145
|
|
|
146
146
|
## Templates
|
|
@@ -239,6 +239,7 @@ const result = await runPipeline(input, config, false);
|
|
|
239
239
|
- [LLM providers](./docs/llm-providers.md) — provider setup, auth, tasks, prompt customisation
|
|
240
240
|
|
|
241
241
|
**Guides**
|
|
242
|
+
- [LLM-enhanced release notes](./docs/llm-release-notes.md) — full guide to LLM tasks, categories, output rendering
|
|
242
243
|
- [Templates](./docs/templates.md) — custom template authoring and context reference
|
|
243
244
|
- [Monorepo](./docs/monorepo.md) — per-package and root output modes
|
|
244
245
|
|
|
@@ -129,13 +129,17 @@ function groupEntriesByType(entries) {
|
|
|
129
129
|
}
|
|
130
130
|
return grouped;
|
|
131
131
|
}
|
|
132
|
-
function formatEntry(entry) {
|
|
132
|
+
function formatEntry(entry, opts) {
|
|
133
133
|
let line;
|
|
134
|
-
if (entry.
|
|
134
|
+
if (entry.leadIn && entry.breaking) {
|
|
135
|
+
line = `- **BREAKING** **${entry.leadIn}**: ${entry.description}`;
|
|
136
|
+
} else if (entry.leadIn) {
|
|
137
|
+
line = `- **${entry.leadIn}**: ${entry.description}`;
|
|
138
|
+
} else if (entry.breaking && entry.scope && !opts?.hideScope) {
|
|
135
139
|
line = `- **BREAKING** **${entry.scope}**: ${entry.description}`;
|
|
136
140
|
} else if (entry.breaking) {
|
|
137
141
|
line = `- **BREAKING** ${entry.description}`;
|
|
138
|
-
} else if (entry.scope) {
|
|
142
|
+
} else if (entry.scope && !opts?.hideScope) {
|
|
139
143
|
line = `- **${entry.scope}**: ${entry.description}`;
|
|
140
144
|
} else {
|
|
141
145
|
line = `- ${entry.description}`;
|
|
@@ -145,6 +149,138 @@ function formatEntry(entry) {
|
|
|
145
149
|
}
|
|
146
150
|
return line;
|
|
147
151
|
}
|
|
152
|
+
function formatCategorySection(name, entries) {
|
|
153
|
+
const lines = [];
|
|
154
|
+
lines.push(`### ${name}`);
|
|
155
|
+
const scopeCounts = /* @__PURE__ */ new Map();
|
|
156
|
+
for (const entry of entries) {
|
|
157
|
+
if (entry.scope) scopeCounts.set(entry.scope, (scopeCounts.get(entry.scope) ?? 0) + 1);
|
|
158
|
+
}
|
|
159
|
+
const groupedScopes = /* @__PURE__ */ new Set();
|
|
160
|
+
for (const [scope, count] of scopeCounts) {
|
|
161
|
+
if (count > 1) groupedScopes.add(scope);
|
|
162
|
+
}
|
|
163
|
+
if (groupedScopes.size === 0) {
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
lines.push(formatEntry(entry));
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
169
|
+
for (const entry of entries) {
|
|
170
|
+
if (entry.scope && groupedScopes.has(entry.scope)) {
|
|
171
|
+
const group = byScope.get(entry.scope) ?? [];
|
|
172
|
+
group.push(entry);
|
|
173
|
+
byScope.set(entry.scope, group);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const renderedScopes = /* @__PURE__ */ new Set();
|
|
177
|
+
for (const entry of entries) {
|
|
178
|
+
if (entry.scope && groupedScopes.has(entry.scope)) {
|
|
179
|
+
if (!renderedScopes.has(entry.scope)) {
|
|
180
|
+
renderedScopes.add(entry.scope);
|
|
181
|
+
lines.push(`**${entry.scope}**:`);
|
|
182
|
+
for (const e of byScope.get(entry.scope) ?? []) {
|
|
183
|
+
lines.push(formatEntry(e, { hideScope: true }));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
lines.push(formatEntry(entry));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
lines.push("");
|
|
192
|
+
return lines;
|
|
193
|
+
}
|
|
194
|
+
function rerouteBreakingEntries(categories) {
|
|
195
|
+
const hasBreaking = categories.some((c) => c.entries.some((e) => e.breaking));
|
|
196
|
+
if (!hasBreaking) return categories;
|
|
197
|
+
const breakingEntries = [];
|
|
198
|
+
const stripped = categories.map((c) => ({
|
|
199
|
+
...c,
|
|
200
|
+
entries: c.entries.filter((e) => {
|
|
201
|
+
if (e.breaking) {
|
|
202
|
+
breakingEntries.push(e);
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
return true;
|
|
206
|
+
})
|
|
207
|
+
}));
|
|
208
|
+
const breakingCatIdx = stripped.findIndex((c) => c.name === "Breaking");
|
|
209
|
+
if (breakingCatIdx >= 0) {
|
|
210
|
+
return stripped.map((c, i) => i === breakingCatIdx ? { ...c, entries: [...breakingEntries, ...c.entries] } : c);
|
|
211
|
+
}
|
|
212
|
+
return [{ name: "Breaking", entries: breakingEntries }, ...stripped.filter((c) => c.entries.length > 0)];
|
|
213
|
+
}
|
|
214
|
+
function applyOrder(categories, order) {
|
|
215
|
+
if (order.length === 0) return categories;
|
|
216
|
+
return [...categories].sort((a, b) => {
|
|
217
|
+
const ai = order.indexOf(a.name);
|
|
218
|
+
const bi = order.indexOf(b.name);
|
|
219
|
+
const rank = (name, idx) => idx === -1 ? name === "Breaking" ? -1 : order.length : idx;
|
|
220
|
+
return rank(a.name, ai) - rank(b.name, bi);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function parseMdLink(text) {
|
|
224
|
+
let search = 0;
|
|
225
|
+
while (search < text.length) {
|
|
226
|
+
const bracketOpen = text.indexOf("[", search);
|
|
227
|
+
if (bracketOpen === -1) return null;
|
|
228
|
+
const bracketClose = text.indexOf("]", bracketOpen + 1);
|
|
229
|
+
if (bracketClose === -1) return null;
|
|
230
|
+
if (text[bracketClose + 1] !== "(") {
|
|
231
|
+
search = bracketClose + 1;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const parenClose = text.indexOf(")", bracketClose + 2);
|
|
235
|
+
if (parenClose === -1) return null;
|
|
236
|
+
const label = text.slice(bracketOpen + 1, bracketClose);
|
|
237
|
+
const url = text.slice(bracketClose + 2, parenClose);
|
|
238
|
+
if (/^https?:\/\//.test(url)) return { label, url };
|
|
239
|
+
search = parenClose + 1;
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function extractLinksFromPRBodies(entries, marker) {
|
|
244
|
+
const seen = /* @__PURE__ */ new Set();
|
|
245
|
+
const links = [];
|
|
246
|
+
for (const entry of entries) {
|
|
247
|
+
for (const pr of entry.context?.prs ?? []) {
|
|
248
|
+
for (const line of pr.body.split("\n")) {
|
|
249
|
+
const trimmed = line.trim();
|
|
250
|
+
if (!trimmed.startsWith(marker)) continue;
|
|
251
|
+
const rest = trimmed.slice(marker.length).trim();
|
|
252
|
+
const mdLink = parseMdLink(rest);
|
|
253
|
+
if (mdLink) {
|
|
254
|
+
if (!seen.has(mdLink.url)) {
|
|
255
|
+
seen.add(mdLink.url);
|
|
256
|
+
links.push(mdLink);
|
|
257
|
+
}
|
|
258
|
+
} else if (/^https?:\/\//.test(rest)) {
|
|
259
|
+
const url = rest.split(/\s/)[0];
|
|
260
|
+
if (!seen.has(url)) {
|
|
261
|
+
seen.add(url);
|
|
262
|
+
links.push({ label: marker.replace(/:$/, ""), url });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return links;
|
|
269
|
+
}
|
|
270
|
+
function resolveLinks(entries, linksConfig) {
|
|
271
|
+
if (!linksConfig) return [];
|
|
272
|
+
const items = linksConfig.items ?? [];
|
|
273
|
+
const discovered = linksConfig.fromPRBodyMarker ? extractLinksFromPRBodies(entries, linksConfig.fromPRBodyMarker) : [];
|
|
274
|
+
const seen = new Set(items.map((i) => i.url));
|
|
275
|
+
const merged = [...items];
|
|
276
|
+
for (const link of discovered) {
|
|
277
|
+
if (!seen.has(link.url)) {
|
|
278
|
+
seen.add(link.url);
|
|
279
|
+
merged.push(link);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return merged;
|
|
283
|
+
}
|
|
148
284
|
function formatVersion(context, options) {
|
|
149
285
|
const lines = [];
|
|
150
286
|
const versionLabel = options?.includePackageName && context.packageName ? `${context.packageName}@${context.version}` : context.version;
|
|
@@ -159,14 +295,31 @@ function formatVersion(context, options) {
|
|
|
159
295
|
lines.push(context.enhanced.summary);
|
|
160
296
|
lines.push("");
|
|
161
297
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
lines.push(
|
|
298
|
+
if (context.enhanced?.categories && context.enhanced.categories.length > 0) {
|
|
299
|
+
let categories = rerouteBreakingEntries(context.enhanced.categories);
|
|
300
|
+
categories = applyOrder(categories, options?.categoryOrder ?? []);
|
|
301
|
+
for (const category of categories) {
|
|
302
|
+
if (category.entries.length === 0) continue;
|
|
303
|
+
lines.push(...formatCategorySection(category.name, category.entries));
|
|
304
|
+
}
|
|
305
|
+
const links = resolveLinks(context.entries, options?.links);
|
|
306
|
+
if (links.length > 0) {
|
|
307
|
+
lines.push(`### ${options?.links?.title ?? "Links"}`);
|
|
308
|
+
for (const link of links) {
|
|
309
|
+
lines.push(`- [${link.label}](${link.url})`);
|
|
310
|
+
}
|
|
311
|
+
lines.push("");
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
const grouped = groupEntriesByType(context.entries);
|
|
315
|
+
for (const [type, entries] of grouped) {
|
|
316
|
+
if (entries.length === 0) continue;
|
|
317
|
+
lines.push(`### ${TYPE_LABELS[type]}`);
|
|
318
|
+
for (const entry of entries) {
|
|
319
|
+
lines.push(formatEntry(entry));
|
|
320
|
+
}
|
|
321
|
+
lines.push("");
|
|
168
322
|
}
|
|
169
|
-
lines.push("");
|
|
170
323
|
}
|
|
171
324
|
return lines.join("\n");
|
|
172
325
|
}
|