lookbkdev/lookbk-skills / skills/proof-band-kit
proof-band-kit
VerifiedBuild the "trusted by" band that sits under a hero from one proof.json - customer logos and a few numbers, set like the figures page of an annual report. Every logo is measured from its own SVG (ink box, aspect, ink density) and sized to the same visual weight on one baseline per row. Every figure is in tabular numerals with a numbered note giving its basis, source and as-of date; the build refuses a figure without a source, a future date, "+" or "up to", and any number not tied to a note. Each logo opens on hover, focus or tap to one line on what that customer uses the product for. Three layouts, two finished looks (ledger and signal), an optional slow marquee that pauses, phone and tablet layouts, a paste-in embed, a check at four widths that re-measures the balance, and a frame-by-frame recorder. Use for customer logos, operating figures and "in use at" bands on product, SaaS and B2B pages.
scripts/kit/record.mjs
View on GitHub// Proof Band Kit: records the built page scrolling from its hero onto the
// band, frame by frame, into a video and a poster, or takes one still.
//
// node scripts/record.mjs out/index.html [--seconds 8] [--size 1920x1080] [--poster 5]
// node scripts/record.mjs out/index.html --still 5 [--size 390x844 --scale 2] [--png file.png]
// node scripts/record.mjs out/index.html --still 5 --debug --png balance.png
// node scripts/record.mjs out/index.html --moments [--size 390x844]
//
// The page runs with ?pb-record=1: nothing moves on its own, and for every
// frame the recorder asks the page to scroll along its fixed script (the
// hero, onto the band at 0.8 to 2.4 s, then two marks opened in turn) and
// to draw its entrance at that time. Every frame is taken at its exact time,
// so the video is the same on any machine. --moments prints { enter,
// settled, end, stretches }: the stretches are the spans where nothing on
// the band is changing, and stills and posters belong inside them.
// --debug draws the measured ink boxes and the shared baseline on the marks.
import { spawnSync } from 'node:child_process'
import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { dirname, join, relative, resolve } from 'node:path'
import { launch } from './cdp.mjs'
import { serve } from './serve.mjs'
function args(argv) {
const out = { _: [] }
for (let i = 0; i < argv.length; i++) {
const a = argv[i]
if (!a.startsWith('--')) out._.push(a)
else {
const [k, v] = a.slice(2).split('=')
out[k] = v ?? (argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[++i] : true)
}
}
return out
}
const shown = (p) => {
const r = relative(process.cwd(), p)
return r.startsWith('..') ? p : r
}
function ffmpeg(argv) {
const bin = process.env.FFMPEG_PATH || 'ffmpeg'
const r = spawnSync(bin, ['-hide_banner', '-loglevel', 'error', '-y', ...argv], { stdio: ['ignore', 'inherit', 'pipe'] })
if (r.error) throw new Error('ffmpeg not found: install it (brew install ffmpeg, winget install ffmpeg, apt install ffmpeg) or set FFMPEG_PATH')
if (r.status !== 0) throw new Error(`ffmpeg failed: ${String(r.stderr).slice(-600)}`)
}
export async function record(input, opts = {}) {
const file = resolve(input)
if (!existsSync(file)) throw new Error(`${input} not found; build the page first`)
const out = dirname(file)
const [w, h] = String(opts.size ?? '1920x1080').split('x').map(Number)
const scale = Number(opts.scale ?? 1)
const fps = Number(opts.fps ?? 30)
const server = await serve(out)
const chrome = await launch({ width: Math.max(w, 800), height: h })
const tmp = mkdtempSync(join(tmpdir(), 'proof-band-kit-'))
const errors = []
try {
const tab = await chrome.page()
chrome.on('Runtime.exceptionThrown', (p) => errors.push(p.exceptionDetails?.exception?.description ?? p.exceptionDetails?.text))
await tab.send('Page.enable')
await tab.send('Runtime.enable')
await tab.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: scale, mobile: w < 760 })
if (opts.reduce) await tab.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: 'reduce' }] })
const loaded = tab.once('Page.loadEventFired', 60000)
const q = `?pb-record=1${opts.debug ? '&pb-debug=1' : ''}`
await tab.send('Page.navigate', { url: `${server.url}${relative(out, file)}${q}` })
await loaded
const ev = async (expression) => {
const r = await tab.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })
if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description ?? r.exceptionDetails.text)
return r.result.value
}
for (let i = 0; i < 100 && !(await ev('!!window.ProofBand')); i++) await new Promise((r) => setTimeout(r, 100))
if (!(await ev('!!window.ProofBand'))) throw new Error(`the page did not start: ${errors.join(' | ') || 'unknown'}`)
await ev('window.ProofBand.ready')
await new Promise((r) => setTimeout(r, 300))
const length = Number(opts.seconds ?? (await ev('window.ProofBand.length')))
const shot = async (t, path) => {
await ev(`window.ProofBand.seek(${t})`)
const { data } = await tab.send('Page.captureScreenshot', { format: 'png' })
writeFileSync(path, Buffer.from(data, 'base64'))
}
if (opts.moments) return { moments: await ev('window.ProofBand.moments()') }
if (opts.still !== undefined) {
const png = resolve(opts.png ?? join(out, 'still.png'))
await ev(`window.ProofBand.seek(${Math.min(Math.max(Number(opts.still) || 0, 0), length)})`)
let clip
if (opts.clip) {
// one part of the page, with a margin: --clip ".pb-run"
const r = await ev(`(() => { const e = document.querySelector(${JSON.stringify(String(opts.clip))}); if (!e) return null; const b = e.getBoundingClientRect(); return { x: b.left + scrollX, y: b.top + scrollY, w: b.width, h: b.height } })()`)
if (!r) throw new Error(`--clip: nothing matches ${opts.clip}`)
await new Promise((r) => setTimeout(r, 150))
const m = Number(opts.margin ?? 24)
clip = { x: Math.max(0, r.x - m), y: Math.max(0, r.y - m), width: r.w + 2 * m, height: r.h + 2 * m, scale: 1 }
}
const { data } = await tab.send('Page.captureScreenshot', { format: 'png', ...(clip ? { clip } : {}) })
writeFileSync(png, Buffer.from(data, 'base64'))
return { png }
}
const frames = Math.round(length * fps)
for (let i = 0; i < frames; i++) await shot(i / fps, join(tmp, `${String(i + 1).padStart(5, '0')}.png`))
const mp4 = join(out, 'preview.mp4')
ffmpeg(['-framerate', String(fps), '-i', join(tmp, '%05d.png'), '-vf', `scale=${w}:${h}:flags=lanczos,format=yuv420p`, '-c:v', 'libx264', '-preset', 'slow', '-crf', String(opts.crf ?? 18), '-movflags', '+faststart', mp4])
const posterAt = Math.min(Math.max(Number(opts.poster ?? 5), 0), length - 1 / fps)
const poster = join(out, 'poster.png')
ffmpeg(['-ss', String(posterAt), '-i', mp4, '-frames:v', '1', '-update', '1', poster])
if (errors.length) console.warn(`page errors: ${errors.join(' | ')}`)
return { mp4, poster }
} finally {
await chrome.close()
server.close()
rmSync(tmp, { recursive: true, force: true })
}
}
export async function main(argv = process.argv.slice(2)) {
const a = args(argv)
const [input] = a._
if (!input) {
console.log('usage: node scripts/record.mjs out/index.html [--seconds 8] [--size 1920x1080] [--poster 5]\n node scripts/record.mjs out/index.html --still SECONDS [--size 390x844 --scale 2] [--png file.png] [--debug] [--reduce]\n node scripts/record.mjs out/index.html --moments [--size 390x844]')
process.exit(1)
}
try {
const r = await record(input, a)
if (r.moments) console.log(JSON.stringify(r.moments))
else if (r.png) console.log(`wrote ${shown(r.png)}`)
else console.log(`wrote ${shown(r.mp4)} and ${shown(r.poster)}`)
} catch (e) {
console.error(e.message)
process.exit(1)
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |