1// Content hash of a page description, ignoring the check stamp itself. check-description.mjs2// writes it when (and only when) the check passed; deploy-description.mjs recomputes it, so a3// description that failed its check, or was edited after it, is refused.4import crypto from 'node:crypto';56export const descHash = (desc) => {7 const { checkedAt, checkedHash, ...rest } = desc;8 return
11// Links that still point at the source site: the cutover hand-off.
12// Component links marked sourcePage, and inline <a href> inside rich text (those stay inline, so
13// they never get a `link`) whose URL is on the source origin (desc.source.url).
14export const openItems = (desc) => {
15 const urls = new Map();
16 const add = (u, k) => { const l = urls.get(u) || urls.set(u, []).get(u); if (!l.includes(k)) l.push(k); };
17 let origin = null; try { origin = new URL(desc.source?.url).origin; } catch {}
18 for (const c of desc.components || []) {
19 if (c.link?.sourcePage) add(c.link.url, c.key);
20 if (origin && c.html) for (const m of c.html.matchAll(/<a\b[^>]*\bhref="([^"]+)"/g)) { const u = m[1].replace(/&/g, '&'); if (u === origin || u.startsWith(origin + '/') || u.startsWith(origin + '?')) add(u, c.key); }
21 }
22 return [...urls].map(([url, keys]) => ({ type: 'links-to-old-site', url, components: keys, action: 'copy that page to Harmony or repoint the link; resolved when no link marked sourcePage remains' }));
23};
24
25// Pages the new site does not have yet. A link whose linkmap entry says `unbuilt` points at a stand-in
26// page (Home, the cart) so the visitor is never sent to the old site, but the page is still missing:
27// it stays here, with the source URL, until the entry stops saying `unbuilt` (the real page is mapped).
28// A redirect to an existing page never resolves it. Reasons and components come from the description,
40 responsibleRole: 'Cutover Operator (page content: site owner)',
41 action: 'build this page in Harmony or confirm it is intentionally dropped, then map its source URL to the real page in the linkmap (without `unbuilt`) and re-run build-description',
42 resolvedBy: 'the source URL maps to a real page in the linkmap; a link that only points at a stand-in page (Home, cart) does not resolve it',