@releasekit/notes 0.33.0 → 0.34.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-4G6BQOIR.js} +142 -54
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
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."),
|
|
@@ -473,16 +465,21 @@ var CIConfigSchema = z.object({
|
|
|
473
465
|
releaseTrigger: z.enum(["commit", "label"]).default("label").describe(
|
|
474
466
|
"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
467
|
),
|
|
476
|
-
prPreview: z.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
468
|
+
prPreview: z.union([
|
|
469
|
+
z.boolean(),
|
|
470
|
+
z.object({
|
|
471
|
+
enabled: z.boolean().default(true).describe("Whether PR preview comments are posted."),
|
|
472
|
+
refreshAfterRelease: z.boolean().default(false).describe(
|
|
473
|
+
'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. Requires the refresh-after-release step in your release workflow.'
|
|
474
|
+
)
|
|
475
|
+
})
|
|
476
|
+
]).default(true).transform(
|
|
477
|
+
(v) => typeof v === "boolean" ? { enabled: v, refreshAfterRelease: false } : { enabled: v.enabled ?? true, refreshAfterRelease: v.refreshAfterRelease ?? false }
|
|
478
|
+
).describe(
|
|
479
|
+
"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
480
|
),
|
|
483
|
-
minChanges: z.number().int().positive().default(1).describe("Minimum number of packages with releasable changes required to trigger a release."),
|
|
484
481
|
labels: CILabelsConfigSchema.default({
|
|
485
|
-
|
|
482
|
+
graduate: "release:graduate",
|
|
486
483
|
prerelease: "channel:prerelease",
|
|
487
484
|
skip: "release:skip",
|
|
488
485
|
immediate: "release:immediate",
|
|
@@ -610,6 +607,36 @@ function assertNoRemovedReleaseNotesFields(config) {
|
|
|
610
607
|
`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
608
|
);
|
|
612
609
|
}
|
|
610
|
+
function assertNoRemovedVersionFields(config) {
|
|
611
|
+
if (!isRecord(config) || !isRecord(config.version)) return;
|
|
612
|
+
const v = config.version;
|
|
613
|
+
const removed = ["versionStrategy", "branchPatterns", "defaultReleaseType", "updateInternalDependencies"].filter(
|
|
614
|
+
(k) => k in v
|
|
615
|
+
);
|
|
616
|
+
if (removed.length === 0) return;
|
|
617
|
+
throw new ConfigError(
|
|
618
|
+
`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.`
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
function assertNoRemovedTopLevelFields(config) {
|
|
622
|
+
if (!isRecord(config)) return;
|
|
623
|
+
if (isRecord(config.ci)) {
|
|
624
|
+
const removed = ["autoRelease", "skipPatterns", "minChanges"].filter((k) => k in config.ci);
|
|
625
|
+
if (removed.length > 0) {
|
|
626
|
+
throw new ConfigError(
|
|
627
|
+
`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).`
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
if (isRecord(config.monorepo) && "mainPackage" in config.monorepo) {
|
|
632
|
+
throw new ConfigError("monorepo.mainPackage was removed \u2014 use version.mainPackage instead.");
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function assertNoRemovedMonorepoMode(config) {
|
|
636
|
+
if (isRecord(config) && isRecord(config.monorepo) && "mode" in config.monorepo) {
|
|
637
|
+
throw new ConfigError("monorepo.mode was removed \u2014 changelog aggregation is controlled by notes.changelog.mode.");
|
|
638
|
+
}
|
|
639
|
+
}
|
|
613
640
|
function loadConfigFile(configPath) {
|
|
614
641
|
if (!fs3.existsSync(configPath)) {
|
|
615
642
|
return {};
|
|
@@ -619,6 +646,9 @@ function loadConfigFile(configPath) {
|
|
|
619
646
|
const parsed = parseJsonc(content);
|
|
620
647
|
const substituted = substituteInObject(parsed);
|
|
621
648
|
assertNoRemovedReleaseNotesFields(substituted);
|
|
649
|
+
assertNoRemovedVersionFields(substituted);
|
|
650
|
+
assertNoRemovedTopLevelFields(substituted);
|
|
651
|
+
assertNoRemovedMonorepoMode(substituted);
|
|
622
652
|
return ReleaseKitConfigSchema.parse(substituted);
|
|
623
653
|
} catch (error2) {
|
|
624
654
|
if (error2 instanceof z2.ZodError) {
|
|
@@ -845,6 +875,7 @@ function forgeErrorStatus(error2) {
|
|
|
845
875
|
}
|
|
846
876
|
var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
|
|
847
877
|
var MAX_RELEASE_PAGES = 3;
|
|
878
|
+
var MAX_OPEN_PR_PAGES = 5;
|
|
848
879
|
function labelNames(labels) {
|
|
849
880
|
return (labels ?? []).map((label) => typeof label === "string" ? label : label.name ?? "");
|
|
850
881
|
}
|
|
@@ -894,6 +925,24 @@ var GitHubForge = class {
|
|
|
894
925
|
});
|
|
895
926
|
return data.map((pr) => ({ number: pr.number, mergedAt: pr.merged_at }));
|
|
896
927
|
}
|
|
928
|
+
async listOpenPullRequests() {
|
|
929
|
+
const prs = [];
|
|
930
|
+
for (let page = 1; page <= MAX_OPEN_PR_PAGES; page++) {
|
|
931
|
+
const { data } = await this.octokit.rest.pulls.list({
|
|
932
|
+
...this.base,
|
|
933
|
+
state: "open",
|
|
934
|
+
sort: "updated",
|
|
935
|
+
direction: "desc",
|
|
936
|
+
per_page: 100,
|
|
937
|
+
page
|
|
938
|
+
});
|
|
939
|
+
for (const pr of data) {
|
|
940
|
+
prs.push({ number: pr.number, headRef: pr.head.ref, draft: pr.draft ?? false, baseSha: pr.base.sha });
|
|
941
|
+
}
|
|
942
|
+
if (data.length < 100) break;
|
|
943
|
+
}
|
|
944
|
+
return prs;
|
|
945
|
+
}
|
|
897
946
|
async getIssue(issueNumber) {
|
|
898
947
|
const { data } = await this.octokit.rest.issues.get({ ...this.base, issue_number: issueNumber });
|
|
899
948
|
return {
|
|
@@ -1282,7 +1331,18 @@ import Anthropic from "@anthropic-ai/sdk";
|
|
|
1282
1331
|
// src/llm/base.ts
|
|
1283
1332
|
var BaseLLMProvider = class {
|
|
1284
1333
|
getTimeout(options) {
|
|
1285
|
-
|
|
1334
|
+
const timeout = options?.timeout ?? LLM_DEFAULTS.timeout;
|
|
1335
|
+
const MAX_TIMEOUT_MS = 2147483647;
|
|
1336
|
+
if (!Number.isFinite(timeout) || timeout < 1) return LLM_DEFAULTS.timeout;
|
|
1337
|
+
return Math.min(Math.trunc(timeout), MAX_TIMEOUT_MS);
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* An AbortSignal that fires after the configured request timeout. Pass it to the provider's
|
|
1341
|
+
* request (SDK `{ signal }` request option, or fetch's `signal`). When it fires the request
|
|
1342
|
+
* aborts; providers check `signal.aborted` in their catch to surface a clear timeout error.
|
|
1343
|
+
*/
|
|
1344
|
+
timeoutSignal(options) {
|
|
1345
|
+
return AbortSignal.timeout(this.getTimeout(options));
|
|
1286
1346
|
}
|
|
1287
1347
|
getMaxTokens(options) {
|
|
1288
1348
|
return options?.maxTokens ?? LLM_DEFAULTS.maxTokens;
|
|
@@ -1325,23 +1385,27 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1325
1385
|
debugLogMessages(this.name, messages);
|
|
1326
1386
|
const systemMsg = messages.find((m) => m.role === "system");
|
|
1327
1387
|
const nonSystemMessages = messages.filter((m) => m.role !== "system").map((m) => ({ role: m.role, content: m.content }));
|
|
1388
|
+
const signal = this.timeoutSignal(options);
|
|
1328
1389
|
try {
|
|
1329
1390
|
if (options?.schema) {
|
|
1330
1391
|
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
|
-
|
|
1392
|
+
const response2 = await this.client.messages.create(
|
|
1393
|
+
{
|
|
1394
|
+
model: this.model,
|
|
1395
|
+
max_tokens: this.getMaxTokens(options),
|
|
1396
|
+
system: systemMsg?.content,
|
|
1397
|
+
tools: [
|
|
1398
|
+
{
|
|
1399
|
+
name: toolName,
|
|
1400
|
+
description: "Emit structured release notes data as JSON",
|
|
1401
|
+
input_schema: options.schema
|
|
1402
|
+
}
|
|
1403
|
+
],
|
|
1404
|
+
tool_choice: { type: "tool", name: toolName },
|
|
1405
|
+
messages: nonSystemMessages
|
|
1406
|
+
},
|
|
1407
|
+
{ signal }
|
|
1408
|
+
);
|
|
1345
1409
|
const toolBlock = response2.content.find((b) => b.type === "tool_use");
|
|
1346
1410
|
if (toolBlock?.type === "tool_use") {
|
|
1347
1411
|
const structured = toolBlock.input;
|
|
@@ -1349,12 +1413,15 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1349
1413
|
}
|
|
1350
1414
|
throw new LLMError("Expected tool_use block in Anthropic response");
|
|
1351
1415
|
}
|
|
1352
|
-
const response = await this.client.messages.create(
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1416
|
+
const response = await this.client.messages.create(
|
|
1417
|
+
{
|
|
1418
|
+
model: this.model,
|
|
1419
|
+
max_tokens: this.getMaxTokens(options),
|
|
1420
|
+
system: systemMsg?.content,
|
|
1421
|
+
messages: nonSystemMessages
|
|
1422
|
+
},
|
|
1423
|
+
{ signal }
|
|
1424
|
+
);
|
|
1358
1425
|
const firstBlock = response.content[0];
|
|
1359
1426
|
if (!firstBlock || firstBlock.type !== "text") {
|
|
1360
1427
|
throw new LLMError("Unexpected response format from Anthropic");
|
|
@@ -1362,6 +1429,7 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1362
1429
|
return { content: firstBlock.text };
|
|
1363
1430
|
} catch (error2) {
|
|
1364
1431
|
if (error2 instanceof LLMError) throw error2;
|
|
1432
|
+
if (signal.aborted) throw new LLMError(`Anthropic request timed out after ${this.getTimeout(options)}ms`);
|
|
1365
1433
|
throw new LLMError(`Anthropic API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1366
1434
|
}
|
|
1367
1435
|
}
|
|
@@ -1408,6 +1476,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1408
1476
|
if (options?.schema) {
|
|
1409
1477
|
requestBody.format = options.schema;
|
|
1410
1478
|
}
|
|
1479
|
+
const signal = this.timeoutSignal(options);
|
|
1411
1480
|
try {
|
|
1412
1481
|
const headers = {
|
|
1413
1482
|
"Content-Type": "application/json"
|
|
@@ -1419,7 +1488,8 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1419
1488
|
const response = await fetch(`${baseUrl}/api/chat`, {
|
|
1420
1489
|
method: "POST",
|
|
1421
1490
|
headers,
|
|
1422
|
-
body: JSON.stringify(requestBody)
|
|
1491
|
+
body: JSON.stringify(requestBody),
|
|
1492
|
+
signal
|
|
1423
1493
|
});
|
|
1424
1494
|
if (!response.ok) {
|
|
1425
1495
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -1449,6 +1519,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1449
1519
|
return { content };
|
|
1450
1520
|
} catch (error2) {
|
|
1451
1521
|
if (error2 instanceof LLMError) throw error2;
|
|
1522
|
+
if (signal.aborted) throw new LLMError(`Ollama request timed out after ${this.getTimeout(options)}ms`);
|
|
1452
1523
|
throw new LLMError(`Ollama error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1453
1524
|
}
|
|
1454
1525
|
}
|
|
@@ -1479,6 +1550,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1479
1550
|
}
|
|
1480
1551
|
async complete(messages, options) {
|
|
1481
1552
|
debugLogMessages(this.name, messages);
|
|
1553
|
+
const signal = this.timeoutSignal(options);
|
|
1482
1554
|
try {
|
|
1483
1555
|
const openaiMessages = messages.map((m) => ({ role: m.role, content: m.content }));
|
|
1484
1556
|
const requestParams = {
|
|
@@ -1499,7 +1571,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1499
1571
|
}
|
|
1500
1572
|
}
|
|
1501
1573
|
};
|
|
1502
|
-
const response = await this.client.chat.completions.create(requestParams);
|
|
1574
|
+
const response = await this.client.chat.completions.create(requestParams, { signal });
|
|
1503
1575
|
const content = response.choices[0]?.message?.content;
|
|
1504
1576
|
if (!content) {
|
|
1505
1577
|
throw new LLMError("Empty response from OpenAI");
|
|
@@ -1516,6 +1588,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1516
1588
|
return { content };
|
|
1517
1589
|
} catch (error2) {
|
|
1518
1590
|
if (error2 instanceof LLMError) throw error2;
|
|
1591
|
+
if (signal.aborted) throw new LLMError(`OpenAI request timed out after ${this.getTimeout(options)}ms`);
|
|
1519
1592
|
throw new LLMError(`OpenAI API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1520
1593
|
}
|
|
1521
1594
|
}
|
|
@@ -1543,6 +1616,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1543
1616
|
}
|
|
1544
1617
|
async complete(messages, options) {
|
|
1545
1618
|
debugLogMessages(this.name, messages);
|
|
1619
|
+
const signal = this.timeoutSignal(options);
|
|
1546
1620
|
try {
|
|
1547
1621
|
const openaiMessages = messages.map((m) => ({ role: m.role, content: m.content }));
|
|
1548
1622
|
const requestParams = {
|
|
@@ -1552,7 +1626,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1552
1626
|
temperature: this.getTemperature(options),
|
|
1553
1627
|
stream: false
|
|
1554
1628
|
};
|
|
1555
|
-
const response = await this.client.chat.completions.create(requestParams);
|
|
1629
|
+
const response = await this.client.chat.completions.create(requestParams, { signal });
|
|
1556
1630
|
const content = response.choices[0]?.message?.content;
|
|
1557
1631
|
if (!content) {
|
|
1558
1632
|
throw new LLMError("Empty response from LLM");
|
|
@@ -1560,6 +1634,7 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1560
1634
|
return { content };
|
|
1561
1635
|
} catch (error2) {
|
|
1562
1636
|
if (error2 instanceof LLMError) throw error2;
|
|
1637
|
+
if (signal.aborted) throw new LLMError(`${this.name} request timed out after ${this.getTimeout(options)}ms`);
|
|
1563
1638
|
throw new LLMError(`LLM API error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
1564
1639
|
}
|
|
1565
1640
|
}
|
|
@@ -1662,10 +1737,20 @@ function getAllowedScopesFromCategories(categories) {
|
|
|
1662
1737
|
}
|
|
1663
1738
|
return scopeMap;
|
|
1664
1739
|
}
|
|
1740
|
+
function expandPackageScopes(packageNames) {
|
|
1741
|
+
const forms = /* @__PURE__ */ new Set();
|
|
1742
|
+
for (const name of packageNames) {
|
|
1743
|
+
forms.add(name);
|
|
1744
|
+
forms.add(name.replace(/^@/, ""));
|
|
1745
|
+
const slash = name.lastIndexOf("/");
|
|
1746
|
+
forms.add(slash >= 0 ? name.slice(slash + 1) : name);
|
|
1747
|
+
}
|
|
1748
|
+
return [...forms];
|
|
1749
|
+
}
|
|
1665
1750
|
function resolveAllowedScopes(scopeConfig, categories, packageNames) {
|
|
1666
1751
|
if (!scopeConfig || scopeConfig.mode === "unrestricted") return null;
|
|
1667
1752
|
if (scopeConfig.mode === "none") return [];
|
|
1668
|
-
if (scopeConfig.mode === "packages") return packageNames ?? [];
|
|
1753
|
+
if (scopeConfig.mode === "packages") return expandPackageScopes(packageNames ?? []);
|
|
1669
1754
|
if (scopeConfig.mode === "restricted") {
|
|
1670
1755
|
const explicit = scopeConfig.rules?.allowed ?? [];
|
|
1671
1756
|
const all = new Set(explicit);
|
|
@@ -1686,8 +1771,8 @@ function validateScope(scope, allowedScopes, caseSensitive = false) {
|
|
|
1686
1771
|
const isAllowed = allowedScopes.some((a) => normalise(a) === normalise(scope));
|
|
1687
1772
|
return isAllowed ? scope : void 0;
|
|
1688
1773
|
}
|
|
1689
|
-
function validateEntryScopes(entries, scopeConfig, categories) {
|
|
1690
|
-
const allowedScopes = resolveAllowedScopes(scopeConfig, categories);
|
|
1774
|
+
function validateEntryScopes(entries, scopeConfig, categories, packageNames) {
|
|
1775
|
+
const allowedScopes = resolveAllowedScopes(scopeConfig, categories, packageNames);
|
|
1691
1776
|
if (allowedScopes === null) return { valid: true, entries, errors: [] };
|
|
1692
1777
|
const caseSensitive = scopeConfig?.rules?.caseSensitive ?? false;
|
|
1693
1778
|
const action = scopeConfig?.rules?.invalidScopeAction ?? "remove";
|
|
@@ -1865,7 +1950,7 @@ function createCategorizeValidator(entries, context) {
|
|
|
1865
1950
|
const scope = llmEntry?.scope ?? void 0;
|
|
1866
1951
|
return scope ? { ...entry, scope } : entry;
|
|
1867
1952
|
});
|
|
1868
|
-
const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories);
|
|
1953
|
+
const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories, context.packageNames);
|
|
1869
1954
|
if (scopeResult.errors.length > 0) {
|
|
1870
1955
|
const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
|
|
1871
1956
|
warn(
|
|
@@ -2026,7 +2111,7 @@ function createEnhanceAndCategorizeValidator(entries, context) {
|
|
|
2026
2111
|
leadIn: llmEntry.leadIn ?? void 0
|
|
2027
2112
|
};
|
|
2028
2113
|
});
|
|
2029
|
-
const scopeResult = validateEntryScopes(enhancedEntries, context.scopes, context.categories);
|
|
2114
|
+
const scopeResult = validateEntryScopes(enhancedEntries, context.scopes, context.categories, context.packageNames);
|
|
2030
2115
|
if (scopeResult.errors.length > 0) {
|
|
2031
2116
|
const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
|
|
2032
2117
|
warn(
|
|
@@ -2597,7 +2682,7 @@ function createDocumentContext(contexts, repoUrl) {
|
|
|
2597
2682
|
compareUrls: Object.keys(compareUrls).length > 0 ? compareUrls : void 0
|
|
2598
2683
|
};
|
|
2599
2684
|
}
|
|
2600
|
-
async function processWithLLM(context, llmConfig, examples) {
|
|
2685
|
+
async function processWithLLM(context, llmConfig, examples, packageNames) {
|
|
2601
2686
|
const tasks = llmConfig.tasks ?? {};
|
|
2602
2687
|
const llmContext = {
|
|
2603
2688
|
packageName: context.packageName,
|
|
@@ -2608,7 +2693,8 @@ async function processWithLLM(context, llmConfig, examples) {
|
|
|
2608
2693
|
style: llmConfig.style,
|
|
2609
2694
|
scopes: llmConfig.scopes,
|
|
2610
2695
|
prompts: llmConfig.prompts,
|
|
2611
|
-
examples
|
|
2696
|
+
examples,
|
|
2697
|
+
packageNames
|
|
2612
2698
|
};
|
|
2613
2699
|
const enhanced = {
|
|
2614
2700
|
entries: context.entries
|
|
@@ -2769,8 +2855,11 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2769
2855
|
})
|
|
2770
2856
|
}));
|
|
2771
2857
|
}
|
|
2858
|
+
const allPackageNames = contexts.map((c) => c.packageName);
|
|
2772
2859
|
contexts = await Promise.all(
|
|
2773
|
-
contexts.map(
|
|
2860
|
+
contexts.map(
|
|
2861
|
+
(ctx) => processWithLLM(ctx, llmConfig, examplesByPackage.get(ctx.packageName) ?? [], allPackageNames)
|
|
2862
|
+
)
|
|
2774
2863
|
);
|
|
2775
2864
|
}
|
|
2776
2865
|
const files = [];
|
|
@@ -3009,7 +3098,6 @@ function createNotesCommand() {
|
|
|
3009
3098
|
}
|
|
3010
3099
|
if (options.monorepo) {
|
|
3011
3100
|
const monoMode = options.monorepo;
|
|
3012
|
-
config.monorepo = { ...config.monorepo, mode: monoMode };
|
|
3013
3101
|
if (config.changelog !== false && !options.changelogMode) {
|
|
3014
3102
|
config.changelog = { ...config.changelog ?? {}, mode: monoMode };
|
|
3015
3103
|
}
|
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.34.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",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
71
|
"vitest": "^4.1.9",
|
|
72
72
|
"@releasekit/config": "0.0.0",
|
|
73
|
-
"@releasekit/core": "0.0.0",
|
|
74
73
|
"@releasekit/forge": "0.0.0",
|
|
74
|
+
"@releasekit/core": "0.0.0",
|
|
75
75
|
"@releasekit/git": "0.0.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|