devlens-mcp 0.3.3 → 0.4.0
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 +45 -37
- package/RELEASE_NOTES.md +249 -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 +207 -40
- package/docs/setup-guide.md +102 -38
- package/docs/tool-reference.md +71 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/INSTALLATION_GUIDE.md +0 -3
- package/QUICK_START.md +0 -3
package/docs/figma-workflow.md
CHANGED
|
@@ -7,16 +7,16 @@ This guide explains how to use DevLens together with Figma MCP to create a fully
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
11
|
-
│ Figma │────►│ AI │────►│ Code │────►│ Device │
|
|
12
|
-
│ Design │ │ Agent │ │ Editor │ │ Screen │
|
|
13
|
-
└──────────┘ └──────┬───┘ └──────────┘ └────┬─────┘
|
|
14
|
-
│
|
|
15
|
-
│◄────
|
|
16
|
-
│ (
|
|
10
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
11
|
+
│ Figma │────►│ AI │────►│ Code │────►│ Device │────►│ VQA │
|
|
12
|
+
│ Design │ │ Agent │ │ Editor │ │ Screen │ │ Validate │
|
|
13
|
+
└──────────┘ └──────┬───┘ └──────────┘ └──────────┘ └────┬─────┘
|
|
14
|
+
│ │
|
|
15
|
+
│◄──── devlens_vqa_validate ─────────────────────┘
|
|
16
|
+
│ (issues found?)
|
|
17
17
|
│ │
|
|
18
18
|
▼ ▼
|
|
19
|
-
Fix Code ◄────
|
|
19
|
+
Fix Code ◄──── VQA Report + Fix Suggestions
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
---
|
|
@@ -72,16 +72,20 @@ Use DevLens to verify the implementation matches the design.
|
|
|
72
72
|
The AI executes this loop:
|
|
73
73
|
|
|
74
74
|
```
|
|
75
|
-
1. devlens_metro_status ← Verify Metro is healthy
|
|
76
|
-
2. devlens_dismiss_overlays ← Remove debug banners
|
|
77
|
-
3.
|
|
78
|
-
4.
|
|
79
|
-
5.
|
|
80
|
-
6.
|
|
81
|
-
7.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
9.
|
|
75
|
+
1. devlens_metro_status ← Verify Metro is healthy
|
|
76
|
+
2. devlens_dismiss_overlays ← Remove debug banners
|
|
77
|
+
3. devlens_ds_context ← Load design tokens (correct color/spacing names)
|
|
78
|
+
4. Generate/update React Native code
|
|
79
|
+
5. devlens_hot_reload ← Trigger Metro fast refresh
|
|
80
|
+
6. devlens_wait_for_screen ← Wait for screen to stabilize
|
|
81
|
+
7. devlens_snapshot(validate: true) ← Catch invisible/zero-size elements
|
|
82
|
+
8. devlens_compare_with_figma ← Quick compare (similarity score + diff)
|
|
83
|
+
(figmaUrl: "...", depth: "quick")
|
|
84
|
+
9. If similarity < 90%: fix obvious layout issues, repeat from step 5
|
|
85
|
+
10. devlens_vqa_validate ← Full VQA check (spacing, color, alignment, sizing)
|
|
86
|
+
(figmaUrl: "...")
|
|
87
|
+
11. Read VQA report → apply suggested fixes
|
|
88
|
+
12. Repeat from step 5 until VQA status = PASS (zero issues)
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
Key improvements in v0.3.0:
|
|
@@ -103,47 +107,210 @@ The AI reads the diff image to identify specific issues (wrong font size, missin
|
|
|
103
107
|
## Example Conversation
|
|
104
108
|
|
|
105
109
|
```
|
|
106
|
-
User: Build the login screen from Figma
|
|
107
|
-
|
|
110
|
+
User: Build the login screen from this Figma and make sure VQA passes with zero issues:
|
|
111
|
+
https://figma.com/design/abc123/MyApp?node-id=10-200
|
|
108
112
|
|
|
109
|
-
AI: I'll start by checking Metro
|
|
113
|
+
AI: I'll start by checking Metro, dismissing overlays, and loading the design system.
|
|
110
114
|
[calls devlens_metro_status → Metro healthy on port 8081]
|
|
111
115
|
[calls devlens_dismiss_overlays → LogBox suppressed]
|
|
112
|
-
[calls
|
|
116
|
+
[calls devlens_ds_context → loaded JDS3 tokens: colors, spacing, typography]
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
Creating LoginScreen.tsx using JDS3 design tokens...
|
|
115
119
|
[writes LoginScreen.tsx]
|
|
116
120
|
[calls devlens_hot_reload]
|
|
117
121
|
[calls devlens_wait_for_screen(stableMs: 1500)]
|
|
118
122
|
[calls devlens_snapshot(validate: true)]
|
|
123
|
+
Validation: all elements visible, no zero-size issues.
|
|
119
124
|
|
|
120
|
-
|
|
125
|
+
Running quick comparison first...
|
|
126
|
+
[calls devlens_compare_with_figma(figmaUrl: "...", depth: "quick")]
|
|
127
|
+
Similarity: 72%. Major layout issues — fixing first.
|
|
121
128
|
|
|
122
|
-
|
|
123
|
-
figmaUrl: "https://figma.com/design/abc123/MyApp?node-id=10-200")]
|
|
124
|
-
|
|
125
|
-
Similarity: 72%. The diff shows:
|
|
126
|
-
- Title text is 18px but should be 24px
|
|
127
|
-
- Primary button color is #333 but should be #2563EB
|
|
128
|
-
- Bottom padding missing on form container
|
|
129
|
-
|
|
130
|
-
Fixing these issues...
|
|
129
|
+
Fixing: title font size 18px→24px, button color #333→#2563EB, missing bottom padding.
|
|
131
130
|
[updates LoginScreen.tsx]
|
|
132
131
|
[calls devlens_hot_reload]
|
|
133
132
|
[calls devlens_wait_for_screen(stableMs: 1000)]
|
|
134
|
-
[calls devlens_compare_with_figma(
|
|
135
|
-
|
|
133
|
+
[calls devlens_compare_with_figma(figmaUrl: "...", depth: "quick")]
|
|
134
|
+
Similarity: 93%. Good enough for full VQA now.
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
Running full VQA validation...
|
|
137
|
+
[calls devlens_vqa_validate(figmaUrl: "...")]
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
=== VQA Report: WARNING ===
|
|
140
|
+
Issues: 3 (0 critical, 2 major, 1 minor)
|
|
141
|
+
1. [MAJOR] [sizing] Input border radius: expected 12px, actual 8px
|
|
142
|
+
2. [MAJOR] [spacing] Gap between email and password fields: expected 16px, actual 24px
|
|
143
|
+
3. [minor] [alignment] "Forgot Password" link off by 2px horizontally
|
|
144
|
+
|
|
145
|
+
Fixing all 3 issues...
|
|
146
|
+
[updates LoginScreen.tsx — borderRadius: 12, marginBottom: 16, alignSelf adjustment]
|
|
140
147
|
[calls devlens_hot_reload]
|
|
141
148
|
[calls devlens_wait_for_screen]
|
|
142
|
-
[calls
|
|
143
|
-
|
|
149
|
+
[calls devlens_vqa_validate(figmaUrl: "...")]
|
|
150
|
+
|
|
151
|
+
=== VQA Report: PASS ===
|
|
152
|
+
Overall Score: 98.7%
|
|
153
|
+
Issues: 0
|
|
154
|
+
|
|
155
|
+
LoginScreen is ready for designer handoff. Zero VQA issues.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## VQA Workflow — Zero Designer Tickets (v0.4.0)
|
|
161
|
+
|
|
162
|
+
### The Problem VQA Solves
|
|
163
|
+
|
|
164
|
+
Traditional workflow:
|
|
165
|
+
```
|
|
166
|
+
Dev builds screen --> Gives build to designer --> Designer raises 15 VQA tickets
|
|
167
|
+
--> Dev fixes --> New build --> 5 more tickets --> Fix --> Repeat (2-3 days wasted)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
With DevLens VQA:
|
|
171
|
+
```
|
|
172
|
+
Dev tells AI "implement + pass VQA" --> AI builds + auto-fixes all issues
|
|
173
|
+
--> Designer gets build with ZERO VQA --> Done (30 min)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Quick Start: Copy-Paste Prompts for Developers
|
|
179
|
+
|
|
180
|
+
**Prompt 1 — Build a new screen with VQA validation:**
|
|
181
|
+
```
|
|
182
|
+
Build the HomeScreen component based on this Figma design:
|
|
183
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
184
|
+
|
|
185
|
+
After building, run VQA validation to make sure there are ZERO issues.
|
|
186
|
+
Fix any spacing, color, alignment, or sizing issues automatically.
|
|
187
|
+
Keep running VQA until the report shows PASS.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Prompt 2 — Run VQA on an existing screen:**
|
|
191
|
+
```
|
|
192
|
+
Take a snapshot of the current screen, then run VQA validation against this Figma:
|
|
193
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
194
|
+
|
|
195
|
+
Show me the full VQA report. If there are any issues, fix them and re-run until PASS.
|
|
196
|
+
```
|
|
144
197
|
|
|
145
|
-
|
|
198
|
+
**Prompt 3 — Quick VQA check after a small change:**
|
|
146
199
|
```
|
|
200
|
+
I just changed the padding on the header. Do a minimal VQA check — only check
|
|
201
|
+
spacing and alignment against this Figma:
|
|
202
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Prompt 4 — VQA for specific components only:**
|
|
206
|
+
```
|
|
207
|
+
Run VQA only on the product card component (ref e5 to e12) against Figma:
|
|
208
|
+
https://figma.com/design/ABC123/MyApp?node-id=22-450
|
|
209
|
+
|
|
210
|
+
Check colors and sizing only, skip the rest.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Prompt 5 — Full implementation + VQA + designer handoff:**
|
|
214
|
+
```
|
|
215
|
+
I need to implement this Figma screen and hand it to the designer with ZERO VQA issues:
|
|
216
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
217
|
+
|
|
218
|
+
Steps:
|
|
219
|
+
1. Load the design system context first
|
|
220
|
+
2. Build the component using correct DS tokens
|
|
221
|
+
3. Hot reload and wait for screen to stabilize
|
|
222
|
+
4. Run full VQA validation (spacing, colors, alignment, sizing, missing elements)
|
|
223
|
+
5. Fix every issue the VQA report finds
|
|
224
|
+
6. Re-run VQA until the report says PASS with 0 issues
|
|
225
|
+
7. Show me the final VQA report as proof
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### What the AI Does Behind the Scenes
|
|
231
|
+
|
|
232
|
+
When you use any of the prompts above, the AI agent automatically runs this sequence:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
1. devlens_ds_context ← Load design tokens
|
|
236
|
+
2. (AI writes/updates component code)
|
|
237
|
+
3. devlens_hot_reload ← Push changes to device
|
|
238
|
+
4. devlens_wait_for_screen(stableMs: 1500) ← Wait for render
|
|
239
|
+
5. devlens_snapshot(validate: true) ← Get element tree + catch invisible bugs
|
|
240
|
+
6. devlens_vqa_validate( ← Run VQA
|
|
241
|
+
figmaUrl: "https://figma.com/design/...",
|
|
242
|
+
checkCategories: ["spacing", "color", "alignment", "sizing", "missing"]
|
|
243
|
+
)
|
|
244
|
+
7. (AI reads VQA report, applies fix suggestions to code)
|
|
245
|
+
8. Repeat steps 3-7 until VQA status = PASS
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### Understanding the VQA Report
|
|
251
|
+
|
|
252
|
+
The VQA tool returns a structured report that looks like this:
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
=== VQA Report: WARNING ===
|
|
256
|
+
Overall Score: 91.3%
|
|
257
|
+
Issues: 3 (0 critical, 2 major, 1 minor)
|
|
258
|
+
|
|
259
|
+
--- Issues ---
|
|
260
|
+
1. [MAJOR] [spacing] Vertical gap between [e3] and [e5] differs from Figma.
|
|
261
|
+
Expected: 12px gap
|
|
262
|
+
Actual: 20px gap (8px off)
|
|
263
|
+
|
|
264
|
+
2. [MAJOR] [color] Color mismatch on [e7]: Significant color mismatch
|
|
265
|
+
Expected: #1A73E8
|
|
266
|
+
Actual: #2196F3
|
|
267
|
+
|
|
268
|
+
3. [minor] [alignment] Element [e2] is misaligned from Figma position.
|
|
269
|
+
Expected: center (215, 120)
|
|
270
|
+
Actual: center (218, 122) — off by (3, 2)px
|
|
271
|
+
|
|
272
|
+
--- Suggested Fixes ---
|
|
273
|
+
1. [high] Adjust margin/padding on element [e3] to match Figma specs: 12px gap.
|
|
274
|
+
2. [high] Update color value for [e7]. Expected: #1A73E8. Check design token mapping.
|
|
275
|
+
3. [medium] Fix alignment of [e2]. Adjust flex alignment or positioning.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Report status meanings:**
|
|
279
|
+
| Status | Meaning | Action |
|
|
280
|
+
|--------|---------|--------|
|
|
281
|
+
| `PASS` | Zero issues. Safe to hand to designer. | Ship it. |
|
|
282
|
+
| `WARNING` | Only major/minor issues, no critical. | Fix majors, minors are optional. |
|
|
283
|
+
| `FAIL` | Critical issues found (missing elements, huge mismatches). | Must fix before designer sees it. |
|
|
284
|
+
|
|
285
|
+
**Issue severity meanings:**
|
|
286
|
+
| Severity | What it means | Example |
|
|
287
|
+
|----------|---------------|---------|
|
|
288
|
+
| `critical` | Designer will 100% reject this | Missing component, wrong screen, >40% color mismatch |
|
|
289
|
+
| `major` | Designer will raise a VQA ticket | 8px spacing off, wrong color hex, misaligned by 10px+ |
|
|
290
|
+
| `minor` | Designer might notice, might not | 2px alignment off, slight color shade difference |
|
|
291
|
+
|
|
292
|
+
**VQA categories:**
|
|
293
|
+
| Category | What it checks |
|
|
294
|
+
|----------|---------------|
|
|
295
|
+
| `spacing` | Gaps between adjacent elements vs Figma |
|
|
296
|
+
| `color` | Dominant colors per region vs Figma reference |
|
|
297
|
+
| `alignment` | Element center/edge positions vs Figma |
|
|
298
|
+
| `sizing` | Element width/height vs Figma dimensions |
|
|
299
|
+
| `missing` | Regions with <60% visual match (content probably missing) |
|
|
300
|
+
| `extra` | Extra elements on device not in design |
|
|
301
|
+
| `typography` | Font sizes and weights via accessibility metadata |
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
### When to Use VQA vs Regular Compare
|
|
306
|
+
|
|
307
|
+
| Scenario | Use | Why |
|
|
308
|
+
|----------|-----|-----|
|
|
309
|
+
| Building a new screen from Figma | `devlens_vqa_validate` | Full VQA report with fix suggestions |
|
|
310
|
+
| Quick check during iteration | `devlens_compare_with_figma(depth: "quick")` | Fast similarity %, no detailed report |
|
|
311
|
+
| Small CSS tweak, just want to verify | `devlens_analyze(scope: "minimal")` | Fastest — just a pixel diff, no layout report |
|
|
312
|
+
| Final check before designer handoff | `devlens_vqa_validate` | Proves zero VQA issues |
|
|
313
|
+
| Comparing before/after screenshots | `devlens_compare_images` | A/B comparison, no Figma needed |
|
|
147
314
|
|
|
148
315
|
---
|
|
149
316
|
|
package/docs/setup-guide.md
CHANGED
|
@@ -8,8 +8,8 @@ Add this to `~/.cursor/mcp.json` and restart Cursor:
|
|
|
8
8
|
{
|
|
9
9
|
"mcpServers": {
|
|
10
10
|
"devlens": {
|
|
11
|
-
"command": "
|
|
12
|
-
"args": ["devlens-mcp@latest"],
|
|
11
|
+
"command": "/bin/zsh",
|
|
12
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"],
|
|
13
13
|
"env": {
|
|
14
14
|
"METRO_PORT": "8081"
|
|
15
15
|
}
|
|
@@ -18,9 +18,11 @@ Add this to `~/.cursor/mcp.json` and restart Cursor:
|
|
|
18
18
|
}
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
That's it. DevLens tools will appear in Cursor's MCP panel.
|
|
21
|
+
That's it. DevLens tools will appear in Cursor's MCP panel after restart.
|
|
22
22
|
|
|
23
|
-
> **
|
|
23
|
+
> **v0.4.0 Auto-Detection**: DevLens now automatically detects your shell (bash/zsh/fish) and `node`/`npx` path on every startup. If it finds a misconfigured command or path in your MCP config JSON, it patches it automatically (with backup). Check startup logs for `[devlens] Patched` or `[devlens] Config OK` messages.
|
|
24
|
+
>
|
|
25
|
+
> **Why `/bin/zsh -l`?** Cursor doesn't load your shell profile, so `node` from nvm/fnm isn't in PATH. Using `/bin/zsh -l` loads your login profile first. DevLens v0.4.0+ handles this automatically — if you put `/bin/bash` but use zsh, it will auto-correct.
|
|
24
26
|
|
|
25
27
|
---
|
|
26
28
|
|
|
@@ -30,6 +32,7 @@ That's it. DevLens tools will appear in Cursor's MCP panel.
|
|
|
30
32
|
```bash
|
|
31
33
|
claude mcp add devlens -- npx devlens-mcp@latest
|
|
32
34
|
```
|
|
35
|
+
> Claude Code loads shell profiles automatically, so no `/bin/zsh` wrapper needed.
|
|
33
36
|
|
|
34
37
|
### Claude Desktop
|
|
35
38
|
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
@@ -37,8 +40,8 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
37
40
|
{
|
|
38
41
|
"mcpServers": {
|
|
39
42
|
"devlens": {
|
|
40
|
-
"command": "
|
|
41
|
-
"args": ["devlens-mcp@latest"],
|
|
43
|
+
"command": "/bin/zsh",
|
|
44
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"],
|
|
42
45
|
"env": { "METRO_PORT": "8081" }
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -52,7 +55,7 @@ cd mcp-devlens && npm install && npm run build
|
|
|
52
55
|
npm run register # auto-registers with Claude Code
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
For Cursor with local build, use `"command": "node"` and `"args": ["/absolute/path/to/mcp-devlens/dist/bin/cli.js"]` instead of
|
|
58
|
+
For Cursor with local build, use `"command": "node"` and `"args": ["/absolute/path/to/mcp-devlens/dist/bin/cli.js"]` instead of the zsh wrapper.
|
|
56
59
|
|
|
57
60
|
---
|
|
58
61
|
|
|
@@ -89,8 +92,8 @@ Full example with all optional vars:
|
|
|
89
92
|
{
|
|
90
93
|
"mcpServers": {
|
|
91
94
|
"devlens": {
|
|
92
|
-
"command": "
|
|
93
|
-
"args": ["devlens-mcp@latest"],
|
|
95
|
+
"command": "/bin/zsh",
|
|
96
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"],
|
|
94
97
|
"env": {
|
|
95
98
|
"METRO_PORT": "8081",
|
|
96
99
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -113,11 +116,62 @@ Start your emulator/simulator and Metro, then ask your AI:
|
|
|
113
116
|
| 2 | "Take a screenshot" | Device screenshot as inline image |
|
|
114
117
|
| 3 | "Take a snapshot with validation" | Accessibility tree with `ref=eN` IDs |
|
|
115
118
|
| 4 | "Show Metro logs" | Console output from your app |
|
|
119
|
+
| 5 | "Run VQA on this screen against Figma: `<url>`" | VQA report with PASS/WARNING/FAIL |
|
|
116
120
|
|
|
117
121
|
If step 1 works, DevLens is running correctly.
|
|
118
122
|
|
|
119
123
|
---
|
|
120
124
|
|
|
125
|
+
## VQA Workflow — Quick Reference for Developers
|
|
126
|
+
|
|
127
|
+
DevLens v0.4.0 includes a VQA (Visual Quality Assurance) validator. Use it to catch design issues **before** designers see the build — zero VQA tickets.
|
|
128
|
+
|
|
129
|
+
### Copy-paste prompts you can use in Cursor:
|
|
130
|
+
|
|
131
|
+
**Build a new screen + VQA:**
|
|
132
|
+
```
|
|
133
|
+
Build the HomeScreen component based on this Figma design:
|
|
134
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
135
|
+
|
|
136
|
+
After building, run VQA validation to make sure there are ZERO issues.
|
|
137
|
+
Fix any spacing, color, alignment, or sizing issues automatically.
|
|
138
|
+
Keep running VQA until the report shows PASS.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Run VQA on an already-built screen:**
|
|
142
|
+
```
|
|
143
|
+
Take a snapshot of the current screen, then run VQA validation against this Figma:
|
|
144
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
145
|
+
|
|
146
|
+
Show me the full VQA report. If there are any issues, fix them and re-run until PASS.
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Quick check after a small CSS change:**
|
|
150
|
+
```
|
|
151
|
+
I just changed the padding on the header. Do a minimal VQA check — only check
|
|
152
|
+
spacing and alignment against this Figma:
|
|
153
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Full implementation + zero VQA guarantee:**
|
|
157
|
+
```
|
|
158
|
+
I need to implement this Figma screen and hand it to the designer with ZERO VQA issues:
|
|
159
|
+
https://figma.com/design/ABC123/MyApp?node-id=10-200
|
|
160
|
+
|
|
161
|
+
Steps:
|
|
162
|
+
1. Load the design system context first
|
|
163
|
+
2. Build the component using correct DS tokens
|
|
164
|
+
3. Hot reload and wait for screen to stabilize
|
|
165
|
+
4. Run full VQA validation (spacing, colors, alignment, sizing, missing elements)
|
|
166
|
+
5. Fix every issue the VQA report finds
|
|
167
|
+
6. Re-run VQA until the report says PASS with 0 issues
|
|
168
|
+
7. Show me the final VQA report as proof
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
For the full VQA workflow guide with report format details, see [Figma Workflow](./figma-workflow.md#vqa-workflow--zero-designer-tickets-v040).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
121
175
|
## Figma Token Setup
|
|
122
176
|
|
|
123
177
|
Required only for `devlens_compare_with_figma`.
|
|
@@ -177,8 +231,8 @@ Optional. Enables `devlens_ds_context` for design-token-aware code generation.
|
|
|
177
231
|
{
|
|
178
232
|
"mcpServers": {
|
|
179
233
|
"devlens": {
|
|
180
|
-
"command": "
|
|
181
|
-
"args": ["devlens-mcp@latest"],
|
|
234
|
+
"command": "/bin/zsh",
|
|
235
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"],
|
|
182
236
|
"env": {
|
|
183
237
|
"METRO_PORT": "8081",
|
|
184
238
|
"FIGMA_TOKEN": "figd_xxxxx",
|
|
@@ -197,37 +251,46 @@ Ask your AI: *"Load the design system context"* — it should return token names
|
|
|
197
251
|
|
|
198
252
|
## Troubleshooting
|
|
199
253
|
|
|
200
|
-
### Fix:
|
|
254
|
+
### Fix: Used `node` as command with shell flags (`-l`, `-c`)
|
|
255
|
+
|
|
256
|
+
If your old config looked like this:
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"command": "/opt/homebrew/bin/node",
|
|
260
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
This is incorrect — `-l` and `-c` are shell flags (zsh/bash), not node flags. Node ignores or errors on them.
|
|
201
264
|
|
|
202
|
-
**
|
|
265
|
+
**v0.4.0 auto-fix:** DevLens detects this misconfiguration on startup and patches `command` to your actual shell (`/bin/zsh`, `/bin/bash`, etc.) automatically. Check logs for `[devlens] Patched`.
|
|
203
266
|
|
|
204
|
-
**
|
|
267
|
+
**Manual fix:** Replace `node` with `/bin/zsh`:
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"command": "/bin/zsh",
|
|
271
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
272
|
+
}
|
|
273
|
+
```
|
|
205
274
|
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
which npx
|
|
209
|
-
```
|
|
210
|
-
This prints something like:
|
|
211
|
-
```
|
|
212
|
-
/Users/yourname/.nvm/versions/node/v20.12.2/bin/npx
|
|
213
|
-
```
|
|
275
|
+
---
|
|
214
276
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
```
|
|
277
|
+
### Fix: `env: node: No such file or directory`
|
|
278
|
+
|
|
279
|
+
This means Cursor can't find `node`. It happens when Node is installed via nvm/fnm and the MCP config uses `"command": "npx"` directly.
|
|
280
|
+
|
|
281
|
+
**Fix:** Use the `/bin/zsh -l` wrapper as shown in the install section above:
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"command": "/bin/zsh",
|
|
285
|
+
"args": ["-l", "-c", "npx devlens-mcp@latest"]
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The `-l` flag loads your login shell profile (where nvm/fnm initialize), making `node` available. This is the default recommended config and works for everyone on macOS. DevLens v0.4.0 auto-detects and patches this if misconfigured.
|
|
229
290
|
|
|
230
|
-
|
|
291
|
+
**Alternative:** If you prefer not to use the zsh wrapper, you can use the full absolute path to `npx`:
|
|
292
|
+
1. Run `which npx` in Terminal
|
|
293
|
+
2. Use that full path as `"command"` (e.g. `"/Users/you/.nvm/versions/node/v20.12.2/bin/npx"`)
|
|
231
294
|
|
|
232
295
|
---
|
|
233
296
|
|
|
@@ -280,7 +343,7 @@ Then restart Cursor. npx will re-download the latest version.
|
|
|
280
343
|
|
|
281
344
|
## What's Available
|
|
282
345
|
|
|
283
|
-
DevLens provides **
|
|
346
|
+
DevLens provides **36 tools** across 9 categories:
|
|
284
347
|
|
|
285
348
|
| Category | Tools | Count |
|
|
286
349
|
|----------|-------|-------|
|
|
@@ -292,5 +355,6 @@ DevLens provides **34 tools** across 8 categories:
|
|
|
292
355
|
| React Native / Metro | metro_status, metro_logs, component_tree, hot_reload, network_requests, dismiss_overlays | 6 |
|
|
293
356
|
| Navigation | open_url, go_back | 2 |
|
|
294
357
|
| Design System | ds_context | 1 |
|
|
358
|
+
| Analysis & VQA | analyze, vqa_validate | 2 |
|
|
295
359
|
|
|
296
360
|
See the [Tool Reference](./tool-reference.md) for detailed parameter docs.
|
package/docs/tool-reference.md
CHANGED
|
@@ -583,6 +583,74 @@ On Android: presses system Back button. On iOS: performs back swipe.
|
|
|
583
583
|
|
|
584
584
|
---
|
|
585
585
|
|
|
586
|
+
## Analysis & VQA Tools
|
|
587
|
+
|
|
588
|
+
### devlens_analyze
|
|
589
|
+
Smart analysis tool with configurable depth. Respects scope of request — if a user asks for a minimal check, it performs minimal analysis.
|
|
590
|
+
|
|
591
|
+
| Param | Type | Required | Default | Description |
|
|
592
|
+
|-------|------|----------|---------|-------------|
|
|
593
|
+
| `scope` | `"minimal"` \| `"targeted"` \| `"full"` | No | `"full"` | `"minimal"`: quick pixel diff, no layout report. `"targeted"`: compare specific refs only. `"full"`: complete analysis. |
|
|
594
|
+
| `targetRefs` | string[] | No | — | Element refs to focus on (for `"targeted"` scope). E.g., `["e1", "e5"]`. |
|
|
595
|
+
| `referenceImagePath` | string | No | — | Path or URL to reference image. |
|
|
596
|
+
| `referenceImageBase64` | string | No | — | Base64-encoded reference image. |
|
|
597
|
+
| `figmaUrl` | string | No | — | Figma URL for reference. |
|
|
598
|
+
| `threshold` | number | No | `0.1` | Color difference threshold (0-1). |
|
|
599
|
+
|
|
600
|
+
**Scope behaviors:**
|
|
601
|
+
- **minimal**: Captures screenshot, runs quick pixel diff with perceptual mode and system bar exclusion. Skips layout report. Fast.
|
|
602
|
+
- **targeted**: Takes full snapshot but only inspects the specified refs. Returns bounds and properties for targeted elements.
|
|
603
|
+
- **full**: Complete snapshot + optional layout report + comparison with reference.
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
### devlens_vqa_validate
|
|
608
|
+
Run Visual Quality Assurance validation against a Figma design. Returns structured VQA report with issues and fix suggestions.
|
|
609
|
+
|
|
610
|
+
| Param | Type | Required | Default | Description |
|
|
611
|
+
|-------|------|----------|---------|-------------|
|
|
612
|
+
| `figmaUrl` | string | No | — | Full Figma URL (e.g., `"https://figma.com/design/ABC123/MyApp?node-id=10-200"`). |
|
|
613
|
+
| `fileKey` | string | No | — | Figma file key (use instead of figmaUrl). |
|
|
614
|
+
| `nodeId` | string | No | — | Figma node ID (e.g., `"10:200"`). |
|
|
615
|
+
| `scale` | number | No | `2` | Figma export scale. |
|
|
616
|
+
| `checkCategories` | string[] | No | `["spacing","color","alignment","sizing","missing"]` | VQA categories to check. Options: `spacing`, `color`, `typography`, `alignment`, `missing`, `extra`, `sizing`. |
|
|
617
|
+
| `enableAutoFix` | boolean | No | `true` | Generate fix suggestions for each issue. |
|
|
618
|
+
| `preprocessReference` | boolean | No | `true` | Remove Figma artifacts before comparison. |
|
|
619
|
+
|
|
620
|
+
**VQA Check Categories:**
|
|
621
|
+
- **spacing**: Verifies margins/paddings between adjacent elements match Figma specs
|
|
622
|
+
- **color**: Extracts dominant colors per region and compares with design reference
|
|
623
|
+
- **alignment**: Checks element center/edge alignment against Figma positions
|
|
624
|
+
- **sizing**: Verifies element dimensions match Figma within tolerance
|
|
625
|
+
- **missing**: Detects regions with very low visual match (possible missing content)
|
|
626
|
+
- **extra**: Detects extra elements on device not in Figma
|
|
627
|
+
- **typography**: Font size/weight checks via accessibility metadata
|
|
628
|
+
|
|
629
|
+
**VQA Report format:**
|
|
630
|
+
```
|
|
631
|
+
=== VQA Report: PASS/WARNING/FAIL ===
|
|
632
|
+
Overall Score: 94.2%
|
|
633
|
+
Issues: 3 (0 critical, 2 major, 1 minor)
|
|
634
|
+
|
|
635
|
+
--- Issues ---
|
|
636
|
+
1. [MAJOR] [spacing] Vertical gap between [e3] and [e5] differs from Figma.
|
|
637
|
+
Expected: 12px gap
|
|
638
|
+
Actual: 20px gap (8px off)
|
|
639
|
+
2. [MAJOR] [color] Color mismatch on [e7]: Significant color mismatch...
|
|
640
|
+
Expected: #1A73E8
|
|
641
|
+
Actual: #2196F3
|
|
642
|
+
3. [minor] [alignment] Element [e2] is misaligned from Figma position.
|
|
643
|
+
Expected: center (215, 120)
|
|
644
|
+
Actual: center (218, 122) — off by (3, 2)px
|
|
645
|
+
|
|
646
|
+
--- Suggested Fixes ---
|
|
647
|
+
1. [high] Adjust margin/padding on element [e3] to match Figma specs: 12px gap.
|
|
648
|
+
2. [high] Update color value for [e7]. Expected: #1A73E8. Check design token mapping.
|
|
649
|
+
3. [medium] Fix alignment of [e2]. Adjust flex alignment or positioning.
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
586
654
|
## Quick Reference Table
|
|
587
655
|
|
|
588
656
|
| # | Tool | Category | Key Params |
|
|
@@ -620,3 +688,6 @@ On Android: presses system Back button. On iOS: performs back swipe.
|
|
|
620
688
|
| 31 | `devlens_dismiss_overlays` | Metro | suppressLogBox?, pressBack? |
|
|
621
689
|
| 32 | `devlens_open_url` | Navigation | url |
|
|
622
690
|
| 33 | `devlens_go_back` | Navigation | — |
|
|
691
|
+
| 34 | `devlens_ds_context` | Design System | — |
|
|
692
|
+
| 35 | `devlens_analyze` | Analysis | scope, targetRefs?, referenceImagePath?, referenceImageBase64?, figmaUrl?, threshold? |
|
|
693
|
+
| 36 | `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.0",
|
|
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