All checks were successful
PR checks / checks (pull_request) Successful in 1m13s
Twenty pages completing the tree section 10 planned: Modules (8), Architecture
(5) and Reference (7). Four decisions, D38-D41, recorded in PLAN.md section 10.
D39 is the one that shaped the phase. Section 1 forbids re-specifying a
contract, and a Reference section is exactly where that rule is most tempting to
break, so the line is drawn at names: every environment variable, config key,
installer command, visibility rung and canonical document is listed with one
terse line saying what it is FOR, while shapes, semantics and every "why" stay
in the canonical document.
That is only safe because the names are checked. checkReference.mjs compares six
enumerations against the repositories that own them, over the Gitea API, as set
comparisons in BOTH directions -- and the second direction is the one that earns
its keep, because a reference page does not usually rot by describing something
that vanished, it rots by quietly not mentioning what was added since.
The check went green on its first run, which is the least trustworthy possible
outcome, so it was verified by breaking it: seven mutations, all caught. The one
worth keeping is the visibility ladder REORDERED with its membership unchanged
-- it is a security boundary, and a set comparison alone would have passed it.
D41 turns plannedSidebar from a checklist into a checked invariant, and finding
out why was the phase's first defect: it had already drifted, because phase 7
added the Content page under D37 and never updated the list. Nothing failed,
because nothing read it. checkSidebar.mjs now asserts the two trees agree on
groups, labels and order -- order because the order of Getting started IS the
installation path.
Two more things the writing found. PLAN.md's page count was wrong and had been
since section 10 was written ("roughly 38, 37 planned" for a tree of forty).
And module.json's `mounts` and the SPA's paths are different mechanisms that no
single document stated plainly -- module-uo declares admin: ["/shard",
"/uo-link"] while its screen lives at /admin/uo/link, because API routes are
deliberately NOT namespaced while SPA routes are. That is precisely the
distinction the installer got wrong in v0.1.0, and it now has a named home.
D40: the docs link to /architecture/'s drawn diagrams rather than importing
them. Those components carry marketing chrome and depend on diagram.css, which
Starlight does not load; the docs use text diagrams, which paste into an issue.
npm run verify green: 40 pages across 5 groups agree with plannedSidebar, 2390
internal links resolve, 123 repository links point at a branch, 19 facts, 59
quickstart checks, 22 reference enumerations, astro check 0 errors, 36 tests.
Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
3.6 KiB
JavaScript
78 lines
3.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* checkSidebar.mjs — PLAN.md §12, added in phase 8.
|
|
*
|
|
* `src/config/sidebar.mjs` holds two trees: `docsSidebar`, which Starlight renders, and
|
|
* `plannedSidebar`, the tree §10 planned. While pages were still being written the second
|
|
* was a checklist. Now that every page exists it is a second copy of the first, maintained
|
|
* by hand — and a hand-maintained copy with nothing reading it is exactly the shape of
|
|
* thing §1 is about.
|
|
*
|
|
* It had already drifted, silently: phase 7 added the `Content` page under D37 and this
|
|
* list was never updated. Nothing failed, because nothing read it. That is the whole
|
|
* argument for this check.
|
|
*
|
|
* So the two must agree on groups, labels AND order. Order is checked because the order of
|
|
* "Getting started" IS the installation path — §10 calls it the priority of the whole
|
|
* project — and a reordering that nobody noticed would be a worse defect than a missing
|
|
* page.
|
|
*
|
|
* node scripts/checkSidebar.mjs
|
|
*
|
|
* No token and no network: both trees are in this repository.
|
|
*/
|
|
|
|
import { docsSidebar, plannedSidebar } from '../src/config/sidebar.mjs';
|
|
|
|
const failures = [];
|
|
const fail = (what, detail) => failures.push({ what, detail });
|
|
|
|
const live = new Map(docsSidebar.map((g) => [g.label, g.items.map((i) => i.label)]));
|
|
const planned = new Map(Object.entries(plannedSidebar));
|
|
|
|
// ── Groups ──────────────────────────────────────────────────────────────────
|
|
for (const label of live.keys()) {
|
|
if (!planned.has(label)) fail(`group ${label}`, 'is in the live sidebar and not in plannedSidebar');
|
|
}
|
|
for (const label of planned.keys()) {
|
|
if (!live.has(label)) fail(`group ${label}`, 'is in plannedSidebar and not in the live sidebar');
|
|
}
|
|
|
|
// ── Pages, in order ─────────────────────────────────────────────────────────
|
|
for (const [label, liveItems] of live) {
|
|
const plannedItems = planned.get(label);
|
|
if (!plannedItems) continue;
|
|
|
|
for (const page of liveItems) {
|
|
if (!plannedItems.includes(page)) fail(`${label} → ${page}`, 'is live but not in plannedSidebar');
|
|
}
|
|
for (const page of plannedItems) {
|
|
if (!liveItems.includes(page)) fail(`${label} → ${page}`, 'is planned but has no live sidebar entry');
|
|
}
|
|
|
|
// Only meaningful once membership matches; otherwise it just repeats the above.
|
|
if (liveItems.length === plannedItems.length && liveItems.every((p) => plannedItems.includes(p))) {
|
|
if (liveItems.join(' | ') !== plannedItems.join(' | ')) {
|
|
fail(
|
|
`${label} order`,
|
|
`live "${liveItems.join(' → ')}" vs planned "${plannedItems.join(' → ')}"`,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ── Report ──────────────────────────────────────────────────────────────────
|
|
if (failures.length === 0) {
|
|
const pages = [...live.values()].reduce((n, items) => n + items.length, 0);
|
|
console.log(`checkSidebar: ${live.size} groups and ${pages} pages agree with plannedSidebar.`);
|
|
} else {
|
|
console.error(`\ncheckSidebar: ${failures.length} disagreement(s) between the two trees:\n`);
|
|
for (const f of failures) console.error(` ✗ ${f.what}\n ${f.detail}`);
|
|
console.error(`
|
|
Both trees are in src/config/sidebar.mjs. Decide which one is right — if a page was
|
|
deliberately added, renamed or reordered, plannedSidebar records that decision and
|
|
should move with it.
|
|
`);
|
|
process.exit(1);
|
|
}
|