@andrii_kremlovskyi/playwright-traces-reader 1.3.2 → 2.1.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 CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Parse [Playwright](https://playwright.dev) trace files into structured data — useful for AI agents, custom reporters, and post-run analysis tooling.
4
4
 
5
+ See [CLI_ARCHITECTURE.md](CLI_ARCHITECTURE.md) for the future CLI and report-hub architecture overview.
6
+ See [CLI_REFERENCE.md](CLI_REFERENCE.md) for the detailed CLI command reference.
7
+ See [CLI_JSON_CONTRACTS.md](CLI_JSON_CONTRACTS.md) for the versioned JSON output contracts used by the CLI.
8
+ See [LIBRARY_INTEGRATION.md](LIBRARY_INTEGRATION.md) for in-process library usage guidance.
9
+
5
10
  ## Features
6
11
 
7
12
  - Find all unique failed tests across a report in one call — retries deduplicated, passing tests excluded, last retry selected automatically (`getFailedTestSummaries`)
@@ -21,6 +26,49 @@ Parse [Playwright](https://playwright.dev) trace files into structured data —
21
26
  npm install @andrii_kremlovskyi/playwright-traces-reader
22
27
  ```
23
28
 
29
+ ## CLI
30
+
31
+ The package exposes a local CLI. In a repository that has the package installed, use it with `npx`:
32
+
33
+ ```bash
34
+ npx playwright-traces-reader failures ./playwright-report
35
+ npx playwright-traces-reader summary ./playwright-report/data/<sha1>
36
+ npx playwright-traces-reader network ./playwright-report/data/<sha1>
37
+ ```
38
+
39
+ Phase 1 commands:
40
+
41
+ - `init-skills [targetDir]` — scaffold the GitHub Copilot skill into a repository
42
+ - `failures <reportPath>` — report-level unique failing test analysis
43
+ - `summary <tracePath>` — one-call trace summary
44
+ - `slow-steps <tracePath>` — slowest steps from a single trace
45
+ - `steps <tracePath>` — step tree reconstruction
46
+ - `network <tracePath>` — API and browser network traffic
47
+ - `dom <tracePath>` — DOM snapshots before, during, and after actions
48
+ - `timeline <tracePath>` — merged chronological trace timeline
49
+ - `screenshots <tracePath> --out-dir <path>` — extract screenshots for human inspection
50
+
51
+ Default output mode in Phase 1:
52
+
53
+ - JSON is the default for CLI commands
54
+
55
+ Optional output mode:
56
+
57
+ - `--format text` — human-readable terminal output when explicitly requested
58
+
59
+ JSON responses are versioned envelopes documented in [CLI_JSON_CONTRACTS.md](CLI_JSON_CONTRACTS.md).
60
+
61
+ `failures` is a compact triage command. It returns minimal report-level records, including `tracePath` and `traceSha1`, so the next step is to run `summary <tracePath>` for full trace details.
62
+
63
+ Typical CLI workflow:
64
+
65
+ ```bash
66
+ npx playwright-traces-reader failures ./playwright-report
67
+ npx playwright-traces-reader summary /absolute/path/to/playwright-report/data/<sha1>
68
+ ```
69
+
70
+ Use `--format text` only when you explicitly want terminal-oriented output instead of the default JSON response.
71
+
24
72
  ## GitHub Copilot Skill
25
73
 
26
74
  Install a ready-made GitHub Copilot skill scaffold into your project:
@@ -31,10 +79,40 @@ npx @andrii_kremlovskyi/playwright-traces-reader init-skills
31
79
  npx @andrii_kremlovskyi/playwright-traces-reader init-skills ./my-project
32
80
  ```
33
81
 
34
- This copies a `SKILL.md` template to `.github/skills/analyze-playwright-traces/SKILL.md` with code examples for all extractor functions. Once in place, GitHub Copilot will use the skill automatically when answering questions about your Playwright test runs.
82
+ This copies a `SKILL.md` template to `.github/skills/analyze-playwright-traces/SKILL.md`. The skill is CLI-first and points Copilot to supported `npx playwright-traces-reader ...` commands instead of temporary script generation.
83
+
84
+ Like the other CLI commands, `init-skills` now returns JSON by default and supports `--format text` when a human-readable confirmation message is preferred.
85
+
86
+ ## Library Integration
87
+
88
+ The preferred interface for agents and test repositories is the CLI.
89
+
90
+ For in-process integrations such as future `playwright-reports` usage, see [LIBRARY_INTEGRATION.md](LIBRARY_INTEGRATION.md).
35
91
 
36
92
  ## Trace Format
37
93
 
94
+ Playwright HTML reports have a report root that looks like this:
95
+
96
+ ```
97
+ playwright-report/
98
+ ├── index.html ← HTML report shell; contains embedded base64 ZIP data
99
+ └── data/
100
+ ├── <sha1>/
101
+ ├── <sha1>.zip
102
+ └── ...
103
+ ```
104
+
105
+ The structured test results JSON does not live as a plain `report.json` file next to `index.html`.
106
+
107
+ Instead, Playwright embeds it inside `index.html` in a `<template id="playwrightReportBase64">` tag. That template contains a base64-encoded ZIP payload, and inside that ZIP there is a `report.json` file with the report-level test metadata and outcomes.
108
+
109
+ This is the data loaded by `getReportMetadata()` and used for fields such as:
110
+
111
+ - report stats
112
+ - test outcomes
113
+ - trace attachment paths like `data/<sha1>.zip`
114
+ - `testId`-based retry deduplication
115
+
38
116
  Playwright HTML reports store traces in `playwright-report/data/<sha1>/`:
39
117
 
40
118
  ```
@@ -63,7 +141,7 @@ for (const f of failures) {
63
141
  console.log(`Error: ${f.error?.message}`);
64
142
  console.log(`Duration: ${f.durationMs}ms`);
65
143
 
66
- for (const call of f.apiCalls) {
144
+ for (const call of f.networkCalls) {
67
145
  console.log(` ${call.method} ${call.url} → ${call.status}`);
68
146
  }
69
147
 
@@ -100,6 +178,13 @@ console.log(`Error: ${summary.error?.message}`);
100
178
 
101
179
  ## API
102
180
 
181
+ The API section below describes the exported library functions.
182
+
183
+ Important distinction:
184
+
185
+ - the CLI `failures` command now returns compact triage records
186
+ - the library `getFailedTestSummaries()` function still returns full `TraceSummary[]`
187
+
103
188
  ### `getFailedTestSummaries(reportDataDir, options?)`
104
189
 
105
190
  Report-level helper. Returns `TraceSummary[]` — one entry per **unique** failing test:
@@ -0,0 +1,16 @@
1
+ import type { ActionDomSnapshots, NetworkEntry, Screenshot, TestStep, TimelineEntry, TraceSummary } from '../index';
2
+ import type { FailureListItem } from './json';
3
+ export type OutputFormat = 'text' | 'json';
4
+ export declare function emitOutput(io: {
5
+ stdout: (text: string) => void;
6
+ }, format: OutputFormat, data: unknown, text: string): void;
7
+ export declare function formatInitSkillsText(skillPath: string): string;
8
+ export declare function formatFailuresText(failures: FailureListItem[]): string;
9
+ export declare function formatSummaryText(summary: TraceSummary): string;
10
+ export declare function formatSlowStepsText(steps: TestStep[]): string;
11
+ export declare function formatStepsText(steps: TestStep[]): string;
12
+ export declare function formatNetworkText(entries: NetworkEntry[]): string;
13
+ export declare function formatDomSnapshotsText(snapshots: ActionDomSnapshots[]): string;
14
+ export declare function formatTimelineText(entries: TimelineEntry[]): string;
15
+ export declare function formatScreenshotsText(screenshots: Screenshot[]): string;
16
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/cli/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,wBAAgB,UAAU,CAAC,EAAE,EAAE;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO1H;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM,CAiBtE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA+B/D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAM7D;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAQzD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAiBjE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAmB9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,CAwBnE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAMvE"}
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emitOutput = emitOutput;
4
+ exports.formatInitSkillsText = formatInitSkillsText;
5
+ exports.formatFailuresText = formatFailuresText;
6
+ exports.formatSummaryText = formatSummaryText;
7
+ exports.formatSlowStepsText = formatSlowStepsText;
8
+ exports.formatStepsText = formatStepsText;
9
+ exports.formatNetworkText = formatNetworkText;
10
+ exports.formatDomSnapshotsText = formatDomSnapshotsText;
11
+ exports.formatTimelineText = formatTimelineText;
12
+ exports.formatScreenshotsText = formatScreenshotsText;
13
+ function emitOutput(io, format, data, text) {
14
+ if (format === 'json') {
15
+ io.stdout(`${JSON.stringify(data, null, 2)}\n`);
16
+ return;
17
+ }
18
+ io.stdout(`${text}\n`);
19
+ }
20
+ function formatInitSkillsText(skillPath) {
21
+ return `Skill scaffolded at ${skillPath}`;
22
+ }
23
+ function formatFailuresText(failures) {
24
+ if (failures.length === 0)
25
+ return 'No failing tests found.';
26
+ return failures.map((failure, index) => {
27
+ const title = failure.testTitle ?? failure.title;
28
+ const errorLine = failure.errorMessage ?? 'No error message available';
29
+ return [
30
+ `${index + 1}. [${failure.outcome ?? failure.status}] ${title}`,
31
+ ` Duration: ${formatDuration(failure.durationMs)}`,
32
+ ` Error: ${errorLine}`,
33
+ ` Trace SHA1: ${failure.traceSha1}`,
34
+ ` Trace path: ${failure.tracePath}`,
35
+ ` Network: ${failure.networkCallCount} calls (${failure.networkErrorCount} errors)`,
36
+ ` Failure DOM snapshot: ${failure.hasFailureDomSnapshot ? 'yes' : 'no'}`,
37
+ ].join('\n');
38
+ }).join('\n\n');
39
+ }
40
+ function formatSummaryText(summary) {
41
+ const lines = [
42
+ `${summary.status.toUpperCase()} ${summary.testTitle ?? summary.title}`,
43
+ `Outcome: ${summary.outcome ?? 'unknown'}`,
44
+ `Duration: ${formatDuration(summary.durationMs)}`,
45
+ ];
46
+ if (summary.error?.message) {
47
+ lines.push(`Error: ${summary.error.message}`);
48
+ }
49
+ if (summary.topLevelSteps.length > 0) {
50
+ lines.push('Top-level steps:');
51
+ lines.push(indentBlock(formatStepsText(summary.topLevelSteps), 2));
52
+ }
53
+ if (summary.slowestSteps.length > 0) {
54
+ lines.push('Slowest steps:');
55
+ lines.push(indentBlock(formatSlowStepsText(summary.slowestSteps), 2));
56
+ }
57
+ if (summary.networkCalls.length > 0) {
58
+ lines.push(`Network calls: ${summary.networkCalls.length}`);
59
+ }
60
+ if (summary.failureDomSnapshot) {
61
+ lines.push('Failure DOM snapshot:');
62
+ lines.push(indentBlock(formatDomSnapshotsText([summary.failureDomSnapshot]), 2));
63
+ }
64
+ return lines.join('\n');
65
+ }
66
+ function formatSlowStepsText(steps) {
67
+ if (steps.length === 0)
68
+ return 'No timed steps found.';
69
+ return steps.map((step, index) => (`${index + 1}. ${formatDuration(step.durationMs)} ${step.title}${step.error ? ' [failed]' : ''}`)).join('\n');
70
+ }
71
+ function formatStepsText(steps) {
72
+ if (steps.length === 0)
73
+ return 'No steps found.';
74
+ const lines = [];
75
+ for (const step of steps) {
76
+ appendStepLines(lines, step, 0);
77
+ }
78
+ return lines.join('\n');
79
+ }
80
+ function formatNetworkText(entries) {
81
+ if (entries.length === 0)
82
+ return 'No network entries found.';
83
+ return entries.map((entry, index) => {
84
+ const lines = [
85
+ `${index + 1}. [${entry.source}] ${entry.method} ${entry.url} -> ${entry.status} ${entry.statusText}`,
86
+ ` Duration: ${entry.durationMs}ms | MIME: ${entry.mimeType || 'unknown'}`,
87
+ ];
88
+ const requestBody = truncate(entry.requestBody, 240);
89
+ if (requestBody)
90
+ lines.push(` Request body: ${requestBody}`);
91
+ const responseBody = truncate(entry.responseBody, 240);
92
+ if (responseBody)
93
+ lines.push(` Response body: ${responseBody}`);
94
+ return lines.join('\n');
95
+ }).join('\n\n');
96
+ }
97
+ function formatDomSnapshotsText(snapshots) {
98
+ if (snapshots.length === 0)
99
+ return 'No DOM snapshots found.';
100
+ return snapshots.map((snapshot, index) => {
101
+ const lines = [`${index + 1}. callId ${snapshot.callId}`];
102
+ for (const phase of ['before', 'action', 'after']) {
103
+ const phaseSnapshot = snapshot[phase];
104
+ if (!phaseSnapshot)
105
+ continue;
106
+ lines.push(` ${phase}: ${phaseSnapshot.frameUrl}`);
107
+ if (phaseSnapshot.targetElement) {
108
+ lines.push(` ${phase} target: ${phaseSnapshot.targetElement}`);
109
+ }
110
+ lines.push(` ${phase} html: ${truncate(singleLine(phaseSnapshot.html), 220)}`);
111
+ }
112
+ return lines.join('\n');
113
+ }).join('\n\n');
114
+ }
115
+ function formatTimelineText(entries) {
116
+ if (entries.length === 0)
117
+ return 'No timeline entries found.';
118
+ return entries.map(entry => {
119
+ const prefix = `${new Date(entry.timestamp).toISOString()} [${entry.type}]`;
120
+ switch (entry.type) {
121
+ case 'step': {
122
+ const step = entry.data;
123
+ return `${prefix} ${step.title}`;
124
+ }
125
+ case 'screenshot': {
126
+ const screenshot = entry.data;
127
+ return `${prefix} ${screenshot.sha1} ${screenshot.width}x${screenshot.height}`;
128
+ }
129
+ case 'dom': {
130
+ const domSnapshot = entry.data;
131
+ return `${prefix} callId ${domSnapshot.callId}`;
132
+ }
133
+ case 'network': {
134
+ const networkEntry = entry.data;
135
+ return `${prefix} ${networkEntry.method} ${networkEntry.url} -> ${networkEntry.status}`;
136
+ }
137
+ }
138
+ }).join('\n');
139
+ }
140
+ function formatScreenshotsText(screenshots) {
141
+ if (screenshots.length === 0)
142
+ return 'No screenshots extracted.';
143
+ return screenshots.map((screenshot, index) => (`${index + 1}. ${screenshot.savedPath} (${screenshot.width}x${screenshot.height}, ${screenshot.timestamp})`)).join('\n');
144
+ }
145
+ function appendStepLines(lines, step, depth) {
146
+ const indent = ' '.repeat(depth);
147
+ const suffix = step.error ? ` [failed: ${firstLine(step.error.message) ?? step.error.name}]` : '';
148
+ lines.push(`${indent}- ${step.title} (${formatDuration(step.durationMs)})${suffix}`);
149
+ for (const child of step.children) {
150
+ appendStepLines(lines, child, depth + 1);
151
+ }
152
+ }
153
+ function formatDuration(durationMs) {
154
+ return durationMs === null ? 'n/a' : `${durationMs}ms`;
155
+ }
156
+ function firstLine(value) {
157
+ if (!value)
158
+ return null;
159
+ return value.split(/\r?\n/, 1)[0] ?? null;
160
+ }
161
+ function singleLine(value) {
162
+ return value.replace(/\s+/g, ' ').trim();
163
+ }
164
+ function truncate(value, maxLength) {
165
+ if (!value)
166
+ return null;
167
+ const compact = singleLine(value);
168
+ if (compact.length <= maxLength)
169
+ return compact;
170
+ return `${compact.slice(0, maxLength - 3)}...`;
171
+ }
172
+ function indentBlock(value, spaces) {
173
+ const indent = ' '.repeat(spaces);
174
+ return value.split('\n').map(line => `${indent}${line}`).join('\n');
175
+ }
176
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/cli/formatters.ts"],"names":[],"mappings":";;AAYA,gCAOC;AAED,oDAEC;AAED,gDAiBC;AAED,8CA+BC;AAED,kDAMC;AAED,0CAQC;AAED,8CAiBC;AAED,wDAmBC;AAED,gDAwBC;AAED,sDAMC;AA3JD,SAAgB,UAAU,CAAC,EAAsC,EAAE,MAAoB,EAAE,IAAa,EAAE,IAAY;IAClH,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAAiB;IACpD,OAAO,uBAAuB,SAAS,EAAE,CAAC;AAC5C,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gC,EAAE,SAAiB;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAChD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAE,MAAc;IAChD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type TraceContext } from '../index';
2
+ export declare function copySkillTemplate(targetDir: string): Promise<string>;
3
+ export declare function resolveReportDataDir(inputPath: string): Promise<string>;
4
+ export declare function loadReportMetadataForTrace(traceContext: TraceContext, explicitReportPath?: string): Promise<import("../parseTrace").ReportMetadata | null>;
5
+ export declare function parsePositiveInteger(value: string): number;
6
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhE,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa1E;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB7E;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,YAAY,EAC1B,kBAAkB,CAAC,EAAE,MAAM,0DAO5B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM1D"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.copySkillTemplate = copySkillTemplate;
37
+ exports.resolveReportDataDir = resolveReportDataDir;
38
+ exports.loadReportMetadataForTrace = loadReportMetadataForTrace;
39
+ exports.parsePositiveInteger = parsePositiveInteger;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const commander_1 = require("commander");
43
+ const index_1 = require("../index");
44
+ async function copySkillTemplate(targetDir) {
45
+ const skillDir = path.join(targetDir, '.github', 'skills', 'analyze-playwright-traces');
46
+ await fs.promises.mkdir(skillDir, { recursive: true });
47
+ const templatePath = path.resolve(__dirname, '..', '..', 'templates', 'skills', 'analyze-playwright-traces', 'SKILL.md');
48
+ const destPath = path.join(skillDir, 'SKILL.md');
49
+ if (!fs.existsSync(templatePath)) {
50
+ throw new Error(`Template not found at ${templatePath}`);
51
+ }
52
+ await fs.promises.copyFile(templatePath, destPath);
53
+ return destPath;
54
+ }
55
+ async function resolveReportDataDir(inputPath) {
56
+ const resolvedPath = path.resolve(inputPath);
57
+ const stat = await fs.promises.stat(resolvedPath);
58
+ if (!stat.isDirectory()) {
59
+ throw new Error(`Invalid report path: ${resolvedPath}. Expected a report root or data directory.`);
60
+ }
61
+ const reportIndexPath = path.join(resolvedPath, 'index.html');
62
+ const reportDataDir = path.join(resolvedPath, 'data');
63
+ if (fs.existsSync(reportIndexPath) && fs.existsSync(reportDataDir)) {
64
+ return reportDataDir;
65
+ }
66
+ if (path.basename(resolvedPath) === 'data') {
67
+ return resolvedPath;
68
+ }
69
+ throw new Error(`Could not resolve a Playwright report data directory from ${resolvedPath}.`);
70
+ }
71
+ async function loadReportMetadataForTrace(traceContext, explicitReportPath) {
72
+ if (explicitReportPath) {
73
+ return (0, index_1.getReportMetadata)(path.resolve(explicitReportPath));
74
+ }
75
+ return (0, index_1.getReportMetadata)(path.dirname(traceContext.traceDir));
76
+ }
77
+ function parsePositiveInteger(value) {
78
+ const parsed = Number.parseInt(value, 10);
79
+ if (!Number.isInteger(parsed) || parsed <= 0) {
80
+ throw new commander_1.InvalidArgumentError(`Invalid positive integer: ${value}`);
81
+ }
82
+ return parsed;
83
+ }
84
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,8CAaC;AAED,oDAkBC;AAED,gEASC;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AAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACtD,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACnE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,MAAM,EAAE,CAAC;QAC3C,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6DAA6D,YAAY,GAAG,CAAC,CAAC;AAChG,CAAC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,YAA0B,EAC1B,kBAA2B;IAE3B,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,gCAAoB,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { ActionDomSnapshots, NetworkEntry, Screenshot, TestStep, TimelineEntry, TraceSummary } from '../index';
2
+ export declare const CLI_JSON_SCHEMA_VERSION: 1;
3
+ export interface FailureListItem {
4
+ testTitle: string | null;
5
+ title: string;
6
+ status: 'passed' | 'failed';
7
+ outcome: 'expected' | 'unexpected' | 'flaky' | 'skipped' | null;
8
+ durationMs: number | null;
9
+ errorMessage: string | null;
10
+ tracePath: string;
11
+ traceSha1: string;
12
+ networkCallCount: number;
13
+ networkErrorCount: number;
14
+ hasFailureDomSnapshot: boolean;
15
+ }
16
+ export interface InitSkillsCommandJson {
17
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
18
+ command: 'init-skills';
19
+ skillPath: string;
20
+ }
21
+ export interface FailuresCommandJson {
22
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
23
+ command: 'failures';
24
+ count: number;
25
+ failures: FailureListItem[];
26
+ }
27
+ export interface SummaryCommandJson {
28
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
29
+ command: 'summary';
30
+ summary: TraceSummary;
31
+ }
32
+ export interface SlowStepsCommandJson {
33
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
34
+ command: 'slow-steps';
35
+ count: number;
36
+ steps: TestStep[];
37
+ }
38
+ export interface StepsCommandJson {
39
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
40
+ command: 'steps';
41
+ count: number;
42
+ steps: TestStep[];
43
+ }
44
+ export interface NetworkCommandJson {
45
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
46
+ command: 'network';
47
+ count: number;
48
+ entries: NetworkEntry[];
49
+ }
50
+ export interface DomCommandJson {
51
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
52
+ command: 'dom';
53
+ count: number;
54
+ snapshots: ActionDomSnapshots[];
55
+ }
56
+ export interface TimelineCommandJson {
57
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
58
+ command: 'timeline';
59
+ count: number;
60
+ entries: TimelineEntry[];
61
+ }
62
+ export interface ScreenshotsCommandJson {
63
+ schemaVersion: typeof CLI_JSON_SCHEMA_VERSION;
64
+ command: 'screenshots';
65
+ count: number;
66
+ screenshots: Screenshot[];
67
+ }
68
+ export type CliCommandJson = InitSkillsCommandJson | FailuresCommandJson | SummaryCommandJson | SlowStepsCommandJson | StepsCommandJson | NetworkCommandJson | DomCommandJson | TimelineCommandJson | ScreenshotsCommandJson;
69
+ export declare function createInitSkillsCommandJson(skillPath: string): InitSkillsCommandJson;
70
+ export declare function createFailuresCommandJson(failures: FailureListItem[]): FailuresCommandJson;
71
+ export declare function createSummaryCommandJson(summary: TraceSummary): SummaryCommandJson;
72
+ export declare function createSlowStepsCommandJson(steps: TestStep[]): SlowStepsCommandJson;
73
+ export declare function createStepsCommandJson(steps: TestStep[]): StepsCommandJson;
74
+ export declare function createNetworkCommandJson(entries: NetworkEntry[]): NetworkCommandJson;
75
+ export declare function createDomCommandJson(snapshots: ActionDomSnapshots[]): DomCommandJson;
76
+ export declare function createTimelineCommandJson(entries: TimelineEntry[]): TimelineCommandJson;
77
+ export declare function createScreenshotsCommandJson(screenshots: Screenshot[]): ScreenshotsCommandJson;
78
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/cli/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,OAAO,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IAChE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC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pB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,OAAO,uBAAuB,CAAC;IAC9C,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GACtB,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,sBAAsB,CAAC;AAE3B,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,CAMpF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,mBAAmB,CAO1F;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAMlF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,CAOlF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAO1E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAOpF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,cAAc,CAOpF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,mBAAmB,CAOvF;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,sBAAsB,CAO9F"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_JSON_SCHEMA_VERSION = void 0;
4
+ exports.createInitSkillsCommandJson = createInitSkillsCommandJson;
5
+ exports.createFailuresCommandJson = createFailuresCommandJson;
6
+ exports.createSummaryCommandJson = createSummaryCommandJson;
7
+ exports.createSlowStepsCommandJson = createSlowStepsCommandJson;
8
+ exports.createStepsCommandJson = createStepsCommandJson;
9
+ exports.createNetworkCommandJson = createNetworkCommandJson;
10
+ exports.createDomCommandJson = createDomCommandJson;
11
+ exports.createTimelineCommandJson = createTimelineCommandJson;
12
+ exports.createScreenshotsCommandJson = createScreenshotsCommandJson;
13
+ exports.CLI_JSON_SCHEMA_VERSION = 1;
14
+ function createInitSkillsCommandJson(skillPath) {
15
+ return {
16
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
17
+ command: 'init-skills',
18
+ skillPath,
19
+ };
20
+ }
21
+ function createFailuresCommandJson(failures) {
22
+ return {
23
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
24
+ command: 'failures',
25
+ count: failures.length,
26
+ failures,
27
+ };
28
+ }
29
+ function createSummaryCommandJson(summary) {
30
+ return {
31
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
32
+ command: 'summary',
33
+ summary,
34
+ };
35
+ }
36
+ function createSlowStepsCommandJson(steps) {
37
+ return {
38
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
39
+ command: 'slow-steps',
40
+ count: steps.length,
41
+ steps,
42
+ };
43
+ }
44
+ function createStepsCommandJson(steps) {
45
+ return {
46
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
47
+ command: 'steps',
48
+ count: steps.length,
49
+ steps,
50
+ };
51
+ }
52
+ function createNetworkCommandJson(entries) {
53
+ return {
54
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
55
+ command: 'network',
56
+ count: entries.length,
57
+ entries,
58
+ };
59
+ }
60
+ function createDomCommandJson(snapshots) {
61
+ return {
62
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
63
+ command: 'dom',
64
+ count: snapshots.length,
65
+ snapshots,
66
+ };
67
+ }
68
+ function createTimelineCommandJson(entries) {
69
+ return {
70
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
71
+ command: 'timeline',
72
+ count: entries.length,
73
+ entries,
74
+ };
75
+ }
76
+ function createScreenshotsCommandJson(screenshots) {
77
+ return {
78
+ schemaVersion: exports.CLI_JSON_SCHEMA_VERSION,
79
+ command: 'screenshots',
80
+ count: screenshots.length,
81
+ screenshots,
82
+ };
83
+ }
84
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/cli/json.ts"],"names":[],"mappings":";;;AAiGA,kEAMC;AAED,8DAOC;AAED,4DAMC;AAED,gEAOC;AAED,wDAOC;AAED,4DAOC;AAED,oDAOC;AAED,8DAOC;AAED,oEAOC;AArKY,QAAA,uBAAuB,GAAG,CAAU,CAAC;AAwFlD,SAAgB,2BAA2B,CAAC,SAAiB;IAC3D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,aAAa;QACtB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAAC,QAA2B;IACnE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAqB;IAC5D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,SAAS;QAClB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,KAAiB;IAC1D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CAAC,KAAiB;IACtD,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAuB;IAC9D,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,SAA+B;IAClE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAAC,OAAwB;IAChE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAAC,WAAyB;IACpE,OAAO;QACL,aAAa,EAAE,+BAAuB;QACtC,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,WAAW;KACZ,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ export interface CliIo {
3
+ stdout: (text: string) => void;
4
+ stderr: (text: string) => void;
5
+ }
6
+ export declare function runCli(argv: string[], io?: CliIo): Promise<number>;
3
7
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6CA,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAqLD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAenF"}