Skip to content

Verify

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

9 modules

ModuleDescription
スクリーンショットに注釈スクリーンショットにラベル付きのバウンディングボックスを描いて違いを示す
要素スタイル取得ブラウザ要素から計算されたスタイルを取得
スタイル比較取得したスタイルと期待値を比較
Figmaスタイル取得Figma APIからデザイントークンを取得(トークンはローカルに保持)
レポート生成HTML/JSON/Markdownで検証レポートを生成
ルールセット読み込みYAMLファイルから検証ルールを読み込む
検証実行デザイン検証をフル実行:取得 → 比較 → レポート
スペック検証実行動的スペック検証 - YAMLでモジュールを組み合わせる
ビジュアル差分参照デザインと開発サイトを視覚的に比較し、違いに注釈を付ける

Modules

スクリーンショットに注釈

verify.annotate

スクリーンショットにラベル付きのバウンディングボックスを描いて違いを示す

Parameters:

NameTypeRequiredDefaultDescription
image_pathstringYes-スクリーンショット画像のパス
annotationsarrayYes-注釈の配列: [{label, x, y, width, height, color?, description?}]
output_pathstringNo-注釈付き画像の出力パス(デフォルト: _annotatedサフィックスを追加)

Output:

FieldTypeDescription
output_pathstring注釈付き画像のパス
annotation_countinteger描かれた注釈の数

要素スタイル取得

verify.capture

ブラウザ要素から計算されたスタイルを取得

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

スタイル比較

verify.compare

取得したスタイルと期待値を比較

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

Figmaスタイル取得

verify.figma

Figma APIからデザイントークンを取得(トークンはローカルに保持)

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

レポート生成

verify.report

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

ルールセット読み込み

verify.ruleset

YAMLファイルから検証ルールを読み込む

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to YAML ruleset file

Output:

FieldTypeDescription
rulesetobjectParsed ruleset
rules_countintegerNumber of rules

検証実行

verify.run

デザイン検証をフル実行:取得 → 比較 → レポート

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

スペック検証実行

verify.spec

動的スペック検証 - YAMLでモジュールを組み合わせる

Parameters:

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

Output:

FieldTypeDescription
passedboolean
summaryobject
resultsarray

ビジュアル差分

verify.visual_diff

参照デザインと開発サイトを視覚的に比較し、違いに注釈を付ける

Parameters:

NameTypeRequiredDefaultDescription
reference_urlstringYes-参照デザインのURLまたはローカル画像パス
dev_urlstringYes-比較する開発サイトのURL
output_dirstringNo./verify-reports/visual-diffレポートの出力ディレクトリ
focus_areasarrayNo-注目するエリア(例: ["ヘッダー", "ログインフォーム"])
viewport_widthnumberNo1280ブラウザのビューポートの幅
viewport_heightnumberNo800ブラウザのビューポートの高さ
modelstringNogpt-4o使用するビジョンモデル
api_keystringNo-OpenAI APIキー(またはOPENAI_API_KEY環境変数を使用)

Output:

FieldTypeDescription
similarity_scorenumber類似度のパーセンテージ (0-100)
annotationsarray注釈付きの違いのリスト
annotated_imagestring注釈付きスクリーンショットのパス
report_pathstringHTMLレポートのパス
summarystring違いの概要

Released under the Apache 2.0 License.