by adom
The hero-image lab with a human gate: `hero-studio pose <owner/slug>` opens the studio in front of the human, posed for their package, and blocks until they click Generate, producing the provenance-stamped 2000x1250 PNG the registry's hero gate requires. The image carries the title and artwork; the exported image also bakes the type pill (top right) and full wiki slug (bottom right); the page shows the hero bare, and only the homepage marquee overlays its own dynamic info. Every hero wears its P
← Commit history
Publish 0.25.0
8 files changed
+127−24
SKILL.md+24−7@@ -57,9 +57,12 @@ scales by gating the STYLE, not every part: so app pages need `"type": "app"` or they get the hardware pill and layout. Each part is composed first to measure its lint: a hard fail skips that part (`results[].error` and `.lint`) and the batch carries on; warnings land- in `results[].warnings`. The style's title size is fixed, so a headline- longer than the gated page's can run into the showcase: read those warnings- and fix that part by hand if it matters.+ in `results[].warnings`. The style's title size was set on another page's+ headline, so a longer one here can reach the showcase image: batch steps+ that part's title down 0.5cqw at a time (never under the 6.5cqw floor) until+ it clears the image by the required gap, and reports it as+ `batch-title-fitted`. A part that cannot clear at the floor is skipped with+ its `showcase-*` failure: shorten its headline or pose it by hand. EXISTING pages (a fleet that already lives on the wiki, e.g. 136 of the 137 basic parts) are not republished: push the PNG into the page repo and@@ -398,9 +401,12 @@ The studio also runs a measured LAYOUT LINTER after every change: pill vs showcase overlap (a scrim is auto-applied so the pill reads as a badge), image text intruding into the dynamic marquee band, text clipped by the hero edge (HARD FAIL: locks Generate), near-edge insets, 4+ line title wraps, TEXT-COLLIDING WITH THE SHOWCASE (the fix is ALWAYS to move or resize the showcase,-never to shrink the title; a title under 6.5cqw draws its own warning because-dock thumbnails render it illegibly), OPTICAL alignment (the title's ink edge+TOUCHING THE SHOWCASE IMAGE (HARD FAIL: any title, subtitle or detail line+that runs onto the showcase image, or comes within 40px of it at export scale,+locks Generate and skips the part in a batch; the Backdrop layout, which puts+text over the image on purpose, is exempt. Move or resize the showcase image,+shorten the text, or run fit, which keeps the gap; a title under 6.5cqw draws+its own warning because dock thumbnails render it illegibly), OPTICAL alignment (the title's ink edge vs the subtitle's, canvas-measured, because glyph side bearing shifts pixels off the box edge), and an informational published-headroom line (export px between the lowest text and the marquee band).@@ -634,7 +640,18 @@ Every generated PNG's provenance comment carries, at the top level: branding, brand_sha, brand_version, brand_status so a consumer reading a published hero can tell which guide, and which-revision of it, produced those pixels.+revision of it, produced those pixels. It also carries `lint: {source,+findings: [{id, level, msg}]}`: the checks measured in the render that became+the hero (`source: render`), or the last measured set when the renderer did+not report them (the pup leg), so a published hero can be audited for what+was flagged when it was made.++A guide whose display face is a CSS generic family (`system-ui`,+`sans-serif`, `ui-sans-serif` and the like) with no font file draws a+`brand-font-generic` warning, and `doctor --owner` reports it as a failed+`brand font` check: a generic family is not a typeface, so the title comes+out in whatever font the renderer's machine has. Give the guide a woff2+under fonts/ (`typography.display.file`) or a Google Fonts family name. ### Checking it before you pose
doctor.mjs+10@@ -24,6 +24,9 @@ const PLAT = createRequire(import.meta.url)('./platform.cjs'); export const puppeteerCandidates = RP.puppeteerCandidates; export const puppeteerInstallCommand = RP.puppeteerInstallCommand; export const quickRendererStatus = RP.quickStatus;+// CSS generic families: names that pick "some font on this machine" (the+// studio page keeps the same list for its brand-font-generic warning).+export const GENERIC_FONTS = ['system-ui', 'ui-sans-serif', 'ui-serif', 'ui-monospace', 'ui-rounded', 'sans-serif', 'serif', 'monospace', 'cursive', 'fantasy', '-apple-system', 'blinkmacsystemfont']; // import() of a bare absolute path fails on Windows (ERR_UNSUPPORTED_ESM_URL_SCHEME: // "C:" reads as a URL scheme), and the old empty catch turned that into@@ -272,6 +275,13 @@ export async function runBrandChecks(owner) { } else if (marks) { pass('brand logo', 'mark resolves (' + String(marks).split('/').pop() + ')'); }+ const display = (((guide.brand || {}).typography || {}).display) || {};+ if (display.family && !display.file && GENERIC_FONTS.includes(String(display.family).trim().toLowerCase())) {+ fail('brand font', owner + '/brand names "' + display.family + '" as its display face: a generic family, so every hero draws its title in whatever font the renderer has',+ 'give the guide a real face: a woff2 under fonts/ named in typography.display.file, or a Google Fonts family name');+ } else if (display.family) {+ pass('brand font', 'display face "' + display.family + '"' + (display.file ? ' (' + String(display.file).split('/').pop() + ')' : ''));+ } for (const w of (guide.warnings || [])) checks.push({ name: 'brand warning', ok: false, detail: w, fix: 'a warning does not block confirm; fix it in brand.json when you next edit the guide' }); return { ok: checks.every((c) => c.ok), owner, status, guide, checks };
drive.mjs+23−5@@ -21,6 +21,8 @@ const ti = process.argv.indexOf('--ai-thread'); const AI_THREAD = (ti >= 0 && process.argv[ti + 1]) || process.env.ADOM_AI_THREAD || ''; if (ti >= 0) process.argv.splice(ti, 2); const BASE = 'http://localhost:' + PORT + '/';+// The family's smallest legible title (the linter's title-timid floor).+const TITLE_FLOOR = 6.5; const args = process.argv.slice(2); const verb = args.shift(); @@ -243,11 +245,27 @@ try { // Applying the style and the showcase moved the pose, so the stored lint // is one pose behind and automated Generate would refuse it. Compose // re-measures it against this part, in the same render Generate uses.- const c = await fetch(BASE + 'compose.png');- if (!c.ok) throw new Error('compose (' + c.status + '): ' + (await c.text()).slice(0, 300));- await c.arrayBuffer();- const measured = (await jf('state')).lint || [];- lint = measured.map((l) => ({ level: l.level, id: l.id, msg: l.msg }));+ const measure = async () => {+ const c = await fetch(BASE + 'compose.png');+ if (!c.ok) throw new Error('compose (' + c.status + '): ' + (await c.text()).slice(0, 300));+ await c.arrayBuffer();+ return ((await jf('state')).lint || []).map((l) => ({ level: l.level, id: l.id, msg: l.msg }));+ };+ const touchesShowcase = (ls) => ls.some((l) => l.level === 'fail' && /^showcase-/.test(l.id));+ lint = await measure();+ // The style's title size was set on another page's headline; a longer+ // one here can reach the showcase image. Step the title down (never+ // under the 6.5cqw legibility floor) until it clears, and report it.+ let fitted = null;+ const styleSize = ((stylePatch.fontSize || {}).title) || 8;+ for (let size = styleSize - 0.5; touchesShowcase(lint) && size >= TITLE_FLOOR; size = Math.round((size - 0.5) * 10) / 10) {+ await jf('state', { fontSize: { title: size } });+ lint = await measure();+ fitted = { from: styleSize, to: size };+ }+ if (fitted && !touchesShowcase(lint)) {+ lint.push({ level: 'info', id: 'batch-title-fitted', msg: 'title set to ' + fitted.to + 'cqw (the style says ' + fitted.from + ') to clear the showcase image' });+ } const hard = lint.filter((l) => l.level === 'fail'); if (hard.length) throw new Error('hard-fail lint: ' + hard.map((l) => '[' + l.id + '] ' + l.msg).join('; ')); const g = await jf('generate', { attest: { style: styleName, human, quote } });
package.json+1−1@@ -2,7 +2,7 @@ "slug": "hero-studio", "title": "Hero Studio", "type": "app",- "version": "0.24.2",+ "version": "0.25.0", "description": "The hero-image lab with a human gate: `hero-studio pose <owner/slug>` opens the studio in front of the human, posed for their package, and blocks until they click Generate, producing the provenance-stamped 2000x1250 PNG the registry's hero gate requires. The image carries the title and artwork; the exported image also bakes the type pill (top right) and full wiki slug (bottom right); the page shows the hero bare, and only the homepage marquee overlays its own dynamic info. Every hero wears its PAGE OWNER's brand guide (<owner>/brand): colors, type, logo and background themes, Adom's included; an unresolved guide holds unbranded rather than borrowing Adom's look. Placement is fixed for all. The floating app window is the showcase: it auto-loads a real screenshot from the package's wiki page (screenshots/, docs/), takes a manual import, or a full-hero import (the human-ratified re-stamp path for existing heroes). The pose gate opens in verification mode: per-item checklist (title, subtitle, showcase, type match) and a Generate that unlocks only fully confirmed. Includes showcase bleeds, brand tile themes, gradient angles, pixel-faithful wiki marquee and index-card previews, and a component-hero mode with a photo/raytrace/phong fallback ladder.", "license": "MIT", "tags": [
page.json+1−1@@ -2,7 +2,7 @@ "slug": "hero-studio", "title": "Hero Studio", "type": "app",- "version": "0.24.2",+ "version": "0.25.0", "description": "The hero-image lab with a human gate: `hero-studio pose <owner/slug>` opens the studio in front of the human, posed for their package, and blocks until they click Generate, producing the provenance-stamped 2000x1250 PNG the registry's hero gate requires. The image carries the title and artwork; the exported image also bakes the type pill (top right) and full wiki slug (bottom right); the page shows the hero bare, and only the homepage marquee overlays its own dynamic info. Every hero wears its PAGE OWNER's brand guide (<owner>/brand): colors, type, logo and background themes, Adom's included; an unresolved guide holds unbranded rather than borrowing Adom's look. Placement is fixed for all. The floating app window is the showcase: it auto-loads a real screenshot from the package's wiki page (screenshots/, docs/), takes a manual import, or a full-hero import (the human-ratified re-stamp path for existing heroes). The pose gate opens in verification mode: per-item checklist (title, subtitle, showcase, type match) and a Generate that unlocks only fully confirmed. Includes showcase bleeds, brand tile themes, gradient angles, pixel-faithful wiki marquee and index-card previews, and a component-hero mode with a photo/raytrace/phong fallback ladder.", "license": "MIT", "tags": [
public/js/app.js+49−8@@ -10,6 +10,12 @@ if (new URLSearchParams(location.search).has('render')) document.body.dataset.re // two ping-ponged hundreds of times a second, so the renderer's networkidle2 wait never settled and // every Generate died at the 30 s navigation timeout (2026-09-22, adom/adom-bluegreen). const RENDER_VIEW = new URLSearchParams(location.search).has('render');+// The clear space every text block keeps from the showcase image, as a+// fraction of the hero's width (40px on the 2000px export).+const EXPORT_W = 2000;+const SHOWCASE_GAP = 0.02;+// CSS generic families: names that pick "some font on this machine".+const GENERIC_FONTS = ['system-ui', 'ui-sans-serif', 'ui-serif', 'ui-monospace', 'ui-rounded', 'sans-serif', 'serif', 'monospace', 'cursive', 'fantasy', '-apple-system', 'blinkmacsystemfont']; /* console relay: the AI reads GET /console instead of DevTools */ (function () {@@ -1104,9 +1110,20 @@ function computeLint() { // move or resize the SHOWCASE (layout, size), never to shrink the title: // small type is invisible on the dock, and #25's six-hour session shrank the // title four times before anyone questioned the showcase.- for (const t of texts) {- if (showcase && overlapPx(t.box, showcase) > 9) {- items.push({ id: 'showcase-' + t.id, level: 'warn', el: t.id, msg: 'the ' + t.name + ' collides with the showcase image: resize or move the showcase image (layout picker, size), do not shrink the ' + t.name + ' to fit' });+ // Text never touches the showcase image, and keeps a clear gap from it.+ // Both are hard failures: an overlap shipped on a whole batch of heroes+ // while it was only a warning. The Backdrop layout puts text over the+ // image on purpose (behind a scrim), so it is exempt.+ if (showcase && state.layout !== 'showcase') {+ const gap = H.width * SHOWCASE_GAP;+ const gapPx = Math.round(SHOWCASE_GAP * EXPORT_W);+ const grown = { left: showcase.left - gap, top: showcase.top - gap, right: showcase.right + gap, bottom: showcase.bottom + gap };+ for (const t of texts) {+ if (overlapPx(t.box, showcase) > 0) {+ items.push({ id: 'showcase-' + t.id, level: 'fail', el: t.id, msg: 'the ' + t.name + ' runs onto the showcase image. Move or resize the showcase image (layout picker, size), shorten the text, or run fit (it keeps the ' + gapPx + 'px gap)' });+ } else if (overlapPx(t.box, grown) > 0) {+ items.push({ id: 'showcase-gap-' + t.id, level: 'fail', el: t.id, msg: 'the ' + t.name + ' comes within ' + gapPx + 'px of the showcase image (export scale); leave at least that much space. Move or resize the showcase image, shorten the text, or run fit' });+ } } } const fsNow = (state.fontSize || {});@@ -1215,6 +1232,13 @@ function computeLint() { const cs = getComputedStyle(titleEl); const want = ((brand.typography || {}).display || {}).family || ''; const got = (cs.fontFamily || '').replace(/["']/g, '');+ // A generic family (system-ui, sans-serif, ...) is not a typeface: the+ // renderer draws whatever its machine has, so every hero from this+ // guide looks different and none of them looks designed.+ const wantFile = ((brand.typography || {}).display || {}).file;+ if (want && !wantFile && GENERIC_FONTS.includes(want.trim().toLowerCase())) {+ items.push({ id: 'brand-font-generic', level: 'warn', el: 'el-title', msg: owner + '/brand names "' + want + '" as its display face, which is a generic family, not a typeface: the title is drawn in whatever font the renderer has. Give the guide a real face: a woff2 under fonts/ (typography.display.file) or a Google Fonts family name' });+ } if (want && got && got.toLowerCase().indexOf(want.toLowerCase()) !== 0) { items.push({ id: 'brand-font-drift', level: 'warn', el: 'el-title', msg: 'the title is drawn in "' + got.split(',')[0] + '" but ' + owner + '/brand names "' + want + '" as its display face. A font file that did not load falls back silently, so the published hero would not be in the owner\'s type' }); }@@ -1426,16 +1450,33 @@ function solveTitleFit(maxCqw) { const H = hero.getBoundingClientRect(); if (H.width < 60) return null; const bandTop = H.top + H.height * 0.76;+ // The showcase image, grown by the clear gap the linter requires: a size+ // whose glyphs reach into it is not a fit (none in the Backdrop layout,+ // where text sits over the image on purpose).+ const winEl = hero.querySelector('.window');+ let keepOut = null;+ if (winEl && winEl.offsetParent && state.mode !== 'component' && state.layout !== 'showcase') {+ const w = winEl.getBoundingClientRect();+ const gap = H.width * SHOWCASE_GAP;+ keepOut = { left: w.left - gap, top: w.top - gap, right: w.right + gap, bottom: w.bottom + gap };+ }+ const glyphs = () => {+ const range = document.createRange();+ range.selectNodeContents(tEl);+ return Array.from(range.getClientRects()).filter((r) => r.width > 1 && r.height > 1);+ }; const measure = (v) => { hero.style.setProperty('--fs-title', v + 'cqw'); void tEl.offsetHeight; const b = tEl.getBoundingClientRect(); const lh = parseFloat(getComputedStyle(tEl).lineHeight) || 1;- return { b, lines: Math.max(1, Math.round(b.height / lh)) };+ const clear = !keepOut || glyphs().every((r) => r.right <= keepOut.left || r.left >= keepOut.right || r.bottom <= keepOut.top || r.top >= keepOut.bottom);+ return { b, clear, lines: Math.max(1, Math.round(b.height / lh)) }; };- const inHero = (b) => b.bottom < bandTop && b.right <= H.right + 1 && b.left >= H.left - 1 && b.top >= H.top - 1;- const fits = (v) => { const m = measure(v); return m.lines <= 3 && inHero(m.b); };- const fitsLoose = (v) => inHero(measure(v).b);+ const inHeroBox = (b) => b.bottom < bandTop && b.right <= H.right + 1 && b.left >= H.left - 1 && b.top >= H.top - 1;+ const inHero = (m) => inHeroBox(m.b) && m.clear;+ const fits = (v) => { const m = measure(v); return m.lines <= 3 && inHero(m); };+ const fitsLoose = (v) => inHero(measure(v)); const hi = Math.min(maxCqw || 13, 13); const sweep = (pred) => { let best = null;@@ -1470,7 +1511,7 @@ function solveTitleFit(maxCqw) { function runFit(maxCqw) { const r = solveTitleFit(maxCqw); if (r == null) {- handleToast({ text: 'fit: no title size in 5-13cqw keeps this headline inside the hero for this layout; shorten the headline or change layout', kind: 'warn', seq: Date.now() });+ handleToast({ text: 'fit: no title size in 5-13cqw keeps this headline inside the hero and clear of the showcase image for this layout; shorten the headline, or move or resize the showcase image', kind: 'warn', seq: Date.now() }); return; } const cur = (state.fontSize || {}).title || 8;
server.js+17@@ -9,6 +9,15 @@ const PLAT = require('./platform.cjs'); // The useful line of a renderer's stderr. Node ends an uncaught exception with a blank line and // "Node.js v18.19.1", so taking the LAST line reported the Node version as the error (2026-09-22: // the human saw "Generate failed: local: Node.js v18.19.1"). Prefer the last line naming an error.+/// The check results a hero is stamped with: those measured in its own+/// render when the renderer reported them, else the last measured set and+/// where it came from. Messages are kept short; ids and levels are the audit.+function stampLint(fromRender, last, meta) {+ const rows = (fromRender || last || []).map((l) => ({ id: l.id, level: l.level, msg: String(l.msg || '').slice(0, 160) }));+ const source = fromRender ? 'render' : (meta && meta.source) || 'none';+ return { source, findings: rows };+}+ function renderError(buf) { const lines = String(buf || '').split('\n').map((l) => l.trim()).filter((l) => l && !/^Node\.js v\d/.test(l)); const named = lines.filter((l) => /(^|\b)(\w*Error|error)\b[:\s]/.test(l) && !/^at /.test(l));@@ -1599,15 +1608,22 @@ function route(req, res, url, p) { return finish({ ok: false, error: 'no renderer available (pinned to pup but neither HERO_STUDIO_URL nor VSCODE_PROXY_URI is set)', hint: 'drop the renderer pin, or give the host a URL it can reach the studio on (pose --url <port-mapping URL>)' }); } const failures = [];+ // The checks measured in the very render that becomes the hero; they ride+ // the stamp so a published hero can be audited for what was flagged.+ let renderLint = null; const runRender = (a, cb) => { const child = spawn(process.execPath, [path.join(__dirname, a.script), a.url, outFile], { env: process.env, stdio: ['ignore', 'pipe', 'pipe'], }); let errBuf = '';+ let outBuf = '';+ child.stdout.on('data', (c) => { outBuf += c; }); child.stderr.on('data', (c) => { errBuf += c; }); const timer = setTimeout(() => { child.kill(); }, a.timeout); child.on('close', (code) => { clearTimeout(timer);+ const lm = outBuf.split('\n').find((l) => l.startsWith('LINT_JSON '));+ if (lm) { try { renderLint = JSON.parse(lm.slice('LINT_JSON '.length)); } catch {} } if (code === 0 && fs.existsSync(outFile)) return cb(null); cb(renderError(errBuf) || a.label + ' render exited ' + code); });@@ -1682,6 +1698,7 @@ function route(req, res, url, p) { const branding = g.owner || String(state.page || '').split('/')[0] || null; const meta = JSON.stringify({ generator: 'hero-studio', version: PKG_VERSION, ts, renderer: renderedVia, branding, brand_sha: g.sha || null, brand_version: g.version || null, brand_status: g.status || 'missing',+ lint: stampLint(renderLint, state.lint, lintMeta), state: { mode: state.mode, page: state.page, comp: state.comp, theme: state.theme, layout: state.layout, gradAngle: state.gradAngle, fontSize: state.fontSize, verify: state.verify, confirm: state.confirm, showcase_used: !!(state.showcase && state.showcase.src), showcase_full: !!(state.showcase && state.showcase.full), showcase: showcaseSaved ? { path: showcaseSaved.path, sha256: showcaseSaved.sha256, w: showcaseSaved.w, h: showcaseSaved.h, chrome: showcaseSaved.chrome, full: showcaseSaved.full, cover: showcaseSaved.cover } : undefined, circuitSeed: state.theme.startsWith('circuit') ? state.circuitSeed : undefined, circuit: state.circuit }, attestation: attest ? { human: attest.human, quote: String(attest.quote).slice(0, 300), aiThread: req.aiThread || '', ts, style: attest.style || undefined, styleGate: req._styleGate ? req._styleGate.gate : undefined, prior: req._priorProvenance || undefined } : undefined, changes: (Object.keys(changes.page).length || Object.keys(changes.pose).length) ? { page: changes.page, pose: changes.pose, applied: changes.applied } : undefined }); const py = 'import sys\n' + 'from PIL import Image\n' +
test/brand.mjs+2−2@@ -170,8 +170,8 @@ async function main() { }); let port = 0; let log = '';- srv.stdout.on('data', (d) => { log += d; const m = /hero-studio on (\d+)/.exec(String(d)); if (m && !port) port = +m[1]; });- srv.stderr.on('data', (d) => { log += d; const m = /hero-studio on (\d+)/.exec(String(d)); if (m && !port) port = +m[1]; });+ srv.stdout.on('data', (d) => { log += d; const m = /hero-studio on (?:\S+:)?(\d+)/.exec(String(d)); if (m && !port) port = +m[1]; });+ srv.stderr.on('data', (d) => { log += d; const m = /hero-studio on (?:\S+:)?(\d+)/.exec(String(d)); if (m && !port) port = +m[1]; }); for (let i = 0; i < 100 && !port; i++) await new Promise((r) => setTimeout(r, 100)); if (!port) { console.error('server never printed its port. log:\n' + log); srv.kill('SIGTERM'); process.exit(1); } const BASE = 'http://127.0.0.1:' + port + '/';