Skip to content

Commit 5996c95

Browse files
TMHSDigitalclaude
andcommitted
404 suggests stacks; --stale-days=N honoured; bot issue lookups see every open issue
- data payload gains stacks [{ id, title }] (schema and docs updated); the 404 page matches a mistyped /stack/<id>/ against them and falls back to "See all stacks" (#249) - staleDaysFrom reads --stale-days=N as well as --stale-days N (#250) - links, reverify and thumbs workflows pass --limit 1000 to gh issue list, so an older bot issue is found and updated, not duplicated (#248) Closes #248 Closes #249 Closes #250 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LpkeXQPaUhxjgqdqnk6BrJ
1 parent a5e438f commit 5996c95

10 files changed

Lines changed: 36 additions & 15 deletions

File tree

‎.github/workflows/links.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
title="Link check: ${PROBLEMS} sources need a look"
4444
# Only the bot's own issue: anyone can open one with this label and title.
45-
existing=$(gh issue list --state open --label correction --json number,title,author \
45+
existing=$(gh issue list --limit 1000 --state open --label correction --json number,title,author \
4646
--jq '[.[] | select(.author.login == "app/github-actions" and (.title | startswith("Link check:")))][0].number // empty')
4747
if [ -n "$existing" ]; then
4848
gh issue edit "$existing" --title "$title" --body-file link-report.md

‎.github/workflows/reverify.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
month=$(date -u +%Y-%m)
4242
title="Re-verify batch ${month}: ${COUNT} entries due a licence re-read"
4343
# Only the bot's own issue: anyone can open one with this label and title.
44-
existing=$(gh issue list --state open --label "help wanted" --json number,title,author \
44+
existing=$(gh issue list --limit 1000 --state open --label "help wanted" --json number,title,author \
4545
--jq '[.[] | select(.author.login == "app/github-actions" and (.title | startswith("Re-verify batch ")))][0].number // empty')
4646
if [ -n "$existing" ]; then
4747
gh issue edit "$existing" --title "$title" --body-file reverify-batch.md

‎.github/workflows/thumbs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
{ printf 'Open the pull request: %s\n\n' "$compare"; cat "$RUNNER_TEMP/thumbs-report.md"; } > "$RUNNER_TEMP/issue-body.md"
114114
title="Thumbnail refresh ${month}: ${CHANGED} changes"
115115
# Only the bot's own issue: anyone can open one with this label and title.
116-
existing=$(gh issue list --state open --label "enhancement" --json number,title,author \
116+
existing=$(gh issue list --limit 1000 --state open --label "enhancement" --json number,title,author \
117117
--jq '[.[] | select(.author.login == "app/github-actions" and (.title | startswith("Thumbnail refresh ")))][0].number // empty')
118118
if [ -n "$existing" ]; then
119119
gh issue edit "$existing" --title "$title" --body-file "$RUNNER_TEMP/issue-body.md"

‎docs/data.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The catalog is published as machine-readable files on every deploy. The metadata
88

99
| File | What it is |
1010
| --- | --- |
11-
| [`data.json`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/data.json) | The whole catalog: every entry with its licence fields, plus categories, guides and counts |
11+
| [`data.json`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/data.json) | The whole catalog: every entry with its licence fields, plus categories, guides, stacks and counts |
1212
| [`data.schema.json`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/data.schema.json) | JSON Schema (draft 2020-12) for `data.json`. The build fails if `data.json` does not match it |
1313
| [`catalog.csv`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/catalog.csv) | One row per entry, for spreadsheets. Lists are joined with `; ` |
1414
| [`feed.xml`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/feed.xml) | Atom feed of newly added sources |
@@ -47,7 +47,7 @@ Each entry in `data.json` has these fields. `catalog.csv` has the ones marked CS
4747
| `attributionClass`, `licenseRank` | | Derived sort keys used by the site |
4848
| `maintenance`, `engine_lock`, `ue_versions`, `limits`, `grid_dimensions`, `camera_perspective`, `hardware_tags` | | Present only where they apply; see [the site README](../site/README.md) |
4949

50-
Top-level keys are `generatedAt`, `version`, `site`, `categories`, `guides`, `featured`, `stats` (counts of total, active, needs-review, deprecated and commercial entries), `filters` (`licenseFamilies` and `formatGroups`, the labels and groups behind the site's filters) and `entries`.
50+
Top-level keys are `generatedAt`, `version`, `site`, `categories`, `guides`, `stacks` (id and title of each starter stack), `featured`, `stats` (counts of total, active, needs-review, deprecated and commercial entries), `filters` (`licenseFamilies` and `formatGroups`, the labels and groups behind the site's filters) and `entries`.
5151

5252
Field names are stable, and [`data.schema.json`](https://tmhsdigital.github.io/Free-Game-Dev-Assets/data.schema.json) states them as a JSON Schema the build enforces, so a field cannot be renamed or retyped without the schema changing too. New optional fields may appear, so ignore keys you do not know rather than failing on them (the schema itself rejects unknown keys, which is how the build catches drift).
5353

‎site/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ and tools that want the metadata without scraping the page. The page itself load
4141
`data.js`, the same payload assigned to `window.__CATALOG__`.
4242

4343
- Top-level keys: `generatedAt`, `version` (the calendar tag of the day, `vYYYY.MM.DD`),
44-
`site`, `categories`, `guides`, `featured`, `stats` (counts: `total`, `active`,
44+
`site`, `categories`, `guides`, `stacks` (id and title), `featured`, `stats` (counts: `total`, `active`,
4545
`needsReview`, `deprecated`, `commercialOk`, `commercialVaries`, `categories`), `filters`
4646
(`licenseFamilies`, the labels for the Licence filter, and `formatGroups`, the groups behind
4747
the Format filter) and `entries`.

‎site/build.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,8 @@ function main() {
608608
site: config.site,
609609
categories: config.categories,
610610
guides: config.guides,
611+
// Stack ids and titles, so the 404 page can suggest a mistyped stack (#249).
612+
stacks: stacks.map((s) => ({ id: s.meta.id, title: s.meta.title })),
611613
featured,
612614
stats,
613615
// Choices for the Licence and Format filters (app.js).

‎site/data.schema.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@
4444
}
4545
}
4646
},
47+
"stacks": {
48+
"type": "array",
49+
"description": "Starter stacks: id and title; the page is stack/<id>/",
50+
"items": {
51+
"type": "object",
52+
"required": ["id", "title"],
53+
"properties": {
54+
"id": { "type": "string" },
55+
"title": { "type": "string" }
56+
}
57+
}
58+
},
4759
"featured": {
4860
"type": "array",
4961
"items": {

‎site/lib/lib.test.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,8 @@ eq("did you mean: misspelt kenney", closestEntries(slugOf("kenny"), guessPool).s
10231023
/* check-links: flags and API failures (#82) -------------------------------- */
10241024
eq("stale-days default", staleDaysFrom(["node", "x"]).days, 365);
10251025
eq("stale-days value", staleDaysFrom(["node", "x", "--stale-days", "30"]).days, 30);
1026+
eq("stale-days=N value (#250)", staleDaysFrom(["node", "x", "--stale-days=30"]).days, 30);
1027+
has("stale-days= empty is an error", staleDaysFrom(["node", "x", "--stale-days="]).error, "whole number");
10261028
has("stale-days as the last argument is an error", staleDaysFrom(["node", "x", "--stale-days"]).error, "got nothing");
10271029
has("stale-days followed by another flag is an error", staleDaysFrom(["node", "x", "--stale-days", "--report"]).error, "--stale-days needs a whole number");
10281030
has("stale-days non-number is an error", staleDaysFrom(["node", "x", "--stale-days", "soon"]).error, '"soon"');

‎site/lib/link-check.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ export const USAGE = "usage: node site/check-links.mjs [--report <file.md>] [--s
5252
* before any fetch, so a typo cannot throw after twenty minutes of requests.
5353
*/
5454
export function staleDaysFrom(argv, fallback = 365) {
55+
// Both spellings parseArgs accepts: `--stale-days 30` and `--stale-days=30` (#250).
56+
const eqArg = argv.find((a) => a.startsWith("--stale-days="));
5557
const i = argv.indexOf("--stale-days");
56-
if (i === -1) return { days: fallback };
57-
const raw = argv[i + 1];
58+
if (i === -1 && eqArg === undefined) return { days: fallback };
59+
const raw = i === -1 ? eqArg.slice("--stale-days=".length) : argv[i + 1];
5860
const days = Number(raw);
5961
if (raw === undefined || raw.startsWith("--") || !/^\d+$/.test(raw.trim()) || !Number.isSafeInteger(days)) {
6062
return { error: `--stale-days needs a whole number of days, got ${raw === undefined ? "nothing" : JSON.stringify(raw)}\n${USAGE}` };

‎site/public/not-found.js‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* The 404 page reads the words in the address that missed (a mistyped
33
* /entry/kenny-ui/, say), suggests the closest entries and offers a catalog
4-
* search for the same words. A miss under /category/ or /guide/ suggests the
5-
* closest category or guide instead. The page works without it.
4+
* search for the same words. A miss under /category/, /guide/ or /stack/
5+
* suggests the closest category, guide or stack instead. The page works without it.
66
*/
77
import { closestEntries, missSection, missSlug } from "./search.js";
88

@@ -18,12 +18,14 @@ import { closestEntries, missSection, missSlug } from "./search.js";
1818
if (!slug) return;
1919
const section = missSection(location.pathname, root.pathname);
2020

21-
// Pages to match against: entries by default, or the category or guide list.
21+
// Pages to match against: entries by default, or the category, guide or stack list.
2222
let pages;
2323
if (section === "category") {
2424
pages = Object.entries(data.categories || {}).map(([id, c]) => ({ id, name: c.label || id, note: c.blurb || "", href: `category/${id}/` }));
2525
} else if (section === "guide") {
2626
pages = (data.guides || []).map((g) => ({ id: g.id, name: g.title || g.id, note: "", href: `guide/${g.id}/` }));
27+
} else if (section === "stack") {
28+
pages = (data.stacks || []).map((s) => ({ id: s.id, name: s.title || s.id, note: "", href: `stack/${s.id}/` }));
2729
} else {
2830
pages = data.entries.map((e) => ({
2931
id: e.id,
@@ -56,13 +58,14 @@ import { closestEntries, missSection, missSlug } from "./search.js";
5658
}
5759
host.append(heading, list);
5860
}
59-
// A catalog search only helps for entry-like words, not a mistyped category or guide name.
60-
if (section === "category" || section === "guide") {
61+
// A catalog search only helps for entry-like words, not a mistyped category, guide or stack name.
62+
const lists = { category: ["#catalog", "Browse every category"], guide: ["#guides", "See all guides"], stack: ["#stacks", "See all stacks"] };
63+
if (lists[section]) {
6164
if (matches.length) return;
6265
const back = document.createElement("p");
6366
const link = document.createElement("a");
64-
link.href = new URL(section === "guide" ? "#guides" : "#catalog", root).href;
65-
link.textContent = section === "guide" ? "See all guides" : "Browse every category";
67+
link.href = new URL(lists[section][0], root).href;
68+
link.textContent = lists[section][1];
6669
back.append(link);
6770
host.append(back);
6871
return;

0 commit comments

Comments
 (0)