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.
Files changed (121) hide show
  1. package/README.md +48 -38
  2. package/RELEASE_NOTES.md +253 -0
  3. package/dist/bin/cli.js +2 -0
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/src/figma/figma-properties.d.ts +88 -0
  6. package/dist/src/figma/figma-properties.d.ts.map +1 -0
  7. package/dist/src/figma/figma-properties.js +121 -0
  8. package/dist/src/figma/figma-properties.js.map +1 -0
  9. package/dist/src/figma/figma-structure.d.ts +43 -0
  10. package/dist/src/figma/figma-structure.d.ts.map +1 -0
  11. package/dist/src/figma/figma-structure.js +74 -0
  12. package/dist/src/figma/figma-structure.js.map +1 -0
  13. package/dist/src/figma/figma-url.d.ts +37 -0
  14. package/dist/src/figma/figma-url.d.ts.map +1 -0
  15. package/dist/src/figma/figma-url.js +68 -0
  16. package/dist/src/figma/figma-url.js.map +1 -0
  17. package/dist/src/jds-tokens/resolve-token.d.ts +2 -0
  18. package/dist/src/jds-tokens/resolve-token.d.ts.map +1 -0
  19. package/dist/src/jds-tokens/resolve-token.js +24 -0
  20. package/dist/src/jds-tokens/resolve-token.js.map +1 -0
  21. package/dist/src/jds-tokens/tokens.d.ts +2 -0
  22. package/dist/src/jds-tokens/tokens.d.ts.map +1 -0
  23. package/dist/src/jds-tokens/tokens.js +12 -0
  24. package/dist/src/jds-tokens/tokens.js.map +1 -0
  25. package/dist/src/platform/ios/ios-device.d.ts +2 -0
  26. package/dist/src/platform/ios/ios-device.d.ts.map +1 -1
  27. package/dist/src/platform/ios/ios-device.js +18 -8
  28. package/dist/src/platform/ios/ios-device.js.map +1 -1
  29. package/dist/src/platform/ios/scale-resolver.d.ts +29 -0
  30. package/dist/src/platform/ios/scale-resolver.d.ts.map +1 -0
  31. package/dist/src/platform/ios/scale-resolver.js +114 -0
  32. package/dist/src/platform/ios/scale-resolver.js.map +1 -0
  33. package/dist/src/platform/ios/simctl.d.ts +5 -0
  34. package/dist/src/platform/ios/simctl.d.ts.map +1 -1
  35. package/dist/src/platform/ios/simctl.js +4 -0
  36. package/dist/src/platform/ios/simctl.js.map +1 -1
  37. package/dist/src/server.d.ts.map +1 -1
  38. package/dist/src/server.js +9 -1
  39. package/dist/src/server.js.map +1 -1
  40. package/dist/src/setup/config-patcher.d.ts +2 -0
  41. package/dist/src/setup/config-patcher.d.ts.map +1 -0
  42. package/dist/src/setup/config-patcher.js +128 -0
  43. package/dist/src/setup/config-patcher.js.map +1 -0
  44. package/dist/src/setup/shell-detector.d.ts +10 -0
  45. package/dist/src/setup/shell-detector.d.ts.map +1 -0
  46. package/dist/src/setup/shell-detector.js +72 -0
  47. package/dist/src/setup/shell-detector.js.map +1 -0
  48. package/dist/src/snapshot/device-properties.d.ts +53 -0
  49. package/dist/src/snapshot/device-properties.d.ts.map +1 -0
  50. package/dist/src/snapshot/device-properties.js +94 -0
  51. package/dist/src/snapshot/device-properties.js.map +1 -0
  52. package/dist/src/snapshot/formatter.d.ts +13 -5
  53. package/dist/src/snapshot/formatter.d.ts.map +1 -1
  54. package/dist/src/snapshot/formatter.js +28 -19
  55. package/dist/src/snapshot/formatter.js.map +1 -1
  56. package/dist/src/snapshot/layout-inference.d.ts +44 -0
  57. package/dist/src/snapshot/layout-inference.d.ts.map +1 -0
  58. package/dist/src/snapshot/layout-inference.js +138 -0
  59. package/dist/src/snapshot/layout-inference.js.map +1 -0
  60. package/dist/src/tools/analyze-tools.d.ts +60 -0
  61. package/dist/src/tools/analyze-tools.d.ts.map +1 -0
  62. package/dist/src/tools/analyze-tools.js +196 -0
  63. package/dist/src/tools/analyze-tools.js.map +1 -0
  64. package/dist/src/tools/interaction-tools.d.ts +6 -6
  65. package/dist/src/tools/interaction-tools.d.ts.map +1 -1
  66. package/dist/src/tools/interaction-tools.js +12 -2
  67. package/dist/src/tools/interaction-tools.js.map +1 -1
  68. package/dist/src/tools/metro-tools.d.ts +2 -2
  69. package/dist/src/tools/navigation-tools.d.ts.map +1 -1
  70. package/dist/src/tools/navigation-tools.js +6 -1
  71. package/dist/src/tools/navigation-tools.js.map +1 -1
  72. package/dist/src/tools/screenshot-tools.d.ts +75 -0
  73. package/dist/src/tools/screenshot-tools.d.ts.map +1 -1
  74. package/dist/src/tools/screenshot-tools.js +238 -8
  75. package/dist/src/tools/screenshot-tools.js.map +1 -1
  76. package/dist/src/tools/snapshot-tools.d.ts +15 -0
  77. package/dist/src/tools/snapshot-tools.d.ts.map +1 -1
  78. package/dist/src/tools/snapshot-tools.js +32 -1
  79. package/dist/src/tools/snapshot-tools.js.map +1 -1
  80. package/dist/src/tools/vqa-tools.d.ts +62 -0
  81. package/dist/src/tools/vqa-tools.d.ts.map +1 -0
  82. package/dist/src/tools/vqa-tools.js +204 -0
  83. package/dist/src/tools/vqa-tools.js.map +1 -0
  84. package/dist/src/utils/image-preprocess.d.ts +1 -1
  85. package/dist/src/utils/image-preprocess.d.ts.map +1 -1
  86. package/dist/src/utils/image-preprocess.js +79 -0
  87. package/dist/src/utils/image-preprocess.js.map +1 -1
  88. package/dist/src/visual/color-extractor.d.ts +37 -0
  89. package/dist/src/visual/color-extractor.d.ts.map +1 -0
  90. package/dist/src/visual/color-extractor.js +116 -0
  91. package/dist/src/visual/color-extractor.js.map +1 -0
  92. package/dist/src/visual/comparator.d.ts +21 -0
  93. package/dist/src/visual/comparator.d.ts.map +1 -1
  94. package/dist/src/visual/comparator.js +110 -13
  95. package/dist/src/visual/comparator.js.map +1 -1
  96. package/dist/src/visual/layout-analyzer.d.ts.map +1 -1
  97. package/dist/src/visual/layout-analyzer.js +17 -7
  98. package/dist/src/visual/layout-analyzer.js.map +1 -1
  99. package/dist/src/visual/node-matcher.d.ts +43 -0
  100. package/dist/src/visual/node-matcher.d.ts.map +1 -0
  101. package/dist/src/visual/node-matcher.js +190 -0
  102. package/dist/src/visual/node-matcher.js.map +1 -0
  103. package/dist/src/visual/property-comparator.d.ts +49 -0
  104. package/dist/src/visual/property-comparator.d.ts.map +1 -0
  105. package/dist/src/visual/property-comparator.js +246 -0
  106. package/dist/src/visual/property-comparator.js.map +1 -0
  107. package/dist/src/visual/structural-comparator.d.ts +46 -0
  108. package/dist/src/visual/structural-comparator.d.ts.map +1 -0
  109. package/dist/src/visual/structural-comparator.js +293 -0
  110. package/dist/src/visual/structural-comparator.js.map +1 -0
  111. package/dist/src/visual/vqa-analyzer.d.ts +30 -0
  112. package/dist/src/visual/vqa-analyzer.d.ts.map +1 -0
  113. package/dist/src/visual/vqa-analyzer.js +271 -0
  114. package/dist/src/visual/vqa-analyzer.js.map +1 -0
  115. package/docs/figma-workflow.md +210 -40
  116. package/docs/setup-guide.md +104 -40
  117. package/docs/tool-reference.md +137 -11
  118. package/package.json +1 -1
  119. package/tsconfig.json +1 -1
  120. package/INSTALLATION_GUIDE.md +0 -3
  121. package/QUICK_START.md +0 -3
@@ -1,6 +1,6 @@
1
1
  # DevLens Tool Reference
2
2
 
3
- Complete reference for all **33** DevLens MCP tools, organized by category.
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 | `devlens_metro_status` | Metro | |
616
- | 27 | `devlens_metro_logs` | Metro | level?, since? |
617
- | 28 | `devlens_component_tree` | Metro | depth? |
618
- | 29 | `devlens_hot_reload` | Metro | |
619
- | 30 | `devlens_network_requests` | Metro | urlPattern? |
620
- | 31 | `devlens_dismiss_overlays` | Metro | suppressLogBox?, pressBack? |
621
- | 32 | `devlens_open_url` | Navigation | url |
622
- | 33 | `devlens_go_back` | Navigation | |
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.3",
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
@@ -16,5 +16,5 @@
16
16
  "sourceMap": true
17
17
  },
18
18
  "include": ["src/**/*", "bin/**/*"],
19
- "exclude": ["node_modules", "dist", "tests"]
19
+ "exclude": ["node_modules", "dist", "tests", "src/jds-tokens"]
20
20
  }
@@ -1,3 +0,0 @@
1
- # Installation Guide
2
-
3
- This file has moved. See **[docs/setup-guide.md](./docs/setup-guide.md)** for all installation, configuration, and troubleshooting instructions.
package/QUICK_START.md DELETED
@@ -1,3 +0,0 @@
1
- # Quick Start
2
-
3
- This file has moved. See **[docs/setup-guide.md](./docs/setup-guide.md)** for all installation, configuration, and troubleshooting instructions.