Index of every page on this site: llms.txt
All skills
tale-project avatar

/visual-aspect-analyzer

@02b23bc
by Taletale-project/tale47 stars
10
Run it yourself

Run this as the FINAL review step once you have finished a UI change you can load in a browser — it is the visual-regression gate, run once at the end (not after every edit), and the change is not done until it reports `score: 100`. It drives a real browser over the page, auto-detects its relevant elements (no selectors), labels each by ARIA role + accessible name, and reports which changed the rendered frame, what each is anchored to (screen/page/ancestor), and what transition defects (layout-shift, flicker, jank, dithering) occurred, with a 0–100 score. Run `bun src/analyze-cli.ts <url>` for a lean JSON report (`--full` for the faithful record). Also read before resolving what an element is anchored to, or editing the instrument, analysis, or element auto-detection in this directory.

  • 73 files
  • 505.3 KB
  • Updated 4 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/tale-project/tale/visual-aspect-analyzer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈1.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

visual-aspect-analyzer

Drive a real browser over a session and report, per auto-detected element, what actually changed on screen: identity (each element's role "name" label), visual impact (did it change the frame?), anchors (what holds it in place?), position (each element's bounding box, and where it moved from), motion (the approximate easing curve — linear/ease-in/ease-out/ease-in-out), and transition defects (layout-shift, flicker, jank, dithering) — with a 0–100 health score and fix hints. You don't pick the elements: the instrument finds the page's relevant ones for you (see Auto-detection).

Install

Run from the repository root:

bun install --frozen-lockfile
bunx playwright install chromium   # for the live CLI / e2e only

Runs on Bun directly — no build step; the in-page instrument is bundled in memory.

Use

# Turnkey: analyze a live url (launches its own browser, auto-detects elements)
bun run --filter @tale/visual-aspect-analyzer analyze <url>

# Offline: re-analyze a recorded session
bun run --filter @tale/visual-aspect-analyzer report examples/sample-recording.json

There are no selectors to pass — the instrument auto-detects the page's relevant elements. Pixel capture and auto-scroll are enabled by the live CLI, and the health summary always prints to stderr. The only flag is --full (faithful Report).

Or embed the driver (any Playwright-shaped page satisfies PageLike):

import { buildInstrumentBundle } from './src/bundle';
import { analyzeSession } from './src/driver';
const report = await analyzeSession(page, {
  url,
  instrumentBundle: await buildInstrumentBundle(),
  capturePixels: true, // dithering + the paint counterfactual — the CLI sets this; omit and you lose both
  // interact: async (p) => {/* log in / open a modal before sampling */},
  // keyframes: 4, settleMs: 500, pixelThreshold,  // session knobs the CLI fixes
});

stdout is a lean, AI-optimized report (defects coalesced, numbers rounded, fix hints hoisted to one per type — much smaller than the raw record); --full emits the faithful Report. See SKILL.md for the exact schema.

What it detects

  • Impact (temporal): paints (occlusion-gated) and/or affects layout, unioned over every frame — caught even if it only starts mid-session.
  • Affected-by (causal): the elements a tracked element moved — same-frame co-movement, confirmed by layout-shift sources and an invisible counterfactual.
  • Anchors: screen · page · an ancestor · null.
  • Transitions: move · resize · fade · color · composite, scored smooth / janky / flicker / shift (scroll and pure resizes are never mistaken for motion).
  • Defects: layout-shift (CLS, read not recomputed), flicker, jank, dithering.

Auto-detection

There are no selectors. The in-page instrument finds the page's developer-recognizable component roots itself, then tracks them through the same pipeline:

  1. Event boundaries. Injected before the page's own scripts, it wraps addEventListener to record which elements get interaction handlers (click/pointer/key/input/…) — a strong "this is a component" signal (listeners.ts).
  2. A scored selection at settle. It gathers candidates from cheap signals — landmarks & roles, headings, interactive elements, the event boundaries above, media, and component-name hints (hero/card/nav/…) — then does one batched layout pass to score each (semantics + interactivity + visual prominence), collapses parent/child wrappers to the component root, and keeps the top set within a budget (select.ts).
  3. Media + activity. Replaced media (canvas/video/img) is always seeded, and the mutation/resize/intersection/layout-shift/animation observers add anything that becomes active at runtime.

Each tracked element is labeled by its ARIA role + accessible name (accname.ts) — nav "Main", button "Add to cart" — falling back to a CSS path. Coverage is reported in the audit block (discovered, capped), never a silent truncation.

Architecture

Layer Files Runs in
In-page instrument instrument.ts · select.ts · listeners.ts · accname.ts the browser (injected IIFE)
Driver + pixel pipeline driver.ts · pixels.ts · annotate.ts Node / Bun
Analysis (pure) impact · anchors · defects/ · report Node / Bun
Boundary recording.ts — guards untyped JSON → typed Recording Node / Bun
Output summarize.ts · compact.ts · CLIs Node / Bun

Verify

bun run --filter @tale/visual-aspect-analyzer typecheck
bun run --filter @tale/visual-aspect-analyzer test
bun run --filter @tale/visual-aspect-analyzer e2e  # real Chromium; skips if unavailable

typecheck and test run on every pull request as part of the repo-wide gate in .github/workflows/checks.yml, which also runs oxfmt, oxlint, knip, and commitlint. This skill is a turbo workspace, so its checks run through bun run check (or bunx turbo run typecheck test) at the repo root — no separate install or lockfile here.

Scope & limitations

  • Auto-detection sees the main document only — closed shadow roots and cross-origin iframes are not pierced.
  • Pixel capture clips to the viewport; off-screen frames yield no pixel noise (the observer/geometry signals still apply). Dithering noise is averaged over the element's box, so a small churning region inside a large element can dilute below the threshold.
  • A purely-decorative static element with no semantic role, interactivity, media, or component-name hint carries no signal, so it may not be auto-detected; give it a role, a recognizable class/id, or a data-* attribute if you need it tracked.

See SKILL.md and the in-code deep-dives src/impact-detection.md / src/defects/transition-defects.md.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 02b23bc. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago

README badge

README badge for tale-project/tale/visual-aspect-analyzer