@releasekit/notes 0.27.0 → 0.29.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/dist/{aggregator-GXJXPM7O.js → aggregator-6TEWRELZ.js} +2 -2
- package/dist/{chunk-QCJ545PJ.js → chunk-E6757S4V.js} +11 -0
- package/dist/{chunk-L34QVI62.js → chunk-ECD44YFA.js} +1 -1
- package/dist/{chunk-RASPVTWN.js → chunk-QHSLAQIS.js} +157 -89
- package/dist/cli.js +2 -2
- package/dist/index.js +3 -3
- package/docs/templates.md +12 -0
- package/package.json +7 -7
|
@@ -108,6 +108,12 @@ var EXIT_CODES = {
|
|
|
108
108
|
// src/output/markdown.ts
|
|
109
109
|
import * as fs2 from "fs";
|
|
110
110
|
import * as path2 from "path";
|
|
111
|
+
var DEFAULT_FIRST_RELEASE_TEXT = "_First release of ${packageName}._";
|
|
112
|
+
function firstReleaseLine(context, config) {
|
|
113
|
+
if (!context.isFirstRelease || config === false) return void 0;
|
|
114
|
+
const template = config?.text ?? DEFAULT_FIRST_RELEASE_TEXT;
|
|
115
|
+
return template.replaceAll("${packageName}", context.packageName).replaceAll("${version}", context.version);
|
|
116
|
+
}
|
|
111
117
|
var TYPE_ORDER = ["added", "changed", "deprecated", "removed", "fixed", "security"];
|
|
112
118
|
var TYPE_LABELS = {
|
|
113
119
|
added: "Added",
|
|
@@ -287,6 +293,11 @@ function formatVersion(context, options) {
|
|
|
287
293
|
const versionHeader = context.previousVersion ? `## [${versionLabel}]` : `## ${versionLabel}`;
|
|
288
294
|
lines.push(`${versionHeader} - ${context.date}`);
|
|
289
295
|
lines.push("");
|
|
296
|
+
const introLine = firstReleaseLine(context, options?.firstRelease);
|
|
297
|
+
if (introLine) {
|
|
298
|
+
lines.push(introLine);
|
|
299
|
+
lines.push("");
|
|
300
|
+
}
|
|
290
301
|
if (context.compareUrl) {
|
|
291
302
|
lines.push(`[Full Changelog](${context.compareUrl})`);
|
|
292
303
|
lines.push("");
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
success,
|
|
11
11
|
warn,
|
|
12
12
|
writeMarkdown
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-E6757S4V.js";
|
|
14
14
|
|
|
15
15
|
// ../config/dist/index.js
|
|
16
16
|
import * as fs from "fs";
|
|
@@ -357,6 +357,9 @@ var LLMConfigSchema = z.object({
|
|
|
357
357
|
}).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
|
|
358
358
|
categoryOrder: z.array(z.string()).optional().describe(
|
|
359
359
|
"Explicit ordering of categories in the output. Categories not listed retain their configured order after the listed ones."
|
|
360
|
+
),
|
|
361
|
+
cache: z.boolean().default(false).describe(
|
|
362
|
+
"Cache LLM responses on disk (under the OS temp dir), keyed by a hash of the provider, model, prompt, and request options. A re-run or backfill with the same inputs reuses the cached generation instead of re-calling the provider. Off by default."
|
|
360
363
|
)
|
|
361
364
|
});
|
|
362
365
|
var ReleaseNotesConfigSchema = z.object({
|
|
@@ -376,7 +379,18 @@ var ReleaseNotesConfigSchema = z.object({
|
|
|
376
379
|
).optional().describe("Static list of links to append."),
|
|
377
380
|
fromPRBodyMarker: z.string().optional().describe("Marker string in PR bodies; content after it is extracted and appended as links."),
|
|
378
381
|
title: z.string().optional().describe("Heading for the links section.")
|
|
379
|
-
}).optional().describe("Extra links to append to the release notes.")
|
|
382
|
+
}).optional().describe("Extra links to append to the release notes."),
|
|
383
|
+
firstRelease: z.union([
|
|
384
|
+
z.literal(false).describe("Set to false to disable the first-release placeholder intro."),
|
|
385
|
+
z.object({
|
|
386
|
+
text: z.string().optional().describe(
|
|
387
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
|
|
388
|
+
"Placeholder intro line for a package's first release. Supports ${packageName} and ${version}. Defaults to a factual line so it reads cleanly even when published unedited."
|
|
389
|
+
)
|
|
390
|
+
})
|
|
391
|
+
]).optional().describe(
|
|
392
|
+
"First-release placeholder intro, shown when a package has no prior version (previousVersion is null). Default-on with a factual line; set to false to disable."
|
|
393
|
+
)
|
|
380
394
|
}).describe("Release notes configuration");
|
|
381
395
|
var NotesInputConfigSchema = z.object({
|
|
382
396
|
source: z.string().optional(),
|
|
@@ -395,6 +409,9 @@ var CILabelsConfigSchema = z.object({
|
|
|
395
409
|
skip: z.string().default("release:skip").describe("Label to suppress a release on this PR"),
|
|
396
410
|
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."),
|
|
397
411
|
retry: z.string().default("release:retry").describe("Label to retry a failed publish by re-applying it to a merged standing PR. Standing-pr mode only."),
|
|
412
|
+
previewNotes: z.string().default("release:preview-notes").describe(
|
|
413
|
+
"Label on the standing PR that generates LLM release notes on demand into an editable region in the PR body, for review and editing before merge. Standing-pr mode only."
|
|
414
|
+
),
|
|
398
415
|
major: z.string().default("bump:major").describe("Label to force a major bump"),
|
|
399
416
|
minor: z.string().default("bump:minor").describe("Label to force a minor bump"),
|
|
400
417
|
patch: z.string().default("bump:patch").describe("Label to force a patch bump")
|
|
@@ -436,6 +453,7 @@ var CIConfigSchema = z.object({
|
|
|
436
453
|
skip: "release:skip",
|
|
437
454
|
immediate: "release:immediate",
|
|
438
455
|
retry: "release:retry",
|
|
456
|
+
previewNotes: "release:preview-notes",
|
|
439
457
|
major: "bump:major",
|
|
440
458
|
minor: "bump:minor",
|
|
441
459
|
patch: "bump:patch"
|
|
@@ -731,8 +749,55 @@ function getDefaultConfig() {
|
|
|
731
749
|
}
|
|
732
750
|
|
|
733
751
|
// src/core/pipeline.ts
|
|
734
|
-
import * as
|
|
735
|
-
import * as
|
|
752
|
+
import * as fs13 from "fs";
|
|
753
|
+
import * as path12 from "path";
|
|
754
|
+
|
|
755
|
+
// src/llm/cache.ts
|
|
756
|
+
import { createHash } from "crypto";
|
|
757
|
+
import * as fs6 from "fs/promises";
|
|
758
|
+
import * as os2 from "os";
|
|
759
|
+
import * as path6 from "path";
|
|
760
|
+
function defaultCacheDir() {
|
|
761
|
+
return path6.join(os2.tmpdir(), "releasekit", "llm-cache");
|
|
762
|
+
}
|
|
763
|
+
function stableStringify(value) {
|
|
764
|
+
return JSON.stringify(
|
|
765
|
+
value,
|
|
766
|
+
(_key, val) => val && typeof val === "object" && !Array.isArray(val) ? Object.fromEntries(Object.entries(val).sort(([a], [b]) => a < b ? -1 : 1)) : val
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
function withContentHashCache(provider, identity, dir = defaultCacheDir()) {
|
|
770
|
+
return {
|
|
771
|
+
name: provider.name,
|
|
772
|
+
capabilities: provider.capabilities,
|
|
773
|
+
async complete(messages, options) {
|
|
774
|
+
const key = createHash("sha256").update(
|
|
775
|
+
stableStringify({
|
|
776
|
+
provider: provider.name,
|
|
777
|
+
model: identity.model,
|
|
778
|
+
baseURL: identity.baseURL,
|
|
779
|
+
messages,
|
|
780
|
+
temperature: options?.temperature,
|
|
781
|
+
maxTokens: options?.maxTokens,
|
|
782
|
+
schema: options?.schema,
|
|
783
|
+
toolName: options?.toolName
|
|
784
|
+
})
|
|
785
|
+
).digest("hex");
|
|
786
|
+
const file = path6.join(dir, `${key}.json`);
|
|
787
|
+
try {
|
|
788
|
+
return JSON.parse(await fs6.readFile(file, "utf-8"));
|
|
789
|
+
} catch {
|
|
790
|
+
}
|
|
791
|
+
const result = await provider.complete(messages, options);
|
|
792
|
+
try {
|
|
793
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
794
|
+
await fs6.writeFile(file, JSON.stringify(result));
|
|
795
|
+
} catch {
|
|
796
|
+
}
|
|
797
|
+
return result;
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
}
|
|
736
801
|
|
|
737
802
|
// src/llm/context/prFetcher.ts
|
|
738
803
|
import { RequestError } from "@octokit/request-error";
|
|
@@ -845,10 +910,10 @@ var LLM_DEFAULTS = {
|
|
|
845
910
|
};
|
|
846
911
|
|
|
847
912
|
// src/llm/examples/fetcher.ts
|
|
848
|
-
import { createHash } from "crypto";
|
|
849
|
-
import * as
|
|
850
|
-
import * as
|
|
851
|
-
import * as
|
|
913
|
+
import { createHash as createHash2 } from "crypto";
|
|
914
|
+
import * as fs7 from "fs";
|
|
915
|
+
import * as os3 from "os";
|
|
916
|
+
import * as path7 from "path";
|
|
852
917
|
import { RequestError as RequestError2 } from "@octokit/request-error";
|
|
853
918
|
import { Octokit as Octokit2 } from "@octokit/rest";
|
|
854
919
|
|
|
@@ -904,16 +969,16 @@ ${blocks.join("\n")}
|
|
|
904
969
|
|
|
905
970
|
// src/llm/examples/fetcher.ts
|
|
906
971
|
function cacheDir() {
|
|
907
|
-
return
|
|
972
|
+
return path7.join(os3.tmpdir(), "releasekit", "examples");
|
|
908
973
|
}
|
|
909
974
|
function cacheKey(owner, repo, packageName) {
|
|
910
975
|
const safe = packageName.replace(/[^a-zA-Z0-9-]/g, "_");
|
|
911
|
-
const hash =
|
|
912
|
-
return
|
|
976
|
+
const hash = createHash2("sha256").update(packageName).digest("hex").slice(0, 8);
|
|
977
|
+
return path7.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
|
|
913
978
|
}
|
|
914
979
|
function readCache(key, latestTag, count) {
|
|
915
980
|
try {
|
|
916
|
-
const raw =
|
|
981
|
+
const raw = fs7.readFileSync(key, "utf-8");
|
|
917
982
|
const entry = JSON.parse(raw);
|
|
918
983
|
if (entry.latestTag !== latestTag || entry.count < count) return null;
|
|
919
984
|
return entry.examples;
|
|
@@ -923,8 +988,8 @@ function readCache(key, latestTag, count) {
|
|
|
923
988
|
}
|
|
924
989
|
function writeCache(key, latestTag, count, examples) {
|
|
925
990
|
try {
|
|
926
|
-
|
|
927
|
-
|
|
991
|
+
fs7.mkdirSync(path7.dirname(key), { recursive: true });
|
|
992
|
+
fs7.writeFileSync(key, JSON.stringify({ latestTag, count, examples }), "utf-8");
|
|
928
993
|
} catch {
|
|
929
994
|
}
|
|
930
995
|
}
|
|
@@ -1079,6 +1144,16 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1079
1144
|
}
|
|
1080
1145
|
};
|
|
1081
1146
|
|
|
1147
|
+
// src/utils/json.ts
|
|
1148
|
+
function extractJsonFromResponse(response) {
|
|
1149
|
+
const stripped = response.replace(/^```(?:json)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
1150
|
+
const objectMatch = stripped.match(/\{[\s\S]*\}/);
|
|
1151
|
+
if (objectMatch) return objectMatch[0];
|
|
1152
|
+
const arrayMatch = stripped.match(/\[[\s\S]*\]/);
|
|
1153
|
+
if (arrayMatch) return arrayMatch[0];
|
|
1154
|
+
return stripped;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1082
1157
|
// src/llm/ollama.ts
|
|
1083
1158
|
var OllamaProvider = class extends BaseLLMProvider {
|
|
1084
1159
|
name = "ollama";
|
|
@@ -1141,7 +1216,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1141
1216
|
const content = data.message.content;
|
|
1142
1217
|
if (options?.schema) {
|
|
1143
1218
|
try {
|
|
1144
|
-
const structured = JSON.parse(content);
|
|
1219
|
+
const structured = JSON.parse(extractJsonFromResponse(content));
|
|
1145
1220
|
return { content, structured };
|
|
1146
1221
|
} catch (e) {
|
|
1147
1222
|
debug(`Ollama: failed to parse structured response: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -1208,7 +1283,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1208
1283
|
}
|
|
1209
1284
|
if (options?.schema) {
|
|
1210
1285
|
try {
|
|
1211
|
-
const structured = JSON.parse(content);
|
|
1286
|
+
const structured = JSON.parse(extractJsonFromResponse(content));
|
|
1212
1287
|
return { content, structured };
|
|
1213
1288
|
} catch (e) {
|
|
1214
1289
|
debug(`OpenAI: failed to parse structured response: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -1267,16 +1342,6 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1267
1342
|
}
|
|
1268
1343
|
};
|
|
1269
1344
|
|
|
1270
|
-
// src/utils/json.ts
|
|
1271
|
-
function extractJsonFromResponse(response) {
|
|
1272
|
-
const stripped = response.replace(/^```(?:json)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
1273
|
-
const objectMatch = stripped.match(/\{[\s\S]*\}/);
|
|
1274
|
-
if (objectMatch) return objectMatch[0];
|
|
1275
|
-
const arrayMatch = stripped.match(/\[[\s\S]*\]/);
|
|
1276
|
-
if (arrayMatch) return arrayMatch[0];
|
|
1277
|
-
return stripped;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
1345
|
// src/llm/correctiveRetry.ts
|
|
1281
1346
|
async function withCorrectiveRetry(call, validate, buildCorrectionMessages3, initialMessages, maxCorrectiveAttempts = 2) {
|
|
1282
1347
|
let messages = initialMessages;
|
|
@@ -1914,20 +1979,20 @@ function createProvider(config) {
|
|
|
1914
1979
|
}
|
|
1915
1980
|
|
|
1916
1981
|
// src/output/versioned.ts
|
|
1917
|
-
import * as
|
|
1918
|
-
import * as
|
|
1982
|
+
import * as fs8 from "fs";
|
|
1983
|
+
import * as path8 from "path";
|
|
1919
1984
|
function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent) {
|
|
1920
1985
|
const written = [];
|
|
1921
1986
|
for (const ctx of contexts) {
|
|
1922
|
-
const outputPath = nested ?
|
|
1987
|
+
const outputPath = nested ? path8.join(directory, ctx.packageName, `${ctx.version}.md`) : path8.join(directory, `${ctx.version}.md`);
|
|
1923
1988
|
const content = renderContent(ctx);
|
|
1924
1989
|
if (dryRun) {
|
|
1925
1990
|
info(`[DRY RUN] Release notes (would write to ${outputPath}):`);
|
|
1926
1991
|
info(content);
|
|
1927
1992
|
continue;
|
|
1928
1993
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
1994
|
+
fs8.mkdirSync(path8.dirname(outputPath), { recursive: true });
|
|
1995
|
+
fs8.writeFileSync(outputPath, content, "utf-8");
|
|
1931
1996
|
success(`Release notes written to ${outputPath}`);
|
|
1932
1997
|
written.push(outputPath);
|
|
1933
1998
|
}
|
|
@@ -1935,7 +2000,7 @@ function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent)
|
|
|
1935
2000
|
}
|
|
1936
2001
|
|
|
1937
2002
|
// src/templates/ejs.ts
|
|
1938
|
-
import * as
|
|
2003
|
+
import * as fs9 from "fs";
|
|
1939
2004
|
import ejs from "ejs";
|
|
1940
2005
|
function renderEjs(template, context) {
|
|
1941
2006
|
try {
|
|
@@ -1945,16 +2010,16 @@ function renderEjs(template, context) {
|
|
|
1945
2010
|
}
|
|
1946
2011
|
}
|
|
1947
2012
|
function renderEjsFile(filePath, context) {
|
|
1948
|
-
if (!
|
|
2013
|
+
if (!fs9.existsSync(filePath)) {
|
|
1949
2014
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
1950
2015
|
}
|
|
1951
|
-
const template =
|
|
2016
|
+
const template = fs9.readFileSync(filePath, "utf-8");
|
|
1952
2017
|
return renderEjs(template, context);
|
|
1953
2018
|
}
|
|
1954
2019
|
|
|
1955
2020
|
// src/templates/handlebars.ts
|
|
1956
|
-
import * as
|
|
1957
|
-
import * as
|
|
2021
|
+
import * as fs10 from "fs";
|
|
2022
|
+
import * as path9 from "path";
|
|
1958
2023
|
import Handlebars from "handlebars";
|
|
1959
2024
|
function registerHandlebarsHelpers() {
|
|
1960
2025
|
Handlebars.registerHelper("capitalize", (str) => {
|
|
@@ -1980,28 +2045,28 @@ function renderHandlebars(template, context) {
|
|
|
1980
2045
|
}
|
|
1981
2046
|
}
|
|
1982
2047
|
function renderHandlebarsFile(filePath, context) {
|
|
1983
|
-
if (!
|
|
2048
|
+
if (!fs10.existsSync(filePath)) {
|
|
1984
2049
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
1985
2050
|
}
|
|
1986
|
-
const template =
|
|
2051
|
+
const template = fs10.readFileSync(filePath, "utf-8");
|
|
1987
2052
|
return renderHandlebars(template, context);
|
|
1988
2053
|
}
|
|
1989
2054
|
function renderHandlebarsComposable(templateDir, context) {
|
|
1990
2055
|
registerHandlebarsHelpers();
|
|
1991
|
-
const versionPath =
|
|
1992
|
-
const entryPath =
|
|
1993
|
-
const documentPath =
|
|
1994
|
-
if (!
|
|
2056
|
+
const versionPath = path9.join(templateDir, "version.hbs");
|
|
2057
|
+
const entryPath = path9.join(templateDir, "entry.hbs");
|
|
2058
|
+
const documentPath = path9.join(templateDir, "document.hbs");
|
|
2059
|
+
if (!fs10.existsSync(documentPath)) {
|
|
1995
2060
|
throw new TemplateError(`Document template not found: ${documentPath}`);
|
|
1996
2061
|
}
|
|
1997
|
-
if (
|
|
1998
|
-
Handlebars.registerPartial("version",
|
|
2062
|
+
if (fs10.existsSync(versionPath)) {
|
|
2063
|
+
Handlebars.registerPartial("version", fs10.readFileSync(versionPath, "utf-8"));
|
|
1999
2064
|
}
|
|
2000
|
-
if (
|
|
2001
|
-
Handlebars.registerPartial("entry",
|
|
2065
|
+
if (fs10.existsSync(entryPath)) {
|
|
2066
|
+
Handlebars.registerPartial("entry", fs10.readFileSync(entryPath, "utf-8"));
|
|
2002
2067
|
}
|
|
2003
2068
|
try {
|
|
2004
|
-
const compiled = Handlebars.compile(
|
|
2069
|
+
const compiled = Handlebars.compile(fs10.readFileSync(documentPath, "utf-8"));
|
|
2005
2070
|
return compiled(context);
|
|
2006
2071
|
} catch (error2) {
|
|
2007
2072
|
throw new TemplateError(`Handlebars render error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
@@ -2009,8 +2074,8 @@ function renderHandlebarsComposable(templateDir, context) {
|
|
|
2009
2074
|
}
|
|
2010
2075
|
|
|
2011
2076
|
// src/templates/liquid.ts
|
|
2012
|
-
import * as
|
|
2013
|
-
import * as
|
|
2077
|
+
import * as fs11 from "fs";
|
|
2078
|
+
import * as path10 from "path";
|
|
2014
2079
|
import { Liquid } from "liquidjs";
|
|
2015
2080
|
function createLiquidEngine(root) {
|
|
2016
2081
|
return new Liquid({
|
|
@@ -2028,15 +2093,15 @@ function renderLiquid(template, context) {
|
|
|
2028
2093
|
}
|
|
2029
2094
|
}
|
|
2030
2095
|
function renderLiquidFile(filePath, context) {
|
|
2031
|
-
if (!
|
|
2096
|
+
if (!fs11.existsSync(filePath)) {
|
|
2032
2097
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
2033
2098
|
}
|
|
2034
|
-
const template =
|
|
2099
|
+
const template = fs11.readFileSync(filePath, "utf-8");
|
|
2035
2100
|
return renderLiquid(template, context);
|
|
2036
2101
|
}
|
|
2037
2102
|
function renderLiquidComposable(templateDir, context) {
|
|
2038
|
-
const documentPath =
|
|
2039
|
-
if (!
|
|
2103
|
+
const documentPath = path10.join(templateDir, "document.liquid");
|
|
2104
|
+
if (!fs11.existsSync(documentPath)) {
|
|
2040
2105
|
throw new TemplateError(`Document template not found: ${documentPath}`);
|
|
2041
2106
|
}
|
|
2042
2107
|
const engine = createLiquidEngine(templateDir);
|
|
@@ -2048,10 +2113,10 @@ function renderLiquidComposable(templateDir, context) {
|
|
|
2048
2113
|
}
|
|
2049
2114
|
|
|
2050
2115
|
// src/templates/loader.ts
|
|
2051
|
-
import * as
|
|
2052
|
-
import * as
|
|
2116
|
+
import * as fs12 from "fs";
|
|
2117
|
+
import * as path11 from "path";
|
|
2053
2118
|
function getEngineFromFile(filePath) {
|
|
2054
|
-
const ext =
|
|
2119
|
+
const ext = path11.extname(filePath).toLowerCase();
|
|
2055
2120
|
switch (ext) {
|
|
2056
2121
|
case ".liquid":
|
|
2057
2122
|
return "liquid";
|
|
@@ -2085,10 +2150,10 @@ function getRenderFileFn(engine) {
|
|
|
2085
2150
|
}
|
|
2086
2151
|
}
|
|
2087
2152
|
function detectTemplateMode(templatePath) {
|
|
2088
|
-
if (!
|
|
2153
|
+
if (!fs12.existsSync(templatePath)) {
|
|
2089
2154
|
throw new TemplateError(`Template path not found: ${templatePath}`);
|
|
2090
2155
|
}
|
|
2091
|
-
const stat =
|
|
2156
|
+
const stat = fs12.statSync(templatePath);
|
|
2092
2157
|
if (stat.isFile()) {
|
|
2093
2158
|
return "single";
|
|
2094
2159
|
}
|
|
@@ -2106,7 +2171,7 @@ function renderSingleFile(templatePath, context, engine) {
|
|
|
2106
2171
|
};
|
|
2107
2172
|
}
|
|
2108
2173
|
function renderComposable(templateDir, context, engine) {
|
|
2109
|
-
const files =
|
|
2174
|
+
const files = fs12.readdirSync(templateDir);
|
|
2110
2175
|
const engineMap = {
|
|
2111
2176
|
liquid: { document: "document.liquid", version: "version.liquid", entry: "entry.liquid" },
|
|
2112
2177
|
handlebars: { document: "document.hbs", version: "version.hbs", entry: "entry.hbs" },
|
|
@@ -2129,15 +2194,15 @@ function renderComposable(templateDir, context, engine) {
|
|
|
2129
2194
|
return { content: renderHandlebarsComposable(templateDir, context), engine: resolvedEngine };
|
|
2130
2195
|
}
|
|
2131
2196
|
const expectedFiles = engineMap[resolvedEngine];
|
|
2132
|
-
const documentPath =
|
|
2133
|
-
if (!
|
|
2197
|
+
const documentPath = path11.join(templateDir, expectedFiles.document);
|
|
2198
|
+
if (!fs12.existsSync(documentPath)) {
|
|
2134
2199
|
throw new TemplateError(`Document template not found: ${expectedFiles.document}`);
|
|
2135
2200
|
}
|
|
2136
|
-
const versionPath =
|
|
2137
|
-
const entryPath =
|
|
2201
|
+
const versionPath = path11.join(templateDir, expectedFiles.version);
|
|
2202
|
+
const entryPath = path11.join(templateDir, expectedFiles.entry);
|
|
2138
2203
|
const render = getRenderFn(resolvedEngine);
|
|
2139
|
-
const entryTemplate =
|
|
2140
|
-
const versionTemplate =
|
|
2204
|
+
const entryTemplate = fs12.existsSync(entryPath) ? fs12.readFileSync(entryPath, "utf-8") : null;
|
|
2205
|
+
const versionTemplate = fs12.existsSync(versionPath) ? fs12.readFileSync(versionPath, "utf-8") : null;
|
|
2141
2206
|
if (entryTemplate && versionTemplate) {
|
|
2142
2207
|
const versionsWithEntries = context.versions.map((versionCtx) => {
|
|
2143
2208
|
const entries = versionCtx.entries.map((entry) => {
|
|
@@ -2148,7 +2213,7 @@ function renderComposable(templateDir, context, engine) {
|
|
|
2148
2213
|
});
|
|
2149
2214
|
const docContext = { ...context, renderedVersions: versionsWithEntries };
|
|
2150
2215
|
return {
|
|
2151
|
-
content: render(
|
|
2216
|
+
content: render(fs12.readFileSync(documentPath, "utf-8"), docContext),
|
|
2152
2217
|
engine: resolvedEngine
|
|
2153
2218
|
};
|
|
2154
2219
|
}
|
|
@@ -2292,7 +2357,8 @@ function createTemplateContext(pkg) {
|
|
|
2292
2357
|
date: pkg.date,
|
|
2293
2358
|
repoUrl: pkg.repoUrl,
|
|
2294
2359
|
entries: pkg.entries,
|
|
2295
|
-
compareUrl
|
|
2360
|
+
compareUrl,
|
|
2361
|
+
isFirstRelease: pkg.previousVersion === null
|
|
2296
2362
|
};
|
|
2297
2363
|
}
|
|
2298
2364
|
function createDocumentContext(contexts, repoUrl) {
|
|
@@ -2333,12 +2399,13 @@ async function processWithLLM(context, llmConfig, examples) {
|
|
|
2333
2399
|
info(`LLM base URL: ${llmConfig.baseURL}`);
|
|
2334
2400
|
}
|
|
2335
2401
|
const rawProvider = createProvider(llmConfig);
|
|
2402
|
+
const baseProvider = llmConfig.cache ? withContentHashCache(rawProvider, { model: llmConfig.model, baseURL: llmConfig.baseURL }) : rawProvider;
|
|
2336
2403
|
const retryOpts = llmConfig.retry ?? LLM_DEFAULTS.retry;
|
|
2337
2404
|
const configOptions = llmConfig.options;
|
|
2338
2405
|
const provider = {
|
|
2339
|
-
name:
|
|
2340
|
-
capabilities:
|
|
2341
|
-
complete: (messages, opts) => withRetry(() =>
|
|
2406
|
+
name: baseProvider.name,
|
|
2407
|
+
capabilities: baseProvider.capabilities,
|
|
2408
|
+
complete: (messages, opts) => withRetry(() => baseProvider.complete(messages, { ...configOptions, ...opts }), retryOpts)
|
|
2342
2409
|
};
|
|
2343
2410
|
const activeTasks = Object.entries(tasks).filter(([, enabled]) => enabled).map(([name]) => name);
|
|
2344
2411
|
info(`Running LLM tasks: ${activeTasks.join(", ")}`);
|
|
@@ -2394,17 +2461,17 @@ function getBuiltinTemplatePath(style) {
|
|
|
2394
2461
|
let packageRoot;
|
|
2395
2462
|
try {
|
|
2396
2463
|
const currentUrl = import.meta.url;
|
|
2397
|
-
packageRoot =
|
|
2398
|
-
packageRoot =
|
|
2464
|
+
packageRoot = path12.dirname(new URL(currentUrl).pathname);
|
|
2465
|
+
packageRoot = path12.join(packageRoot, "..", "..");
|
|
2399
2466
|
} catch {
|
|
2400
2467
|
packageRoot = __dirname;
|
|
2401
2468
|
}
|
|
2402
|
-
return
|
|
2469
|
+
return path12.join(packageRoot, "templates", style);
|
|
2403
2470
|
}
|
|
2404
2471
|
async function generateWithTemplate(contexts, templatesConfig, outputPath, repoUrl, dryRun) {
|
|
2405
2472
|
let templatePath;
|
|
2406
2473
|
if (templatesConfig?.path) {
|
|
2407
|
-
templatePath =
|
|
2474
|
+
templatePath = path12.resolve(templatesConfig.path);
|
|
2408
2475
|
} else {
|
|
2409
2476
|
templatePath = getBuiltinTemplatePath("keep-a-changelog");
|
|
2410
2477
|
}
|
|
@@ -2419,11 +2486,11 @@ async function generateWithTemplate(contexts, templatesConfig, outputPath, repoU
|
|
|
2419
2486
|
process.stdout.write(result.content);
|
|
2420
2487
|
return;
|
|
2421
2488
|
}
|
|
2422
|
-
const dir =
|
|
2423
|
-
if (!
|
|
2424
|
-
|
|
2489
|
+
const dir = path12.dirname(outputPath);
|
|
2490
|
+
if (!fs13.existsSync(dir)) {
|
|
2491
|
+
fs13.mkdirSync(dir, { recursive: true });
|
|
2425
2492
|
}
|
|
2426
|
-
|
|
2493
|
+
fs13.writeFileSync(outputPath, result.content, "utf-8");
|
|
2427
2494
|
const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
|
|
2428
2495
|
success(`${label} written to ${outputPath} (using ${result.engine} template)`);
|
|
2429
2496
|
}
|
|
@@ -2490,7 +2557,8 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2490
2557
|
const fmtOpts = {
|
|
2491
2558
|
includePackageName: contexts.length > 1 || contexts.some((c) => c.packageName.includes("/")),
|
|
2492
2559
|
categoryOrder: llmConfig?.categoryOrder,
|
|
2493
|
-
links: releaseNotesConfig?.links
|
|
2560
|
+
links: releaseNotesConfig?.links,
|
|
2561
|
+
firstRelease: releaseNotesConfig?.firstRelease
|
|
2494
2562
|
};
|
|
2495
2563
|
if (!pipelineOptions?.skipChangelogs && changelogConfig !== false && changelogConfig.mode) {
|
|
2496
2564
|
const fileName = changelogConfig.file ?? "CHANGELOG.md";
|
|
@@ -2523,12 +2591,12 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2523
2591
|
const dir = releaseNotesConfig.file.dir;
|
|
2524
2592
|
info(`Generating release notes \u2192 ${dir}`);
|
|
2525
2593
|
try {
|
|
2526
|
-
const { detectMonorepo } = await import("./aggregator-
|
|
2594
|
+
const { detectMonorepo } = await import("./aggregator-6TEWRELZ.js");
|
|
2527
2595
|
const nested = detectMonorepo(process.cwd()).isMonorepo || contexts.length > 1;
|
|
2528
2596
|
const renderContent = (ctx) => {
|
|
2529
2597
|
if (releaseNotesConfig.templates?.path) {
|
|
2530
|
-
const templatePath =
|
|
2531
|
-
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
|
|
2598
|
+
const templatePath = path12.resolve(releaseNotesConfig.templates.path);
|
|
2599
|
+
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true, output: "file" };
|
|
2532
2600
|
return renderTemplate(templatePath, docCtx, releaseNotesConfig.templates.engine).content;
|
|
2533
2601
|
}
|
|
2534
2602
|
if (ctx.enhanced?.releaseNotes) return ctx.enhanced.releaseNotes;
|
|
@@ -2543,7 +2611,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2543
2611
|
const packageNotes = {};
|
|
2544
2612
|
const releaseNotesResult = {};
|
|
2545
2613
|
for (const ctx of contexts) {
|
|
2546
|
-
packageNotes[ctx.packageName] = formatVersion(ctx);
|
|
2614
|
+
packageNotes[ctx.packageName] = formatVersion(ctx, { firstRelease: releaseNotesConfig?.firstRelease });
|
|
2547
2615
|
if (pipelineOptions?.skipReleaseNotes) {
|
|
2548
2616
|
continue;
|
|
2549
2617
|
}
|
|
@@ -2552,8 +2620,8 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2552
2620
|
} else if (releaseNotesConfig) {
|
|
2553
2621
|
if (releaseNotesConfig.templates?.path) {
|
|
2554
2622
|
try {
|
|
2555
|
-
const templatePath =
|
|
2556
|
-
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
|
|
2623
|
+
const templatePath = path12.resolve(releaseNotesConfig.templates.path);
|
|
2624
|
+
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true, output: "release" };
|
|
2557
2625
|
const rendered = renderTemplate(
|
|
2558
2626
|
templatePath,
|
|
2559
2627
|
docCtx,
|
|
@@ -2570,7 +2638,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2570
2638
|
info(
|
|
2571
2639
|
`No LLM release notes or template output for ${ctx.packageName}, using formatted changelog as release notes preview`
|
|
2572
2640
|
);
|
|
2573
|
-
releaseNotesResult[ctx.packageName] = formatVersion(ctx);
|
|
2641
|
+
releaseNotesResult[ctx.packageName] = formatVersion(ctx, { firstRelease: releaseNotesConfig?.firstRelease });
|
|
2574
2642
|
}
|
|
2575
2643
|
}
|
|
2576
2644
|
}
|
|
@@ -2585,7 +2653,7 @@ async function processInput(inputJson, config, dryRun, pipelineOptions) {
|
|
|
2585
2653
|
return runPipeline(input, config, dryRun, pipelineOptions);
|
|
2586
2654
|
}
|
|
2587
2655
|
async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
|
|
2588
|
-
const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-
|
|
2656
|
+
const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-6TEWRELZ.js");
|
|
2589
2657
|
const cwd = process.cwd();
|
|
2590
2658
|
const detected = detectMonorepo(cwd);
|
|
2591
2659
|
if (!detected.isMonorepo) return [];
|
|
@@ -2604,7 +2672,7 @@ async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
|
|
|
2604
2672
|
}
|
|
2605
2673
|
|
|
2606
2674
|
// src/command.ts
|
|
2607
|
-
import * as
|
|
2675
|
+
import * as fs14 from "fs";
|
|
2608
2676
|
import * as readline from "readline";
|
|
2609
2677
|
import { Command } from "commander";
|
|
2610
2678
|
function createNotesCommand() {
|
|
@@ -2705,7 +2773,7 @@ function createNotesCommand() {
|
|
|
2705
2773
|
}
|
|
2706
2774
|
let inputJson;
|
|
2707
2775
|
if (options.input) {
|
|
2708
|
-
inputJson =
|
|
2776
|
+
inputJson = fs14.readFileSync(options.input, "utf-8");
|
|
2709
2777
|
} else {
|
|
2710
2778
|
inputJson = await readStdin();
|
|
2711
2779
|
}
|
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-QHSLAQIS.js";
|
|
5
5
|
import {
|
|
6
6
|
readPackageVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E6757S4V.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
import * as fs from "fs";
|
package/dist/index.js
CHANGED
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
runPipeline,
|
|
19
19
|
saveAuth,
|
|
20
20
|
versionOutputToChangelogInput
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QHSLAQIS.js";
|
|
22
22
|
import {
|
|
23
23
|
aggregateToRoot,
|
|
24
24
|
detectMonorepo,
|
|
25
25
|
writeMonorepoChangelogs
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ECD44YFA.js";
|
|
27
27
|
import {
|
|
28
28
|
debug,
|
|
29
29
|
formatVersion,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
renderMarkdown,
|
|
32
32
|
success,
|
|
33
33
|
writeMarkdown
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-E6757S4V.js";
|
|
35
35
|
|
|
36
36
|
// src/output/json.ts
|
|
37
37
|
import * as fs from "fs";
|
package/docs/templates.md
CHANGED
|
@@ -71,6 +71,18 @@ The outermost template (`document`) receives:
|
|
|
71
71
|
| `unreleased` | `TemplateContext \| undefined` | Unreleased changes, if any |
|
|
72
72
|
| `compareUrls` | `Record<string, string> \| undefined` | Map of version → compare URL for all versions |
|
|
73
73
|
| `perPackage` | `boolean \| undefined` | `true` when rendered inline for a single package (e.g. GitHub release body). Use this to suppress document-level headings that are redundant when the content is embedded in a release that already shows the package name and version. |
|
|
74
|
+
| `output` | `'file' \| 'release' \| undefined` | Which release-notes destination this render targets: `'file'` (an in-repo per-version file) or `'release'` (the GitHub release body). Branch on it to emit content that only suits one — most importantly, docs-site **YAML frontmatter**, which would render as literal text in a GitHub release. |
|
|
75
|
+
|
|
76
|
+
A release-notes template that adds frontmatter for the in-repo file but not the GitHub release body:
|
|
77
|
+
|
|
78
|
+
```liquid
|
|
79
|
+
{% if output == "file" %}---
|
|
80
|
+
title: {{ versions[0].version }}
|
|
81
|
+
date: {{ versions[0].date }}
|
|
82
|
+
---
|
|
83
|
+
{% endif %}{% for v in versions %}{% for entry in v.entries %}- {{ entry.description }}
|
|
84
|
+
{% endfor %}{% endfor %}
|
|
85
|
+
```
|
|
74
86
|
|
|
75
87
|
### Version context
|
|
76
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@releasekit/notes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@anthropic-ai/sdk": "^0.
|
|
50
|
+
"@anthropic-ai/sdk": "^0.104.1",
|
|
51
51
|
"@octokit/request-error": "^7.1.0",
|
|
52
52
|
"@octokit/rest": "^22.0.1",
|
|
53
53
|
"chalk": "^5.6.2",
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
"minimatch": "^10.0.0",
|
|
60
60
|
"openai": "^6.42.0",
|
|
61
61
|
"smol-toml": "^1.6.1",
|
|
62
|
-
"yaml": "^2.
|
|
62
|
+
"yaml": "^2.9.0",
|
|
63
63
|
"zod": "^4.4.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@biomejs/biome": "^2.
|
|
66
|
+
"@biomejs/biome": "^2.5.0",
|
|
67
67
|
"@types/ejs": "^3.1.5",
|
|
68
|
-
"@types/node": "^22.19.
|
|
69
|
-
"@vitest/coverage-v8": "^4.1.
|
|
68
|
+
"@types/node": "^22.19.21",
|
|
69
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
70
70
|
"tsup": "^8.5.1",
|
|
71
71
|
"typescript": "^5.9.3",
|
|
72
|
-
"vitest": "^4.1.
|
|
72
|
+
"vitest": "^4.1.9",
|
|
73
73
|
"@releasekit/config": "0.0.0",
|
|
74
74
|
"@releasekit/core": "0.0.0"
|
|
75
75
|
},
|