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.23.5
6 files changed
+68−11
SKILL.md+7−2@@ -298,8 +298,13 @@ this running server (`onDisk`), which only a restart picks up. recovery. Typical light-container fix: `npm install puppeteer-core@24` (Node below 22.12 cannot use 25.x), `npx @puppeteer/browsers install chrome@stable --path ~/.cache/puppeteer`, then the apt library list doctor-prints (note: `libasound2t64` on Ubuntu 24.04). Re-run doctor until it passes,-then pose.+prints (note: `libasound2t64` on Ubuntu 24.04). On a Linux ARM64 container+Chrome for Testing has no ARM64 build (that command downloads an x86-64+Chrome that can never run): install Playwright's Chromium instead, `npx -y+playwright install chromium && sudo npx -y playwright install-deps+chromium`; hero-studio finds it under `~/.cache/ms-playwright`, skips any+Chrome built for the wrong CPU, and doctor says "wrong CPU architecture"+rather than suggesting libraries. Re-run doctor until it passes, then pose. When doctor reports "ready via pup fallback", Generate works today through the host browser; installing the local runtime is an upgrade (sharper output, no
doctor.mjs+9−3@@ -100,9 +100,10 @@ export async function runChecks() { chrome = findChrome(); pass('chrome binary', chrome); } catch (e) {- fail('chrome binary', e.message,- 'npx @puppeteer/browsers install chrome@stable --path ~/.cache/puppeteer\n' +- ' # --path matters: findChrome() scans ~/.cache/puppeteer/chrome/' + (PLAT.IS_WIN || PLAT.IS_MAC ? '\n or: ' + PLAT.fixFor('chrome') : ''));+ const wrong = RP.wrongArchChromes();+ fail('chrome binary', wrong.length+ ? 'only Chrome builds for another CPU are installed (' + wrong.map((w) => w.arch + ': ' + w.path).join('; ') + '); this machine is ' + process.arch+ : e.message, RP.chromeInstallCommand()); } // 3. the binary actually RUNS. This is the check that catches missing shared@@ -114,6 +115,11 @@ export async function runChecks() { if (chrome && (PLAT.IS_WIN || PLAT.IS_MAC)) { chromeRuns = true; pass('chrome binary present', 'the headless launch below is the real check on ' + process.platform);+ } else if (chrome && !RP.archOk(chrome)) {+ // An x86-64 Chrome on an ARM64 container (or the reverse) can never run;+ // installing libraries would not help, the loader looks for the other CPU's.+ fail('chrome architecture', 'wrong CPU architecture: ' + chrome + ' is built for ' + RP.binaryArch(chrome) + ', this machine is ' + process.arch,+ 'unset CHROME or point it at a ' + process.arch + ' build; install one with: ' + RP.chromeInstallCommand()); } else if (chrome) { const v = await run(chrome, ['--version']); if (v.ok) {
package.json+1−1@@ -2,7 +2,7 @@ "slug": "hero-studio", "title": "Hero Studio", "type": "app",- "version": "0.23.4",+ "version": "0.23.5", "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.23.4",+ "version": "0.23.5", "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": [
platform.cjs+1−1@@ -133,7 +133,7 @@ function fixFor(what) { if (what === 'chrome') { if (IS_WIN) return 'install Google Chrome, or set CHROME to a chrome.exe (e.g. C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe)'; if (IS_MAC) return 'install Google Chrome, or set CHROME to "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"';- return 'npx @puppeteer/browsers install chrome@stable --path ~/.cache/puppeteer';+ return require('./renderer-paths.cjs').chromeInstallCommand(); } return ''; }
renderer-paths.cjs+49−3@@ -84,15 +84,52 @@ function chromeCandidates(platform = process.platform, env = process.env, home = path.join(home, 'Applications', 'Google Chrome.app', 'Contents', 'MacOS', 'Google Chrome')); } else { list.push(...inCache(['chrome-linux64', 'chrome']));+ // Playwright's Chromium: the one prebuilt browser for Linux ARM64 (Chrome+ // for Testing has none), installed by `npx playwright install chromium`.+ const pw = path.join(home, '.cache', 'ms-playwright');+ let pwDirs = [];+ try { pwDirs = fs.readdirSync(pw).filter((d) => /^chromium-\d+$/.test(d)).sort((a, b) => b.slice(9) - a.slice(9)); } catch { pwDirs = []; }+ list.push(...pwDirs.map((d) => path.join(pw, d, 'chrome-linux', 'chrome'))); list.push('/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/usr/bin/chromium', '/usr/bin/chromium-browser'); } return list; } +/// The CPU a Linux ELF binary is built for ('x64', 'arm64', ...), or null when+/// the file is not an ELF (a wrapper script, a macOS or Windows binary): an+/// unknown architecture is not held against a binary.+function binaryArch(file) {+ let fd;+ try {+ fd = fs.openSync(file, 'r');+ const buf = Buffer.alloc(20);+ if (fs.readSync(fd, buf, 0, 20, 0) < 20) return null;+ if (buf[0] !== 0x7f || buf[1] !== 0x45 || buf[2] !== 0x4c || buf[3] !== 0x46) return null;+ const machine = buf[5] === 2 ? buf.readUInt16BE(18) : buf.readUInt16LE(18);+ return { 0x3e: 'x64', 0xb7: 'arm64', 0x03: 'ia32', 0x28: 'arm' }[machine] || ('elf-machine-' + machine);+ } catch {+ return null;+ } finally {+ if (fd !== undefined) try { fs.closeSync(fd); } catch { /* closed */ }+ }+}++/// Whether a binary can run on this CPU (true when its architecture is unknown).+function archOk(file, arch = process.arch) {+ const a = binaryArch(file);+ return !a || a === arch;+}++/// Candidates that exist but are built for another CPU: an x86-64 Chrome+/// downloaded onto an ARM64 container looks installed and can never launch.+function wrongArchChromes() {+ return chromeCandidates().filter((c) => fs.existsSync(c) && !archOk(c)).map((c) => ({ path: c, arch: binaryArch(c) }));+}+ function chromePath() { if (process.env.CHROME && fs.existsSync(process.env.CHROME)) return process.env.CHROME; if (ISOLATED) return null;- for (const c of chromeCandidates()) if (fs.existsSync(c)) return c;+ for (const c of chromeCandidates()) if (fs.existsSync(c) && archOk(c)) return c; return null; } @@ -110,9 +147,18 @@ function puppeteerInstallCommand() { function chromeInstallCommand() { if (process.platform === 'win32' || process.platform === 'darwin') return require('./platform.cjs').fixFor('chrome');+ if (process.arch === 'arm64') {+ return 'npx -y playwright install chromium && sudo npx -y playwright install-deps chromium # Linux ARM64: Chrome for Testing has no ARM64 build, Playwright ships one under ~/.cache/ms-playwright';+ } return 'npx @puppeteer/browsers install chrome@stable --path ' + path.join(os.homedir(), '.cache', 'puppeteer'); } +function chromeMissingWhy() {+ const wrong = wrongArchChromes();+ if (!wrong.length) return 'Chrome not found';+ return 'Chrome found but built for the wrong CPU (' + wrong.map((w) => w.arch + ': ' + w.path).join('; ') + '), and this machine is ' + process.arch;+}+ // The cheap, synchronous status the gate shows: files exist, nothing is // launched. doctor.mjs is the ground truth (it launches Chrome); this is what // can run before every Generate and once a minute without cost.@@ -125,7 +171,7 @@ function quickStatus() { ok: !!(pptr && chrome), puppeteer: pptr, chrome,- why: !pptr ? 'puppeteer-core not found' : (!chrome ? 'Chrome not found' : null),+ why: !pptr ? 'puppeteer-core not found' : (!chrome ? chromeMissingWhy() : null), fix: !pptr ? puppeteerInstallCommand() : (!chrome ? chromeInstallCommand() : null), }, pup: { ok: proxied, why: proxied ? null : 'VSCODE_PROXY_URI is not set, so the host browser cannot reach the studio' },@@ -133,4 +179,4 @@ function quickStatus() { }; } -module.exports = { DIR, RENDERER_HOME, ISOLATED, chromeCandidates, puppeteerRoots, puppeteerCandidates, puppeteerPackages, puppeteerPath, chromePath, puppeteerPin, puppeteerInstallCommand, chromeInstallCommand, quickStatus };+module.exports = { DIR, RENDERER_HOME, ISOLATED, chromeCandidates, binaryArch, archOk, wrongArchChromes, puppeteerRoots, puppeteerCandidates, puppeteerPackages, puppeteerPath, chromePath, puppeteerPin, puppeteerInstallCommand, chromeInstallCommand, quickStatus };