Skip to content

Verify

Visual verification, Figma comparison, style capture, and report generation.

9 modules

ModuleDescription
Annotate ScreenshotDraw labeled bounding boxes on screenshots to mark differences
Capture Element StylesCapture computed styles from browser element
Compare StylesCompare captured styles with expected values
Fetch Figma StyleFetch design tokens from Figma API (token stays local)
Generate ReportGenerate verification report in HTML/JSON/Markdown
Load RulesetLoad verification rules from YAML file
Run VerificationRun full design verification: capture → compare → report
Run Spec VerificationDynamic spec verification - compose any modules via YAML
Visual DiffCompare reference design with dev site visually, annotate differences

Modules

Annotate Screenshot

verify.annotate

Draw labeled bounding boxes on screenshots to mark differences

Parameters:

NameTypeRequiredDefaultDescription
image_pathstringYes-Path to the screenshot image
annotationsarrayYes-Array of annotations: [{label, x, y, width, height, color?, description?}]
output_pathstringNo-Output path for annotated image (default: adds _annotated suffix)

Output:

FieldTypeDescription
output_pathstringPath to annotated image
annotation_countintegerNumber of annotations drawn

Capture Element Styles

verify.capture

Capture computed styles from browser element

Parameters:

NameTypeRequiredDefaultDescription
urlstringYes-URL to capture from
selectorstringYes-CSS selector
wait_forstringNo-Wait for selector before capture
viewport_widthnumberNo1280Viewport width
viewport_heightnumberNo800Viewport height

Output:

FieldTypeDescription
elementobjectCaptured element with styles
foundbooleanWhether element was found

Compare Styles

verify.compare

Compare captured styles with expected values

Parameters:

NameTypeRequiredDefaultDescription
actualobjectYes-Captured element styles (from verify.capture)
expectedobjectYes-Expected styles to compare against
selectorstringNo-Selector for reporting
size_tolerancenumberNo2.0Tolerance for size (px)
spacing_tolerancenumberNo2.0Tolerance for spacing (px)
font_size_tolerancenumberNo1.0Tolerance for font size (px)
color_tolerancenumberNo5Tolerance for color (0-255)
check_typographybooleanNoTrueCheck typography
check_colorsbooleanNoTrueCheck colors
check_spacingbooleanNoTrueCheck spacing
check_sizingbooleanNoFalseCheck sizing

Output:

FieldTypeDescription
passedbooleanWhether comparison passed
violationsarrayList of violations found
error_countnumberNumber of errors
warning_countnumberNumber of warnings

Fetch Figma Style

verify.figma

Fetch design tokens from Figma API (token stays local)

Parameters:

NameTypeRequiredDefaultDescription
file_idstringYes-Figma file key (from URL)
node_idstringNo-Specific node ID to fetch
node_namestringNo-Find node by name
tokenstringNo-Figma token (or use FIGMA_TOKEN env var)

Output:

FieldTypeDescription
nodeobjectFigma node data
styleobjectExtracted style

Generate Report

verify.report

Generate verification report in HTML/JSON/Markdown

Parameters:

NameTypeRequiredDefaultDescription
resultsarrayYes-Comparison results from verify.compare
namestringNoverify-reportReport name
urlstringNo-URL that was verified
formatstringNohtmlOutput format (html, json, markdown, all)
output_dirstringNo./verify-reportsOutput directory
screenshotsarrayNo-Screenshot paths to include

Output:

FieldTypeDescription
report_pathstringPath to generated report
summaryobjectSummary statistics

Load Ruleset

verify.ruleset

Load verification rules from YAML file

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to YAML ruleset file

Output:

FieldTypeDescription
rulesetobjectParsed ruleset
rules_countintegerNumber of rules

Run Verification

verify.run

Run full design verification: capture → compare → report

Parameters:

NameTypeRequiredDefaultDescription
urlstringYes-URL to verify
selectorsarrayNo-CSS selectors to verify
ruleset_pathstringNo-Path to YAML ruleset file
expected_stylesobjectNo-Expected styles per selector
figma_file_idstringNo-Figma file ID for comparison
figma_tokenstringNo-Figma token (or FIGMA_TOKEN env)
figma_mappingobjectNo-Selector to Figma node mapping
output_dirstringNo./verify-reportsOutput directory
report_formatstringNohtmlReport format
take_screenshotbooleanNoTrueCapture screenshot
viewport_widthnumberNo1280Viewport width
viewport_heightnumberNo800Viewport height

Output:

FieldTypeDescription
passedbooleanOverall verification passed
summaryobjectSummary statistics
report_pathstringPath to generated report

Example: Example

yaml
url: http://localhost:3000
selectors: ["button[type=\"submit\"]", "input[type=\"email\"]"]

Example: Example

yaml
url: http://localhost:3000
selectors: ["button.primary"]
figma_file_id: abc123xyz
figma_mapping: {"button.primary": "Primary Button"}

Example: Example

yaml
url: http://localhost:3000
ruleset_path: ./design-rules.yaml

Run Spec Verification

verify.spec

Dynamic spec verification - compose any modules via YAML

Parameters:

NameTypeRequiredDefaultDescription
ruleset_pathstringNo-Path to YAML ruleset file
rulesetobjectNo-Inline ruleset object

Output:

FieldTypeDescription
passedboolean
summaryobject
resultsarray

Visual Diff

verify.visual_diff

Compare reference design with dev site visually, annotate differences

Parameters:

NameTypeRequiredDefaultDescription
reference_urlstringYes-URL or local image path of reference design
dev_urlstringYes-URL of development site to compare
output_dirstringNo./verify-reports/visual-diffOutput directory for reports
focus_areasarrayNo-Areas to focus on (e.g. ["header", "login form"])
viewport_widthnumberNo1280Browser viewport width
viewport_heightnumberNo800Browser viewport height
modelstringNogpt-4oVision model to use
api_keystringNo-OpenAI API key (or use OPENAI_API_KEY env var)

Output:

FieldTypeDescription
similarity_scorenumberSimilarity percentage (0-100)
annotationsarrayList of annotated differences
annotated_imagestringPath to annotated screenshot
report_pathstringPath to HTML report
summarystringSummary of differences

Released under the Apache 2.0 License.