@releasekit/notes 0.33.0 → 0.35.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 +3 -0
- package/dist/{chunk-7ASJIYE2.js → chunk-AWGBVBT2.js} +169 -54
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @releasekit/notes
|
|
2
2
|
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> 🚧 **Pre-1.0.0** — ReleaseKit is evolving fast and **💥 breaking changes are common**; it's **not production-ready** until `v1.0.0`. Pin exact versions. See the [main README](../../README.md) for details.
|
|
5
|
+
|
|
3
6
|
[](https://www.npmjs.com/package/@releasekit/notes)
|
|
4
7
|
[](https://www.npmjs.com/package/@releasekit/notes)
|
|
5
8
|
[](https://www.npmjs.com/package/@releasekit/notes)
|
|
@@ -65,14 +65,8 @@ var GitConfigSchema = z.object({
|
|
|
65
65
|
skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
|
|
66
66
|
});
|
|
67
67
|
var MonorepoConfigSchema = z.object({
|
|
68
|
-
mode: z.enum(["root", "packages", "both"]).optional().describe("Changelog aggregation mode"),
|
|
69
68
|
rootPath: z.string().optional().describe("Path to root changelog"),
|
|
70
|
-
packagesPath: z.string().optional().describe("Path to packages directory")
|
|
71
|
-
mainPackage: z.string().optional().describe("Main package name for versioning")
|
|
72
|
-
});
|
|
73
|
-
var BranchPatternSchema = z.object({
|
|
74
|
-
pattern: z.string().describe("Glob or regex matched against the branch name (e.g. 'release/*')"),
|
|
75
|
-
releaseType: z.enum(["major", "minor", "patch", "prerelease"]).describe("Version bump type applied when this pattern matches")
|
|
69
|
+
packagesPath: z.string().optional().describe("Path to packages directory")
|
|
76
70
|
});
|
|
77
71
|
var VersionCargoConfigSchema = z.object({
|
|
78
72
|
enabled: z.boolean().default(true).describe("Enable Cargo.toml version handling"),
|
|
@@ -121,12 +115,8 @@ var VersionConfigSchema = z.object({
|
|
|
121
115
|
`How the "Project-wide changes" block is bounded in package-specific-tag mode. "union" (default): repo-level commits accrue from the union of the releasing packages' ranges, floored by the OLDEST unreleased baseline \u2014 so a genuinely-global commit recurs in every release until the oldest-baselined package is released past it. "sinceLastRelease": floor the block by the single nearest tag reachable across the repo, so global commits already shown by the most recent release don't recur (recommended for per-package-tag monorepos). No effect in sync mode, where one shared tag already consumes repo-level commits on each release.`
|
|
122
116
|
),
|
|
123
117
|
mainPackage: z.string().optional().describe("Package to use for version determination"),
|
|
124
|
-
updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor").describe("How to bump internal dependencies"),
|
|
125
118
|
skip: z.array(z.string()).optional().describe("Packages to exclude from versioning"),
|
|
126
119
|
commitMessage: z.string().optional().describe("Template for release commit messages"),
|
|
127
|
-
versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage").describe("Strategy for determining version bumps"),
|
|
128
|
-
branchPatterns: z.array(BranchPatternSchema).optional().describe("Branch name patterns for version determination"),
|
|
129
|
-
defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional().describe("Default release type when no pattern matches"),
|
|
130
120
|
mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn").describe("How to handle version mismatches"),
|
|
131
121
|
versionPrefix: z.string().default("").describe("Prefix for version tags"),
|
|
132
122
|
prereleaseIdentifier: z.string().optional().describe("Identifier for prerelease versions (e.g., 'alpha', 'beta')"),
|
|
@@ -161,7 +151,7 @@ var PubPublishConfigSchema = z.object({
|
|
|
161
151
|
publishOrder: z.array(z.string()).default([]).describe("Order in which to publish packages")
|
|
162
152
|
});
|
|
163
153
|
var PublishGitConfigSchema = z.object({
|
|
164
|
-
push: z.boolean().
|
|
154
|
+
push: z.boolean().optional().describe("Push tags and commits to remote. When unset, inherits the top-level git.push (which defaults to push)."),
|
|
165
155
|
pushMethod: z.enum(["auto", "ssh", "https"]).optional().describe("Push method override"),
|
|
166
156
|
remote: z.string().optional().describe("Remote name override"),
|
|
167
157
|
branch: z.string().optional().describe("Branch name override"),
|
|
@@ -415,7 +405,9 @@ var NotesConfigSchema = z.object({
|
|
|
415
405
|
)
|
|
416
406
|
});
|
|
417
407
|
var CILabelsConfigSchema = z.object({
|
|
418
|
-
|
|
408
|
+
graduate: z.string().default("release:graduate").describe(
|
|
409
|
+
"Label that graduates a prerelease to its stable base version (e.g. 1.0.0-next.6 \u2192 1.0.0). A standalone release trigger in label/direct mode; in standing-pr mode it sets the next merge to graduate."
|
|
410
|
+
),
|
|
419
411
|
prerelease: z.string().default("channel:prerelease").describe("Label to create a prerelease"),
|
|
420
412
|
skip: z.string().default("release:skip").describe("Label to suppress a release on this PR"),
|
|
421
413
|
immediate: z.string().default("release:immediate").describe("Label to bypass the standing PR for one merge \u2014 triggers a direct release. Standing-pr mode only."),
|
|
@@ -464,6 +456,12 @@ var StandingPrConfigSchema = z.object({
|
|
|
464
456
|
)
|
|
465
457
|
}).optional().describe(
|
|
466
458
|
"Restrict who can steer the standing PR \u2014 its selection checkboxes, release labels, and merge. Omit to allow anyone with the GitHub permission GitHub itself requires for each action (today\u2019s behavior)."
|
|
459
|
+
),
|
|
460
|
+
primaryPackages: z.array(z.string()).default([]).describe(
|
|
461
|
+
"Packages that drive releases \u2014 rendered as parent rows in the standing-PR selection list, with their coupled group-mates and changed prerequisites nested beneath, so one parent toggle holds back the whole release unit. Glob patterns or exact names. Empty (default) \u2192 flat per-package list (current behavior)."
|
|
462
|
+
),
|
|
463
|
+
selection: z.enum(["streamlined", "granular"]).default("streamlined").describe(
|
|
464
|
+
"How the selection list renders when primaryPackages is set. streamlined: one checkbox per primary, coupled members shown read-only in a collapsed pane, and a held-back primary cascades to its unit. granular: every package keeps its own checkbox, nested under its primary, with no cascade. No effect when primaryPackages is empty."
|
|
467
465
|
)
|
|
468
466
|
});
|
|
469
467
|
var CIConfigSchema = z.object({
|
|
@@ -473,16 +471,21 @@ var CIConfigSchema = z.object({
|
|
|
473
471
|
releaseTrigger: z.enum(["commit", "label"]).default("label").describe(
|
|
474
472
|
"What triggers a release. 'label': a PR bump label (bump:patch/minor/major) is required. 'commit': conventional commits drive the bump automatically; every merge can trigger a release."
|
|
475
473
|
),
|
|
476
|
-
prPreview: z.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
474
|
+
prPreview: z.union([
|
|
475
|
+
z.boolean(),
|
|
476
|
+
z.object({
|
|
477
|
+
enabled: z.boolean().default(true).describe("Whether PR preview comments are posted."),
|
|
478
|
+
refreshAfterRelease: z.boolean().default(false).describe(
|
|
479
|
+
'After a release completes, replay the preview comment on still-open feeder PRs so their "what would release" estimate is not left stale against the moved baseline. Cosmetic and best-effort \u2014 a failure here never fails the release. Driven automatically in-process after a successful release (both the direct and standing-PR publish paths); the standalone `refresh-after-release` command also performs it for setups that run it as a separate step.'
|
|
480
|
+
)
|
|
481
|
+
})
|
|
482
|
+
]).default(true).transform(
|
|
483
|
+
(v) => typeof v === "boolean" ? { enabled: v, refreshAfterRelease: false } : { enabled: v.enabled ?? true, refreshAfterRelease: v.refreshAfterRelease ?? false }
|
|
484
|
+
).describe(
|
|
485
|
+
"PR preview comments showing what would be released if the PR is merged. `true`/`false` toggles them; the object form additionally enables `refreshAfterRelease` to refresh feeder-PR previews after a release."
|
|
482
486
|
),
|
|
483
|
-
minChanges: z.number().int().positive().default(1).describe("Minimum number of packages with releasable changes required to trigger a release."),
|
|
484
487
|
labels: CILabelsConfigSchema.default({
|
|
485
|
-
|
|
488
|
+
graduate: "release:graduate",
|
|
486
489
|
prerelease: "channel:prerelease",
|
|
487
490
|
skip: "release:skip",
|
|
488
491
|
immediate: "release:immediate",
|
|
@@ -610,6 +613,36 @@ function assertNoRemovedReleaseNotesFields(config) {
|
|
|
610
613
|
`notes.releaseNotes no longer supports ${removed.join(", ")}. Release notes go to the GitHub release body by default; for in-repo per-version files set notes.releaseNotes.file to { "dir": "release-notes" }. For a cumulative changelog file, use changelog.mode.`
|
|
611
614
|
);
|
|
612
615
|
}
|
|
616
|
+
function assertNoRemovedVersionFields(config) {
|
|
617
|
+
if (!isRecord(config) || !isRecord(config.version)) return;
|
|
618
|
+
const v = config.version;
|
|
619
|
+
const removed = ["versionStrategy", "branchPatterns", "defaultReleaseType", "updateInternalDependencies"].filter(
|
|
620
|
+
(k) => k in v
|
|
621
|
+
);
|
|
622
|
+
if (removed.length === 0) return;
|
|
623
|
+
throw new ConfigError(
|
|
624
|
+
`version no longer supports ${removed.join(", ")}. Branch-pattern versioning was never functional \u2014 use Conventional Commits or --bump for version bumps. For coupled packages use version.groups; to release a package's changed dependencies use release:with-prerequisites / --include-prerequisites.`
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
function assertNoRemovedTopLevelFields(config) {
|
|
628
|
+
if (!isRecord(config)) return;
|
|
629
|
+
if (isRecord(config.ci)) {
|
|
630
|
+
const removed = ["autoRelease", "skipPatterns", "minChanges"].filter((k) => k in config.ci);
|
|
631
|
+
if (removed.length > 0) {
|
|
632
|
+
throw new ConfigError(
|
|
633
|
+
`ci no longer supports ${removed.join(", ")}. autoRelease was removed (it had no effect); skipPatterns and minChanges live under release.ci (release.ci.skipPatterns / release.ci.minChanges).`
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (isRecord(config.monorepo) && "mainPackage" in config.monorepo) {
|
|
638
|
+
throw new ConfigError("monorepo.mainPackage was removed \u2014 use version.mainPackage instead.");
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
function assertNoRemovedMonorepoMode(config) {
|
|
642
|
+
if (isRecord(config) && isRecord(config.monorepo) && "mode" in config.monorepo) {
|
|
643
|
+
throw new ConfigError("monorepo.mode was removed \u2014 changelog aggregation is controlled by notes.changelog.mode.");
|
|
644
|
+
}
|
|
645
|
+
}
|
|
613
646
|
function loadConfigFile(configPath) {
|
|
614
647
|
if (!fs3.existsSync(configPath)) {
|
|
615
648
|
return {};
|
|
@@ -619,6 +652,9 @@ function loadConfigFile(configPath) {
|
|
|
619
652
|
const parsed = parseJsonc(content);
|
|
620
653
|
const substituted = substituteInObject(parsed);
|
|
621
654
|
assertNoRemovedReleaseNotesFields(substituted);
|
|
655
|
+
assertNoRemovedVersionFields(substituted);
|
|
656
|
+
assertNoRemovedTopLevelFields(substituted);
|
|
657
|
+
assertNoRemovedMonorepoMode(substituted);
|
|
622
658
|
return ReleaseKitConfigSchema.parse(substituted);
|
|
623
659
|
} catch (error2) {
|
|
624
660
|
if (error2 instanceof z2.ZodError) {
|
|
@@ -845,6 +881,7 @@ function forgeErrorStatus(error2) {
|
|
|
845
881
|
}
|
|
846
882
|
var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
|
|
847
883
|
var MAX_RELEASE_PAGES = 3;
|
|
884
|
+
var MAX_OPEN_PR_PAGES = 5;
|
|
848
885
|
function labelNames(labels) {
|
|
849
886
|
return (labels ?? []).map((label) => typeof label === "string" ? label : label.name ?? "");
|
|
850
887
|
}
|
|
@@ -894,6 +931,24 @@ var GitHubForge = class {
|
|
|
894
931
|
});
|
|
895
932
|
return data.map((pr) => ({ number: pr.number, mergedAt: pr.merged_at }));
|
|
896
933
|
}
|
|
934
|
+
async listOpenPullRequests() {
|
|
935
|
+
const prs = [];
|
|
936
|
+
for (let page = 1; page <= MAX_OPEN_PR_PAGES; page++) {
|
|
937
|
+
const { data } = await this.octokit.rest.pulls.list({
|
|
938
|
+
...this.base,
|
|
939
|
+
state: "open",
|
|
940
|
+
sort: "updated",
|
|
941
|
+
direction: "desc",
|
|
942
|
+
per_page: 100,
|
|
943
|
+
page
|
|
944
|
+
});
|
|
945
|
+
for (const pr of data) {
|
|
946
|
+
prs.push({ number: pr.number, headRef: pr.head.ref, draft: pr.draft ?? false, baseSha: pr.base.sha });
|
|
947
|
+
}
|
|
948
|
+
if (data.length < 100) break;
|
|
949
|
+
}
|
|
950
|
+
return prs;
|
|
951
|
+
}
|
|
897
952
|
async getIssue(issueNumber) {
|
|
898
953
|
const { data } = await this.octokit.rest.issues.get({ ...this.base, issue_number: issueNumber });
|
|
899
954
|
return {
|
|
@@ -917,6 +972,27 @@ var GitHubForge = class {
|
|
|
917
972
|
async mergePullRequest(prNumber, method) {
|
|
918
973
|
await this.octokit.rest.pulls.merge({ ...this.base, pull_number: prNumber, merge_method: method });
|
|
919
974
|
}
|
|
975
|
+
async createIssue(issue) {
|
|
976
|
+
const { data } = await this.octokit.rest.issues.create({ ...this.base, ...issue });
|
|
977
|
+
return { number: data.number, url: data.html_url };
|
|
978
|
+
}
|
|
979
|
+
async updateIssue(issueNumber, changes) {
|
|
980
|
+
await this.octokit.rest.issues.update({ ...this.base, issue_number: issueNumber, ...changes });
|
|
981
|
+
}
|
|
982
|
+
async findOpenIssueByLabel(label) {
|
|
983
|
+
const iterator = this.octokit.paginate.iterator(this.octokit.rest.issues.listForRepo, {
|
|
984
|
+
...this.base,
|
|
985
|
+
state: "open",
|
|
986
|
+
labels: label,
|
|
987
|
+
per_page: 100
|
|
988
|
+
});
|
|
989
|
+
for await (const response of iterator) {
|
|
990
|
+
for (const issue of response.data) {
|
|
991
|
+
if (!issue.pull_request) return { number: issue.number, url: issue.html_url };
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
920
996
|
async getActorPermission(username) {
|
|
921
997
|
try {
|
|
922
998
|
const { data } = await this.octokit.rest.repos.getCollaboratorPermissionLevel({ ...this.base, username });
|
|
@@ -1282,7 +1358,18 @@ import Anthropic from "@anthropic-ai/sdk";
|
|
|
1282
1358
|
// src/llm/base.ts
|
|
1283
1359
|
var BaseLLMProvider = class {
|
|
1284
1360
|
getTimeout(options) {
|
|
1285
|
-
|
|
1361
|
+
const timeout = options?.timeout ?? LLM_DEFAULTS.timeout;
|
|
1362
|
+
const MAX_TIMEOUT_MS = 2147483647;
|
|
1363
|
+
if (!Number.isFinite(timeout) || timeout < 1) return LLM_DEFAULTS.timeout;
|
|
1364
|
+
return Math.min(Math.trunc(timeout), MAX_TIMEOUT_MS);
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* An AbortSignal that fires after the configured request timeout. Pass it to the provider's
|
|
1368
|
+
* request (SDK `{ signal }` request option, or fetch's `signal`). When it fires the request
|
|
1369
|
+
* aborts; providers check `signal.aborted` in their catch to surface a clear timeout error.
|
|
1370
|
+
*/
|
|
1371
|
+
timeoutSignal(options) {
|
|
1372
|
+
return AbortSignal.timeout(this.getTimeout(options));
|
|
1286
1373
|
}
|
|
1287
1374
|
getMaxTokens(options) {
|
|
1288
1375
|
return options?.maxTokens ?? LLM_DEFAULTS.maxTokens;
|
|
@@ -1325,23 +1412,27 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1325
1412
|
debugLogMessages(this.name, messages);
|
|
1326
1413
|
const systemMsg = messages.find((m) => m.role === "system");
|
|
1327
1414
|
const nonSystemMessages = messages.filter((m) => m.role !== "system").map((m) => ({ role: m.role, content: m.content }));
|
|
1415
|
+
const signal = this.timeoutSignal(options);
|
|
1328
1416
|
try {
|
|
1329
1417
|
if (options?.schema) {
|
|
1330
1418
|
const toolName = options.toolName ?? "emit_release_notes";
|
|
1331
|
-
const response2 = await this.client.messages.create(
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1419
|
+
const response2 = await this.client.messages.create(
|
|
1420
|
+
{
|
|
1421
|
+
model: this.model,
|
|
1422
|
+
max_tokens: this.getMaxTokens(options),
|
|
1423
|
+
system: systemMsg?.content,
|
|
1424
|
+
tools: [
|
|
1425
|
+
{
|
|
1426
|
+
name: toolName,
|
|
1427
|
+
description: "Emit structured release notes data as JSON",
|
|
1428
|
+
input_schema: options.schema
|
|
1429
|
+
}
|
|
1430
|
+
],
|
|
1431
|
+
tool_choice: { type: "tool", name: toolName },
|
|
1432
|
+
messages: nonSystemMessages
|
|
1433
|
+
},
|
|
1434
|
+
{ signal }
|
|
1435
|
+
);
|
|
1345
1436
|
const toolBlock = response2.content.find((b) => b.type === "tool_use");
|
|
1346
1437
|
if (toolBlock?.type === "tool_use") {
|
|
1347
1438
|
const structured = toolBlock.input;
|
|
@@ -1349,12 +1440,15 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1349
1440
|
}
|
|
1350
1441
|
throw new LLMError("Expected tool_use block in Anthropic response");
|
|
1351
1442
|
}
|
|
1352
|
-
const response = await this.client.messages.create(
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1443
|
+
const response = await this.client.messages.create(
|
|
1444
|
+
{
|
|
1445
|
+
model: this.model,
|
|
1446
|
+
max_tokens: this.getMaxTokens(options),
|
|
1447
|
+
system: systemMsg?.content,
|
|
1448
|
+
messages: nonSystemMessages
|
|
1449
|
+
},
|
|
1450
|
+
{ signal }
|
|
1451
|
+
);
|
|
1358
1452
|
const firstBlock = response.content[0];
|
|
1359
1453
|
if (!firstBlock || firstBlock.type !== "text") {
|
|
1360
1454
|
throw new LLMError("Unexpected response format from Anthropic");
|
|
@@ -1362,6 +1456,7 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1362
1456
|
return { content: firstBlock.text };
|
|
1363
1457
|
} catch (error2) {
|
|
1364
1458
|
if (error2 instanceof LLMError) throw error2;
|
|
1459
|
+
if (signal.aborted) throw new LLMError(`Anthropic request timed out after ${this.getTimeout(options)}ms`);
|
|
1365
1460
|
throw new LLMError(`Anthropic API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1366
1461
|
}
|
|
1367
1462
|
}
|
|
@@ -1408,6 +1503,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1408
1503
|
if (options?.schema) {
|
|
1409
1504
|
requestBody.format = options.schema;
|
|
1410
1505
|
}
|
|
1506
|
+
const signal = this.timeoutSignal(options);
|
|
1411
1507
|
try {
|
|
1412
1508
|
const headers = {
|
|
1413
1509
|
"Content-Type": "application/json"
|
|
@@ -1419,7 +1515,8 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1419
1515
|
const response = await fetch(`${baseUrl}/api/chat`, {
|
|
1420
1516
|
method: "POST",
|
|
1421
1517
|
headers,
|
|
1422
|
-
body: JSON.stringify(requestBody)
|
|
1518
|
+
body: JSON.stringify(requestBody),
|
|
1519
|
+
signal
|
|
1423
1520
|
});
|
|
1424
1521
|
if (!response.ok) {
|
|
1425
1522
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -1449,6 +1546,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1449
1546
|
return { content };
|
|
1450
1547
|
} catch (error2) {
|
|
1451
1548
|
if (error2 instanceof LLMError) throw error2;
|
|
1549
|
+
if (signal.aborted) throw new LLMError(`Ollama request timed out after ${this.getTimeout(options)}ms`);
|
|
1452
1550
|
throw new LLMError(`Ollama error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1453
1551
|
}
|
|
1454
1552
|
}
|
|
@@ -1479,6 +1577,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1479
1577
|
}
|
|
1480
1578
|
async complete(messages, options) {
|
|
1481
1579
|
debugLogMessages(this.name, messages);
|
|
1580
|
+
const signal = this.timeoutSignal(options);
|
|
1482
1581
|
try {
|
|
1483
1582
|
const openaiMessages = messages.map((m) => ({ role: m.role, content: m.content }));
|
|
1484
1583
|
const requestParams = {
|
|
@@ -1499,7 +1598,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1499
1598
|
}
|
|
1500
1599
|
}
|
|
1501
1600
|
};
|
|
1502
|
-
const response = await this.client.chat.completions.create(requestParams);
|
|
1601
|
+
const response = await this.client.chat.completions.create(requestParams, { signal });
|
|
1503
1602
|
const content = response.choices[0]?.message?.content;
|
|
1504
1603
|
if (!content) {
|
|
1505
1604
|
throw new LLMError("Empty response from OpenAI");
|
|
@@ -1516,6 +1615,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1516
1615
|
return { content };
|
|
1517
1616
|
} catch (error2) {
|
|
1518
1617
|
if (error2 instanceof LLMError) throw error2;
|
|
1618
|
+
if (signal.aborted) throw new LLMError(`OpenAI request timed out after ${this.getTimeout(options)}ms`);
|
|
1519
1619
|
throw new LLMError(`OpenAI API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1520
1620
|
}
|
|
1521
1621
|
}
|
|
@@ -1543,6 +1643,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1543
1643
|
}
|
|
1544
1644
|
async complete(messages, options) {
|
|
1545
1645
|
debugLogMessages(this.name, messages);
|
|
1646
|
+
const signal = this.timeoutSignal(options);
|
|
1546
1647
|
try {
|
|
1547
1648
|
const openaiMessages = messages.map((m) => ({ role: m.role, content: m.content }));
|
|
1548
1649
|
const requestParams = {
|
|
@@ -1552,7 +1653,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1552
1653
|
temperature: this.getTemperature(options),
|
|
1553
1654
|
stream: false
|
|
1554
1655
|
};
|
|
1555
|
-
const response = await this.client.chat.completions.create(requestParams);
|
|
1656
|
+
const response = await this.client.chat.completions.create(requestParams, { signal });
|
|
1556
1657
|
const content = response.choices[0]?.message?.content;
|
|
1557
1658
|
if (!content) {
|
|
1558
1659
|
throw new LLMError("Empty response from LLM");
|
|
@@ -1560,6 +1661,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1560
1661
|
return { content };
|
|
1561
1662
|
} catch (error2) {
|
|
1562
1663
|
if (error2 instanceof LLMError) throw error2;
|
|
1664
|
+
if (signal.aborted) throw new LLMError(`${this.name} request timed out after ${this.getTimeout(options)}ms`);
|
|
1563
1665
|
throw new LLMError(`LLM API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1564
1666
|
}
|
|
1565
1667
|
}
|
|
@@ -1662,10 +1764,20 @@ function getAllowedScopesFromCategories(categories) {
|
|
|
1662
1764
|
}
|
|
1663
1765
|
return scopeMap;
|
|
1664
1766
|
}
|
|
1767
|
+
function expandPackageScopes(packageNames) {
|
|
1768
|
+
const forms = /* @__PURE__ */ new Set();
|
|
1769
|
+
for (const name of packageNames) {
|
|
1770
|
+
forms.add(name);
|
|
1771
|
+
forms.add(name.replace(/^@/, ""));
|
|
1772
|
+
const slash = name.lastIndexOf("/");
|
|
1773
|
+
forms.add(slash >= 0 ? name.slice(slash + 1) : name);
|
|
1774
|
+
}
|
|
1775
|
+
return [...forms];
|
|
1776
|
+
}
|
|
1665
1777
|
function resolveAllowedScopes(scopeConfig, categories, packageNames) {
|
|
1666
1778
|
if (!scopeConfig || scopeConfig.mode === "unrestricted") return null;
|
|
1667
1779
|
if (scopeConfig.mode === "none") return [];
|
|
1668
|
-
if (scopeConfig.mode === "packages") return packageNames ?? [];
|
|
1780
|
+
if (scopeConfig.mode === "packages") return expandPackageScopes(packageNames ?? []);
|
|
1669
1781
|
if (scopeConfig.mode === "restricted") {
|
|
1670
1782
|
const explicit = scopeConfig.rules?.allowed ?? [];
|
|
1671
1783
|
const all = new Set(explicit);
|
|
@@ -1686,8 +1798,8 @@ function validateScope(scope, allowedScopes, caseSensitive = false) {
|
|
|
1686
1798
|
const isAllowed = allowedScopes.some((a) => normalise(a) === normalise(scope));
|
|
1687
1799
|
return isAllowed ? scope : void 0;
|
|
1688
1800
|
}
|
|
1689
|
-
function validateEntryScopes(entries, scopeConfig, categories) {
|
|
1690
|
-
const allowedScopes = resolveAllowedScopes(scopeConfig, categories);
|
|
1801
|
+
function validateEntryScopes(entries, scopeConfig, categories, packageNames) {
|
|
1802
|
+
const allowedScopes = resolveAllowedScopes(scopeConfig, categories, packageNames);
|
|
1691
1803
|
if (allowedScopes === null) return { valid: true, entries, errors: [] };
|
|
1692
1804
|
const caseSensitive = scopeConfig?.rules?.caseSensitive ?? false;
|
|
1693
1805
|
const action = scopeConfig?.rules?.invalidScopeAction ?? "remove";
|
|
@@ -1865,7 +1977,7 @@ function createCategorizeValidator(entries, context) {
|
|
|
1865
1977
|
const scope = llmEntry?.scope ?? void 0;
|
|
1866
1978
|
return scope ? { ...entry, scope } : entry;
|
|
1867
1979
|
});
|
|
1868
|
-
const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories);
|
|
1980
|
+
const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories, context.packageNames);
|
|
1869
1981
|
if (scopeResult.errors.length > 0) {
|
|
1870
1982
|
const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
|
|
1871
1983
|
warn(
|
|
@@ -2026,7 +2138,7 @@ function createEnhanceAndCategorizeValidator(entries, context) {
|
|
|
2026
2138
|
leadIn: llmEntry.leadIn ?? void 0
|
|
2027
2139
|
};
|
|
2028
2140
|
});
|
|
2029
|
-
const scopeResult = validateEntryScopes(enhancedEntries, context.scopes, context.categories);
|
|
2141
|
+
const scopeResult = validateEntryScopes(enhancedEntries, context.scopes, context.categories, context.packageNames);
|
|
2030
2142
|
if (scopeResult.errors.length > 0) {
|
|
2031
2143
|
const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
|
|
2032
2144
|
warn(
|
|
@@ -2597,7 +2709,7 @@ function createDocumentContext(contexts, repoUrl) {
|
|
|
2597
2709
|
compareUrls: Object.keys(compareUrls).length > 0 ? compareUrls : void 0
|
|
2598
2710
|
};
|
|
2599
2711
|
}
|
|
2600
|
-
async function processWithLLM(context, llmConfig, examples) {
|
|
2712
|
+
async function processWithLLM(context, llmConfig, examples, packageNames) {
|
|
2601
2713
|
const tasks = llmConfig.tasks ?? {};
|
|
2602
2714
|
const llmContext = {
|
|
2603
2715
|
packageName: context.packageName,
|
|
@@ -2608,7 +2720,8 @@ async function processWithLLM(context, llmConfig, examples) {
|
|
|
2608
2720
|
style: llmConfig.style,
|
|
2609
2721
|
scopes: llmConfig.scopes,
|
|
2610
2722
|
prompts: llmConfig.prompts,
|
|
2611
|
-
examples
|
|
2723
|
+
examples,
|
|
2724
|
+
packageNames
|
|
2612
2725
|
};
|
|
2613
2726
|
const enhanced = {
|
|
2614
2727
|
entries: context.entries
|
|
@@ -2769,8 +2882,11 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2769
2882
|
})
|
|
2770
2883
|
}));
|
|
2771
2884
|
}
|
|
2885
|
+
const allPackageNames = contexts.map((c) => c.packageName);
|
|
2772
2886
|
contexts = await Promise.all(
|
|
2773
|
-
contexts.map(
|
|
2887
|
+
contexts.map(
|
|
2888
|
+
(ctx) => processWithLLM(ctx, llmConfig, examplesByPackage.get(ctx.packageName) ?? [], allPackageNames)
|
|
2889
|
+
)
|
|
2774
2890
|
);
|
|
2775
2891
|
}
|
|
2776
2892
|
const files = [];
|
|
@@ -3009,7 +3125,6 @@ function createNotesCommand() {
|
|
|
3009
3125
|
}
|
|
3010
3126
|
if (options.monorepo) {
|
|
3011
3127
|
const monoMode = options.monorepo;
|
|
3012
|
-
config.monorepo = { ...config.monorepo, mode: monoMode };
|
|
3013
3128
|
if (config.changelog !== false && !options.changelogMode) {
|
|
3014
3129
|
config.changelog = { ...config.changelog ?? {}, mode: monoMode };
|
|
3015
3130
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@releasekit/notes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Release notes and changelog generation with LLM-powered enhancement and flexible templating",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -47,31 +47,31 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@anthropic-ai/sdk": "^0.
|
|
50
|
+
"@anthropic-ai/sdk": "^0.106.0",
|
|
51
51
|
"@octokit/rest": "^22.0.1",
|
|
52
52
|
"chalk": "^5.6.2",
|
|
53
53
|
"commander": "^14.0.3",
|
|
54
54
|
"ejs": "^4.0.1",
|
|
55
55
|
"handlebars": "^4.7.9",
|
|
56
56
|
"jsonc-parser": "^3.3.1",
|
|
57
|
-
"liquidjs": "^10.27.
|
|
57
|
+
"liquidjs": "^10.27.1",
|
|
58
58
|
"minimatch": "^10.0.0",
|
|
59
|
-
"openai": "^6.
|
|
59
|
+
"openai": "^6.45.0",
|
|
60
60
|
"smol-toml": "^1.7.0",
|
|
61
61
|
"yaml": "^2.9.0",
|
|
62
62
|
"zod": "^4.4.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "^2.5.
|
|
65
|
+
"@biomejs/biome": "^2.5.1",
|
|
66
66
|
"@types/ejs": "^3.1.5",
|
|
67
67
|
"@types/node": "^22.20.0",
|
|
68
68
|
"@vitest/coverage-v8": "^4.1.9",
|
|
69
69
|
"tsup": "^8.5.1",
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
71
|
"vitest": "^4.1.9",
|
|
72
|
-
"@releasekit/config": "0.0.0",
|
|
73
72
|
"@releasekit/core": "0.0.0",
|
|
74
73
|
"@releasekit/forge": "0.0.0",
|
|
74
|
+
"@releasekit/config": "0.0.0",
|
|
75
75
|
"@releasekit/git": "0.0.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|