1aac419Add Liouville pages, crafted-by-human link and CLAUDE.mdJeremy Magland 1// Writes app/crafted-link.js with an arewehuman replay link for recipe.md.
2// The link carries the whole recording in its URL fragment (gzip + base64url),
3// which the viewer accepts as-is, so nothing needs to be hosted.
4import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
5import { gzipSync } from 'node:zlib';
7const dir = '.arewehuman/recipe.md';
8const logs = readdirSync(dir).filter((f) => f.endsWith('.awh.jsonl'));
9if (logs.length !== 1) {
10 throw new Error(`Expected one recording in ${dir}, found ${logs.length}`);
11}
13const recording = readFileSync(`${dir}/${logs[0]}`);
14const z = gzipSync(recording, { level: 9 }).toString('base64url');
15const url = `https://magland.github.io/arewehuman/#/view?z=${z}`;
17writeFileSync('app/crafted-link.js', `// Generated by scripts/crafted-link.mjs; do not edit.\nwindow.CRAFTED_LINK = ${JSON.stringify(url)};\n`);
18console.log(`app/crafted-link.js: replay link for ${logs[0]} (${url.length} characters)`);