- Startseite
- Plugins
- Vision, Sprache & Multimodal
- dsh-pixel-lint
dsh-pixel-lint
maxisoft-git/dsh-pixel-lint
Compares a design screenshot with the built page, capturing the page in headless Chrome when no screenshot is given, and reports the pixel difference, the failing checks and a pass or fail verdict, using a separately installed pixel-validator. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Installation
dsh plugin --profile web add github:maxisoft-git/dsh-pixel-lintREADME
Pixel lint
A numeric gate between a design screenshot and the built page. It adds the pixel_validate tool, the /pixels command and a tab titled «Пиксели» in the right sidebar. The tool compares a reference image with an implementation — an existing screenshot or a capture of a URL taken with headless Chrome — and returns a verdict against a strictness profile: per-pixel difference, per-section difference, colour ΔE at sample points, and the text and spacing drift you measured yourself. It does not edit the page or the design, does not judge how the page looks, and does not ship the comparison scripts: they are a separate local install.
What it adds
| Row | Effect |
|---|---|
Tool pixel_validate | Compares reference with implementation or with a capture of url + viewport; optional target to compare one element or rectangle, fit for differing image sizes, JSON files for section, colour, text and spacing checks. Returns a compact PASS/FAIL summary, the failing rows and the report path. |
Command /pixels | Repeats the last run of this workspace without a model turn, or runs /pixels <ref> <impl> [profile]. The command-menu entry opens the tab. |
| Right-sidebar tab «Пиксели» | One tab type (pixel-lint): verdict badge, profile and image size, the global diff, per-group pass counts and worst drift, the failing checks, the fit warning, the reference and implementation paths and the report path, with an «Обновить» button. |
Host route GET /api/pixel-lint/last | The JSON the tab renders — the same report the tool returned. Accepts ?sid=<sessionId>, or ?dir=<path> that must stay inside the session workspace; the route answers only a loopback peer with a loopback Host and a same-origin Origin on writes. |
Install
DSH 0.2.2-rc.1 or newer.
In DSH. Plugins → Add plugin with the installation spec github:maxisoft-git/dsh-pixel-lint. The
plugin manager installs it for the whole profile; a new session picks it up.
From a checkout. git clone https://github.com/maxisoft-git/dsh-pixel-lint.git, then install that
absolute directory with Plugins → Add plugin.
Use
- Put the design export in the workspace, at the size it will be compared at, for example
design/home.pngat 390×844. - Ask the agent to compare, or call the tool yourself:
pixel_validate { "reference": "design/home.png", "capture": { "url": "http://localhost:5173", "width": 390, "height": 844 }, "profile": "strict" }
pixel_validate { "reference": "design/home.png", "implementation": "build/home.png" }
pixel_validate { "reference": "design/home.png", "capture": { "url": "http://localhost:5173", "width": 390, "height": 844 }, "target": { "selector": ".card" }, "fit": true }
- Or, without a model turn:
/pixels design/home.png build/home.png strict
/pixels
Bare /pixels reads the arguments of the last run from .dsh/pixel-lint/last-args.json and repeats it.
- Read the result in the chat or in the right sidebar: open the tab from the sidebar's add control, or pick
/pixelsin the command menu. The tab and the tool read the same JSON, so they cannot disagree.
The tool compares the whole image unless a target names a region. target.selector and target.text are measured in the live page over the Chrome DevTools Protocol and require capture.url; target.rect works with two ready images; target.pad grows the box without leaving the image. The chosen rectangle is cut out of both images, so the numbers describe that region alone.
The four profiles and their thresholds, which come from the validator install and are recorded in every report:
| Profile | Global | Section | Text | Spacing | Colour |
|---|---|---|---|---|---|
lenient | 3.5 % | 2.5 % | 3 px | 2 px | ΔE 4 |
portable | 1.5 % | 1.0 % | 2 px | 1 px | ΔE 2.5 |
strict (default) | 0.8 % | 0.5 % | 1 px | 1 px | ΔE 1.5 |
ultra | 0.4 % | 0.25 % | 0.5 px | 0.5 px | ΔE 1.0 |
Facts about a run: reference and implementation must be .png, .jpg, .jpeg or .webp files up to 64 MB, and the check JSON files must live inside the workspace; the implementation is captured at device pixel ratio 1, so 390 CSS px stay 390 px; image sizes must match, and a mismatch is an error unless fit is set — then the smaller image is padded with white, the larger is cropped from the top-left, and the result says which happened; sections, colors, text and spacing are JSON files of extra checks; for text and spacing the plugin only compares the drift between the two numbers you measured.
Configuration
The plugin has no keys in its plugin row. The environment variables are read from the DSH process:
| Key | Default | Meaning | Where it is stored |
|---|---|---|---|
PIXEL_VALIDATOR_HOME | ~/.local/share/pixel-validator | Directory holding validate-visual.sh and summarize-validation.sh | Environment of the DSH process |
DSH_PIXEL_LINT_CHROME | — (unset; the first existing candidate path is used) | Chrome or Chromium binary for capture; when set it is tried before the candidates | Environment of the DSH process |
DSH_PIXEL_LINT_VALIDATOR_SHA256 | — (unset) | Optional pin: comma-separated sha256 of validate-visual.sh and summarize-validation.sh; a mismatch refuses the run | Environment of the DSH process |
profile | strict | Strictness profile of one run | The tool call or the /pixels argument |
capture.dpr | 1 | Device pixel ratio of a capture | The tool call |
The candidate paths, in order: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome, /Applications/Chromium.app/Contents/MacOS/Chromium, /usr/bin/google-chrome, /usr/bin/chromium, /usr/bin/chromium-browser. capture has no chrome field — the model cannot choose the binary; a non-standard installation is selected with DSH_PIXEL_LINT_CHROME.
Data and network
The plugin sends no image and no report anywhere; the only network traffic is the page load of the capture.url you gave. It is opened by the local Chrome: an http(s):// URL without embedded credentials, or a local .html/.htm file inside the workspace. Any other form — a file:// URL outside the workspace, data:, chrome: — is rejected before the browser starts. A page that loads remote resources makes the browser request them.
The comparison runs on this machine: ImageMagick (magick) and the scripts at PIXEL_VALIDATOR_HOME. Chrome is started only for a capture, with a throwaway profile directory in the system temp folder that is removed afterwards, so it never sees your cookies, extensions or history; measuring a target by selector or text starts the same kind of throwaway browser.
Files written on disk, all under <workspace>/.dsh/pixel-lint/:
| File | When |
|---|---|
report.json | every run — the full validator report |
last.json | every run — what the tab renders |
last-args.json | every run — what bare /pixels repeats |
implementation.png | a run with capture |
implementation-full.png | a run with capture and a target measured in the page |
target-reference.png, target-implementation.png | a run with a target |
report.json.aligned.png | a run with fit on images of different sizes |
.gitignore | written with the first run; it contains *, so nothing in the folder is committed |
Turning it off: disable the plugin, which removes the tool, the command, the tab and the route. The artifacts stay until you delete .dsh/pixel-lint/.
Security
SECURITY.md — how to report a vulnerability and which versions are supported.
SECURITY-AUDIT.md — the per-plugin audit: data flow, permissions, findings and their fixes.
The route answers loopback sockets only, rejects a foreign Origin, takes no request body, and reads a report only from the workspace whose directory it resolved. The plugin never sends the images anywhere and never returns the full report JSON to the model — only the compact summary and paths.
Requirements
- DeepSeek Harness 0.2.2-rc.1 or newer.
- Node.js 22.19.0 or newer, as declared in
engines. - ImageMagick with the
magickcommand:brew install imagemagickon macOS, the distribution package elsewhere. - The
pixel-validatorscripts in~/.local/share/pixel-validator, or whereverPIXEL_VALIDATOR_HOMEpoints. They are not vendored here: they come fromjasny/perfect-agent, which carries no license, so the package only runs them. - Chrome or Chromium for
capture; not needed whenimplementationis an existing image. The candidate paths above are macOS and Linux paths. - macOS or Linux.
Development
npm testrunsnode scripts/smoke.mjs: a real Chrome capture, the capture-boundary refusals, a deterministic identical run, a drifted run that must failstrict, the size-mismatch refusal,fitand the workspace store. On a machine without Chrome or without the validator scripts it still runs the capture-boundary refusals and skips the rest, which is what CI does.node scripts/smoke-host.mjsandnode scripts/smoke-target.mjscover the mounted plugin — tool, refusals,/pixels, the route — and thetargetgeometry; they are run directly, not bynpm test.npm run verifychecks the manifest, the patch file, the three locale files and the required README, LICENSE, CHANGELOG, SECURITY and SECURITY-AUDIT files.- Local link install: Plugins → Add plugin with the absolute path of the checkout. No build step.
- Layout:
index.js(Host: route, tool,/pixels),client.js(Browser: the tab),lib/validator.mjs(validator and Chrome capture),lib/cdp.mjs(DevTools Protocol driver for measuring an element),lib/target.mjs(target validation and cropping),lib/report.mjs(report shaping and the workspace store),cordis.patch.yml,locale/,scripts/.
License
MIT © 2026 maxisoft-git
Ähnliche Plugins
dsh-web-ui (dsh-tool-describe-image)
zhu1090093659/dsh-web-ui
modlens
liustack/modlens
ipollowork
devin-axis/ipollowork
dsh-image-gen
shanliuling/dsh-image-gen