Files
zeekayandGitHub ea43c5a975 Type lib, scripts, v2, home and app under strict (#8)
* Type scripts under strict

Playwright's API the checks use is declared in host.ts (the package is
the app repo's); caught errors read through why(). tabs-tree.test waits
for the typed tabsTree.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type the shared components under strict

Window globals (__lenis, __hzHold, google) and the two react-dom calls
are declared in components/*.d.ts, since @types/react-dom is not a
dependency and the lockfile is frozen.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type components/v2 under strict

Props, state, refs and DOM events in the 93 v2 files. A2Motion's easing
tuples are as const. Two real bugs: x-archimedes/MaskLines imported a
NoJs that does not exist, and x-hypatia/PinChapters returned the element
from a ref callback, which React 19 reads as a cleanup. AppSheet no
longer sets aria-label to a JSX label.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type components/home under strict

The race, cost and frontier figures, the plan cards, the repository card
and the product stories take Run, Models and Plan types from lib.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type the hero devices and the app routes under strict

HeroScene and its parts describe hero-scenes.json; the [slug] pages take
params as a Promise, and metadata and viewport carry Next's types.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Give the integrations previews their Preview type

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Use the bench Card type for the closing cards

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
2026-11-14 01:34:34 -08:00

41 lines
2.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Real copy check (James, 8 Nov): every line of text on live hanzo.ai must appear, word for word, on our page.
// Usage: node scripts/copycheck.mjs /about /dev ... (dev server on :4180, or HZ_BASE=...; CHROME=path on Linux). Done means "missing 0".
import puppeteer from 'puppeteer-core';
import fs from 'node:fs';
const OUT = 'shots/copycheck';
fs.mkdirSync(OUT, { recursive: true });
const norm = (s: string) => s.toLowerCase().replace(/[’']/g, "'").replace(/[“”]/g, '"').replace(/[–—]/g, '-').replace(/\s+/g, ' ').trim();
const b = await puppeteer.launch({ executablePath: process.env.CHROME || '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true });
async function text(url: string) {
const p = await b.newPage();
await p.setViewport({ width: 1470, height: 900 });
await p.goto(url, { waitUntil: 'networkidle2', timeout: 120000 }).catch(() => {});
// open every collapsed thing and scroll through so lazy sections render
await p.evaluate(async () => {
document.querySelectorAll('details').forEach((d) => (d.open = true));
for (let y = 0; y < document.documentElement.scrollHeight; y += 700) { scrollTo(0, y); await new Promise((r) => setTimeout(r, 120)); }
});
// hanzo.ai counts its figures up from zero (prices, ×-faster, commits per org): read once they have landed, not mid-count
await new Promise((r) => setTimeout(r, 6000));
// textContent (not innerText) so hidden tabs, accordions and visually-hidden copy still count
const t = await p.evaluate(() => {
const main = document.querySelector('main') || document.body;
main.querySelectorAll('script,style,noscript,svg').forEach((n) => n.remove());
return [...main.querySelectorAll('h1,h2,h3,h4,h5,p,li,dt,dd,td,th,button,a,span,div,label,figcaption,blockquote')]
.filter((e) => !e.children.length).map((e) => e.textContent);
});
await p.close();
return t;
}
for (const path of process.argv.slice(2)) {
const live = [...new Set((await text('https://hanzo.ai' + path)).map(norm).filter((s) => s.length >= 12 && /[a-z]{3}/.test(s)))];
const ours = norm((await text((process.env.HZ_BASE || 'http://localhost:4180') + path.replace(/\/?$/, '/'))).join(' \n '));
const missing = live.filter((s) => !ours.includes(s));
fs.writeFileSync(`${OUT}/${path === '/' ? 'home' : path.slice(1).replace(/\//g, '_')}.txt`, missing.join('\n'));
console.log(`${path.padEnd(14)} missing ${missing.length} of ${live.length} lines`);
}
await b.close();