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(ci): run the changelog gate in CI, where it was never running
Abdurrahman Fakhrul1d970b84d789
diff --git a/package.json b/package.jsonindex a0cc7f7e..d36db434 100644--- a/package.json+++ b/package.json@@ -15,7 +15,7 @@"typecheck": "tsc --noEmit","test": "node scripts/check-test-toolchain.mjs && vitest run","coverage": "node scripts/check-test-toolchain.mjs && vitest run --coverage",- "check": "node scripts/check-cycles.mjs && node scripts/check-architecture.mjs && node scripts/check-docs.mjs && node scripts/gen-comparison.mjs --check && node scripts/check-contrast.mjs && bun scripts/check-skill-flows.mjs && bun run check:instance-literals && bun run test:ci && bun run parity:nakama && bun run test:parity",+ "check": "node scripts/check-cycles.mjs && node scripts/check-architecture.mjs && node scripts/check-docs.mjs && node scripts/gen-comparison.mjs --check && node scripts/gen-changelog.mjs --check && node scripts/check-contrast.mjs && bun scripts/check-skill-flows.mjs && bun run check:instance-literals && bun run test:ci && bun run parity:nakama && bun run test:parity","audit": "node scripts/audit.mjs","verify": "bun run typecheck && bun run lint && bun run coverage && bun run check && bun run audit","pr:preflight": "bash scripts/pr-preflight.sh --full",diff --git a/scripts/changelog-gate.test.ts b/scripts/changelog-gate.test.tsnew file mode 100644index 00000000..21028ace--- /dev/null+++ b/scripts/changelog-gate.test.ts@@ -0,0 +1,62 @@+import { spawnSync } from "node:child_process";+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";+import os from "node:os";+import path from "node:path";+import { afterEach, describe, expect, it } from "vitest";++// Two separate failures led here, both of which let `main` go red without CI noticing:+//+// 1. `docs/CHANGELOG.md` is generated from commit subjects, so a hand-made docs commit+// leaves it stale the moment it lands. Three docs-only commits in one session each+// needed a second commit to fix.+// 2. The staleness check lived only in the local pre-push hook and in gates-12.sh. CI+// runs `bun run check`, which did not include it — so a squash merge could leave the+// file stale again and every CI run stayed green.+//+// This pins both: the generator's `--check` really fails on a stale file, and the CI-facing+// `check` script actually invokes it. A gate nobody runs is not a gate.++const ROOT = path.resolve(__dirname, "..");++describe("changelog staleness gate", () => {+ const roots: string[] = [];+ afterEach(() => {+ for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });+ });++ it("is wired into the script CI runs, not just the local hook", () => {+ const scripts = JSON.parse(readFileSync(path.join(ROOT, "package.json"), "utf8")).scripts as Record<string, string>;+ expect(scripts.check, "CI runs `bun run check`; the gate must be in it").toContain("gen-changelog.mjs --check");+ // The pre-push hook already had it; keep both, since a local run should fail too.+ expect(readFileSync(path.join(ROOT, "scripts/gates.sh"), "utf8")).toContain("gen-changelog.mjs --check");+ expect(readFileSync(path.join(ROOT, "scripts/gates-12.sh"), "utf8")).toContain("gen-changelog.mjs --check");+ });++ it("exits non-zero when the file does not match history", () => {+ // A repo-shaped fixture: two commits, and a changelog that lists neither.+ const root = mkdtempSync(path.join(os.tmpdir(), "mso-changelog-gate-"));+ 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")));+ writeFileSync(path.join(root, "docs/CHANGELOG.md"), "# Changelog\n\nstale placeholder\n");++ const git = (...args: string[]) =>+ spawnSync("git", args, { cwd: root, encoding: "utf8" });+ git("init", "-q");+ writeFileSync(path.join(root, "a.txt"), "a");+ git("-c", "user.name=T", "-c", "[email protected]", "add", "-A");+ git("-c", "user.name=T", "-c", "[email protected]", "commit", "-qm", "feat(x): a real change");++ const stale = spawnSync(process.execPath, ["scripts/gen-changelog.mjs", "--check"], { cwd: root, encoding: "utf8" });+ expect(stale.status, "a changelog that omits a commit must fail the gate").toBe(1);+ expect(stale.stderr).toMatch(/stale/i);++ // Regenerating must make it current, and stay current on a second check — that is+ // what stops the "regenerate, then stale again" loop.+ expect(spawnSync(process.execPath, ["scripts/gen-changelog.mjs"], { cwd: root, encoding: "utf8" }).status).toBe(0);+ const fresh = spawnSync(process.execPath, ["scripts/gen-changelog.mjs", "--check"], { cwd: root, encoding: "utf8" });+ expect(fresh.status, "after regenerating the gate must pass").toBe(0);+ expect(fresh.stdout + fresh.stderr).toMatch(/current/i);+ });+});