Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(docs): collapse squash duplicates in the changelog instead of listing twice
Abdurrahman Fakhruld8dd5baa9f03
diff --git a/scripts/changelog-gate.test.ts b/scripts/changelog-gate.test.tsindex 21028ace..9fffe9e6 100644--- a/scripts/changelog-gate.test.ts+++ b/scripts/changelog-gate.test.ts@@ -59,4 +59,36 @@ describe("changelog staleness gate", () => {expect(fresh.status, "after regenerating the gate must pass").toBe(0);expect(fresh.stdout + fresh.stderr).toMatch(/current/i);});++ // A squash merge appends " (#NNN)" to the subject, so the same change can land in+ // history twice on one day — once as the original commit, once as the squash that+ // replaced it. Listing it twice is what made this file stale after every squash.+ it("collapses a squash duplicate but keeps a PR number that stands alone", () => {+ const root = mkdtempSync(path.join(os.tmpdir(), "mso-changelog-squash-"));+ roots.push(root);+ mkdirSync(path.join(root, "scripts"), { recursive: true });+ mkdirSync(path.join(root, "docs"), { recursive: true });+ writeFileSync(path.join(root, "scripts/gen-changelog.mjs"), readFileSync(path.join(ROOT, "scripts/gen-changelog.mjs")));++ const git = (...args: string[]) => spawnSync("git", args, { cwd: root, encoding: "utf8" });+ const commit = (file: string, subject: string) => {+ writeFileSync(path.join(root, file), file);+ git("init", "-q");+ git("-c", "user.name=T", "-c", "[email protected]", "add", "-A");+ git("-c", "user.name=T", "-c", "[email protected]", "commit", "-qm", subject);+ };+ git("init", "-q");+ // Same change, twice: the original and the squash that replaced it.+ commit("a.txt", "feat(x): a real change");+ commit("b.txt", "feat(x): a real change (#999)");+ // A different change whose PR number is its only occurrence.+ commit("c.txt", "feat(y): only once (#777)");++ expect(spawnSync(process.execPath, ["scripts/gen-changelog.mjs"], { cwd: root, encoding: "utf8" }).status).toBe(0);+ const out = readFileSync(path.join(root, "docs/CHANGELOG.md"), "utf8");++ expect(out.match(/a real change/g)?.length, "the duplicate must appear once").toBe(1);+ expect(out, "the collapsed line drops the PR suffix").not.toContain("a real change (#999)");+ expect(out, "a lone PR number must survive, it links the line to its discussion").toContain("only once (#777)");+ });});diff --git a/scripts/gen-changelog.mjs b/scripts/gen-changelog.mjsindex c89f1bf8..f40f05f0 100644--- a/scripts/gen-changelog.mjs+++ b/scripts/gen-changelog.mjs@@ -89,6 +89,25 @@ for (const [date, list] of byDay) {);}+// A squash merge appends " (#NNN)" to the subject, so the same change can appear twice+// on one day: once as the original commits, once as the squashed commit that replaced+// them. The bare number tells the reader nothing the line does not already say, so when+// a subject with a PR number collides with the same subject without one, keep the bare+// form. Only collisions are touched — a PR number that is the only occurrence survives,+// because it is the one fact linking a line to its discussion.+for (const [date, list] of byDay) {+ const bare = new Set(list.filter((c) => !/\(#\d+\)$/.test(c.subject)).map((c) => c.subject));+ const hasPrSuffix = (s) => /^(.*\S)\s+\(#\d+\)$/.exec(s);+ byDay.set(+ date,+ list.filter((c) => {+ const m = hasPrSuffix(c.subject);+ // Keep the suffixed row only when nothing bare describes the same change.+ return !(m && bare.has(m[1]));+ }),+ );+}+const days = [...byDay.keys()].sort().reverse().slice(0, MAX_DAYS);const out = ["# Changelog",