Seeded claude design
This commit is contained in:
29
scripts/check-changelog.mjs
Normal file
29
scripts/check-changelog.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
// Verify that CHANGELOG.md gained at least one entry under [Unreleased]
|
||||
// or that a [vX.Y.Z] block was added since main. Fails CI if not.
|
||||
//
|
||||
// Skip with the PR label `no-changelog` for trivial doc-only changes.
|
||||
|
||||
import { execSync } from "node:child_process";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const base = process.env.GITHUB_BASE_REF || "main";
|
||||
let diff;
|
||||
try {
|
||||
execSync(`git fetch --no-tags --depth=50 origin ${base}`, { stdio: "ignore" });
|
||||
diff = execSync(`git diff --unified=0 origin/${base}...HEAD -- CHANGELOG.md`).toString();
|
||||
} catch (err) {
|
||||
console.error("Could not diff CHANGELOG.md:", err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const additions = diff.split("\n").filter(l => l.startsWith("+") && !l.startsWith("+++"));
|
||||
const meaningful = additions.filter(l => l.replace(/^\+/, "").trim().length > 0 && !l.includes("Unreleased"));
|
||||
|
||||
if (meaningful.length === 0) {
|
||||
console.error("CHANGELOG.md has no new entries on this PR.");
|
||||
console.error("Either add an entry under [Unreleased], or label this PR `no-changelog`.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`OK — ${meaningful.length} CHANGELOG line(s) added.`);
|
||||
22
scripts/extract-release-notes.mjs
Normal file
22
scripts/extract-release-notes.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
// Print the CHANGELOG slice for a given tag to stdout.
|
||||
// Used by the release workflow to attach release notes.
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const tag = process.argv[2];
|
||||
if (!tag) {
|
||||
console.error("Usage: extract-release-notes.mjs vX.Y.Z");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const version = tag.replace(/^v/, "");
|
||||
const changelog = readFileSync("CHANGELOG.md", "utf8");
|
||||
const re = new RegExp(`## \\[${version.replace(/\./g, "\\.")}\\][\\s\\S]*?(?=\\n## \\[|$)`, "m");
|
||||
const m = changelog.match(re);
|
||||
|
||||
if (!m) {
|
||||
console.error(`No CHANGELOG section found for [${version}].`);
|
||||
process.exit(1);
|
||||
}
|
||||
process.stdout.write(m[0].trim() + "\n");
|
||||
Reference in New Issue
Block a user