:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(devex): add a feature reel mode to qa-frontend (#109947)
Julian Bezd53a5ac83d0c
diff --git a/.agents/skills/qa-frontend/SKILL.md b/.agents/skills/qa-frontend/SKILL.mdindex 4c14d7c5860e..b9c2b45fad0a 100644--- a/.agents/skills/qa-frontend/SKILL.md+++ b/.agents/skills/qa-frontend/SKILL.md@@ -6,21 +6,24 @@ description: >flow against the local PostHog stack, use qa-frontend, or QA current frontendchanges with browser/runtime evidence. Do not use for generic code review, PRreview, "check my changes", CI debugging, or security audit; use qa-team,- debugging-ci-failures, or security-audit instead. Runs in PR mode or local+ debugging-ci-failures, or security-audit instead. QA runs in PR mode or localmode, plans adaptive browser and visual checks, drives browser MCP/toolingsuch as Playwright MCP or Chrome DevTools MCP, captures evidence, and applies- only approved/narrow fixes.+ only approved/narrow fixes. Reel mode makes a feature reel instead: a short,+ sharp animated WebP of a new UI flow from Storybook stills, for a PR+ description. Use it when asked for a reel, GIF, or animated demo of a flow.allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Agent, mcp__playwright__*, mcp__chrome-devtools__*, mcp__phrocs__*---# QA Frontend-Run the code, not just the diff. This is a repo-local skill for PostHog developers working on PostHog itself. It executes a bounded frontend QA loop against a local PostHog stack and operates in one of two modes:+Run the code, not just the diff. This is a repo-local skill for PostHog developers working on PostHog itself. It executes a bounded frontend QA loop against a local PostHog stack and operates in one of three modes:- **PR mode** - user references a specific PR (URL, number, or branch). The skill checks out the PR, runs QA, optionally uploads final evidence after approval, and posts a single PR comment after approval. Requires a clean working tree.- **Local mode** - user asks to QA their current work with no PR reference. The skill QAs the current checkout against the repo's default branch (`origin/HEAD`) by default, or an explicit local base ref when the user provides one, plus staged, unstaged, and untracked changes. It writes a report locally and does **not** upload evidence or touch GitHub. A dirty working tree is fine in this mode.+- **Reel mode** - user asks for a reel, GIF, or animated demo of a UI flow for a PR description. The skill skips the QA loop and follows `references/feature-reel.md`: Storybook stills become an animated WebP with a cursor and zoom. It needs Storybook, not the local stack.-Use this skill only for explicit frontend/browser/runtime QA. If the prompt is a generic review, code-review, "check my changes", CI-debugging, or security-audit request, use the more specific repo skill instead.+Use this skill only for explicit frontend/browser/runtime QA or a feature reel. If the prompt is a generic review, code-review, "check my changes", CI-debugging, or security-audit request, use the more specific repo skill instead.Choose mode from the prompt. If an explicit frontend QA request names a PR, links one, or says "browser-test PR <N>", use PR mode. If it targets the current frontend work with no PR ref, use local mode.@@ -32,7 +35,7 @@ Claude Code ships built-in `/run` and `/verify` skills. This skill composes with## Quick Use-1. Decide mode (PR vs local) from the user prompt and presence of a PR ref.+1. Decide mode (PR, local, or reel) from the user prompt and presence of a PR ref. Reel mode continues in `references/feature-reel.md` and skips the steps below.2. In PR mode, require a clean working tree before doing anything else.3. Require a reachable local stack and working browser MCP/tooling session. If browser MCP tools are missing, load `references/browser-mcp-patterns.md` and ask before configuring anything. Reuse the developer's current PostHog setup by default; always ask before starting PostHog.4. In PR mode, checkout the PR with `gh pr checkout`. In local mode, stay on the current branch.@@ -70,6 +73,7 @@ Load these files only when the matching phase starts:- `references/evidence-and-output.md` - evidence upload, verdict artifacts, and PR/local report rendering.- `references/pr-comment-template.md` - final PR comment structure.- `references/cleanup.md` - checkout, browser session, stack, and generated-file cleanup after the report is written.+- `references/feature-reel.md` - reel mode: shot list, Storybook capture, render, and upload of a feature reel.Skill scripts live next to this file (under `scripts/`). When Claude Code activates this skill, it emits a line at the top of the prompt:@@ -85,7 +89,7 @@ Do **not** improvise discovery by searching the home directory or other checkout## Preconditions-Load `references/safety-rules.md` now, before acting on anything below - its stop rules and approval gates govern the whole run in both modes.+Load `references/safety-rules.md` now, before acting on anything below - its stop rules and approval gates govern the whole run in every mode.Parse `$ARGUMENTS` into:diff --git a/.agents/skills/qa-frontend/references/feature-reel.md b/.agents/skills/qa-frontend/references/feature-reel.mdnew file mode 100644index 000000000000..92c9b9d1d409--- /dev/null+++ b/.agents/skills/qa-frontend/references/feature-reel.md@@ -0,0 +1,93 @@+# Feature reel++A feature reel is a short animated WebP of one UI flow, for a PR description.+Use it when one still cannot show the change, for example a menu that opens on right-click, or a flow across two screens.+When one still can show the change, take the still instead (see "Screenshots" in `/writing-pr-descriptions`).++The reel is made from Storybook stills, not from a screen recording.+The camera zooms to the target of each step, a cursor glides there and clicks, and the next state fades in.+The motion is a pure function of the stills, so it is the same on every run, and the reel stays sharp on high-density screens.+The scripts need only the repo's Playwright and Pillow. Do not install ffmpeg or other packages for this mode.++Run every command below from the root of the PostHog checkout.++## 1. Start Storybook++Reuse a Storybook that runs. Otherwise, start one with `pnpm storybook` (port 6006).+Story ids are in `http://localhost:6006/index.json`.+On a cold dev server the first load of a story can take minutes, because Vite compiles each lazy chunk on its first request.+`reel-capture.mjs` waits up to five minutes for it.++## 2. Write the shot list++Start from a story that shows the first state of the flow, usually a story without a `play` function.+When no story shows that state, write a scratch story and keep it out of the commit.++Write each step of the flow as one entry in `steps`.+The `play` function of the story that shows the end state is often the best source: one `userEvent` or `fireEvent` call becomes one step.+The reel drives the steps itself, because a `play` function cannot be paused between its calls.++```json+{+ "url": "http://localhost:6006/iframe.html?id=scenes-app-project-homepage-today--home&viewMode=story",+ "viewport": { "width": 1280, "height": 800 },+ "steps": [+ { "caption": "Open Spaces", "action": "click", "target": { "label": "Spaces" } },+ {+ "caption": "Right-click a session",+ "action": "rightclick",+ "target": { "within": "[data-attr=\"today-recent-session\"]", "text": "Add a retry to the billing webhook" },+ "at": { "x": 40, "y": 14 },+ "waitFor": { "within": "[role=\"menu\"]", "text": "Open in new tab" },+ "focus": { "selector": "[role=\"menu\"]" }+ }+ ],+ "finalCaption": "Same actions as the hover card"+}+```++| Field | Meaning |+| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `url` | The iframe URL of the story: `http://localhost:6006/iframe.html?id=<story-id>&viewMode=story` |+| `viewport` | Size in CSS pixels. The default is 1280×800 |+| `steps[].caption` | Text on screen while the cursor moves to the target |+| `steps[].action` | `click`, `rightclick` or `hover` |+| `steps[].target` | `{ "label": … }` (accessible name), `{ "text": … }` (exact text), `{ "text": …, "within": "<css>" }` (the `<css>` element that holds the text, such as a row), or `{ "selector": "<css>" }` |+| `steps[].at` | Optional point in CSS pixels from the top-left corner of the target. The default is the center |+| `steps[].waitFor` | Optional target that must show after the action |+| `steps[].focus` | Optional target that the last step shows, such as a menu. The camera frames it in the final shot. Earlier steps ignore it |+| `finalCaption` | Text on screen at the end |++Keep a reel to two to four steps. Each step adds about 1.4 seconds.+Captions are user-facing copy, so `/writing-user-facing-copy` applies: sentence case, a few words, no em dashes.++## 3. Capture, render and encode++```bash+RUN_DIR=".qa-frontend/runs/reel-$(date +%Y%m%d-%H%M%S)"+mkdir -p "$RUN_DIR"+# write the shot list to "$RUN_DIR/shot-list.json"+node "<skill_dir>/scripts/reel-capture.mjs" "$RUN_DIR/shot-list.json" "$RUN_DIR/capture"+node "<skill_dir>/scripts/reel-render.mjs" "$RUN_DIR/capture" "$RUN_DIR/frames"+uv run python "<skill_dir>/scripts/annotate-evidence.py" animate \+ --frames-dir "$RUN_DIR/frames" --max-width 1920 \+ --output "$RUN_DIR/feature-reel.webp"+```++Read the stills in `capture/` before you render. They are the whole content of the reel: a spinner, an empty state or a wrong row in a still is also in the reel. Fix the shot list or the story, then capture again.++Before you share the reel, read some frames from `frames/`: the first frame, one frame at each click, and the last frame.+Each step must show its cause: the cursor reaches the control before the next state fades in.+A two-step reel is about 3 MB and a three-step reel about 5 MB. The upload limit is 10 MB.++## 4. Add it to the PR++The upload gate in `references/safety-rules.md` applies: show the developer the reel and get approval before the upload.+Storybook renders mock data, but a scratch story or a caption can still carry names that must not be public.++```bash+# --yes only after the developer approves this exact file+hogli pr:upload-image --yes --alt "<what the flow shows>" "$RUN_DIR/feature-reel.webp"+```++Paste the markdown line that the command prints as the "after" of the change. For the "before", follow "Screenshots" in `/writing-pr-descriptions`.diff --git a/.agents/skills/qa-frontend/references/safety-rules.md b/.agents/skills/qa-frontend/references/safety-rules.mdindex 6cf9021768e4..9b3777af2dd6 100644--- a/.agents/skills/qa-frontend/references/safety-rules.md+++ b/.agents/skills/qa-frontend/references/safety-rules.md@@ -10,7 +10,7 @@ PR-mode stop rules (apply only when a `PR_REF` was parsed and PR mode was chosen- `git status --porcelain` is non-empty at skill start.- `gh pr checkout` fails repeatedly. Transient SSH-signing, GraphQL TLS-handshake, and network blips during checkout are common; retry the same `gh pr checkout <N>` up to 2 times before treating it as a hard stop. Do not bypass commit signing (no `--no-gpg-sign`) and do not switch to a manual `git fetch + checkout` dance to dodge a transient error.-Stop rules that apply to both modes:+Stop rules that apply to PR mode and local mode:- The local PostHog stack is not reachable.- Browser MCP/tooling cannot navigate or login. (Credentials always resolve to at least the documented seed defaults, so a missing-credentials stop is no longer separately required; if the resolved credentials do not work, the login step itself fails and aborts here.)diff --git a/.agents/skills/qa-frontend/scripts/annotate-evidence.py b/.agents/skills/qa-frontend/scripts/annotate-evidence.pyindex 3394d10863ac..030daf5a3b87 100644--- a/.agents/skills/qa-frontend/scripts/annotate-evidence.py+++ b/.agents/skills/qa-frontend/scripts/annotate-evidence.py@@ -8,7 +8,8 @@ Three subcommands:``--viewport-width`` so they scale correctly on HiDPI captures.- ``animate``: stitch ordered (annotated) frames into an animated WebP, with anoptional GIF fallback. WebP keeps full 24-bit color and is typically several- times smaller than a palette GIF at the same readability.+ times smaller than a palette GIF at the same readability. ``--frames-dir``+ takes the evenly timed frames of a rendered feature reel instead.- ``video``: transcode a recorded demo-pass session (WebM from the browsertool's video recording) into a compact H.264 MP4. Requires ``ffmpeg``.@@ -227,8 +228,16 @@ def _parse_frame(value: str) -> Frame:return Frame(Path(value), DEFAULT_FRAME_MS)+def _frames_from_dir(frames_dir: Path, fps: int) -> list[Frame]:+ if not 1 <= fps <= 60:+ raise SystemExit(f"--fps must be between 1 and 60 (got {fps})")+ if not frames_dir.is_dir():+ raise SystemExit(f"missing frames directory: {frames_dir}")+ return [Frame(path, round(1000 / fps)) for path in sorted(frames_dir.glob("*.png"))]++def animate(args: argparse.Namespace) -> int:- frames: list[Frame] = args.frame+ frames: list[Frame] = _frames_from_dir(args.frames_dir, args.fps) if args.frames_dir else args.framemissing = [f.path for f in frames if not f.path.is_file()]if missing:raise SystemExit(f"missing frame file(s): {', '.join(str(p) for p in missing)}")@@ -266,7 +275,8 @@ def animate(args: argparse.Namespace) -> int:duration=durations,loop=0,quality=82,- method=6,+ # method 6 is far slower on a long reel for a slightly smaller file+ method=4,)outputs = [args.output]if args.gif:@@ -368,14 +378,20 @@ def main() -> int:annotate_parser.set_defaults(func=annotate)animate_parser = subparsers.add_parser("animate", help="assemble frames into an animated WebP")- animate_parser.add_argument(+ frame_source = animate_parser.add_mutually_exclusive_group(required=True)+ frame_source.add_argument("--frame",type=_parse_frame,action="append",- required=True,metavar="PATH[:DURATION_MS]",help=f"ordered frame with optional per-frame duration (default {DEFAULT_FRAME_MS} ms); repeatable",)+ frame_source.add_argument(+ "--frames-dir",+ type=Path,+ help="directory of evenly timed PNG frames in name order, e.g. from reel-render.mjs",+ )+ animate_parser.add_argument("--fps", type=int, default=15, help="frame rate for --frames-dir")animate_parser.add_argument("--output", type=Path, required=True, help="animated WebP output path")animate_parser.add_argument("--gif", type=Path, help="also write a GIF fallback to this path")animate_parser.add_argument("--max-width", type=int, default=MAX_ANIMATION_WIDTH, help="cap frame width")diff --git a/.agents/skills/qa-frontend/scripts/reel-capture.mjs b/.agents/skills/qa-frontend/scripts/reel-capture.mjsnew file mode 100644index 000000000000..1325eb635695--- /dev/null+++ b/.agents/skills/qa-frontend/scripts/reel-capture.mjs@@ -0,0 +1,148 @@+// Captures the stills of a UI flow for reel-render.mjs.+// Drives a Storybook story (or any page that needs no login) with real mouse input,+// takes a screenshot before each step and one at the end, and records where each step points.+//+// Usage: node reel-capture.mjs <shot-list.json> <out-dir>+import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'+import { createRequire } from 'node:module'+import path from 'node:path'++// Resolve Playwright from the PostHog checkout the command runs in, since the skill can live outside it.+const { chromium } = createRequire(path.join(process.cwd(), 'package.json'))('playwright')++// LOADER_SELECTORS in common/storybook/.storybook/test-runner.ts, without toasts:+// a toast can be the result that a step shows.+const LOADER_SELECTORS = [+ '.Spinner',+ '.quill-spinner',+ '.LemonSkeleton',+ '.LemonTableLoader',+ '[aria-busy="true"]',+ '.SessionRecordingPlayer--buffering',+ '.Lettermark--unknown',+ '[data-attr="loading-bar"]',+]+const ACTIONS = ['click', 'rightclick', 'hover']+// reel-render.mjs zooms up to 1.9x at 2x device pixels, so 3x stills keep text sharp at full zoom.+const CAPTURE_SCALE = 3+const FIRST_LOAD_TIMEOUT_MS = 300_000+const STEP_TIMEOUT_MS = 20_000+const QUIET_MS = 1500+const SETTLE_MS = 600++function locate(page, target) {+ let scope = page.locator('body')+ if (target.within) {+ scope = scope.locator(target.within)+ }+ if (target.label) {+ return scope.getByLabel(target.label, { exact: true }).first()+ }+ if (target.text && target.within) {+ // The `within` element that holds an element with exactly this text, such as a list row.+ return scope.filter({ has: page.getByText(target.text, { exact: true }) }).first()+ }+ if (target.text) {+ return scope.getByText(target.text, { exact: true }).first()+ }+ return scope.locator(target.selector).first()+}++async function settle(page, timeout) {+ // Lazy scenes mount their spinner late, so wait for a quiet stretch, not one clean check.+ await page.evaluate(() => {+ window.__reelQuietSince = undefined+ })+ await page.waitForFunction(+ ({ selector, quietMs }) => {+ const busy = [...document.querySelectorAll(selector)].some((el) => el.checkVisibility())+ if (busy) {+ window.__reelQuietSince = undefined+ return false+ }+ window.__reelQuietSince ??= performance.now()+ return performance.now() - window.__reelQuietSince > quietMs+ },+ { selector: LOADER_SELECTORS.join(','), quietMs: QUIET_MS },+ { timeout, polling: 100 }+ )+ await page.evaluate(() => document.fonts.ready)+ // Menus and hover cards open on short timers.+ await page.waitForTimeout(SETTLE_MS)+}++async function boxOf(locator) {+ const box = await locator.boundingBox()+ if (!box) {+ throw new Error('The target has no bounding box. Is it hidden?')+ }+ return { x: box.x, y: box.y, w: box.width, h: box.height }+}++async function act(page, action, point) {+ await page.mouse.move(point.x, point.y)+ if (action === 'click') {+ await page.mouse.click(point.x, point.y)+ } else if (action === 'rightclick') {+ await page.mouse.click(point.x, point.y, { button: 'right' })+ }+}++async function main() {+ const [shotListPath, outDir] = process.argv.slice(2)+ if (!shotListPath || !outDir) {+ throw new Error('Usage: node reel-capture.mjs <shot-list.json> <out-dir>')+ }+ const shotList = JSON.parse(readFileSync(shotListPath, 'utf8'))+ const viewport = shotList.viewport ?? { width: 1280, height: 800 }+ // Check before the first load, which can take minutes on a cold server.+ for (const step of shotList.steps) {+ if (!ACTIONS.includes(step.action)) {+ throw new Error(`Unknown action "${step.action}". Use ${ACTIONS.join(', ')}.`)+ }+ }+ mkdirSync(outDir, { recursive: true })++ const browser = await chromium.launch()+ const context = await browser.newContext({ viewport, deviceScaleFactor: CAPTURE_SCALE, reducedMotion: 'reduce' })+ const page = await context.newPage()+ // A cold Vite dev server compiles each lazy chunk on its first request, which can take minutes.+ await page.goto(shotList.url, { timeout: FIRST_LOAD_TIMEOUT_MS })+ await settle(page, FIRST_LOAD_TIMEOUT_MS)++ const frames = []+ const snap = async (caption, target) => {+ const file = `${String(frames.length).padStart(2, '0')}.png`+ await page.screenshot({ path: path.join(outDir, file) })+ const frame = { file, caption: caption ?? null, target }+ frames.push(frame)+ return frame+ }++ for (const step of shotList.steps) {+ const locator = locate(page, step.target)+ await locator.waitFor({ state: 'visible', timeout: STEP_TIMEOUT_MS })+ // page.mouse works in viewport coordinates, so a target below the fold must scroll in first.+ await locator.scrollIntoViewIfNeeded({ timeout: STEP_TIMEOUT_MS })+ const box = await boxOf(locator)+ const point = step.at+ ? { x: box.x + step.at.x, y: box.y + step.at.y }+ : { x: box.x + box.w / 2, y: box.y + box.h / 2 }+ const frame = await snap(step.caption, { ...box, point, action: step.action })+ await act(page, step.action, point)+ if (step.waitFor) {+ await locate(page, step.waitFor).waitFor({ state: 'visible', timeout: STEP_TIMEOUT_MS })+ }+ await settle(page, STEP_TIMEOUT_MS)+ if (step.focus) {+ frame.target.result = await boxOf(locate(page, step.focus))+ }+ }+ await snap(shotList.finalCaption, null)+ await browser.close()++ writeFileSync(path.join(outDir, 'frames.json'), JSON.stringify({ viewport, frames }, null, 2))+ process.stdout.write(`${outDir}: ${frames.length} stills\n`)+}++await main()diff --git a/.agents/skills/qa-frontend/scripts/reel-render.mjs b/.agents/skills/qa-frontend/scripts/reel-render.mjsnew file mode 100644index 000000000000..396017e6d7a3--- /dev/null+++ b/.agents/skills/qa-frontend/scripts/reel-render.mjs@@ -0,0 +1,60 @@+// Renders the stills from reel-capture.mjs into the PNG frames of a feature reel.+// Loads reel-template.html, steps its render(t) through time and screenshots each frame+// at 2x, so the reel stays sharp on high-density screens.+// Encode the frames with `annotate-evidence.py animate --frames-dir`.+//+// Usage: node reel-render.mjs <capture-dir> <frames-dir>+import { mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs'+import { createRequire } from 'node:module'+import path from 'node:path'+import { pathToFileURL } from 'node:url'++// Resolve Playwright from the PostHog checkout the command runs in, since the skill can live outside it.+const { chromium } = createRequire(path.join(process.cwd(), 'package.json'))('playwright')++const OUTPUT_SCALE = 2+// annotate-evidence.py animate --frames-dir defaults to the same rate.+const FPS = 15+const TEMPLATE = new URL('./reel-template.html', import.meta.url).href+const FRAME_NAME = /^\d{4}\.png$/++async function main() {+ const [captureDir, framesDir] = process.argv.slice(2)+ if (!captureDir || !framesDir) {+ throw new Error('Usage: node reel-render.mjs <capture-dir> <frames-dir>')+ }+ if (path.resolve(captureDir) === path.resolve(framesDir)) {+ // The encoder takes every PNG in the frames folder, so the stills would end up in the reel.+ throw new Error('Use a frames folder other than the capture folder')+ }+ const capture = JSON.parse(readFileSync(path.join(captureDir, 'frames.json'), 'utf8'))+ const data = {+ viewport: capture.viewport,+ frames: capture.frames.map((frame) => ({+ ...frame,+ src: pathToFileURL(path.resolve(captureDir, frame.file)).href,+ })),+ }+ mkdirSync(framesDir, { recursive: true })+ // A shorter re-render would otherwise leave old frames at the end of the reel.+ for (const name of readdirSync(framesDir).filter((name) => FRAME_NAME.test(name))) {+ rmSync(path.join(framesDir, name))+ }++ const browser = await chromium.launch()+ const page = await browser.newPage({ deviceScaleFactor: OUTPUT_SCALE })+ await page.goto(TEMPLATE)+ const { duration, width, height } = await page.evaluate((reelData) => window.setupReel(reelData), data)+ await page.setViewportSize({ width, height })++ const total = Math.ceil(duration * FPS)+ const reel = page.locator('#reel')+ for (let i = 0; i < total; i++) {+ await page.evaluate((t) => window.reel.render(t), i / FPS)+ await reel.screenshot({ path: path.join(framesDir, `${String(i).padStart(4, '0')}.png`) })+ }+ await browser.close()+ process.stdout.write(`${framesDir}: ${total} frames, ${duration.toFixed(1)}s at ${FPS} fps\n`)+}++await main()diff --git a/.agents/skills/qa-frontend/scripts/reel-template.html b/.agents/skills/qa-frontend/scripts/reel-template.htmlnew file mode 100644index 000000000000..ce29ee2bc7dc--- /dev/null+++ b/.agents/skills/qa-frontend/scripts/reel-template.html@@ -0,0 +1,320 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <title>Feature reel</title>+ <style>+ body {+ margin: 0;+ background: #eeefe9;+ }+ #reel {+ position: relative;+ overflow: hidden;+ background: #eeefe9;+ }+ #stage {+ position: absolute;+ left: 0;+ top: 0;+ transform-origin: 0 0;+ }+ .still {+ position: absolute;+ left: 0;+ top: 0;+ }+ #cursor {+ position: absolute;+ left: 0;+ top: 0;+ width: 22px;+ height: 22px;+ margin: -2px 0 0 -4px;+ transform-origin: 4px 2px;+ z-index: 10;+ }+ .ring {+ position: absolute;+ width: 40px;+ height: 40px;+ margin: -20px 0 0 -20px;+ box-sizing: border-box;+ border: 3px solid #f54e00;+ border-radius: 50%;+ z-index: 9;+ }+ .caption {+ position: absolute;+ left: 50%;+ bottom: 18px;+ padding: 9px 18px;+ border-radius: 999px;+ background: #151515;+ color: #eeefe9;+ white-space: nowrap;+ font:+ 600 17px/1.2 -apple-system,+ BlinkMacSystemFont,+ 'Segoe UI',+ Helvetica,+ Arial,+ sans-serif;+ box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);+ z-index: 20;+ }+ </style>+ </head>+ <body>+ <div id="reel"><div id="stage"></div></div>+ <script>+ // The reel is a pure function of time: reel-render.mjs calls render(t) once per output frame.+ const OUT_WIDTH = 960+ const MAX_ZOOM = 1.9+ // The camera never frames less than this many CSS pixels, so a small target keeps its context.+ const MIN_FOCUS = { w: 420, h: 262 }+ const INTRO = 0.7+ const GLIDE = 0.9+ const CLICK_HOLD = 0.35+ const FADE = 0.18+ const PRESS = 0.22+ const RING = 0.55+ const SETTLE = 0.8+ const RESULT_HOLD = 2.2+ const OUTRO = 0.7+ const TAIL = 0.3+ const CURSOR_IN_AT = 0.2+ const CURSOR_FADE = 0.3+ const CAPTION_DELAY = 0.1+ const CAPTION_GAP = 0.15+ const CAPTION_FADE_IN = 0.25+ const CAPTION_FADE_OUT = 0.2+ // keep in sync with the cursor in cursor-overlay.js+ const CURSOR_SVG =+ '<svg width="22" height="22" viewBox="0 0 22 22"><path d="M4 2 L4 17 L8 13.5 L11 20 L13.5 19 L10.5 12.5 L16 12 Z" ' ++ 'fill="#fff" stroke="#151515" stroke-width="1.4" stroke-linejoin="round"/></svg>'++ function clamp01(value) {+ return Math.min(1, Math.max(0, value))+ }++ function easeInOut(p) {+ return p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2+ }++ function easeOut(p) {+ return 1 - (1 - p) ** 3+ }++ function mix(from, to, p) {+ const result = {}+ for (const key of Object.keys(from)) {+ result[key] = from[key] + (to[key] - from[key]) * p+ }+ return result+ }++ // Keys are [time, value] pairs in time order. The value holds before the first key and after the last.+ function track(keys, t) {+ if (t <= keys[0][0]) {+ return keys[0][1]+ }+ for (let i = 1; i < keys.length; i++) {+ const [end, to] = keys[i]+ if (t <= end) {+ const [start, from] = keys[i - 1]+ return mix(from, to, easeInOut((t - start) / (end - start)))+ }+ }+ return keys.at(-1)[1]+ }++ function union(a, b) {+ const x = Math.min(a.x, b.x)+ const y = Math.min(a.y, b.y)+ return { x, y, w: Math.max(a.x + a.w, b.x + b.w) - x, h: Math.max(a.y + a.h, b.y + b.h) - y }+ }++ function planReel(data) {+ const { width: vw, height: vh } = data.viewport+ const outHeight = Math.round((OUT_WIDTH * vh) / vw)+ const cameraFor = (rect) => {+ const w = Math.max(rect.w, MIN_FOCUS.w)+ const h = Math.max(rect.h, MIN_FOCUS.h)+ const zoom = Math.min(MAX_ZOOM, Math.max(1, Math.min(vw / w, vh / h)))+ const s = (OUT_WIDTH / vw) * zoom+ // Clamp so the still always covers the whole output.+ const x = Math.min(0, Math.max(OUT_WIDTH - vw * s, OUT_WIDTH / 2 - (rect.x + rect.w / 2) * s))+ const y = Math.min(0, Math.max(outHeight - vh * s, outHeight / 2 - (rect.y + rect.h / 2) * s))+ return { x, y, s }+ }++ const steps = data.frames.filter((frame) => frame.target)+ if (steps.length === 0) {+ throw new Error('A reel needs at least one step')+ }+ let t = INTRO+ const beats = steps.map((frame) => {+ const { point } = frame.target+ const focus = union(frame.target, { x: point.x - 60, y: point.y - 40, w: 120, h: 80 })+ const beat = {+ at: t,+ camera: cameraFor(focus),+ point,+ clicks: frame.target.action !== 'hover',+ click: t + GLIDE,+ swap: t + GLIDE + CLICK_HOLD,+ caption: frame.caption,+ }+ t += GLIDE + CLICK_HOLD + FADE+ return beat+ })+ const lastTarget = steps.at(-1).target+ const ending = {+ at: t,+ camera: cameraFor(lastTarget.result ? union(lastTarget, lastTarget.result) : lastTarget),+ outro: t + RESULT_HOLD,+ caption: data.frames.at(-1).caption,+ }+ return {+ vw,+ vh,+ outHeight,+ full: { x: 0, y: 0, s: OUT_WIDTH / vw },+ beats,+ ending,+ duration: ending.outro + OUTRO + TAIL,+ }+ }++ function cameraKeys(plan) {+ const keys = [[0, plan.full]]+ let from = plan.full+ for (const beat of plan.beats) {+ keys.push([beat.at, from], [beat.at + GLIDE, beat.camera])+ from = beat.camera+ }+ const { ending } = plan+ keys.push(+ [ending.at, from],+ [ending.at + SETTLE, ending.camera],+ [ending.outro, ending.camera],+ [ending.outro + OUTRO, plan.full]+ )+ return keys+ }++ function cursorKeys(plan) {+ const first = plan.beats[0].point+ const start = { x: Math.min(first.x + 220, plan.vw - 40), y: Math.min(first.y + 160, plan.vh - 40) }+ const keys = [[0, start]]+ let from = start+ for (const beat of plan.beats) {+ keys.push([beat.at + 0.05, from], [beat.at + 0.05 + GLIDE * 0.85, beat.point])+ from = beat.point+ }+ return keys+ }++ function captionWindows(plan) {+ const windows = plan.beats.map((beat, i) => {+ const next = i + 1 < plan.beats.length ? plan.beats[i + 1].at : plan.ending.at+ return { text: beat.caption, from: beat.at, to: next - CAPTION_GAP }+ })+ windows.push({ text: plan.ending.caption, from: plan.ending.at + CAPTION_DELAY, to: plan.ending.outro })+ return windows.filter((window) => window.text)+ }++ async function setupReel(data) {+ const plan = planReel(data)+ const reel = document.getElementById('reel')+ const stage = document.getElementById('stage')+ reel.style.width = `${OUT_WIDTH}px`+ reel.style.height = `${plan.outHeight}px`+ stage.style.width = `${plan.vw}px`+ stage.style.height = `${plan.vh}px`++ const stills = data.frames.map((frame) => {+ const img = document.createElement('img')+ img.className = 'still'+ img.src = frame.src+ img.style.width = `${plan.vw}px`+ img.style.height = `${plan.vh}px`+ stage.appendChild(img)+ return img+ })+ await Promise.all(stills.map((img) => img.decode()))++ const rings = plan.beats.map((beat) => {+ const ring = document.createElement('div')+ ring.className = 'ring'+ ring.style.left = `${beat.point.x}px`+ ring.style.top = `${beat.point.y}px`+ stage.appendChild(ring)+ return ring+ })+ const cursor = document.createElement('div')+ cursor.id = 'cursor'+ cursor.innerHTML = CURSOR_SVG+ stage.appendChild(cursor)++ const captions = captionWindows(plan).map((window) => {+ const el = document.createElement('div')+ el.className = 'caption'+ el.textContent = window.text+ reel.appendChild(el)+ return { el, ...window }+ })++ const camera = cameraKeys(plan)+ const cursorPath = cursorKeys(plan)++ const render = (t) => {+ const cam = track(camera, t)+ stage.style.transform = `translate(${cam.x}px, ${cam.y}px) scale(${cam.s})`++ // Still i + 1 shows the result of beat i, so it fades in over still i at that beat's swap.+ stills.forEach((img, i) => {+ img.style.opacity = i === 0 ? 1 : clamp01((t - plan.beats[i - 1].swap) / FADE)+ })++ let press = 1+ plan.beats.forEach((beat, i) => {+ if (!beat.clicks) {+ rings[i].style.opacity = 0+ return+ }+ const p = (t - beat.click) / RING+ const visible = p >= 0 && p <= 1+ rings[i].style.opacity = visible ? 0.95 * (1 - p) : 0+ rings[i].style.transform = `scale(${0.3 + 1.2 * easeOut(clamp01(p))})`+ const pressed = (t - beat.click) / PRESS+ if (pressed >= 0 && pressed <= 1) {+ press = 1 - 0.2 * Math.sin(Math.PI * pressed)+ }+ })++ const pos = track(cursorPath, t)+ const cursorIn = clamp01((t - CURSOR_IN_AT) / CURSOR_FADE)+ cursor.style.opacity = Math.min(+ cursorIn,+ clamp01((plan.ending.outro + CURSOR_FADE - t) / CURSOR_FADE)+ )+ cursor.style.transform = `translate(${pos.x}px, ${pos.y}px) scale(${press})`++ for (const caption of captions) {+ const fadeIn = clamp01((t - caption.from) / CAPTION_FADE_IN)+ const opacity = Math.min(fadeIn, clamp01((caption.to - t) / CAPTION_FADE_OUT))+ caption.el.style.opacity = opacity+ caption.el.style.transform = `translate(-50%, ${8 * (1 - fadeIn)}px)`+ }+ }++ window.reel = { duration: plan.duration, render }+ return { duration: plan.duration, width: OUT_WIDTH, height: plan.outHeight }+ }++ window.setupReel = setupReel+ </script>+ </body>+</html>diff --git a/.agents/skills/writing-pr-descriptions/SKILL.md b/.agents/skills/writing-pr-descriptions/SKILL.mdindex 8f0874daa975..c7ee13787bc1 100644--- a/.agents/skills/writing-pr-descriptions/SKILL.md+++ b/.agents/skills/writing-pr-descriptions/SKILL.md@@ -98,6 +98,7 @@ Take each screenshot from the first source that can show the change:1. The running app, when one is up.2. Storybook, through a headless browser. Use the story that covers the surface. When no story does, write a scratch story for the screenshot and keep it out of the commit.+3. A feature reel, when one still cannot show a new flow. Reel mode of `/qa-frontend` turns Storybook stills into an animated WebP.Capture at `deviceScaleFactor: 2`. A 1x image looks soft on a high-density screen, and GitHub shrinks a wider image to fit the column. Take the before from the base branch the same way. A new surface has no before, so say that in one line.