From b1f4bdcacbb8b4170bed78c87daed003a107a1ea Mon Sep 17 00:00:00 2001 From: drepkovsky Date: Sun, 14 Jun 2026 14:27:17 +0200 Subject: [PATCH] feat: add `qprobe design` command for deterministic UI design QA Launches headless Chromium and, per --viewport, runs a DOM geometry scan plus a CSS-variable token-conformance scan, printing JSON findings. The scanners are shared verbatim with the agent-board design-qa skill (one source of truth). Browser-launch is dogfooded; CI keeps a routing test since the bare runner has no Chromium. --- .changeset/qprobe-design-command.md | 5 ++ src/browser/design-scanners.ts | 125 ++++++++++++++++++++++++++++ src/cli.ts | 2 + src/commands/design.ts | 76 +++++++++++++++++ tests/integration/design.test.ts | 46 ++++++++++ 5 files changed, 254 insertions(+) create mode 100644 .changeset/qprobe-design-command.md create mode 100644 src/browser/design-scanners.ts create mode 100644 src/commands/design.ts create mode 100644 tests/integration/design.test.ts diff --git a/.changeset/qprobe-design-command.md b/.changeset/qprobe-design-command.md new file mode 100644 index 0000000..c3b3920 --- /dev/null +++ b/.changeset/qprobe-design-command.md @@ -0,0 +1,5 @@ +--- +"@questpie/probe": minor +--- + +Add `qprobe design ` — measure the rendered UI for layout and design-token defects, deterministically and without a vision model. Launches headless Chromium, and for each `--viewport` runs a DOM geometry scan (overflow, truncation, collapse, sibling overlap, near-miss misalignment, tap targets, sub-16px input fonts) plus a CSS-variable token-conformance scan (off-palette colors, off-token box-shadows, off-token border-radii), printing JSON findings. The scanners are shared verbatim with the agent-board `agent-board-design-qa` skill. diff --git a/src/browser/design-scanners.ts b/src/browser/design-scanners.ts new file mode 100644 index 0000000..37ec469 --- /dev/null +++ b/src/browser/design-scanners.ts @@ -0,0 +1,125 @@ +// Deterministic design-QA scanners, injected via page.evaluate(). +// +// Each is an IIFE *string* that runs in page context and returns an array of +// findings: { layer, severity, selector, prop, measured, expected, message }. +// They are kept as strings (not imported functions) on purpose: the exact same +// source is shared with the agent-board `agent-board-design-qa` skill, which +// pastes them into whatever page-eval tool a harness exposes. Keeping one source +// of truth means a fix here is a fix there. They are dependency-free and +// backtick-free so they embed cleanly in either place. +// +// Both were hardened by dogfooding on a real board UI: read the viewport from +// documentElement.clientWidth (the eval context can report 0), report only the +// outermost overflowing element, skip SVG internals, ignore native