@logicsync/pixelprobe 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +198 -32
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -13,10 +13,10 @@ It works on any element — full page sections, individual cards, buttons, navba
13
13
  ## Install
14
14
 
15
15
  ```bash
16
- npm install -g pixelprobe
16
+ npm install -g @logicsync/pixelprobe
17
17
 
18
18
  # Or use directly with npx
19
- npx pixelprobe compare --help
19
+ npx @logicsync/pixelprobe compare --help
20
20
  ```
21
21
 
22
22
  Requires Node.js 18+. On first run, Playwright will download a Chromium binary (~110MB) if one isn't already installed. You can also install it manually:
@@ -53,23 +53,23 @@ pixelprobe compare \
53
53
 
54
54
  #### Options
55
55
 
56
- | Flag | Short | Description | Default |
57
- |------|-------|-------------|---------|
58
- | `--source` | `-s` | Source URL (the reference/original page) | required |
59
- | `--target` | `-t` | Target URL (your local build or new version) | required |
60
- | `--selector` | `-S` | CSS selector for the section on the source page | required |
61
- | `--target-selector` | `-T` | CSS selector on the target page (if different from source) | same as `--selector` |
62
- | `--index` | `-i` | Element index if selector matches multiple elements | `0` |
63
- | `--breakpoints` | `-b` | Comma-separated breakpoint names or `WIDTHxHEIGHT` | `mobile,tablet,desktop,desktop-lg` |
64
- | `--output` | `-o` | Output directory for reports | `./pixelprobe-output` |
65
- | `--format` | `-f` | Output format: `json`, `html`, or `both` | `both` |
66
- | `--threshold` | | Pixel comparison sensitivity (0-1, lower = stricter) | `0.1` |
67
- | `--wait` | `-w` | Wait N milliseconds after page load before capturing | `0` |
68
- | `--json` | | Output compact JSON to stdout (for piping to other tools) | `false` |
69
- | `--headed` | | Run browser in visible (non-headless) mode | `false` |
70
- | `--no-visual` | | Skip pixel-level visual comparison | `false` |
71
- | `--no-styles` | | Skip computed style comparison | `false` |
72
- | `--no-layout` | | Skip layout metrics comparison | `false` |
56
+ | Flag | Short | Description | Default |
57
+ | ------------------- | ----- | ---------------------------------------------------------- | ---------------------------------- |
58
+ | `--source` | `-s` | Source URL (the reference/original page) | required |
59
+ | `--target` | `-t` | Target URL (your local build or new version) | required |
60
+ | `--selector` | `-S` | CSS selector for the section on the source page | required |
61
+ | `--target-selector` | `-T` | CSS selector on the target page (if different from source) | same as `--selector` |
62
+ | `--index` | `-i` | Element index if selector matches multiple elements | `0` |
63
+ | `--breakpoints` | `-b` | Comma-separated breakpoint names or `WIDTHxHEIGHT` | `mobile,tablet,desktop,desktop-lg` |
64
+ | `--output` | `-o` | Output directory for reports | `./pixelprobe-output` |
65
+ | `--format` | `-f` | Output format: `json`, `html`, or `both` | `both` |
66
+ | `--threshold` | | Pixel comparison sensitivity (0-1, lower = stricter) | `0.1` |
67
+ | `--wait` | `-w` | Wait N milliseconds after page load before capturing | `0` |
68
+ | `--json` | | Output compact JSON to stdout (for piping to other tools) | `false` |
69
+ | `--headed` | | Run browser in visible (non-headless) mode | `false` |
70
+ | `--no-visual` | | Skip pixel-level visual comparison | `false` |
71
+ | `--no-styles` | | Skip computed style comparison | `false` |
72
+ | `--no-layout` | | Skip layout metrics comparison | `false` |
73
73
 
74
74
  ### `pixelprobe enumerate`
75
75
 
@@ -228,50 +228,216 @@ Compares the box model: bounding box dimensions, margin, padding, border widths,
228
228
 
229
229
  ## MCP Server (for AI Agents)
230
230
 
231
- `pixelprobe` includes an MCP (Model Context Protocol) server so AI agents can use it as a tool.
231
+ `pixelprobe` includes an [MCP](https://modelcontextprotocol.io) (Model Context Protocol) server, allowing AI coding agents to compare web sections as part of their workflow — for example, verifying that a rebuilt component matches the original design without manual checking.
232
+
233
+ ### Finding the server path
234
+
235
+ All the setup examples below require the path to `dist/mcp/server.js`. How you find it depends on how you installed pixelprobe:
236
+
237
+ **Global install** (`npm install -g @logicsync/pixelprobe`):
238
+
239
+ ```bash
240
+ # Find the server path on your system
241
+ node -e "console.log(require.resolve('@logicsync/pixelprobe/dist/mcp/server.js'))"
242
+ ```
243
+
244
+ Typical locations:
245
+
246
+ | Setup | Path |
247
+ |-------|------|
248
+ | Default (macOS/Linux) | `/usr/local/lib/node_modules/@logicsync/pixelprobe/dist/mcp/server.js` |
249
+ | nvm | `~/.nvm/versions/node/vX.X.X/lib/node_modules/@logicsync/pixelprobe/dist/mcp/server.js` |
250
+ | Homebrew (macOS) | `/opt/homebrew/lib/node_modules/@logicsync/pixelprobe/dist/mcp/server.js` |
251
+ | Windows | `%APPDATA%\npm\node_modules\@logicsync\pixelprobe\dist\mcp\server.js` |
252
+
253
+ **Local/cloned repo**: run `npm run build` first, then use `./dist/mcp/server.js` from the project root.
254
+
255
+ > In the examples below, replace `<SERVER_PATH>` with your resolved path.
232
256
 
233
257
  ### Setup
234
258
 
235
- Add to your Claude Desktop or Claude Code MCP config:
259
+ <details>
260
+ <summary><strong>Claude Code</strong></summary>
261
+
262
+ ```bash
263
+ claude mcp add pixelprobe node <SERVER_PATH>
264
+ ```
265
+
266
+ Or add it to your project's `.mcp.json`:
236
267
 
237
268
  ```json
238
269
  {
239
270
  "mcpServers": {
240
271
  "pixelprobe": {
241
272
  "command": "node",
242
- "args": ["/path/to/pixelprobe/dist/mcp/server.js"]
273
+ "args": ["<SERVER_PATH>"]
243
274
  }
244
275
  }
245
276
  }
246
277
  ```
247
278
 
279
+ </details>
280
+
281
+ <details>
282
+ <summary><strong>Claude Desktop</strong></summary>
283
+
284
+ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
285
+
286
+ ```json
287
+ {
288
+ "mcpServers": {
289
+ "pixelprobe": {
290
+ "command": "node",
291
+ "args": ["<SERVER_PATH>"]
292
+ }
293
+ }
294
+ }
295
+ ```
296
+
297
+ </details>
298
+
299
+ <details>
300
+ <summary><strong>Cursor</strong></summary>
301
+
302
+ Add to your Cursor MCP config (`.cursor/mcp.json` in your project root):
303
+
304
+ ```json
305
+ {
306
+ "mcpServers": {
307
+ "pixelprobe": {
308
+ "command": "node",
309
+ "args": ["<SERVER_PATH>"]
310
+ }
311
+ }
312
+ }
313
+ ```
314
+
315
+ </details>
316
+
317
+ <details>
318
+ <summary><strong>Windsurf</strong></summary>
319
+
320
+ Add to your Windsurf MCP config (`~/.codeium/windsurf/mcp_config.json`):
321
+
322
+ ```json
323
+ {
324
+ "mcpServers": {
325
+ "pixelprobe": {
326
+ "command": "node",
327
+ "args": ["<SERVER_PATH>"]
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ </details>
334
+
335
+ <details>
336
+ <summary><strong>OpenCode</strong></summary>
337
+
338
+ Add to your OpenCode config (`opencode.json` in your project root):
339
+
340
+ ```json
341
+ {
342
+ "mcp": {
343
+ "pixelprobe": {
344
+ "type": "stdio",
345
+ "command": "node",
346
+ "args": ["<SERVER_PATH>"]
347
+ }
348
+ }
349
+ }
350
+ ```
351
+
352
+ </details>
353
+
354
+ <details>
355
+ <summary><strong>OpenAI Codex CLI</strong></summary>
356
+
357
+ Add to your Codex MCP config (`~/.codex/config.json`):
358
+
359
+ ```json
360
+ {
361
+ "mcpServers": {
362
+ "pixelprobe": {
363
+ "command": "node",
364
+ "args": ["<SERVER_PATH>"]
365
+ }
366
+ }
367
+ }
368
+ ```
369
+
370
+ </details>
371
+
372
+ <details>
373
+ <summary><strong>Other MCP-compatible agents</strong></summary>
374
+
375
+ Any agent that supports the MCP stdio transport can use pixelprobe:
376
+
377
+ ```
378
+ node <SERVER_PATH>
379
+ ```
380
+
381
+ </details>
382
+
248
383
  ### MCP Tools
249
384
 
250
385
  #### `compare_sections`
251
386
 
252
- Full comparison across breakpoints. Accepts `sourceUrl`, `targetUrl`, `selector`, `targetSelector`, `breakpoints`, `pixelThreshold`, and other options. Returns structured JSON diff and saves HTML/JSON reports.
387
+ Full comparison across breakpoints. Returns structured JSON diff and saves HTML/JSON reports.
388
+
389
+ | Parameter | Type | Required | Description |
390
+ |-----------|------|----------|-------------|
391
+ | `sourceUrl` | string | yes | Source URL (the reference/original page) |
392
+ | `targetUrl` | string | yes | Target URL (your local build or new version) |
393
+ | `selector` | string | yes | CSS selector for the section (e.g. `.hero-section`, `#pricing`) |
394
+ | `targetSelector` | string | no | CSS selector on the target page, if different from source |
395
+ | `elementIndex` | number | no | Element index if selector matches multiple elements (default: 0) |
396
+ | `breakpoints` | string[] | no | Breakpoint names or `WIDTHxHEIGHT` values (default: mobile, tablet, desktop, desktop-lg) |
397
+ | `pixelThreshold` | number | no | Pixel comparison sensitivity, 0–1 where lower is stricter (default: 0.1) |
398
+ | `includeVisual` | boolean | no | Include pixel-level visual comparison (default: true) |
399
+ | `includeStyles` | boolean | no | Include computed style comparison (default: true) |
400
+ | `includeLayout` | boolean | no | Include layout metrics comparison (default: true) |
401
+ | `waitForTimeout` | number | no | Wait N ms after page load before capturing (default: 0) |
402
+ | `outputDir` | string | no | Directory to save report artifacts (default: `./pixelprobe-output`) |
253
403
 
254
404
  #### `capture_section`
255
405
 
256
406
  Inspect and enumerate elements matching a selector on a page. Useful for discovering element structure before running a comparison.
257
407
 
408
+ | Parameter | Type | Required | Description |
409
+ |-----------|------|----------|-------------|
410
+ | `url` | string | yes | URL of the page to inspect |
411
+ | `selector` | string | yes | CSS selector for the section |
412
+ | `elementIndex` | number | no | Element index if selector matches multiple (default: 0) |
413
+ | `breakpoint` | string | no | Breakpoint to use (default: `desktop`) |
414
+
258
415
  #### `list_breakpoints`
259
416
 
260
- Returns all available breakpoint presets with their dimensions.
417
+ Returns all available breakpoint presets with their dimensions. Takes no parameters.
418
+
419
+ ### Example agent workflow
420
+
421
+ A typical AI agent workflow using pixelprobe:
422
+
423
+ 1. **Discover elements** — call `capture_section` with a selector to see what elements exist on the page and their dimensions
424
+ 2. **Run comparison** — call `compare_sections` with the source and target URLs to get a full diff
425
+ 3. **Read results** — parse the returned JSON summary to identify which breakpoints have issues and what the severity is
426
+ 4. **Fix and re-check** — make code changes, then call `compare_sections` again to verify the fix
261
427
 
262
428
  ## Programmatic API
263
429
 
264
430
  ```typescript
265
- import { WebSectionComparator } from 'pixelprobe';
431
+ import { WebSectionComparator } from "pixelprobe";
266
432
 
267
433
  const comparator = new WebSectionComparator({ headless: true });
268
434
 
269
435
  const result = await comparator.compare({
270
- sourceUrl: 'https://example.com',
271
- targetUrl: 'http://localhost:3000',
272
- selector: '.hero-section',
273
- targetSelector: '.hero', // optional, if target uses different markup
274
- breakpoints: ['mobile', 'tablet', 'desktop'],
436
+ sourceUrl: "https://example.com",
437
+ targetUrl: "http://localhost:3000",
438
+ selector: ".hero-section",
439
+ targetSelector: ".hero", // optional, if target uses different markup
440
+ breakpoints: ["mobile", "tablet", "desktop"],
275
441
  pixelThreshold: 0.1,
276
442
  });
277
443
 
@@ -287,7 +453,7 @@ console.log(result.summary);
287
453
  // }
288
454
 
289
455
  // Enumerate elements before comparing
290
- const elements = await comparator.enumerate('https://example.com', '.card');
456
+ const elements = await comparator.enumerate("https://example.com", ".card");
291
457
  // [{ index: 0, tagName: 'div', textPreview: '...', boundingBox: {...} }, ...]
292
458
  ```
293
459
 
@@ -307,7 +473,7 @@ Contributions are welcome! Here's how to get started:
307
473
  ### Setup
308
474
 
309
475
  ```bash
310
- git clone https://github.com/user/pixelprobe.git
476
+ git clone https://github.com/LogicSync/pixelprobe.git
311
477
  cd pixelprobe
312
478
  npm install
313
479
  npx playwright install chromium
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logicsync/pixelprobe",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Responsive visual & style diff for web page sections — CLI + MCP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,9 +38,9 @@
38
38
  ],
39
39
  "repository": {
40
40
  "type": "git",
41
- "url": "git+https://github.com/user/pixelprobe.git"
41
+ "url": "git+https://github.com/LogicSync/pixelprobe.git"
42
42
  },
43
- "homepage": "https://github.com/user/pixelprobe#readme",
43
+ "homepage": "https://github.com/LogicSync/pixelprobe#readme",
44
44
  "author": {
45
45
  "name": "Hari",
46
46
  "url": "https://github.com/hari-ls"