devlens-mcp 0.3.3 → 0.4.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.
- package/README.md +48 -38
- package/RELEASE_NOTES.md +253 -0
- package/dist/bin/cli.js +2 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/figma/figma-properties.d.ts +88 -0
- package/dist/src/figma/figma-properties.d.ts.map +1 -0
- package/dist/src/figma/figma-properties.js +121 -0
- package/dist/src/figma/figma-properties.js.map +1 -0
- package/dist/src/figma/figma-structure.d.ts +43 -0
- package/dist/src/figma/figma-structure.d.ts.map +1 -0
- package/dist/src/figma/figma-structure.js +74 -0
- package/dist/src/figma/figma-structure.js.map +1 -0
- package/dist/src/figma/figma-url.d.ts +37 -0
- package/dist/src/figma/figma-url.d.ts.map +1 -0
- package/dist/src/figma/figma-url.js +68 -0
- package/dist/src/figma/figma-url.js.map +1 -0
- package/dist/src/jds-tokens/resolve-token.d.ts +2 -0
- package/dist/src/jds-tokens/resolve-token.d.ts.map +1 -0
- package/dist/src/jds-tokens/resolve-token.js +24 -0
- package/dist/src/jds-tokens/resolve-token.js.map +1 -0
- package/dist/src/jds-tokens/tokens.d.ts +2 -0
- package/dist/src/jds-tokens/tokens.d.ts.map +1 -0
- package/dist/src/jds-tokens/tokens.js +12 -0
- package/dist/src/jds-tokens/tokens.js.map +1 -0
- package/dist/src/platform/ios/ios-device.d.ts +2 -0
- package/dist/src/platform/ios/ios-device.d.ts.map +1 -1
- package/dist/src/platform/ios/ios-device.js +18 -8
- package/dist/src/platform/ios/ios-device.js.map +1 -1
- package/dist/src/platform/ios/scale-resolver.d.ts +29 -0
- package/dist/src/platform/ios/scale-resolver.d.ts.map +1 -0
- package/dist/src/platform/ios/scale-resolver.js +114 -0
- package/dist/src/platform/ios/scale-resolver.js.map +1 -0
- package/dist/src/platform/ios/simctl.d.ts +5 -0
- package/dist/src/platform/ios/simctl.d.ts.map +1 -1
- package/dist/src/platform/ios/simctl.js +4 -0
- package/dist/src/platform/ios/simctl.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +9 -1
- package/dist/src/server.js.map +1 -1
- package/dist/src/setup/config-patcher.d.ts +2 -0
- package/dist/src/setup/config-patcher.d.ts.map +1 -0
- package/dist/src/setup/config-patcher.js +128 -0
- package/dist/src/setup/config-patcher.js.map +1 -0
- package/dist/src/setup/shell-detector.d.ts +10 -0
- package/dist/src/setup/shell-detector.d.ts.map +1 -0
- package/dist/src/setup/shell-detector.js +72 -0
- package/dist/src/setup/shell-detector.js.map +1 -0
- package/dist/src/snapshot/device-properties.d.ts +53 -0
- package/dist/src/snapshot/device-properties.d.ts.map +1 -0
- package/dist/src/snapshot/device-properties.js +94 -0
- package/dist/src/snapshot/device-properties.js.map +1 -0
- package/dist/src/snapshot/formatter.d.ts +13 -5
- package/dist/src/snapshot/formatter.d.ts.map +1 -1
- package/dist/src/snapshot/formatter.js +28 -19
- package/dist/src/snapshot/formatter.js.map +1 -1
- package/dist/src/snapshot/layout-inference.d.ts +44 -0
- package/dist/src/snapshot/layout-inference.d.ts.map +1 -0
- package/dist/src/snapshot/layout-inference.js +138 -0
- package/dist/src/snapshot/layout-inference.js.map +1 -0
- package/dist/src/tools/analyze-tools.d.ts +60 -0
- package/dist/src/tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/tools/analyze-tools.js +196 -0
- package/dist/src/tools/analyze-tools.js.map +1 -0
- package/dist/src/tools/interaction-tools.d.ts +6 -6
- package/dist/src/tools/interaction-tools.d.ts.map +1 -1
- package/dist/src/tools/interaction-tools.js +12 -2
- package/dist/src/tools/interaction-tools.js.map +1 -1
- package/dist/src/tools/metro-tools.d.ts +2 -2
- package/dist/src/tools/navigation-tools.d.ts.map +1 -1
- package/dist/src/tools/navigation-tools.js +6 -1
- package/dist/src/tools/navigation-tools.js.map +1 -1
- package/dist/src/tools/screenshot-tools.d.ts +75 -0
- package/dist/src/tools/screenshot-tools.d.ts.map +1 -1
- package/dist/src/tools/screenshot-tools.js +238 -8
- package/dist/src/tools/screenshot-tools.js.map +1 -1
- package/dist/src/tools/snapshot-tools.d.ts +15 -0
- package/dist/src/tools/snapshot-tools.d.ts.map +1 -1
- package/dist/src/tools/snapshot-tools.js +32 -1
- package/dist/src/tools/snapshot-tools.js.map +1 -1
- package/dist/src/tools/vqa-tools.d.ts +62 -0
- package/dist/src/tools/vqa-tools.d.ts.map +1 -0
- package/dist/src/tools/vqa-tools.js +204 -0
- package/dist/src/tools/vqa-tools.js.map +1 -0
- package/dist/src/utils/image-preprocess.d.ts +1 -1
- package/dist/src/utils/image-preprocess.d.ts.map +1 -1
- package/dist/src/utils/image-preprocess.js +79 -0
- package/dist/src/utils/image-preprocess.js.map +1 -1
- package/dist/src/visual/color-extractor.d.ts +37 -0
- package/dist/src/visual/color-extractor.d.ts.map +1 -0
- package/dist/src/visual/color-extractor.js +116 -0
- package/dist/src/visual/color-extractor.js.map +1 -0
- package/dist/src/visual/comparator.d.ts +21 -0
- package/dist/src/visual/comparator.d.ts.map +1 -1
- package/dist/src/visual/comparator.js +110 -13
- package/dist/src/visual/comparator.js.map +1 -1
- package/dist/src/visual/layout-analyzer.d.ts.map +1 -1
- package/dist/src/visual/layout-analyzer.js +17 -7
- package/dist/src/visual/layout-analyzer.js.map +1 -1
- package/dist/src/visual/node-matcher.d.ts +43 -0
- package/dist/src/visual/node-matcher.d.ts.map +1 -0
- package/dist/src/visual/node-matcher.js +190 -0
- package/dist/src/visual/node-matcher.js.map +1 -0
- package/dist/src/visual/property-comparator.d.ts +49 -0
- package/dist/src/visual/property-comparator.d.ts.map +1 -0
- package/dist/src/visual/property-comparator.js +246 -0
- package/dist/src/visual/property-comparator.js.map +1 -0
- package/dist/src/visual/structural-comparator.d.ts +46 -0
- package/dist/src/visual/structural-comparator.d.ts.map +1 -0
- package/dist/src/visual/structural-comparator.js +293 -0
- package/dist/src/visual/structural-comparator.js.map +1 -0
- package/dist/src/visual/vqa-analyzer.d.ts +30 -0
- package/dist/src/visual/vqa-analyzer.d.ts.map +1 -0
- package/dist/src/visual/vqa-analyzer.js +271 -0
- package/dist/src/visual/vqa-analyzer.js.map +1 -0
- package/docs/figma-workflow.md +210 -40
- package/docs/setup-guide.md +104 -40
- package/docs/tool-reference.md +137 -11
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/INSTALLATION_GUIDE.md +0 -3
- package/QUICK_START.md +0 -3
package/docs/tool-reference.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DevLens Tool Reference
|
|
2
2
|
|
|
3
|
-
Complete reference for all **
|
|
3
|
+
Complete reference for all **37** DevLens MCP tools, organized by category.
|
|
4
4
|
|
|
5
5
|
> **Tip:** Use `devlens_metro_status` at the start of every session to verify Metro is healthy before invoking Metro-dependent tools.
|
|
6
6
|
|
|
@@ -100,6 +100,8 @@ List all installed third-party apps.
|
|
|
100
100
|
|-------|------|----------|-------------|
|
|
101
101
|
| `mode` | "full" \| "incremental" | No | "full" (default) returns entire tree. "incremental" returns only changes since last snapshot. |
|
|
102
102
|
| `validate` | boolean | No | When `true`, appends a **Validation Report** that flags zero-size elements, invisible nodes, and empty containers. Default: `false`. |
|
|
103
|
+
| `scope` | "screen" \| "component" | No | "screen" (default) captures full tree. "component" captures only the subtree of `componentRef`. |
|
|
104
|
+
| `componentRef` | string | No | Element ref to scope to (e.g., `"e5"`). Only used when `scope: "component"`. Reduces token usage for targeted checks. |
|
|
103
105
|
|
|
104
106
|
**Example response:**
|
|
105
107
|
```
|
|
@@ -434,6 +436,10 @@ Returns similarity score, diff pixel count, and diff image (same format as `devl
|
|
|
434
436
|
| `resizeStrategy` | "fit" \| "scale" \| "crop" | No | Dimension mismatch handling (default: "fit") |
|
|
435
437
|
| `cropRef` | string | No | Crop device screenshot to element bounds |
|
|
436
438
|
| `region` | {x, y, width, height} | No | Crop device screenshot to pixel region |
|
|
439
|
+
| `layoutReport` | boolean | No | Run per-element layout analysis (default: `true`). Requires `devlens_snapshot` first. |
|
|
440
|
+
| `depth` | "quick" \| "standard" \| "thorough" | No | `"quick"`: skip layout report, loose threshold. `"standard"` (default): normal behavior. `"thorough"`: per-element analysis + property summary. |
|
|
441
|
+
| `excludeSystemBars` | "auto" \| "ios" \| "android" \| "none" | No | Exclude status/nav bar from comparison (default: `"auto"`). |
|
|
442
|
+
| `preprocessReference` | boolean | No | Remove Figma artifacts — rounded corners, backgrounds (default: `true`). |
|
|
437
443
|
|
|
438
444
|
> Provide either `figmaUrl`, or both `fileKey` and `nodeId`.
|
|
439
445
|
|
|
@@ -448,6 +454,54 @@ devlens_compare_with_figma(
|
|
|
448
454
|
|
|
449
455
|
---
|
|
450
456
|
|
|
457
|
+
### devlens_compare_properties
|
|
458
|
+
**Per-component property comparison.** Compares ALL measurable design properties (text sizes, colors, spacing, dimensions, layout direction, padding) between a Figma design and the live device. Returns per-component mismatches with exact expected vs actual values.
|
|
459
|
+
|
|
460
|
+
More detailed than pixel comparison — use after `devlens_compare_with_figma` to catch every property difference. Requires `devlens_snapshot` to have been called first.
|
|
461
|
+
|
|
462
|
+
| Param | Type | Required | Description |
|
|
463
|
+
|-------|------|----------|-------------|
|
|
464
|
+
| `figmaUrl` | string | No | Full Figma URL |
|
|
465
|
+
| `fileKey` | string | No | Figma file key (alternative to figmaUrl) |
|
|
466
|
+
| `nodeId` | string | No | Figma node ID (use with fileKey) |
|
|
467
|
+
| `includeColors` | boolean | No | Extract and compare colors from screenshot (default: `true`) |
|
|
468
|
+
| `tolerances` | object | No | Override defaults: `{ dimensions: 2, fontSize: 0.2, color: 15, spacing: 2 }` |
|
|
469
|
+
|
|
470
|
+
**Properties compared per component:**
|
|
471
|
+
|
|
472
|
+
| Property | Source (Figma) | Source (Device) | Tolerance |
|
|
473
|
+
|----------|----------------|-----------------|-----------|
|
|
474
|
+
| Text content | `characters` | accessibility `text` | Exact |
|
|
475
|
+
| Width / Height | `absoluteBoundingBox` | accessibility `bounds` | ±2px |
|
|
476
|
+
| Font size | `style.fontSize` | height × 0.75 estimate | ±20% |
|
|
477
|
+
| Fill color | `fills[0].color` | screenshot sampling | ΔE ≤ 15 |
|
|
478
|
+
| Layout direction | `layoutMode` | inferred from children | Exact |
|
|
479
|
+
| Item spacing | `itemSpacing` | measured child gaps | ±2px |
|
|
480
|
+
| Padding | `padding*` | inferred from bounds | ±2px |
|
|
481
|
+
| Corner radius | `cornerRadius` | — | Info only |
|
|
482
|
+
| Opacity | `opacity` | — | Info only |
|
|
483
|
+
|
|
484
|
+
**Example output:**
|
|
485
|
+
```
|
|
486
|
+
=== COMPONENT PROPERTY COMPARISON ===
|
|
487
|
+
Compared: 47 properties | Match rate: 78% (37/47)
|
|
488
|
+
|
|
489
|
+
CRITICAL (2):
|
|
490
|
+
[e5] Screen > Header > Title
|
|
491
|
+
fontSize: expected 24px, actual ~33px
|
|
492
|
+
→ Adjust font size from ~33px to 24px
|
|
493
|
+
|
|
494
|
+
WARNING (3):
|
|
495
|
+
[e8] Screen > Body > Card
|
|
496
|
+
width: expected 358px, actual 390px
|
|
497
|
+
→ Adjust width from 390px to 358px
|
|
498
|
+
[e12] Screen > Footer > TabBar
|
|
499
|
+
itemSpacing: expected 0px, actual 12px
|
|
500
|
+
→ Adjust item spacing from 12px to 0px
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
451
505
|
## React Native / Metro (6)
|
|
452
506
|
|
|
453
507
|
### devlens_metro_status
|
|
@@ -583,6 +637,74 @@ On Android: presses system Back button. On iOS: performs back swipe.
|
|
|
583
637
|
|
|
584
638
|
---
|
|
585
639
|
|
|
640
|
+
## Analysis & VQA Tools
|
|
641
|
+
|
|
642
|
+
### devlens_analyze
|
|
643
|
+
Smart analysis tool with configurable depth. Respects scope of request — if a user asks for a minimal check, it performs minimal analysis.
|
|
644
|
+
|
|
645
|
+
| Param | Type | Required | Default | Description |
|
|
646
|
+
|-------|------|----------|---------|-------------|
|
|
647
|
+
| `scope` | `"minimal"` \| `"targeted"` \| `"full"` | No | `"full"` | `"minimal"`: quick pixel diff, no layout report. `"targeted"`: compare specific refs only. `"full"`: complete analysis. |
|
|
648
|
+
| `targetRefs` | string[] | No | — | Element refs to focus on (for `"targeted"` scope). E.g., `["e1", "e5"]`. |
|
|
649
|
+
| `referenceImagePath` | string | No | — | Path or URL to reference image. |
|
|
650
|
+
| `referenceImageBase64` | string | No | — | Base64-encoded reference image. |
|
|
651
|
+
| `figmaUrl` | string | No | — | Figma URL for reference. |
|
|
652
|
+
| `threshold` | number | No | `0.1` | Color difference threshold (0-1). |
|
|
653
|
+
|
|
654
|
+
**Scope behaviors:**
|
|
655
|
+
- **minimal**: Captures screenshot, runs quick pixel diff with perceptual mode and system bar exclusion. Skips layout report. Fast.
|
|
656
|
+
- **targeted**: Takes full snapshot but only inspects the specified refs. Returns bounds and properties for targeted elements.
|
|
657
|
+
- **full**: Complete snapshot + optional layout report + comparison with reference.
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
### devlens_vqa_validate
|
|
662
|
+
Run Visual Quality Assurance validation against a Figma design. Returns structured VQA report with issues and fix suggestions.
|
|
663
|
+
|
|
664
|
+
| Param | Type | Required | Default | Description |
|
|
665
|
+
|-------|------|----------|---------|-------------|
|
|
666
|
+
| `figmaUrl` | string | No | — | Full Figma URL (e.g., `"https://figma.com/design/ABC123/MyApp?node-id=10-200"`). |
|
|
667
|
+
| `fileKey` | string | No | — | Figma file key (use instead of figmaUrl). |
|
|
668
|
+
| `nodeId` | string | No | — | Figma node ID (e.g., `"10:200"`). |
|
|
669
|
+
| `scale` | number | No | `2` | Figma export scale. |
|
|
670
|
+
| `checkCategories` | string[] | No | `["spacing","color","alignment","sizing","missing"]` | VQA categories to check. Options: `spacing`, `color`, `typography`, `alignment`, `missing`, `extra`, `sizing`. |
|
|
671
|
+
| `enableAutoFix` | boolean | No | `true` | Generate fix suggestions for each issue. |
|
|
672
|
+
| `preprocessReference` | boolean | No | `true` | Remove Figma artifacts before comparison. |
|
|
673
|
+
|
|
674
|
+
**VQA Check Categories:**
|
|
675
|
+
- **spacing**: Verifies margins/paddings between adjacent elements match Figma specs
|
|
676
|
+
- **color**: Extracts dominant colors per region and compares with design reference
|
|
677
|
+
- **alignment**: Checks element center/edge alignment against Figma positions
|
|
678
|
+
- **sizing**: Verifies element dimensions match Figma within tolerance
|
|
679
|
+
- **missing**: Detects regions with very low visual match (possible missing content)
|
|
680
|
+
- **extra**: Detects extra elements on device not in Figma
|
|
681
|
+
- **typography**: Font size/weight checks via accessibility metadata
|
|
682
|
+
|
|
683
|
+
**VQA Report format:**
|
|
684
|
+
```
|
|
685
|
+
=== VQA Report: PASS/WARNING/FAIL ===
|
|
686
|
+
Overall Score: 94.2%
|
|
687
|
+
Issues: 3 (0 critical, 2 major, 1 minor)
|
|
688
|
+
|
|
689
|
+
--- Issues ---
|
|
690
|
+
1. [MAJOR] [spacing] Vertical gap between [e3] and [e5] differs from Figma.
|
|
691
|
+
Expected: 12px gap
|
|
692
|
+
Actual: 20px gap (8px off)
|
|
693
|
+
2. [MAJOR] [color] Color mismatch on [e7]: Significant color mismatch...
|
|
694
|
+
Expected: #1A73E8
|
|
695
|
+
Actual: #2196F3
|
|
696
|
+
3. [minor] [alignment] Element [e2] is misaligned from Figma position.
|
|
697
|
+
Expected: center (215, 120)
|
|
698
|
+
Actual: center (218, 122) — off by (3, 2)px
|
|
699
|
+
|
|
700
|
+
--- Suggested Fixes ---
|
|
701
|
+
1. [high] Adjust margin/padding on element [e3] to match Figma specs: 12px gap.
|
|
702
|
+
2. [high] Update color value for [e7]. Expected: #1A73E8. Check design token mapping.
|
|
703
|
+
3. [medium] Fix alignment of [e2]. Adjust flex alignment or positioning.
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
586
708
|
## Quick Reference Table
|
|
587
709
|
|
|
588
710
|
| # | Tool | Category | Key Params |
|
|
@@ -594,7 +716,7 @@ On Android: presses system Back button. On iOS: performs back swipe.
|
|
|
594
716
|
| 5 | `devlens_terminate_app` | App | appId |
|
|
595
717
|
| 6 | `devlens_install_app` | App | path |
|
|
596
718
|
| 7 | `devlens_list_apps` | App | — |
|
|
597
|
-
| 8 | `devlens_snapshot` | Snapshot | mode?, validate? |
|
|
719
|
+
| 8 | `devlens_snapshot` | Snapshot | mode?, validate?, scope?, componentRef? |
|
|
598
720
|
| 9 | `devlens_find_element` | Snapshot | text?, label?, type? |
|
|
599
721
|
| 10 | `devlens_wait_for_element` | Snapshot | text?, label?, timeout? |
|
|
600
722
|
| 11 | `devlens_wait_for_screen` | Snapshot | text?, label?, stableMs?, timeoutMs? |
|
|
@@ -611,12 +733,16 @@ On Android: presses system Back button. On iOS: performs back swipe.
|
|
|
611
733
|
| 22 | `devlens_compare_screenshot` | Visual | referenceImagePath?, referenceImageBase64?, cropRef?, region? |
|
|
612
734
|
| 23 | `devlens_element_screenshot` | Visual | ref, filename? |
|
|
613
735
|
| 24 | `devlens_compare_images` | Visual | imageA, imageB, threshold?, resizeStrategy? |
|
|
614
|
-
| 25 | `devlens_compare_with_figma` | Visual | figmaUrl?, fileKey?, nodeId?, cropRef?, region? |
|
|
615
|
-
| 26 | `
|
|
616
|
-
| 27 | `
|
|
617
|
-
| 28 | `
|
|
618
|
-
| 29 | `
|
|
619
|
-
| 30 | `
|
|
620
|
-
| 31 | `
|
|
621
|
-
| 32 | `
|
|
622
|
-
| 33 | `
|
|
736
|
+
| 25 | `devlens_compare_with_figma` | Visual | figmaUrl?, fileKey?, nodeId?, cropRef?, region?, depth?, excludeSystemBars? |
|
|
737
|
+
| 26 | `devlens_compare_properties` | Visual | figmaUrl?, fileKey?, nodeId?, includeColors?, tolerances? |
|
|
738
|
+
| 27 | `devlens_metro_status` | Metro | — |
|
|
739
|
+
| 28 | `devlens_metro_logs` | Metro | level?, since? |
|
|
740
|
+
| 29 | `devlens_component_tree` | Metro | depth? |
|
|
741
|
+
| 30 | `devlens_hot_reload` | Metro | — |
|
|
742
|
+
| 31 | `devlens_network_requests` | Metro | urlPattern? |
|
|
743
|
+
| 32 | `devlens_dismiss_overlays` | Metro | suppressLogBox?, pressBack? |
|
|
744
|
+
| 33 | `devlens_open_url` | Navigation | url |
|
|
745
|
+
| 34 | `devlens_go_back` | Navigation | — |
|
|
746
|
+
| 35 | `devlens_ds_context` | Design System | — |
|
|
747
|
+
| 36 | `devlens_analyze` | Analysis | scope, targetRefs?, referenceImagePath?, referenceImageBase64?, figmaUrl?, threshold? |
|
|
748
|
+
| 37 | `devlens_vqa_validate` | VQA | figmaUrl?, fileKey?, nodeId?, scale?, checkCategories?, enableAutoFix?, preprocessReference? |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devlens-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "DevLens — Playwright-style MCP server for mobile development. Take screenshots, compare with Figma designs, interact with iOS Simulators & Android Emulators, and access Metro bundler logs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/tsconfig.json
CHANGED
package/INSTALLATION_GUIDE.md
DELETED
package/QUICK_START.md
DELETED