Hub: the Kanban and the Journal tabs, and /hub/journal.json
Kanban: every open issue and pull request and what closed in the last seven days, placed in To do, In progress, In review and Done by the rules of Kira's work board, each card with its roadmap item (its roadmap:<id> label or the item linking it) and a filter by item. Journal: every release with its changes grouped by roadmap item, the merges no release has yet, and a weekly summary from roadmap/journal/<year>-<week>.md. The same journal is /hub/journal.json, for Kira's #updates and posts elsewhere: each entry names the roadmap items it moved and shipped, with their 240-character text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fixesIn, overviewHtml, progress, roadmapHtml, slimIssue } from "./hub.js";
|
||||
import { boardFrom, fixesIn, itemOf, journalFrom, journalHtml, journalJson, overviewHtml, progress, roadmapHtml, slimIssue } from "./hub.js";
|
||||
|
||||
const roadmap = JSON.parse(readFileSync(new URL("../data/roadmap.json", import.meta.url), "utf8"));
|
||||
|
||||
@@ -53,3 +53,48 @@ test("the overview lists the focus items and never nests links", () => {
|
||||
for (const item of roadmap.items.filter((i) => i.focus)) assert.ok(html.includes(`href="#${item.id}"`), item.id);
|
||||
for (const row of html.match(/<li class="row">[\s\S]*?<\/li>/g)) assert.equal(row.split("<a ").length, 2, row);
|
||||
});
|
||||
|
||||
test("the board places issues and pull requests as Kira's board does", () => {
|
||||
const now = Date.parse("2030-01-10T00:00:00Z");
|
||||
const list = [
|
||||
issue(1),
|
||||
issue(2),
|
||||
issue(3, { assignees: [{ login: "x" }] }),
|
||||
pr(10, { body: "Fixes #1" }),
|
||||
pr(11, { body: "Fixes #2", draft: true }),
|
||||
pr(12, { labels: [{ name: `roadmap:${roadmap.items[0].id}` }] }),
|
||||
pr(13, { draft: true }),
|
||||
pr(14, { state: "closed", pull_request: { merged_at: "2030-01-09T00:00:00Z" } }),
|
||||
pr(15, { state: "closed", pull_request: { merged_at: "2029-12-01T00:00:00Z" } }),
|
||||
].map(slimIssue);
|
||||
const board = boardFrom(list, roadmap, now);
|
||||
const ids = (column) => board[column].map((c) => c.n);
|
||||
assert.deepEqual(ids("todo"), []);
|
||||
assert.deepEqual(ids("progress"), [2, 3, 13]);
|
||||
assert.deepEqual(ids("review"), [1, 12]);
|
||||
assert.deepEqual(ids("done"), [14]);
|
||||
assert.deepEqual(board.review[0].prs, [10]);
|
||||
assert.equal(board.review[1].item, roadmap.items[0].id);
|
||||
assert.equal(itemOf(slimIssue(pr(16, { body: "Fixes #1438" })), roadmap), "end-city-banners");
|
||||
});
|
||||
|
||||
test("the journal groups a release's changes by roadmap item and lists what awaits a release", () => {
|
||||
const releases = [
|
||||
{ tag_name: "v0.2.2", name: "Horizon 0.2.2: Rich presence", published_at: "2030-01-02T00:00:00Z", html_url: "u2", body: "### New\n- Discord Rich Presence (#1787)\n\n### Fixed\n- A fix (#5, fixes #4)\n" },
|
||||
{ tag_name: "launcher@0.2.1", name: "Horizon launcher 0.2.1", published_at: "2030-01-01T00:00:00Z", html_url: "u1", body: "### Fixed\n- Window (#6)\n" },
|
||||
];
|
||||
const list = [
|
||||
pr(1788, { state: "closed", pull_request: { merged_at: "2030-01-03T00:00:00Z" } }),
|
||||
pr(7, { state: "closed", pull_request: { merged_at: "2030-01-03T00:00:00Z" }, labels: [{ name: "skip-release" }] }),
|
||||
].map(slimIssue);
|
||||
const entries = journalFrom(releases, list, { ...roadmap, journal: [] });
|
||||
assert.deepEqual(entries.map((e) => e.id), ["next-release", "v0.2.2", "launcher@0.2.1"]);
|
||||
assert.deepEqual(entries[0].changes.map((c) => [c.prs, c.item]), [[[1788], "discord-presence"]]);
|
||||
assert.deepEqual(entries[1].changes.map((c) => [c.section, c.text, c.item]), [["new", "Discord Rich Presence", "discord-presence"], ["fixed", "A fix", null]]);
|
||||
const json = journalJson(entries, roadmap, "now");
|
||||
assert.equal(json.format, "horizon-journal");
|
||||
assert.equal(json.entries[1].items[0].post.length <= 240, true);
|
||||
const html = journalHtml(entries, roadmap);
|
||||
assert.ok(html.includes('href="#item-discord-presence"'));
|
||||
assert.ok(html.includes("And 1 fix."));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user