Keep your UI honest.
DesignLatch catches the gap between your design tokens and your live UI — automatically. It compares expected token values against actual computed styles, then surfaces every drift as a scored compliance report.
DesignLatch catches the gap between your design tokens and your live UI — automatically. It compares expected token values against actual computed styles, then surfaces every drift as a scored compliance report.
Use the CLI for terminal-based workflows with Playwright and HTML reports. Use MCP when an AI agent already holds your data inline and needs JSON-only results.
CLI commands with every flag explained, MCP tool reference, inputs, outputs, and architecture — all in one place.
Your Figma spec says --color-primary: #2dd4a0. Your live site? Nobody checked. A hardcoded hex slipped in. Three sprints later, half your buttons are the wrong shade and nobody noticed until a stakeholder screenshot landed in Slack.
DesignLatch compares your token definitions against computed CSS captured from a real browser, rule by rule, and gives you a score. Run it in CI to catch drift before it ships.
Terminal workflow. Collects snapshots via Playwright, generates HTML reports, and works entirely with files on disk.
AI agent workflow. Accepts inline JSON over stdio, returns structured results, and works best when the agent can also reach Playwright MCP and Figma MCP.
Write a .designlatch.json config listing selectors, rules, and expected token values - your compliance spec.
The CLI uses Playwright to open your live site and record every computed CSS value. MCP receives snapshots as inline JSON from the agent workflow.
The engine diffs expected vs actual, scores compliance, and returns an HTML report (CLI) or structured JSON summary (MCP).
npm install -D @designlatch/cli
npx designlatch initnpx designlatch collect --config .designlatch.json --url https://app.example.com --out snapshots.json
npx designlatch scan --tokens tokens.json --snapshots snapshots.json --report-dir report claude mcp add --transport stdio designlatch npx -- -y @designlatch/mcp
Use Playwright MCP and Figma MCP to gather the live selector styles and the matching design values.
Then call DesignLatch MCP compare_live_ui_to_figma and return the score, mismatches, and report path.DesignLatch keeps your live UI honest against your design system. It compares expected token values with actual computed styles and gives you a scored compliance report - through a terminal CLI or an AI-agent MCP server.
Terminal workflow - Playwright collection, file-based inputs, offline HTML reports. Great for CI and local dev.
AI agent workflow - accepts inline JSON over stdio, returns structured results, and fits best when the agent can also reach Playwright MCP and Figma MCP.
Design drift is invisible until it's embarrassing. Here's what DesignLatch fixes.
Your Figma says --color-primary: #2dd4a0. Your live site? Nobody checked. A hardcoded hex slipped in. Three sprints later, half your buttons are the wrong shade.
Manual visual QA is slow, inconsistent, and doesn't scale.
DesignLatch captures computed CSS from a real browser, diffs it against your token spec rule-by-rule, and returns a scored report.
Run it in CI to fail builds on drift. Objective, repeatable compliance.
The same core engine runs under both adapters.
Write a .designlatch.json config listing selectors, rules, and expected token values - your compliance spec.
CLI uses Playwright to open your live site and record computed CSS. MCP receives snapshots as inline JSON from the agent.
The engine diffs expected vs actual, scores compliance, and returns an HTML report (CLI) or structured JSON (MCP).
New to this? Start with the CLI. Install it, run npx designlatch init, then follow the commands below step by step.
Three packages, one engine. Both adapters share the same core.
@designlatch/corePure engine - validation logic, token resolution, style comparison, scoring, report utilities. No I/O.
@designlatch/appShared workflows: validateInputs() and scanCompliance(). Both adapters call these.
Sibling packages. CLI adds Playwright + HTML. MCP adds a stdio JSON interface for AI agents.
init, collect, validate, scan, and serve.stdio server with three tools.compare_live_ui_to_figma, validate_inputs, and scan_compliance.The CLI is the right choice when you want to run compliance checks locally, collect real snapshots from a live site, and generate readable HTML reports.
npm install -D @designlatch/cli
npx designlatch helpHow to use the CLI: initialize your workspace, keep tokens/config on disk, collect snapshots from a live site, validate inputs, scan for compliance, then serve the HTML report for review.
Use init first when starting a new DesignLatch project. It scaffolds the baseline config plus the local designlatch/ folder structure so the rest of the CLI flow has predictable inputs.
npm install -D @designlatch/cli
npx designlatch initRun collect when you want DesignLatch to open the real product in Playwright and write fresh snapshots to disk. This is the moment where the CLI turns your running UI into measurable input data.
npx designlatch collect --config .designlatch.json --url https://app.example.com --out designlatch/snapshots.jsonUse validate as a fast sanity check. It verifies that the config is readable, the token map resolves, and the snapshots are shaped correctly before you spend time debugging scan output.
npx designlatch validate --config .designlatch.json --tokens designlatch/tokens.json --snapshots designlatch/snapshots.jsonUse scan for the actual comparison pass. It takes the expected tokens, the observed snapshots, and the config rules, then produces scored JSON and HTML output your team can review or gate in CI.
npx designlatch scan --config .designlatch.json --tokens designlatch/tokens.json --snapshots designlatch/snapshots.json --report-dir reportUse serve after scan when you want to inspect the generated report in the browser, share it locally, or quickly verify what actually failed without parsing raw JSON.
npx designlatch serve --report-dir reportThe MCP adapter is the right choice when an AI agent already has design data and live UI data in memory, or when you want the agent to orchestrate a comparison flow and return a structured summary instead of a manual terminal workflow.
claude mcp add --transport stdio designlatch npx -- -y @designlatch/mcp
How to use MCP: configure DesignLatch in an MCP-capable AI client, make sure Playwright MCP and Figma MCP are also available for the compare flow, let the agent gather live and design data, then call the DesignLatch tools to validate and scan.
Add the MCP server to your AI client and restart the agent session so the tools become visible.
Use Playwright MCP for computed styles and Figma MCP for the matching component or token values.
Call compare_live_ui_to_figma for the high-level flow, or use validate_inputs and scan_compliance directly when you already have raw JSON.
This tool is the agent-facing entrypoint when the task sounds like a natural comparison request. It checks prerequisites first, tells the agent what is missing, and once the live/Figma data is supplied it synthesizes the DesignLatch payloads internally and runs the scan.
blocked means Playwright MCP, Figma MCP, or Figma auth is missing. validated means the prerequisites are available but the agent still needs to gather liveCapture or figmaDesign. completed returns score, mismatches, and report paths. failed means validation or scan execution broke.Compare live site (google.com's) search bar UI with this Figma search bar component (Figma Link) using designlatch mcp.{
"request": "Compare google.com's search bar UI with this Figma search bar component",
"liveUrl": "https://google.com",
"selector": "textarea[name='q']",
"figmaFileOrUrl": "https://www.figma.com/file/abc123/search-bar",
"figmaNodeIdOrComponentName": "Search Bar",
"prerequisites": {
"playwrightMcpConfigured": true,
"figmaMcpConfigured": true,
"figmaAuthenticated": true
}
}Call validate_inputs when the agent has already assembled config, tokens, and optionally snapshots, and you want a fast structure check before a full compliance scan.
Validate these DesignLatch inputs first. If they pass, I will run scan_compliance next.
Return the validation result and tell me if any token references or snapshot shapes are wrong.Call scan_compliance when the agent already has the final payloads and wants the report immediately. This is the most direct path when Playwright/Figma orchestration happens outside DesignLatch.
Run DesignLatch scan_compliance with the validated config, tokens, and snapshots.
Return the pass/fail result, score, top mismatches, and report output paths.The CLI works with files on disk: a DesignLatch config, a token map, and captured snapshots. The workflow is explicit and repeatable, which makes it a strong fit for local development and CI.
The MCP tools work with inline JSON. In the high-level compare flow, the agent first gathers live and design data, then passes normalized payloads or prerequisite status into DesignLatch.
The CLI writes snapshots during collection and generates a JSON report plus an HTML report during scanning. That makes it ideal when a human still wants to inspect the final report visually.
The MCP tools return structured results to the agent. The compare flow also returns report paths so the agent can summarize the scan and point the user to the generated artifacts.