driftx 0.1.2 → 0.1.3
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.
|
@@ -6,7 +6,7 @@ description: Visual comparison, accessibility audit, layout regression, and devi
|
|
|
6
6
|
# driftx — Visual Analysis for React Native & Android
|
|
7
7
|
|
|
8
8
|
Use driftx when the user wants to:
|
|
9
|
-
- Compare their running app against a design image (Figma
|
|
9
|
+
- Compare their running app against a design image (from Figma, Google Stitch, Penpot, or any exported mockup)
|
|
10
10
|
- Run an accessibility audit on the component tree
|
|
11
11
|
- Detect layout regressions between builds
|
|
12
12
|
- Inspect the React Native component tree on a device
|
|
@@ -259,18 +259,57 @@ Mark dynamic data rows as **OK** even if the values differ. Only flag structural
|
|
|
259
259
|
|
|
260
260
|
## Workflow Patterns
|
|
261
261
|
|
|
262
|
+
### Design-to-code verification (general pattern)
|
|
263
|
+
|
|
264
|
+
driftx works with any design source. **You MUST follow this pattern for every design-to-code task. Do not skip any step.**
|
|
265
|
+
|
|
266
|
+
1. **Get the design image** from whatever tool the user is using
|
|
267
|
+
2. **Save it locally** as a PNG (e.g., `/tmp/design-target.png`) to use as the driftx comparison target
|
|
268
|
+
3. **Capture a "before" screenshot**: `npx driftx capture -o /tmp/before.png` -- this records the starting state before any code changes
|
|
269
|
+
4. **Write or modify code** to match the design
|
|
270
|
+
5. **Capture an "after" screenshot**: `npx driftx capture -o /tmp/after.png` -- this records the state after code changes
|
|
271
|
+
6. **Compare against the design**: `npx driftx compare --design /tmp/design-target.png --format json`
|
|
272
|
+
7. **Read the results** and classify differences as dynamic data or structural issues
|
|
273
|
+
8. **Test the feature** -- use driftx to interact with the new UI (tap buttons, type into inputs, swipe, etc.) and capture screenshots to verify the interactions work correctly
|
|
274
|
+
9. **Iterate** -- fix structural or interaction issues, capture a new screenshot, re-compare until it matches
|
|
275
|
+
|
|
276
|
+
**Mandatory screenshots:** You MUST capture a screenshot of the app BEFORE making changes and AFTER making changes. This is not optional. The before/after pair proves the work was done and shows what changed. After each subsequent code change, capture another screenshot and re-compare to verify the UI is converging toward the design.
|
|
277
|
+
|
|
278
|
+
**Mandatory interaction testing:** After the UI matches the design, you MUST test every interactive element using driftx (tap, type, swipe). Do not consider a feature complete until you have verified that all interactions work. Capture screenshots after each interaction to confirm the expected behavior.
|
|
279
|
+
|
|
280
|
+
### Compare against a Google Stitch design
|
|
281
|
+
|
|
282
|
+
If the user has the Stitch MCP server connected:
|
|
283
|
+
|
|
284
|
+
1. Use `get_screen` to retrieve the screen details (screenshot URL, HTML code)
|
|
285
|
+
2. Download the screenshot using `curl -L` and save as PNG locally (e.g., `/tmp/stitch-design.png`)
|
|
286
|
+
3. Optionally download the HTML code for implementation reference
|
|
287
|
+
4. Run `npx driftx compare --design /tmp/stitch-design.png --format json`
|
|
288
|
+
5. Read the JSON output and artifact files to understand differences
|
|
289
|
+
6. Fix structural issues, re-compare until it matches
|
|
290
|
+
|
|
262
291
|
### Compare against a Figma design
|
|
263
292
|
|
|
264
|
-
If the user has a Figma MCP server connected
|
|
293
|
+
If the user has a Figma MCP server connected:
|
|
294
|
+
|
|
295
|
+
1. Use Figma MCP to get the design frame and export as PNG
|
|
296
|
+
2. Save the exported image locally (e.g., `/tmp/figma-design.png`)
|
|
297
|
+
3. Run `npx driftx compare --design /tmp/figma-design.png --format json`
|
|
298
|
+
4. Read the JSON output to understand differences
|
|
299
|
+
5. Read artifact files (diff mask, report.md) for visual context
|
|
300
|
+
6. **Classify each difference** as dynamic data or structural issue
|
|
301
|
+
7. Only suggest code fixes for structural issues
|
|
302
|
+
|
|
303
|
+
### Compare against any other design source
|
|
304
|
+
|
|
305
|
+
For other tools (Penpot, Framer, Galileo AI, or a plain image file):
|
|
265
306
|
|
|
266
|
-
1.
|
|
267
|
-
2.
|
|
268
|
-
3.
|
|
269
|
-
4.
|
|
270
|
-
5. **Classify each difference** as dynamic data or structural issue
|
|
271
|
-
6. Only suggest code fixes for structural issues
|
|
307
|
+
1. Get the design image -- export from the tool, or use the path the user provides
|
|
308
|
+
2. Save locally as PNG if not already on disk
|
|
309
|
+
3. Run `npx driftx compare --design <path> --format json`
|
|
310
|
+
4. Follow the same classify-and-fix loop
|
|
272
311
|
|
|
273
|
-
If no
|
|
312
|
+
If no design tool MCP is available, ask the user to provide the design image path.
|
|
274
313
|
|
|
275
314
|
### Accessibility audit
|
|
276
315
|
|