meticulous-simulate-and-diff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSimulate a session and analyze diffs
模拟会话并分析差异
This skill covers running a single simulation and interpreting the results. For the command's full option reference see the skill.
simulatemeticulous-cli-simulateBefore starting, run theskill to ensure the Meticulous CLI is up to date — unless it has already run earlier in this conversation, in which case skip it.meticulous-cli-update
本技能涵盖如何运行单次模拟并解读结果。如需命令的完整选项参考,请查看技能。
simulatemeticulous-cli-simulate开始前,请运行技能确保Meticulous CLI为最新版本——如果本次对话中已经运行过该技能,则可跳过此步骤。meticulous-cli-update
Prerequisites
前提条件
- A to replay
sessionId - An (local dev server, or leave blank to use the original recorded URL)
appUrl - Optionally: a — the ID of a prior replay to diff screenshots against. Without this, screenshots are stored but not compared.
baseReplayId
If you don't have a , you can find one from a downloaded test run:
baseReplayIdbash
meticulous download test-run --apiToken=$METICULOUS_API_TOKEN- 用于回放的
sessionId - (本地开发服务器地址,留空则使用原始录制的URL)
appUrl - 可选:——用于对比截图的先前回放ID。若无此ID,截图会被存储但不会进行对比。
baseReplayId
如果没有,可从已下载的测试运行中查找:
baseReplayIdbash
meticulous download test-run --apiToken=$METICULOUS_API_TOKENThen inspect ~/.meticulous/test-runs/<testRunId>/coverage.json
然后查看 ~/.meticulous/test-runs/<testRunId>/coverage.json
or check the testCases[].replayId fields
或检查 testCases[].replayId 字段
undefinedundefinedStep 1 — Run the simulation
步骤1 —— 运行模拟
With a base replay (diff mode)
带基准回放(差异模式)
bash
meticulous simulate \
--sessionId=<sessionId> \
--appUrl=<url> \
--baseReplayId=<baseReplayId> \
--headlessCapture the full stdout. Key things to look for:
undefinedbash
meticulous simulate \
--sessionId=<sessionId> \
--appUrl=<url> \
--baseReplayId=<baseReplayId> \
--headless捕获完整标准输出。重点关注以下内容:
undefinedPer-screenshot diff outcomes (one line each):
每张截图的差异结果(每行对应一张):
0.412% pixel mismatch for screenshot screenshot-1234.png (threshold is 0.100%) => FAIL!
0.000% pixel mismatch for screenshot screenshot-5678.png (threshold is 0.100%) => PASS
0.412% pixel mismatch for screenshot screenshot-1234.png (threshold is 0.100%) => FAIL!
0.000% pixel mismatch for screenshot screenshot-5678.png (threshold is 0.100%) => PASS
Final summary block:
最终汇总块:
======= View simulation at: https://app.meticulous.ai/projects/<org>/<project>/simulations/<headReplayId> View comparison with base: https://app.meticulous.ai/projects/<org>/<project>/simulations/<baseReplayId>/compare-to/<headReplayId>
**If there are no `FAIL!` lines:** the session is visually identical to the base — stop here and report no regressions.
Proceed to Steps 2–5 to locate and analyse any diffs.======= 查看模拟结果:https://app.meticulous.ai/projects/<org>/<project>/simulations/<headReplayId> 查看与基准的对比:https://app.meticulous.ai/projects/<org>/<project>/simulations/<baseReplayId>/compare-to/<headReplayId>
**如果没有`FAIL!`行:** 会话与基准视觉完全一致——到此为止并报告无回归问题。
若存在差异,请继续执行步骤2至5以定位并分析差异。Without a base replay (quick-check mode)
无基准回放(快速检查模式)
If no is available, omit it. Screenshots are still stored locally for direct visual inspection:
baseReplayIdbash
meticulous simulate \
--sessionId=<sessionId> \
--appUrl=<url> \
--headlessThen locate the replay directory (Step 2) and open the screenshots in to verify the UI looks correct. There are no diff images in this mode — inspection is purely visual. Steps 3–5 do not apply.
<replayDir>/screenshots/若没有,可省略该参数。截图仍会存储在本地供直接视觉检查:
baseReplayIdbash
meticulous simulate \
--sessionId=<sessionId> \
--appUrl=<url> \
--headless然后找到回放目录(步骤2),打开下的截图以验证UI显示正常。此模式下无差异图像——仅需纯视觉检查。步骤3至5不适用。
<replayDir>/screenshots/Step 2 — Extract the head replay ID and locate the replay directory
步骤2 —— 提取头部回放ID并定位回放目录
From the URL, extract the (the last path segment).
View simulation at:<headReplayId>To find the local replay directory created by this run:
bash
ls -lt ~/.meticulous/replays/ | head -5The most recently created entry will be the head replay's directory (named with a timestamp, e.g. ). Note this path — it's referred to below as .
2024-01-15T12-30-45.123Z-abc123/<replayDir>从的URL中提取(最后一个路径段)。
查看模拟结果:<headReplayId>要找到本次运行创建的本地回放目录:
bash
ls -lt ~/.meticulous/replays/ | head -5最新创建的条目即为头部回放的目录(名称含时间戳,例如)。记录此路径——下文将其称为。
2024-01-15T12-30-45.123Z-abc123/<replayDir>Step 3 — Identify which screenshots diffed
步骤3 —— 识别存在差异的截图
bash
ls ~/.meticulous/replays/<replayDir>/diffs/<baseReplayId>/Each file here corresponds to a screenshot where a visual difference was detected. The pixel diff image highlights changed pixels in color. There are also prefixed thumbnail versions.
.pngthumb_Note the filenames — they match the screenshot identifiers (e.g. ).
screenshot-after-event-42.pngbash
ls ~/.meticulous/replays/<replayDir>/diffs/<baseReplayId>/此处的每个文件对应检测到视觉差异的截图。像素差异图像会用颜色高亮显示变化的像素,还有带前缀的缩略图版本。
.pngthumb_记录文件名——它们与截图标识符匹配(例如)。
screenshot-after-event-42.pngStep 4 — Analyze the HTML diff for each diffed screenshot
步骤4 —— 分析每张差异截图的HTML差异
Each screenshot has a corresponding metadata file containing a full HTML snapshot of the page taken just before the screenshot was captured. These files are already on disk:
- Head metadata:
~/.meticulous/replays/<replayDir>/screenshots/<screenshotFilename>.metadata.json - Base metadata:
~/.meticulous/replays/<baseReplayId>/screenshots/<screenshotFilename>.metadata.json
The base metadata is permanently cached when the simulation downloads the base replay, so no additional download is needed.
Read both files. The relevant fields are:
.metadata.json- — full HTML of the page at screenshot time; diff these two strings to understand what changed
before.dom - — which page/route the screenshot was taken on
before.routeData.url
When diffing the HTML, focus on tag additions/removals, attribute changes, and text content changes.
classThe per-screenshot stdout lines also report (proportion of pixels that changed). If there is a pixel diff but the strings are identical, the change is purely visual (e.g. a color shift) rather than structural.
mismatchFractionbefore.dom每张截图都有对应的元数据文件,包含截图捕获前一刻页面的完整HTML快照。这些文件已存储在本地:
- 头部元数据:
~/.meticulous/replays/<replayDir>/screenshots/<screenshotFilename>.metadata.json - 基准元数据:
~/.meticulous/replays/<baseReplayId>/screenshots/<screenshotFilename>.metadata.json
基准元数据会在模拟下载基准回放时永久缓存,无需额外下载。
读取两个文件,重点关注以下字段:
.metadata.json- ——截图时页面的完整HTML;对比这两个字符串以了解变更内容
before.dom - ——截图所在的页面/路由
before.routeData.url
对比HTML时,重点关注标签的添加/移除、属性变更以及文本内容变更。
class每张截图的标准输出行还会报告(变更像素的比例)。如果存在像素差异但字符串完全相同,则变更为纯视觉层面(例如颜色偏移)而非结构层面。
mismatchFractionbefore.domStep 5 — Summarize the findings
步骤5 —— 总结发现
The key output from this skill is a high-level human-readable description of what visually changed and why. Use the pixel diff counts, route URLs, changed class names, and HTML diffs gathered above to answer: what did the user experience change, and which part of the UI is responsible?
Present this in whatever format fits the current context (conversational answer, structured report, input to a calling workflow, etc.). Useful signals to draw on:
- Which routes were affected
- Which CSS classes appeared in the changed DOM regions (these usually map directly to components)
- Whether changes were structural (DOM additions/removals) or purely visual (pixel shift with no HTML diff)
- Whether the same change appears across multiple screenshots (suggesting a shared component changed) vs. isolated to one screenshot
The comparison URL logged to stdout is always worth surfacing, as it lets a human quickly verify the diff visually:
https://app.meticulous.ai/.../simulations/<baseReplayId>/compare-to/<headReplayId>本技能的核心输出是关于视觉变更内容及原因的高可读性描述。结合收集到的像素差异计数、路由URL、变更的类名和HTML差异,回答:用户体验发生了什么变化,UI的哪部分导致了该变化?
可根据当前上下文选择合适的格式呈现(对话式回答、结构化报告、调用工作流的输入等)。可参考以下有用信息:
- 哪些路由受到影响
- 变更DOM区域中出现的CSS类(通常直接对应组件)
- 变更是结构性的(DOM添加/移除)还是纯视觉性的(像素偏移但无HTML差异)
- 同一变更是否出现在多张截图中(表明共享组件发生变更)还是仅出现在单张截图中
标准输出中记录的对比URL值得重点提及,因为它能让人工快速直观地验证差异:
https://app.meticulous.ai/.../simulations/<baseReplayId>/compare-to/<headReplayId>Notes
注意事项
- The pixel diff images at can be opened directly for visual inspection.
~/.meticulous/replays/<replayDir>/diffs/<baseReplayId>/ - If is omitted, no diff analysis is possible. Screenshots are still stored locally and can be compared later by re-running with
--baseReplayIdset to the head replay ID from the first run.--baseReplayId - For the full iterative development workflow (session discovery, per-step commits, and final cloud run), see the skill.
meticulous-iterative-dev
- 下的像素差异图像可直接打开进行视觉检查。
~/.meticulous/replays/<replayDir>/diffs/<baseReplayId>/ - 如果省略,则无法进行差异分析。截图仍会存储在本地,之后可通过将
--baseReplayId设置为首次运行的头部回放ID重新运行来进行对比。--baseReplayId - 如需完整的迭代开发工作流(会话发现、分步提交、最终云端运行),请查看技能。
meticulous-iterative-dev