@andrii_kremlovskyi/playwright-traces-reader 2.6.5 → 2.6.6

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 CHANGED
@@ -110,6 +110,8 @@ when you need extra detail for one selected failure.
110
110
 
111
111
  `digest` is the deep single-trace command. Unlike `failures` (which targets failure points across a report), it captures one whole test — passed, failed, or flaky — as a chronological step tree. Each leaf action with an `input@` snapshot gets one Action-phase DOM (`dom/<callId>.html`) and the nearest screenshot (`screenshots/<callId>.png`), paired 1:1. Every step links the `seq` ids of all network calls within its time window, so a parent's links are a superset of its descendants'. Network is written as chronological NDJSON (`network.ndjson`, one exchange per line, global `seq`); response bodies over 32 KB are spilled to `network-bodies.ndjson` with a `bodyRef` and `bodySizeBytes` so consumers decide before reading. Console output goes to `console.ndjson`. The pretty-printed `digest.json` is the entry point and references all companion files relatively.
112
112
 
113
+ **Agent & Workflow Optimization:** The `digest` output dramatically speeds up reasoning tasks and saves context tokens for LLM agents. Instead of feeding raw, uncompressed trace ZIPs or massive HTML strings, the agent is presented with a structured, pre-correlated step and event tree. This facilitates automated workflows such as analyzing E2E API traffic to generate custom `k6` load testing scripts, verifying API payloads, or synthesizing bug reproduction steps.
114
+
113
115
  Typical CLI workflow:
114
116
 
115
117
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrii_kremlovskyi/playwright-traces-reader",
3
- "version": "2.6.5",
3
+ "version": "2.6.6",
4
4
  "description": "Parse Playwright trace files into structured data for AI agents and tooling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: analyze-playwright-traces
3
- description: Analyze Playwright reports and traces using the playwright-traces-reader CLI, including searching a local playwright-reports hub for runs like UAT EU before inspecting failures, single-test summaries, network traffic, DOM snapshots, screenshots, and timelines.
3
+ description: Analyze Playwright reports and traces using the playwright-traces-reader CLI, including searching a local playwright-reports hub for runs like UAT EU before performing selective trace digestion, single-test summaries, network traffic, DOM snapshots, screenshots, and timelines.
4
4
  ---
5
5
 
6
6
  # Analyze Playwright Traces
@@ -19,9 +19,7 @@ Use this skill when the user asks to analyze Playwright reports or traces, inclu
19
19
 
20
20
  ## Output Handling
21
21
 
22
- - Do not truncate `npx playwright-traces-reader failures ...` manifest output on the first attempt with `Select-Object`, `head`, or similar shell filtering.
23
- - `failures` prints a compact manifest and writes per-failure folders to disk; consume the manifest in full, then read individual failure folders as needed.
24
- - After reading the manifest, open a failure folder's `failure.json` (and its companion files) directly; use `summary <tracePath>` only for extra detail.
22
+ - When working with a digested trace folder (either provided directly or generated via the `digest` command), read the folder's `digest.json` and its companion files directly; use other commands only when you need additional detail.
25
23
  - For potentially larger commands such as `network`, `dom`, or `timeline`, narrowing output is acceptable when needed.
26
24
 
27
25
  ## Prerequisites
@@ -58,11 +56,7 @@ Important scope rule:
58
56
 
59
57
  ### Report discovery through playwright-reports
60
58
 
61
- If the user gave no report identifier at all, do not start with hub discovery. Use the local default `playwright-report/` directory first.
62
-
63
- ```bash
64
- npx playwright-traces-reader failures playwright-report/ ./trace-analysis
65
- ```
59
+ If the user gave no report identifier at all, do not start with hub discovery. Locate the trace path directly within the local default `playwright-report/` directory first.
66
60
 
67
61
  Use `search-reports` when the user describes a report by metadata or recency instead of giving a filesystem path.
68
62
 
@@ -108,8 +102,8 @@ Example handoff flow:
108
102
  ```bash
109
103
  npx playwright-traces-reader search-reports "UAT EU" --limit 1
110
104
  npx playwright-traces-reader prepare-report <reportRef>
111
- npx playwright-traces-reader failures <reportRootPath> ./trace-analysis
112
- npx playwright-traces-reader summary <tracePath>
105
+ npx playwright-traces-reader find-traces <reportRootPath> "login"
106
+ npx playwright-traces-reader digest <tracePath> ./tmp/digest-analysis --report <reportRootPath>
113
107
  ```
114
108
 
115
109
  ### Vault analysis files
@@ -148,43 +142,24 @@ npx playwright-traces-reader vault-read <analysisFile> --out ./tmp/analysis.md
148
142
 
149
143
  The agent cannot access vault files directly with `read_file` because they are stored outside the workspace. Always use `vault-read` through the terminal to retrieve vault content, or use `--out` to save it into the workspace first.
150
144
 
151
- ### Report-level analysis
145
+ ### Single-test trace digestion (First Priority)
152
146
 
153
- Use `failures` when the user wants to triage all failing tests in a report. It
154
- **requires an output directory** and writes one self-contained folder per failed
155
- attempt (including each failed retry) into a timestamped run subfolder, then
156
- prints a compact manifest.
157
-
158
- ```bash
159
- npx playwright-traces-reader failures /path/to/playwright-report /path/to/output
160
- ```
147
+ If the user needs to analyze a specific test trace (either passed, failed, or flaky) and a digested folder has not already been provided directly (e.g., from the dashboard or by the user), use the `digest` command as your **first-priority** tool.
161
148
 
162
- Use `--exclude-skipped` to omit skipped tests:
149
+ Digesting a single trace produces a comprehensive, chronological step and event tree pre-correlated with DOM snapshots, console logs, and network NDJSON files, which is far more token-efficient than running individual parser commands (like `steps` or `network`).
163
150
 
164
151
  ```bash
165
- npx playwright-traces-reader failures /path/to/playwright-report/data /path/to/output --exclude-skipped
152
+ npx playwright-traces-reader digest <tracePath> /path/to/output --report /path/to/playwright-report
166
153
  ```
167
154
 
168
155
  What it does:
156
+ - Creates a self-contained output directory containing `digest.json` (the entry point step tree), `network.ndjson`, `console.ndjson`, and a `dom/` directory with self-contained Action-phase HTML snapshots.
157
+ - Every step in `digest.json` links the sequence IDs of all network calls within its execution window.
158
+ - Response bodies over 32 KB are spilled to `network-bodies.ndjson` with a `bodyRef` so you only load them if needed.
169
159
 
170
- - creates `<output>/run-<timestamp>/` and writes one folder per failed attempt
171
- - each folder contains `failure.json` (the full digest), `screenshots/` frames
172
- around each failure point, `dom/<callId>.html` (the Action-phase DOM at each
173
- failure anchor, referenced from `failure.json`), `network-errors.ndjson`
174
- (one record per line, with per-anchor timing and 32 KB body spill to
175
- `network-error-bodies.ndjson`), `console-errors.ndjson`, and `error.md` when
176
- available
177
- - the NDJSON companions are greppable line-by-line and match the `digest` format
178
- - the full human-readable error text lives in `error.md`; `failure.json` holds
179
- the structured step tree and issues with ANSI escape codes stripped
180
- - mirrors the manifest to `<runDir>/index.json`
181
- - prints the compact manifest to stdout (one entry per failed attempt with
182
- `folder`, `retryIndex`, counts)
183
-
184
- Read the per-failure folder directly from disk instead of re-querying the trace —
185
- that is the whole point: everything needed to reason about one failure is bundled
186
- in its folder. Use `summary <tracePath>` only when you need additional detail not
187
- in the folder.
160
+ Guidelines:
161
+ - **Workspace Cleanup:** Choose any temporary output directory of your choice inside the workspace (e.g., `./tmp/digest-analysis`), perform your analysis by reading `digest.json` and its companion files directly, and then **delete the output directory** once you are done to keep the workspace clean. Make sure you do not delete any other files
162
+ - **Pre-digested Folders:** If the user has already run the digest command or used the playwright-reports dashboard to digest the trace, they may provide the path to the pre-digested folder. In this case, bypass running the `digest` command and inspect `digest.json` in that folder directly.
188
163
 
189
164
  ### Finding traces for any test
190
165
 
@@ -407,10 +382,10 @@ npx playwright-traces-reader init-skills
407
382
 
408
383
  ## Example Prompts This Skill Covers
409
384
 
410
- - Analyze the default local Playwright report and list failures.
411
- - Find the UAT EU report and list failing tests.
385
+ - Find the trace for a failed test in the local report and digest it.
386
+ - Find the UAT EU report, locate the failing test "checkout", and digest its trace.
412
387
  - Find checkout reports from `2026-04-01` through `2026-04-03` and prepare the newest one.
413
- - Resolve this `reportRef` and summarize the failing trace.
388
+ - Resolve this `reportRef` and summarize the trace.
414
389
  - Use the reports hub at `http://127.0.0.1:9333` to find the most recent smoke run.
415
- - Find the trace for my passed "login" test and show me its summary.
390
+ - Find the trace for my passed "login" test and digest it.
416
391
  - Show me traces for all flaky tests matching "checkout".