@releasekit/notes 0.46.0 → 0.47.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 +1 -1
- package/dist/{aggregator-XM2XIYDF.js → aggregator-VH6ZKA4E.js} +1 -1
- package/dist/{chunk-EI7LLVJN.js → chunk-CQAOT5BE.js} +1 -6
- package/dist/{chunk-JOA56Y7A.js → chunk-OAHIISKU.js} +202 -120
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +1 -13
- package/dist/index.js +4 -8
- package/docs/llm-providers.md +2 -3
- package/docs/llm-release-notes.md +7 -9
- package/docs/templates.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ LLM configuration lives under `notes.releaseNotes.llm`:
|
|
|
109
109
|
|------|-------------|
|
|
110
110
|
| `enhance` | Rewrites each entry description in the release notes to be clearer |
|
|
111
111
|
| `summarize` | Generates a one-paragraph summary of the release |
|
|
112
|
-
| `categorize` | Groups entries into semantic categories (default set:
|
|
112
|
+
| `categorize` | Groups entries into semantic categories (default set: New, Changed, Fixed, Developer); breaking entries lead under Breaking |
|
|
113
113
|
| `releaseNotes` | Generates full prose release notes (use as GitHub release body) |
|
|
114
114
|
|
|
115
115
|
## Templates
|
|
@@ -191,12 +191,7 @@ function groupByCategory({ categories, order = [] }, entryOf) {
|
|
|
191
191
|
return true;
|
|
192
192
|
})
|
|
193
193
|
}));
|
|
194
|
-
|
|
195
|
-
if (llmBreaking) {
|
|
196
|
-
llmBreaking.items.unshift(...breaking);
|
|
197
|
-
} else {
|
|
198
|
-
sections.push({ label: BREAKING_SECTION, items: breaking });
|
|
199
|
-
}
|
|
194
|
+
sections.push({ label: BREAKING_SECTION, items: breaking });
|
|
200
195
|
const rank = (label) => {
|
|
201
196
|
const index = order.indexOf(label);
|
|
202
197
|
if (index !== -1) {
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
versionSections,
|
|
26
26
|
warn,
|
|
27
27
|
writeChangelog
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-CQAOT5BE.js";
|
|
29
29
|
|
|
30
30
|
// ../config/dist/index.js
|
|
31
31
|
import * as fs from "fs";
|
|
@@ -448,13 +448,12 @@ var LLMConfigBaseSchema = z.strictObject({
|
|
|
448
448
|
retry: LLMRetryConfigSchema.optional().describe("Retries for LLM requests that fail with a retryable error."),
|
|
449
449
|
tasks: LLMTasksConfigSchema.optional().describe("LLM tasks to run. Each is off unless set to true."),
|
|
450
450
|
categories: z.array(LLMCategorySchema).default(() => [
|
|
451
|
-
{ name: "Breaking", description: "Breaking changes that require user action to upgrade" },
|
|
452
451
|
{ name: "New", description: "New features and capabilities" },
|
|
453
452
|
{ name: "Changed", description: "Changes to existing functionality" },
|
|
454
453
|
{ name: "Fixed", description: "Bug fixes" },
|
|
455
454
|
{ name: "Developer", description: "Internal changes: CI, tooling, dependencies, refactoring" }
|
|
456
455
|
]).describe(
|
|
457
|
-
"Categories the categorize task sorts entries into. Default:
|
|
456
|
+
"Categories the categorize task sorts entries into. Default: New, Changed, Fixed and Developer, each with a built-in description. Breaking is never offered to the model, even if listed: only a commit marked breaking puts an entry there."
|
|
458
457
|
),
|
|
459
458
|
style: z.string().default(
|
|
460
459
|
'Write in past tense ("Added feature", not "Add feature"). Be concise and user-focused. Lead with the impact, not the implementation detail.'
|
|
@@ -467,7 +466,7 @@ var LLMConfigBaseSchema = z.strictObject({
|
|
|
467
466
|
"Number of the project's past GitHub Releases (0\u20135) used as style examples in the combined enhance and categorize prompt and the releaseNotes prompt. Needs GITHUB_TOKEN or GH_TOKEN."
|
|
468
467
|
),
|
|
469
468
|
context: z.strictObject({
|
|
470
|
-
pullRequests: z.boolean().default(true).describe("Fetch the title and body of each entry's
|
|
469
|
+
pullRequests: z.boolean().default(true).describe("Fetch the title and body of each entry's own PR as LLM context. Needs GITHUB_TOKEN or GH_TOKEN.")
|
|
471
470
|
}).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
|
|
472
471
|
categoryOrder: z.array(z.string()).optional().describe(
|
|
473
472
|
"Order of the rendered categories. Listed ones come first; the rest keep their order in categories, except Breaking, which stays first unless listed."
|
|
@@ -487,7 +486,7 @@ var LLMConfigSchema = LLMConfigBaseSchema.superRefine((cfg, ctx) => {
|
|
|
487
486
|
});
|
|
488
487
|
var ReleaseNotesConfigSchema = z.strictObject({
|
|
489
488
|
file: ReleaseNotesFileConfigSchema.optional().describe(
|
|
490
|
-
|
|
489
|
+
'Optional in-repo file output. Omit to keep release notes only on the GitHub release body (the default). When set, writes one immutable Markdown file per version under `dir` \u2014 release-notes/<package>/<version>.md in a monorepo, release-notes/<version>.md in a single-package repo \u2014 giving a browsable, provider-independent per-release history. Not supported with `ci.releaseStrategy: "standing-pr"`.'
|
|
491
490
|
),
|
|
492
491
|
templates: TemplateConfigSchema.optional().describe(
|
|
493
492
|
"Template for rendering release notes (e.g. to add docs-site frontmatter). Takes precedence over LLM prose and the default formatted section."
|
|
@@ -501,7 +500,7 @@ var ReleaseNotesConfigSchema = z.strictObject({
|
|
|
501
500
|
})
|
|
502
501
|
).optional().describe("Static links, each { label, url }, listed first."),
|
|
503
502
|
fromPRBodyMarker: z.string().optional().describe(
|
|
504
|
-
"Also collect links from
|
|
503
|
+
"Also collect links from each entry's own PR body: each line starting with this marker adds its markdown link or bare URL, skipping URLs already listed. Needs llm.context.pullRequests."
|
|
505
504
|
),
|
|
506
505
|
title: z.string().optional().describe("Heading for the links section. Default: Links.")
|
|
507
506
|
}).optional().describe(
|
|
@@ -584,7 +583,7 @@ var StandingPrConfigSchema = z.strictObject({
|
|
|
584
583
|
'Extra actors authorized regardless of permission level: GitHub usernames, or "@org/team-slug" to authorize a whole team. Team-membership checks need a token with read:org scope (a PAT or GitHub App), not the default GITHUB_TOKEN; without it, team entries fail closed \u2014 the 403 is surfaced as a warning and the actor is not authorized.'
|
|
585
584
|
),
|
|
586
585
|
enforceMergeAuthor: z.boolean().default(true).describe(
|
|
587
|
-
"Refuse to publish the standing PR when the actor who merged it is not authorized or cannot be determined (defense-in-depth behind a branch-protection ruleset, which is the primary merge gate). Set false to rely on branch protection alone."
|
|
586
|
+
"Refuse to publish the standing PR, or to release from a merged PR, when the actor who merged it is not authorized or cannot be determined (defense-in-depth behind a branch-protection ruleset, which is the primary merge gate). Set false to rely on branch protection alone."
|
|
588
587
|
)
|
|
589
588
|
}).optional().describe(
|
|
590
589
|
"Restrict who can steer the standing PR \u2014 its selection checkboxes, per-row channel toggles, release labels, and merge. Omit to allow anyone with the GitHub permission GitHub itself requires for each action."
|
|
@@ -665,6 +664,15 @@ var ReleaseKitConfigSchema = z.strictObject({
|
|
|
665
664
|
"CI automation configuration for release triggers, PR previews, and label management"
|
|
666
665
|
),
|
|
667
666
|
release: ReleaseConfigSchema.optional().describe("Release pipeline automation configuration")
|
|
667
|
+
}).superRefine((cfg, ctx) => {
|
|
668
|
+
const releaseNotes = cfg.notes?.releaseNotes;
|
|
669
|
+
if (cfg.ci?.releaseStrategy === "standing-pr" && releaseNotes && releaseNotes.file) {
|
|
670
|
+
ctx.addIssue({
|
|
671
|
+
code: z.ZodIssueCode.custom,
|
|
672
|
+
path: ["notes", "releaseNotes", "file"],
|
|
673
|
+
message: 'not supported with ci.releaseStrategy "standing-pr"; release notes go to the GitHub release only'
|
|
674
|
+
});
|
|
675
|
+
}
|
|
668
676
|
}).describe("Configuration schema for ReleaseKit - Automated versioning, changelog generation, and publishing");
|
|
669
677
|
var MAX_INPUT_LENGTH = 1e4;
|
|
670
678
|
function substituteVariables(value, rootDir = process.cwd()) {
|
|
@@ -1123,40 +1131,16 @@ function getDefaultConfig() {
|
|
|
1123
1131
|
return {};
|
|
1124
1132
|
}
|
|
1125
1133
|
|
|
1126
|
-
// src/output/versioned.ts
|
|
1127
|
-
import * as fs6 from "fs";
|
|
1128
|
-
import * as path6 from "path";
|
|
1129
|
-
function nestsReleaseNotes(packageCount) {
|
|
1130
|
-
return detectMonorepo(process.cwd()).isMonorepo || packageCount > 1;
|
|
1131
|
-
}
|
|
1132
|
-
function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent) {
|
|
1133
|
-
const written = [];
|
|
1134
|
-
for (const ctx of contexts) {
|
|
1135
|
-
const outputPath = nested ? path6.join(directory, ctx.packageName, `${ctx.version}.md`) : path6.join(directory, `${ctx.version}.md`);
|
|
1136
|
-
const content = renderContent(ctx);
|
|
1137
|
-
if (dryRun) {
|
|
1138
|
-
info(`[DRY RUN] Release notes (would write to ${outputPath}):`);
|
|
1139
|
-
info(content);
|
|
1140
|
-
continue;
|
|
1141
|
-
}
|
|
1142
|
-
fs6.mkdirSync(path6.dirname(outputPath), { recursive: true });
|
|
1143
|
-
fs6.writeFileSync(outputPath, content, "utf-8");
|
|
1144
|
-
success(`Release notes written to ${outputPath}`);
|
|
1145
|
-
written.push(outputPath);
|
|
1146
|
-
}
|
|
1147
|
-
return written;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
1134
|
// src/core/pipeline.ts
|
|
1151
1135
|
import * as path12 from "path";
|
|
1152
1136
|
|
|
1153
1137
|
// src/llm/cache.ts
|
|
1154
1138
|
import { createHash } from "crypto";
|
|
1155
|
-
import * as
|
|
1139
|
+
import * as fs6 from "fs/promises";
|
|
1156
1140
|
import * as os2 from "os";
|
|
1157
|
-
import * as
|
|
1141
|
+
import * as path6 from "path";
|
|
1158
1142
|
function defaultCacheDir() {
|
|
1159
|
-
return
|
|
1143
|
+
return path6.join(os2.tmpdir(), "releasekit", "llm-cache");
|
|
1160
1144
|
}
|
|
1161
1145
|
function stableStringify(value) {
|
|
1162
1146
|
return JSON.stringify(
|
|
@@ -1182,17 +1166,17 @@ function withContentHashCache(provider, identity, dir = defaultCacheDir(), { ref
|
|
|
1182
1166
|
toolName: options?.toolName
|
|
1183
1167
|
})
|
|
1184
1168
|
).digest("hex");
|
|
1185
|
-
const file =
|
|
1169
|
+
const file = path6.join(dir, `${key}.json`);
|
|
1186
1170
|
if (!refresh) {
|
|
1187
1171
|
try {
|
|
1188
|
-
return JSON.parse(await
|
|
1172
|
+
return JSON.parse(await fs6.readFile(file, "utf-8"));
|
|
1189
1173
|
} catch {
|
|
1190
1174
|
}
|
|
1191
1175
|
}
|
|
1192
1176
|
const result = await provider.complete(messages, options);
|
|
1193
1177
|
try {
|
|
1194
|
-
await
|
|
1195
|
-
await
|
|
1178
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
1179
|
+
await fs6.writeFile(file, JSON.stringify(result));
|
|
1196
1180
|
} catch {
|
|
1197
1181
|
}
|
|
1198
1182
|
return result;
|
|
@@ -1213,16 +1197,37 @@ function forgeErrorStatus(error2) {
|
|
|
1213
1197
|
}
|
|
1214
1198
|
function isBotComment(comment) {
|
|
1215
1199
|
const user = comment.user;
|
|
1216
|
-
|
|
1217
|
-
return true;
|
|
1218
|
-
}
|
|
1219
|
-
return user.type === "Bot" || user.login?.endsWith("[bot]") === true;
|
|
1200
|
+
return user?.type === "Bot" || user?.login?.endsWith("[bot]") === true;
|
|
1220
1201
|
}
|
|
1221
1202
|
var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
|
|
1222
1203
|
var MAX_RELEASE_PAGES = 3;
|
|
1204
|
+
var AUTHORED_BODY_QUERY = `
|
|
1205
|
+
query ($id: ID!) {
|
|
1206
|
+
node(id: $id) {
|
|
1207
|
+
... on Comment {
|
|
1208
|
+
body
|
|
1209
|
+
lastEditedAt
|
|
1210
|
+
author { login __typename }
|
|
1211
|
+
editor { login __typename }
|
|
1212
|
+
userContentEdits(first: 100) {
|
|
1213
|
+
nodes { editor { login __typename } }
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
`;
|
|
1219
|
+
function graphQLActor(actor) {
|
|
1220
|
+
return actor ? { login: actor.login, type: actor.__typename } : void 0;
|
|
1221
|
+
}
|
|
1223
1222
|
function labelNames(labels) {
|
|
1224
1223
|
return (labels ?? []).map((label) => typeof label === "string" ? label : label.name ?? "");
|
|
1225
1224
|
}
|
|
1225
|
+
function toAuthor(user) {
|
|
1226
|
+
return user ? { login: user.login, type: user.type } : void 0;
|
|
1227
|
+
}
|
|
1228
|
+
function toComment(comment) {
|
|
1229
|
+
return { id: comment.id, nodeId: comment.node_id, body: comment.body ?? "", user: toAuthor(comment.user) };
|
|
1230
|
+
}
|
|
1226
1231
|
function isAlreadyExistsError(error2) {
|
|
1227
1232
|
if (typeof error2 !== "object" || error2 === null) {
|
|
1228
1233
|
return false;
|
|
@@ -1260,7 +1265,7 @@ var GitHubForge = class {
|
|
|
1260
1265
|
per_page: 1
|
|
1261
1266
|
});
|
|
1262
1267
|
const pr = data[0];
|
|
1263
|
-
return pr ? { number: pr.number, url: pr.html_url, labels: labelNames(pr.labels).filter(Boolean) } : null;
|
|
1268
|
+
return pr ? { number: pr.number, url: pr.html_url, labels: labelNames(pr.labels).filter(Boolean), nodeId: pr.node_id } : null;
|
|
1264
1269
|
}
|
|
1265
1270
|
async listRecentlyClosedPullRequests(branch, limit) {
|
|
1266
1271
|
const { data } = await this.octokit.rest.pulls.list({
|
|
@@ -1301,7 +1306,9 @@ var GitHubForge = class {
|
|
|
1301
1306
|
body: data.body ?? "",
|
|
1302
1307
|
title: data.title,
|
|
1303
1308
|
labels: labelNames(data.labels),
|
|
1304
|
-
isPullRequest: Boolean(data.pull_request)
|
|
1309
|
+
isPullRequest: Boolean(data.pull_request),
|
|
1310
|
+
state: data.state === "closed" ? "closed" : "open",
|
|
1311
|
+
author: toAuthor(data.user)
|
|
1305
1312
|
};
|
|
1306
1313
|
}
|
|
1307
1314
|
async getPullRequest(prNumber) {
|
|
@@ -1312,10 +1319,26 @@ var GitHubForge = class {
|
|
|
1312
1319
|
headSha: data.head?.sha,
|
|
1313
1320
|
headRef: data.head?.ref,
|
|
1314
1321
|
baseRef: data.base?.ref,
|
|
1322
|
+
merged: data.merged,
|
|
1315
1323
|
mergeCommitSha: data.merge_commit_sha ?? void 0,
|
|
1316
1324
|
mergedBy: data.merged_by ? { login: data.merged_by.login, type: data.merged_by.type } : void 0
|
|
1317
1325
|
};
|
|
1318
1326
|
}
|
|
1327
|
+
async getAuthoredBody(nodeId) {
|
|
1328
|
+
const { node } = await this.octokit.graphql(AUTHORED_BODY_QUERY, {
|
|
1329
|
+
id: nodeId
|
|
1330
|
+
});
|
|
1331
|
+
if (node?.body === void 0) {
|
|
1332
|
+
throw new Error(`No PR, issue or comment with node ID ${nodeId}`);
|
|
1333
|
+
}
|
|
1334
|
+
return {
|
|
1335
|
+
body: node.body,
|
|
1336
|
+
author: graphQLActor(node.author),
|
|
1337
|
+
editor: graphQLActor(node.editor),
|
|
1338
|
+
lastEditedAt: node.lastEditedAt ?? void 0,
|
|
1339
|
+
editors: (node.userContentEdits?.nodes ?? []).map((edit) => graphQLActor(edit?.editor))
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1319
1342
|
async createPullRequest(pr) {
|
|
1320
1343
|
const { data } = await this.octokit.rest.pulls.create({ ...this.base, ...pr });
|
|
1321
1344
|
return { number: data.number, url: data.html_url };
|
|
@@ -1333,7 +1356,8 @@ var GitHubForge = class {
|
|
|
1333
1356
|
async updateIssue(issueNumber, changes) {
|
|
1334
1357
|
await this.octokit.rest.issues.update({ ...this.base, issue_number: issueNumber, ...changes });
|
|
1335
1358
|
}
|
|
1336
|
-
async
|
|
1359
|
+
async listOpenIssuesByLabel(label) {
|
|
1360
|
+
const issues = [];
|
|
1337
1361
|
const iterator = this.octokit.paginate.iterator(this.octokit.rest.issues.listForRepo, {
|
|
1338
1362
|
...this.base,
|
|
1339
1363
|
state: "open",
|
|
@@ -1343,11 +1367,11 @@ var GitHubForge = class {
|
|
|
1343
1367
|
for await (const response of iterator) {
|
|
1344
1368
|
for (const issue of response.data) {
|
|
1345
1369
|
if (!issue.pull_request) {
|
|
1346
|
-
|
|
1370
|
+
issues.push({ number: issue.number, url: issue.html_url });
|
|
1347
1371
|
}
|
|
1348
1372
|
}
|
|
1349
1373
|
}
|
|
1350
|
-
return
|
|
1374
|
+
return issues;
|
|
1351
1375
|
}
|
|
1352
1376
|
async getActorPermission(username) {
|
|
1353
1377
|
try {
|
|
@@ -1387,11 +1411,7 @@ var GitHubForge = class {
|
|
|
1387
1411
|
if (!comment.body?.startsWith(marker)) {
|
|
1388
1412
|
continue;
|
|
1389
1413
|
}
|
|
1390
|
-
const found =
|
|
1391
|
-
id: comment.id,
|
|
1392
|
-
body: comment.body,
|
|
1393
|
-
user: comment.user ? { login: comment.user.login, type: comment.user.type } : void 0
|
|
1394
|
-
};
|
|
1414
|
+
const found = toComment(comment);
|
|
1395
1415
|
if (isBotComment(found)) {
|
|
1396
1416
|
return found;
|
|
1397
1417
|
}
|
|
@@ -1401,18 +1421,16 @@ var GitHubForge = class {
|
|
|
1401
1421
|
return humanMatch;
|
|
1402
1422
|
}
|
|
1403
1423
|
async createComment(prNumber, body) {
|
|
1404
|
-
await this.octokit.rest.issues.createComment({ ...this.base, issue_number: prNumber, body });
|
|
1424
|
+
const { data } = await this.octokit.rest.issues.createComment({ ...this.base, issue_number: prNumber, body });
|
|
1425
|
+
return toComment(data);
|
|
1405
1426
|
}
|
|
1406
1427
|
async updateComment(commentId, body) {
|
|
1407
|
-
await this.octokit.rest.issues.updateComment({ ...this.base, comment_id: commentId, body });
|
|
1428
|
+
const { data } = await this.octokit.rest.issues.updateComment({ ...this.base, comment_id: commentId, body });
|
|
1429
|
+
return toComment(data);
|
|
1408
1430
|
}
|
|
1409
1431
|
async upsertMarkerComment(prNumber, marker, body) {
|
|
1410
1432
|
const existing = await this.findComment(prNumber, marker);
|
|
1411
|
-
|
|
1412
|
-
await this.updateComment(existing.id, body);
|
|
1413
|
-
} else {
|
|
1414
|
-
await this.createComment(prNumber, body);
|
|
1415
|
-
}
|
|
1433
|
+
return existing && isBotComment(existing) ? this.updateComment(existing.id, body) : this.createComment(prNumber, body);
|
|
1416
1434
|
}
|
|
1417
1435
|
async listLabelNames() {
|
|
1418
1436
|
const names = [];
|
|
@@ -1441,6 +1459,26 @@ var GitHubForge = class {
|
|
|
1441
1459
|
async setLabels(issueNumber, labels) {
|
|
1442
1460
|
await this.octokit.rest.issues.setLabels({ ...this.base, issue_number: issueNumber, labels });
|
|
1443
1461
|
}
|
|
1462
|
+
async listLabelEvents(issueNumber) {
|
|
1463
|
+
const events = [];
|
|
1464
|
+
const iterator = this.octokit.paginate.iterator(this.octokit.rest.issues.listEvents, {
|
|
1465
|
+
...this.base,
|
|
1466
|
+
issue_number: issueNumber,
|
|
1467
|
+
per_page: 100
|
|
1468
|
+
});
|
|
1469
|
+
for await (const response of iterator) {
|
|
1470
|
+
for (const event of response.data) {
|
|
1471
|
+
if ((event.event === "labeled" || event.event === "unlabeled") && "label" in event && event.label.name) {
|
|
1472
|
+
events.push({
|
|
1473
|
+
action: event.event,
|
|
1474
|
+
label: event.label.name,
|
|
1475
|
+
actor: event.actor ? { login: event.actor.login, type: event.actor.type } : void 0
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return events;
|
|
1481
|
+
}
|
|
1444
1482
|
async setCommitStatus(status) {
|
|
1445
1483
|
await this.octokit.rest.repos.createCommitStatus({ ...this.base, ...status });
|
|
1446
1484
|
}
|
|
@@ -1602,9 +1640,9 @@ var LLM_DEFAULTS = {
|
|
|
1602
1640
|
|
|
1603
1641
|
// src/llm/examples/fetcher.ts
|
|
1604
1642
|
import { createHash as createHash2 } from "crypto";
|
|
1605
|
-
import * as
|
|
1643
|
+
import * as fs7 from "fs";
|
|
1606
1644
|
import * as os3 from "os";
|
|
1607
|
-
import * as
|
|
1645
|
+
import * as path7 from "path";
|
|
1608
1646
|
|
|
1609
1647
|
// src/utils/json.ts
|
|
1610
1648
|
function extractJsonFromResponse(response) {
|
|
@@ -1679,6 +1717,33 @@ ${body}
|
|
|
1679
1717
|
function renderEntries(entries) {
|
|
1680
1718
|
return entries.map((e, i) => renderEntry(e, i)).join("\n");
|
|
1681
1719
|
}
|
|
1720
|
+
function orderByIndex(llmEntries, expectedCount) {
|
|
1721
|
+
const ordered = new Array(expectedCount);
|
|
1722
|
+
const unknown = [];
|
|
1723
|
+
const duplicate = [];
|
|
1724
|
+
for (const entry of llmEntries) {
|
|
1725
|
+
if (entry.index < 0 || entry.index >= expectedCount) {
|
|
1726
|
+
unknown.push(entry.index);
|
|
1727
|
+
} else if (ordered[entry.index]) {
|
|
1728
|
+
duplicate.push(entry.index);
|
|
1729
|
+
} else {
|
|
1730
|
+
ordered[entry.index] = entry;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
const missing = [...ordered.keys()].filter((i) => !ordered[i]);
|
|
1734
|
+
const problems = [
|
|
1735
|
+
unknown.length > 0 ? `unknown index ${unknown.join(", ")}` : "",
|
|
1736
|
+
duplicate.length > 0 ? `duplicate index ${duplicate.join(", ")}` : "",
|
|
1737
|
+
missing.length > 0 ? `missing index ${missing.join(", ")}` : ""
|
|
1738
|
+
].filter(Boolean);
|
|
1739
|
+
if (problems.length > 0) {
|
|
1740
|
+
return {
|
|
1741
|
+
ok: false,
|
|
1742
|
+
error: `Expected one entry for each input index 0-${expectedCount - 1}: ${problems.join("; ")}`
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
return { ok: true, entries: ordered };
|
|
1746
|
+
}
|
|
1682
1747
|
function groupByCategory(llmEntries, entries) {
|
|
1683
1748
|
const categoryMap = /* @__PURE__ */ new Map();
|
|
1684
1749
|
for (let i = 0; i < llmEntries.length; i++) {
|
|
@@ -1739,15 +1804,14 @@ function parseLLMResult(result) {
|
|
|
1739
1804
|
}
|
|
1740
1805
|
}
|
|
1741
1806
|
function checkCategoryNames(llmEntries, categoryNames) {
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
const invalid = llmEntries.filter((e) => !categoryNames.includes(e.category)).map((e) => e.category);
|
|
1807
|
+
const listed = categoryNames?.length ? categoryNames : void 0;
|
|
1808
|
+
const invalid = llmEntries.map((e) => e.category).filter((category) => category === BREAKING_SECTION || listed && !listed.includes(category));
|
|
1746
1809
|
if (invalid.length === 0) {
|
|
1747
1810
|
return null;
|
|
1748
1811
|
}
|
|
1749
1812
|
const unique = [...new Set(invalid)];
|
|
1750
|
-
|
|
1813
|
+
const valid = listed ? `Valid categories: ${listed.join(", ")}` : `${BREAKING_SECTION} is reserved; use another category.`;
|
|
1814
|
+
return `Unknown categories: ${unique.join(", ")}. ${valid}`;
|
|
1751
1815
|
}
|
|
1752
1816
|
async function runCorrectiveTask(opts) {
|
|
1753
1817
|
const { provider, initialMessages, schema, toolName, validate } = opts;
|
|
@@ -1809,10 +1873,12 @@ function renderExamplesBlock(examples) {
|
|
|
1809
1873
|
}
|
|
1810
1874
|
const blocks = examples.map((ex) => {
|
|
1811
1875
|
const entryLines = ex.entries.map((e) => {
|
|
1876
|
+
const category = e.category === BREAKING_SECTION ? "" : `[${escBody(e.category)}]`;
|
|
1877
|
+
const scope = e.scope ? `(${escBody(e.scope)})` : "";
|
|
1878
|
+
const tags = [category, scope].filter(Boolean).join(" ");
|
|
1812
1879
|
const leadIn = e.leadIn ? `**${escBody(e.leadIn)}**: ` : "";
|
|
1813
|
-
const scope = e.scope ? ` (${escBody(e.scope)})` : "";
|
|
1814
1880
|
const breaking = e.breaking ? " **BREAKING**" : "";
|
|
1815
|
-
return ` -
|
|
1881
|
+
return ` - ${tags ? `${tags}: ` : ""}${leadIn}${escBody(e.description)}${breaking}`;
|
|
1816
1882
|
}).join("\n");
|
|
1817
1883
|
return `<example version="${escAttr(ex.version)}">
|
|
1818
1884
|
${entryLines}
|
|
@@ -1826,16 +1892,16 @@ ${blocks.join("\n")}
|
|
|
1826
1892
|
|
|
1827
1893
|
// src/llm/examples/fetcher.ts
|
|
1828
1894
|
function cacheDir() {
|
|
1829
|
-
return
|
|
1895
|
+
return path7.join(os3.tmpdir(), "releasekit", "examples");
|
|
1830
1896
|
}
|
|
1831
1897
|
function cacheKey(owner, repo, packageName) {
|
|
1832
1898
|
const safe = packageName.replace(/[^a-zA-Z0-9-]/g, "_");
|
|
1833
1899
|
const hash = createHash2("sha256").update(packageName).digest("hex").slice(0, 8);
|
|
1834
|
-
return
|
|
1900
|
+
return path7.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
|
|
1835
1901
|
}
|
|
1836
1902
|
function readCache(key, latestTag, count) {
|
|
1837
1903
|
try {
|
|
1838
|
-
const raw =
|
|
1904
|
+
const raw = fs7.readFileSync(key, "utf-8");
|
|
1839
1905
|
const entry = JSON.parse(raw);
|
|
1840
1906
|
if (entry.latestTag !== latestTag || entry.count < count) {
|
|
1841
1907
|
return null;
|
|
@@ -1847,8 +1913,8 @@ function readCache(key, latestTag, count) {
|
|
|
1847
1913
|
}
|
|
1848
1914
|
function writeCache(key, latestTag, count, examples) {
|
|
1849
1915
|
try {
|
|
1850
|
-
|
|
1851
|
-
|
|
1916
|
+
fs7.mkdirSync(path7.dirname(key), { recursive: true });
|
|
1917
|
+
fs7.writeFileSync(key, JSON.stringify({ latestTag, count, examples }), "utf-8");
|
|
1852
1918
|
} catch {
|
|
1853
1919
|
}
|
|
1854
1920
|
}
|
|
@@ -2394,16 +2460,17 @@ ${instructions}`;
|
|
|
2394
2460
|
// src/llm/schemas.ts
|
|
2395
2461
|
import { z as z4 } from "zod";
|
|
2396
2462
|
var EntryOutputSchema = z4.object({
|
|
2463
|
+
index: z4.number().int(),
|
|
2397
2464
|
description: z4.string(),
|
|
2398
2465
|
category: z4.string(),
|
|
2399
2466
|
scope: z4.string().nullable(),
|
|
2400
|
-
breaking: z4.boolean().nullable(),
|
|
2401
2467
|
leadIn: z4.string().nullable()
|
|
2402
2468
|
});
|
|
2403
2469
|
var EnhanceAndCategorizeOutputSchema = z4.object({
|
|
2404
2470
|
entries: z4.array(EntryOutputSchema)
|
|
2405
2471
|
});
|
|
2406
2472
|
var CategorizeEntryOutputSchema = z4.object({
|
|
2473
|
+
index: z4.number().int(),
|
|
2407
2474
|
category: z4.string(),
|
|
2408
2475
|
scope: z4.string().nullable()
|
|
2409
2476
|
});
|
|
@@ -2413,9 +2480,6 @@ var CategorizeOutputSchema = z4.object({
|
|
|
2413
2480
|
function nullableString() {
|
|
2414
2481
|
return { anyOf: [{ type: "string" }, { type: "null" }] };
|
|
2415
2482
|
}
|
|
2416
|
-
function nullableBoolean() {
|
|
2417
|
-
return { anyOf: [{ type: "boolean" }, { type: "null" }] };
|
|
2418
|
-
}
|
|
2419
2483
|
function buildEnhanceAndCategorizeSchema(categories) {
|
|
2420
2484
|
const categoryNames = categories.map((c) => c.name);
|
|
2421
2485
|
const categoryField = categoryNames.length > 0 ? { type: "string", enum: categoryNames } : { type: "string" };
|
|
@@ -2427,13 +2491,13 @@ function buildEnhanceAndCategorizeSchema(categories) {
|
|
|
2427
2491
|
items: {
|
|
2428
2492
|
type: "object",
|
|
2429
2493
|
properties: {
|
|
2494
|
+
index: { type: "integer" },
|
|
2430
2495
|
description: { type: "string" },
|
|
2431
2496
|
category: categoryField,
|
|
2432
2497
|
scope: nullableString(),
|
|
2433
|
-
breaking: nullableBoolean(),
|
|
2434
2498
|
leadIn: nullableString()
|
|
2435
2499
|
},
|
|
2436
|
-
required: ["
|
|
2500
|
+
required: ["index", "description", "category", "scope", "leadIn"],
|
|
2437
2501
|
additionalProperties: false
|
|
2438
2502
|
}
|
|
2439
2503
|
}
|
|
@@ -2453,10 +2517,11 @@ function buildCategorizeSchema(categories) {
|
|
|
2453
2517
|
items: {
|
|
2454
2518
|
type: "object",
|
|
2455
2519
|
properties: {
|
|
2520
|
+
index: { type: "integer" },
|
|
2456
2521
|
category: categoryField,
|
|
2457
2522
|
scope: nullableString()
|
|
2458
2523
|
},
|
|
2459
|
-
required: ["category", "scope"],
|
|
2524
|
+
required: ["index", "category", "scope"],
|
|
2460
2525
|
additionalProperties: false
|
|
2461
2526
|
}
|
|
2462
2527
|
}
|
|
@@ -2566,7 +2631,8 @@ ${INSTRUCTION_HIERARCHY}
|
|
|
2566
2631
|
|
|
2567
2632
|
${categorySection}${scopeInstruction}
|
|
2568
2633
|
|
|
2569
|
-
Output a JSON object with an "entries" array
|
|
2634
|
+
Output a JSON object with an "entries" array holding one element per input entry. Each element must have:
|
|
2635
|
+
- "index": the index of the input entry it describes
|
|
2570
2636
|
- "category": category name from the list above
|
|
2571
2637
|
- "scope": subcategory label or null`;
|
|
2572
2638
|
}
|
|
@@ -2585,22 +2651,20 @@ function createCategorizeValidator(entries, context) {
|
|
|
2585
2651
|
if (!zodResult.success) {
|
|
2586
2652
|
return { valid: false, error: `Schema error: ${zodResult.error.message}` };
|
|
2587
2653
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
error: `Expected ${entries.length} entries, got ${zodResult.data.entries.length}`
|
|
2592
|
-
};
|
|
2654
|
+
const ordered = orderByIndex(zodResult.data.entries, entries.length);
|
|
2655
|
+
if (!ordered.ok) {
|
|
2656
|
+
return { valid: false, error: ordered.error };
|
|
2593
2657
|
}
|
|
2658
|
+
const llmEntries = ordered.entries;
|
|
2594
2659
|
const categoryError = checkCategoryNames(
|
|
2595
|
-
|
|
2660
|
+
llmEntries,
|
|
2596
2661
|
context.categories?.map((c) => c.name)
|
|
2597
2662
|
);
|
|
2598
2663
|
if (categoryError) {
|
|
2599
2664
|
return { valid: false, error: categoryError };
|
|
2600
2665
|
}
|
|
2601
2666
|
const withScopes = cleanEntries.map((entry, i) => {
|
|
2602
|
-
const
|
|
2603
|
-
const scope = llmEntry?.scope ?? void 0;
|
|
2667
|
+
const scope = llmEntries[i]?.scope ?? void 0;
|
|
2604
2668
|
return scope ? { ...entry, scope } : entry;
|
|
2605
2669
|
});
|
|
2606
2670
|
const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories, context.packageNames);
|
|
@@ -2610,7 +2674,7 @@ function createCategorizeValidator(entries, context) {
|
|
|
2610
2674
|
`LLM returned ${scopeResult.errors.length} entries with disallowed scopes (${offenders.join(", ")}); resolved per invalidScopeAction.`
|
|
2611
2675
|
);
|
|
2612
2676
|
}
|
|
2613
|
-
return { valid: true, value: groupByCategory(
|
|
2677
|
+
return { valid: true, value: groupByCategory(llmEntries, scopeResult.entries) };
|
|
2614
2678
|
};
|
|
2615
2679
|
}
|
|
2616
2680
|
async function categorizeEntries(provider, entries, context) {
|
|
@@ -2719,11 +2783,11 @@ leadIn guidelines:
|
|
|
2719
2783
|
- Set leadIn ONLY when an entry introduces a named API, feature, or concept worth scanning for (e.g. "Deeplink testing", "browser.electron.triggerDeeplink()")
|
|
2720
2784
|
- Leave leadIn null for routine fixes, dependency bumps, small tweaks, and refactors
|
|
2721
2785
|
|
|
2722
|
-
Output a JSON object with an "entries" array
|
|
2786
|
+
Output a JSON object with an "entries" array holding one element per input entry. Each element must have:
|
|
2787
|
+
- "index": the index of the input entry it describes
|
|
2723
2788
|
- "description": rewritten user-friendly text
|
|
2724
2789
|
- "category": category name (from the list above)
|
|
2725
2790
|
- "scope": subcategory label or null
|
|
2726
|
-
- "breaking": true if this is a breaking change, false or null otherwise
|
|
2727
2791
|
- "leadIn": short noun phrase for scanning (e.g. "Streaming API") or null`;
|
|
2728
2792
|
}
|
|
2729
2793
|
function buildUserPrompt3(entries) {
|
|
@@ -2740,26 +2804,20 @@ function createEnhanceAndCategorizeValidator(entries, context) {
|
|
|
2740
2804
|
if (!zodResult.success) {
|
|
2741
2805
|
return { valid: false, error: `Schema error: ${zodResult.error.message}` };
|
|
2742
2806
|
}
|
|
2743
|
-
const
|
|
2744
|
-
if (
|
|
2745
|
-
return {
|
|
2746
|
-
valid: false,
|
|
2747
|
-
error: `Expected ${entries.length} entries, got ${receivedCount} (entries missing \u2014 cannot proceed)`
|
|
2748
|
-
};
|
|
2749
|
-
}
|
|
2750
|
-
if (receivedCount > entries.length) {
|
|
2751
|
-
warn(`LLM returned ${receivedCount} entries for ${entries.length} inputs; truncating to expected count.`);
|
|
2752
|
-
zodResult.data.entries.length = entries.length;
|
|
2807
|
+
const ordered = orderByIndex(zodResult.data.entries, entries.length);
|
|
2808
|
+
if (!ordered.ok) {
|
|
2809
|
+
return { valid: false, error: ordered.error };
|
|
2753
2810
|
}
|
|
2811
|
+
const llmEntries = ordered.entries;
|
|
2754
2812
|
const categoryError = checkCategoryNames(
|
|
2755
|
-
|
|
2813
|
+
llmEntries,
|
|
2756
2814
|
context.categories?.map((c) => c.name)
|
|
2757
2815
|
);
|
|
2758
2816
|
if (categoryError) {
|
|
2759
2817
|
return { valid: false, error: categoryError };
|
|
2760
2818
|
}
|
|
2761
2819
|
const enhancedEntries = entries.map((original, i) => {
|
|
2762
|
-
const llmEntry =
|
|
2820
|
+
const llmEntry = llmEntries[i];
|
|
2763
2821
|
if (!llmEntry) {
|
|
2764
2822
|
return original;
|
|
2765
2823
|
}
|
|
@@ -2767,7 +2825,6 @@ function createEnhanceAndCategorizeValidator(entries, context) {
|
|
|
2767
2825
|
...original,
|
|
2768
2826
|
description: removeDescriptionRefs(llmEntry.description, [...original.issueIds ?? [], original.prNumber]),
|
|
2769
2827
|
scope: llmEntry.scope ?? void 0,
|
|
2770
|
-
breaking: original.breaking || llmEntry.breaking === true,
|
|
2771
2828
|
leadIn: llmEntry.leadIn ?? void 0
|
|
2772
2829
|
};
|
|
2773
2830
|
});
|
|
@@ -2778,7 +2835,7 @@ function createEnhanceAndCategorizeValidator(entries, context) {
|
|
|
2778
2835
|
`LLM returned ${scopeResult.errors.length} entries with disallowed scopes (${offenders.join(", ")}); resolved per invalidScopeAction.`
|
|
2779
2836
|
);
|
|
2780
2837
|
}
|
|
2781
|
-
const categories = groupByCategory(
|
|
2838
|
+
const categories = groupByCategory(llmEntries, scopeResult.entries);
|
|
2782
2839
|
return {
|
|
2783
2840
|
valid: true,
|
|
2784
2841
|
value: { enhancedEntries: scopeResult.entries, categories }
|
|
@@ -2909,6 +2966,30 @@ async function summarizeEntries(provider, entries, context) {
|
|
|
2909
2966
|
return result.content.trim();
|
|
2910
2967
|
}
|
|
2911
2968
|
|
|
2969
|
+
// src/output/versioned.ts
|
|
2970
|
+
import * as fs8 from "fs";
|
|
2971
|
+
import * as path8 from "path";
|
|
2972
|
+
function nestsReleaseNotes(packageCount) {
|
|
2973
|
+
return detectMonorepo(process.cwd()).isMonorepo || packageCount > 1;
|
|
2974
|
+
}
|
|
2975
|
+
function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent) {
|
|
2976
|
+
const written = [];
|
|
2977
|
+
for (const ctx of contexts) {
|
|
2978
|
+
const outputPath = nested ? path8.join(directory, ctx.packageName, `${ctx.version}.md`) : path8.join(directory, `${ctx.version}.md`);
|
|
2979
|
+
const content = renderContent(ctx);
|
|
2980
|
+
if (dryRun) {
|
|
2981
|
+
info(`[DRY RUN] Release notes (would write to ${outputPath}):`);
|
|
2982
|
+
info(content);
|
|
2983
|
+
continue;
|
|
2984
|
+
}
|
|
2985
|
+
fs8.mkdirSync(path8.dirname(outputPath), { recursive: true });
|
|
2986
|
+
fs8.writeFileSync(outputPath, content, "utf-8");
|
|
2987
|
+
success(`Release notes written to ${outputPath}`);
|
|
2988
|
+
written.push(outputPath);
|
|
2989
|
+
}
|
|
2990
|
+
return written;
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2912
2993
|
// src/templates/loader.ts
|
|
2913
2994
|
import * as fs12 from "fs";
|
|
2914
2995
|
import * as path11 from "path";
|
|
@@ -3225,6 +3306,9 @@ async function withRetry(fn, options = {}) {
|
|
|
3225
3306
|
}
|
|
3226
3307
|
|
|
3227
3308
|
// src/core/pipeline.ts
|
|
3309
|
+
function ownPrNumber(entry) {
|
|
3310
|
+
return entry.prNumber ? parseIssueNumbers([entry.prNumber])[0] : void 0;
|
|
3311
|
+
}
|
|
3228
3312
|
function findCompoundTagSepPos(tag) {
|
|
3229
3313
|
let pos = tag.lastIndexOf("-");
|
|
3230
3314
|
while (pos > 0) {
|
|
@@ -3368,7 +3452,8 @@ async function processWithLLM(context, llmConfig, examples, packageNames) {
|
|
|
3368
3452
|
version: context.version,
|
|
3369
3453
|
previousVersion: context.previousVersion ?? void 0,
|
|
3370
3454
|
date: context.date,
|
|
3371
|
-
|
|
3455
|
+
// The commit's breaking flag, not the model, puts an entry under Breaking.
|
|
3456
|
+
categories: llmConfig.categories?.filter((c) => c.name !== BREAKING_SECTION),
|
|
3372
3457
|
style: llmConfig.style,
|
|
3373
3458
|
scopes: llmConfig.scopes,
|
|
3374
3459
|
prompts: llmConfig.prompts,
|
|
@@ -3523,19 +3608,17 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
3523
3608
|
const prCache = /* @__PURE__ */ new Map();
|
|
3524
3609
|
const pullRequestsEnabled = llmConfig.context?.pullRequests !== false;
|
|
3525
3610
|
if (pullRequestsEnabled && ownerRepo) {
|
|
3526
|
-
const
|
|
3527
|
-
...new Set(
|
|
3528
|
-
releaseNotesContexts.flatMap((ctx) => ctx.entries.flatMap((e) => parseIssueNumbers(e.issueIds ?? [])))
|
|
3529
|
-
)
|
|
3611
|
+
const allPrNumbers = [
|
|
3612
|
+
...new Set(releaseNotesContexts.flatMap((ctx) => ctx.entries.flatMap((e) => ownPrNumber(e) ?? [])))
|
|
3530
3613
|
];
|
|
3531
|
-
if (
|
|
3614
|
+
if (allPrNumbers.length > 0) {
|
|
3532
3615
|
const token = resolveGitHubToken();
|
|
3533
3616
|
if (!token) {
|
|
3534
3617
|
warn("No GitHub token available \u2014 skipping PR context fetch (set GITHUB_TOKEN to enable)");
|
|
3535
3618
|
} else {
|
|
3536
|
-
debug(`Fetching PR context for ${
|
|
3537
|
-
await fetchPullRequestContext(ownerRepo.owner, ownerRepo.repo,
|
|
3538
|
-
debug(`Loaded PR context for ${prCache.size}
|
|
3619
|
+
debug(`Fetching PR context for ${allPrNumbers.length} PR(s)`);
|
|
3620
|
+
await fetchPullRequestContext(ownerRepo.owner, ownerRepo.repo, allPrNumbers, token, prCache);
|
|
3621
|
+
debug(`Loaded PR context for ${prCache.size} PR(s)`);
|
|
3539
3622
|
}
|
|
3540
3623
|
}
|
|
3541
3624
|
}
|
|
@@ -3543,8 +3626,9 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
3543
3626
|
releaseNotesContexts = releaseNotesContexts.map((ctx) => ({
|
|
3544
3627
|
...ctx,
|
|
3545
3628
|
entries: ctx.entries.map((entry) => {
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3629
|
+
const number = ownPrNumber(entry);
|
|
3630
|
+
const pr = number === void 0 ? void 0 : prCache.get(number);
|
|
3631
|
+
return pr ? { ...entry, context: { prs: [pr] } } : entry;
|
|
3548
3632
|
})
|
|
3549
3633
|
}));
|
|
3550
3634
|
}
|
|
@@ -3666,7 +3750,7 @@ async function processInput(inputJson, config, dryRun, pipelineOptions) {
|
|
|
3666
3750
|
return runPipeline(input, config, dryRun, pipelineOptions);
|
|
3667
3751
|
}
|
|
3668
3752
|
async function writeMonorepoFiles(contexts, config, dryRun, fileName, render) {
|
|
3669
|
-
const { detectMonorepo: detectMonorepo2, writeMonorepoChangelogs } = await import("./aggregator-
|
|
3753
|
+
const { detectMonorepo: detectMonorepo2, writeMonorepoChangelogs } = await import("./aggregator-VH6ZKA4E.js");
|
|
3670
3754
|
const cwd = process.cwd();
|
|
3671
3755
|
const detected = detectMonorepo2(cwd);
|
|
3672
3756
|
if (!detected.isMonorepo) {
|
|
@@ -3914,8 +3998,6 @@ export {
|
|
|
3914
3998
|
parseVersionOutputStdin,
|
|
3915
3999
|
loadConfig2 as loadConfig,
|
|
3916
4000
|
getDefaultConfig,
|
|
3917
|
-
nestsReleaseNotes,
|
|
3918
|
-
writeVersionedNotes,
|
|
3919
4001
|
createTemplateContext,
|
|
3920
4002
|
runPipeline,
|
|
3921
4003
|
processInput,
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createNotesCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OAHIISKU.js";
|
|
5
5
|
import {
|
|
6
6
|
readPackageVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CQAOT5BE.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
import * as fs from "fs";
|
package/dist/index.d.ts
CHANGED
|
@@ -484,17 +484,5 @@ declare function detectMonorepo(cwd: string): {
|
|
|
484
484
|
declare function renderJson(contexts: TemplateContext[]): string;
|
|
485
485
|
declare function writeJson(outputPath: string, contexts: TemplateContext[], dryRun: boolean): void;
|
|
486
486
|
|
|
487
|
-
|
|
488
|
-
declare function nestsReleaseNotes(packageCount: number): boolean;
|
|
489
|
-
/**
|
|
490
|
-
* `nested` MUST reflect whether the *repo* has more than one package - not how many packages are in
|
|
491
|
-
* this run. An independently-versioned monorepo releases one package per pipeline invocation, so a
|
|
492
|
-
* flat path would silently overwrite another package that shares a version number.
|
|
493
|
-
*/
|
|
494
|
-
declare function writeVersionedNotes<T extends {
|
|
495
|
-
packageName: string;
|
|
496
|
-
version: string;
|
|
497
|
-
}>(contexts: T[], directory: string, dryRun: boolean, nested: boolean, renderContent: (ctx: T) => string): string[];
|
|
498
|
-
|
|
499
|
-
export { ConfigError, GitHubError, InputParseError, InputValidationError, LLMError, NotesError, TemplateError, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadAuth, loadConfig, nestsReleaseNotes, parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, processInput, renderJson, renderMarkdown, runPipeline, saveAuth, versionOutputToChangelogInput, writeChangelog, writeJson, writeMonorepoChangelogs, writeVersionedNotes };
|
|
487
|
+
export { ConfigError, GitHubError, InputParseError, InputValidationError, LLMError, NotesError, TemplateError, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadAuth, loadConfig, parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, processInput, renderJson, renderMarkdown, runPipeline, saveAuth, versionOutputToChangelogInput, writeChangelog, writeJson, writeMonorepoChangelogs };
|
|
500
488
|
export type { BundledRelease, ChangelogConfig, ChangelogEntry, ChangelogInput, ChangelogType, CompleteOptions, Config, DocumentContext, EnhancedCategory, EnhancedData, FirstReleaseConfig, InputSource, JSONSchema, LLMCategory, LLMConfig, LLMOptions, LLMPromptOverrides, LLMPromptsConfig, LinksConfig, LocationMode, PRContext, PackageChangelog, PipelineOptions, PipelineResult, ReleaseNotesConfig, ReleaseNotesFileConfig, RetryOptions, ScopeConfig, ScopeRules, TemplateBundledPackage, TemplateConfig, TemplateContext, TemplateEngine, TemplateEntry, TemplateSection, TemplateVersion };
|
package/dist/index.js
CHANGED
|
@@ -12,16 +12,14 @@ import {
|
|
|
12
12
|
getExitCode,
|
|
13
13
|
loadAuth,
|
|
14
14
|
loadConfig,
|
|
15
|
-
nestsReleaseNotes,
|
|
16
15
|
parseVersionOutput,
|
|
17
16
|
parseVersionOutputFile,
|
|
18
17
|
parseVersionOutputStdin,
|
|
19
18
|
processInput,
|
|
20
19
|
runPipeline,
|
|
21
20
|
saveAuth,
|
|
22
|
-
versionOutputToChangelogInput
|
|
23
|
-
|
|
24
|
-
} from "./chunk-JOA56Y7A.js";
|
|
21
|
+
versionOutputToChangelogInput
|
|
22
|
+
} from "./chunk-OAHIISKU.js";
|
|
25
23
|
import {
|
|
26
24
|
aggregateToRoot,
|
|
27
25
|
debug,
|
|
@@ -32,7 +30,7 @@ import {
|
|
|
32
30
|
success,
|
|
33
31
|
writeChangelog,
|
|
34
32
|
writeMonorepoChangelogs
|
|
35
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-CQAOT5BE.js";
|
|
36
34
|
|
|
37
35
|
// src/output/json.ts
|
|
38
36
|
import * as fs from "fs";
|
|
@@ -86,7 +84,6 @@ export {
|
|
|
86
84
|
getExitCode,
|
|
87
85
|
loadAuth,
|
|
88
86
|
loadConfig,
|
|
89
|
-
nestsReleaseNotes,
|
|
90
87
|
parseVersionOutput,
|
|
91
88
|
parseVersionOutputFile,
|
|
92
89
|
parseVersionOutputStdin,
|
|
@@ -98,6 +95,5 @@ export {
|
|
|
98
95
|
versionOutputToChangelogInput,
|
|
99
96
|
writeChangelog,
|
|
100
97
|
writeJson,
|
|
101
|
-
writeMonorepoChangelogs
|
|
102
|
-
writeVersionedNotes
|
|
98
|
+
writeMonorepoChangelogs
|
|
103
99
|
};
|
package/docs/llm-providers.md
CHANGED
|
@@ -143,7 +143,7 @@ Entry descriptions are processed in parallel (default concurrency: `5`). Adjust
|
|
|
143
143
|
{ "concurrency": 3 }
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
When `enhance` and `categorize` are both enabled, the pipeline runs a single combined `enhanceAndCategorize` call
|
|
146
|
+
When `enhance` and `categorize` are both enabled, the pipeline runs a single combined `enhanceAndCategorize` call - see [Combined enhance + categorize](#combined-enhance--categorize). The combined call also generates scope assignments and the `leadIn` phrases behind the built-in renderer's `**leadIn**: description` formatting; `enhance` alone produces neither. Routine fixes and bumps receive no `leadIn`.
|
|
147
147
|
|
|
148
148
|
### `summarize`
|
|
149
149
|
|
|
@@ -165,7 +165,6 @@ Groups entries into user-friendly categories rather than conventional commit typ
|
|
|
165
165
|
|
|
166
166
|
| Name | Description |
|
|
167
167
|
|------|-------------|
|
|
168
|
-
| `Breaking` | Breaking changes that require user action to upgrade |
|
|
169
168
|
| `New` | New features and capabilities |
|
|
170
169
|
| `Changed` | Changes to existing functionality |
|
|
171
170
|
| `Fixed` | Bug fixes |
|
|
@@ -208,7 +207,7 @@ When LLM categorisation is active, you can configure the built-in renderer to ap
|
|
|
208
207
|
|
|
209
208
|
## Combined enhance + categorize
|
|
210
209
|
|
|
211
|
-
When both `enhance: true` and `categorize: true` are set, the pipeline makes a **single LLM call** (`enhanceAndCategorize`) that rewrites descriptions, assigns categories, generates `leadIn` phrases
|
|
210
|
+
When both `enhance: true` and `categorize: true` are set, the pipeline makes a **single LLM call** (`enhanceAndCategorize`) that rewrites descriptions, assigns categories, generates `leadIn` phrases and identifies scopes, all in one pass. This is more efficient than two sequential calls and is the recommended configuration when using both tasks.
|
|
212
211
|
|
|
213
212
|
```json
|
|
214
213
|
{ "tasks": { "enhance": true, "categorize": true } }
|
|
@@ -83,7 +83,7 @@ Four tasks are available. Any combination can be enabled simultaneously.
|
|
|
83
83
|
| `summarize` | Generates a 2–3 sentence release summary | `enhanced.summary` in template context |
|
|
84
84
|
| `releaseNotes` | Writes full prose markdown release notes | `enhanced.releaseNotes` / pipeline result |
|
|
85
85
|
|
|
86
|
-
**Recommended starting point:** Enable `enhance` and `categorize` together. This is the most impactful combination
|
|
86
|
+
**Recommended starting point:** Enable `enhance` and `categorize` together. This is the most impactful combination - rewriting and grouping both happen in a single LLM call, and it also unlocks `leadIn` phrases in the built-in renderer. Add `summarize` or `releaseNotes` when you want prose output for GitHub releases.
|
|
87
87
|
|
|
88
88
|
> **Efficiency tip:** When both `enhance` and `categorize` are enabled, the pipeline makes a **single combined LLM call** (`enhanceAndCategorize`) instead of two sequential calls. This combined path also produces `leadIn` phrases and scope assignments, which are not available when running `enhance` alone.
|
|
89
89
|
|
|
@@ -102,7 +102,7 @@ Entries are processed in parallel. Control the batch size with `concurrency` (de
|
|
|
102
102
|
{ "concurrency": 3 }
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
> **Note:** `
|
|
105
|
+
> **Note:** Running `enhance` alone rewrites descriptions only. `leadIn` phrases and scope assignments need `categorize` too - see [Combined enhance + categorize](#combined-enhance--categorize).
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
@@ -116,7 +116,6 @@ When `categories` is not configured, the following defaults are used:
|
|
|
116
116
|
|
|
117
117
|
| Name | Description |
|
|
118
118
|
|------|-------------|
|
|
119
|
-
| `Breaking` | Breaking changes that require user action to upgrade |
|
|
120
119
|
| `New` | New features and capabilities |
|
|
121
120
|
| `Changed` | Changes to existing functionality |
|
|
122
121
|
| `Fixed` | Bug fixes |
|
|
@@ -190,7 +189,6 @@ When both `enhance: true` and `categorize: true` are set, the pipeline runs a si
|
|
|
190
189
|
- Rewritten `description` for each entry
|
|
191
190
|
- Assigned `category`
|
|
192
191
|
- Assigned `scope` (or `null`)
|
|
193
|
-
- `breaking` flag (or `null`)
|
|
194
192
|
- `leadIn` phrase (or `null`)
|
|
195
193
|
|
|
196
194
|
This is more efficient than two sequential calls and produces richer output. Use the `enhanceAndCategorize` key in `prompts.instructions` to customise this combined call — the standalone `enhance` key applies only when `categorize` is disabled:
|
|
@@ -212,9 +210,9 @@ This is more efficient than two sequential calls and produces richer output. Use
|
|
|
212
210
|
|
|
213
211
|
## Breaking change handling
|
|
214
212
|
|
|
215
|
-
Any entry
|
|
213
|
+
Any entry with `breaking: true`, which only its commit can set, is moved to a `Breaking` category by the built-in markdown renderer at render time, regardless of which category the LLM assigned it to. The model is never offered `Breaking` as a category, even if `categories` lists it. The `Breaking` category comes first unless `categoryOrder` places it.
|
|
216
214
|
|
|
217
|
-
|
|
215
|
+
Templates get the same grouping in [`sections`](templates.md#sections).
|
|
218
216
|
|
|
219
217
|
The section marks an entry as breaking, so its line has no prefix: `- **API rename**: Rename connect() to initialize()`.
|
|
220
218
|
|
|
@@ -265,7 +263,7 @@ Invalid scopes trigger a corrective retry — the LLM is told which scopes are v
|
|
|
265
263
|
|
|
266
264
|
## PR body context (`context.pullRequests`)
|
|
267
265
|
|
|
268
|
-
When `context.pullRequests` is `true` (the default), the pipeline fetches the body of each
|
|
266
|
+
When `context.pullRequests` is `true` (the default), the pipeline fetches the body of each entry's own pull request (the `(#N)` on a squash-merge subject) and includes it in the LLM prompt. This gives the LLM additional context — PR descriptions, linked issues, migration notes — for writing accurate enhanced entries.
|
|
269
267
|
|
|
270
268
|
Requires `GITHUB_TOKEN` or `GH_TOKEN`. If no token is available, PR fetching is silently skipped and a warning is logged.
|
|
271
269
|
|
|
@@ -316,7 +314,7 @@ The built-in renderer can append a links section at the bottom of each release.
|
|
|
316
314
|
Two sources of links can be combined:
|
|
317
315
|
|
|
318
316
|
- **`items`** — static label/URL pairs hardcoded in config
|
|
319
|
-
- **`fromPRBodyMarker`** — scans
|
|
317
|
+
- **`fromPRBodyMarker`** — scans each entry's own PR body for lines starting with the marker string and extracts markdown links or bare URLs from them
|
|
320
318
|
|
|
321
319
|
```json
|
|
322
320
|
{
|
|
@@ -357,7 +355,7 @@ Override the built-in prompt instructions for any task using `prompts.instructio
|
|
|
357
355
|
"prompts": {
|
|
358
356
|
"instructions": {
|
|
359
357
|
"enhance": "Write from the perspective of an end user, not a developer.",
|
|
360
|
-
"enhanceAndCategorize": "Prefer 'New' over 'Changed' for additive changes.
|
|
358
|
+
"enhanceAndCategorize": "Prefer 'New' over 'Changed' for additive changes.",
|
|
361
359
|
"categorize": "When enhance is disabled, this key applies to the standalone categorize call.",
|
|
362
360
|
"summarize": "Write a single sentence, not a paragraph.",
|
|
363
361
|
"releaseNotes": "Start with a one-sentence executive summary, then group changes by theme."
|
package/docs/templates.md
CHANGED
|
@@ -144,7 +144,7 @@ Each entry in `entries` has:
|
|
|
144
144
|
| `type` | `ChangelogType` | `"added"`, `"changed"`, `"deprecated"`, `"removed"`, `"fixed"`, `"security"` |
|
|
145
145
|
| `description` | `string` | Entry description (rewritten by LLM if `tasks.enhance` is on) |
|
|
146
146
|
| `scope` | `string \| undefined` | Conventional commit scope (may be assigned or validated by LLM) |
|
|
147
|
-
| `breaking` | `boolean \| undefined` | `true` for breaking changes
|
|
147
|
+
| `breaking` | `boolean \| undefined` | `true` for breaking changes |
|
|
148
148
|
| `issueIds` | `string[] \| undefined` | Referenced issue/PR numbers |
|
|
149
149
|
| `leadIn` | `string \| undefined` | Short scannable phrase for notable entries (e.g. `"Streaming API"`). Set by the LLM during `enhance` or combined `enhanceAndCategorize`. `undefined` for routine entries. |
|
|
150
150
|
| `line` | `string` | The built-in renderer's Markdown line: `- **scope**: description (refs)`, with the lead-in in the scope's place and refs rendered per `notes.changelog.refs` |
|
package/package.json
CHANGED