@crouton-kit/capture 1.4.12 → 1.4.14
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 +25 -1
- package/bin/capture +15 -15
- package/package.json +1 -1
- package/src/capture.ts +1 -1
- package/src/cdp/commands/heap/index.ts +2 -2
- package/src/cdp/commands/lighthouse.ts +1 -1
- package/src/cdp/commands/measure/index.ts +2 -2
- package/src/cdp/commands/motion/index.ts +2 -2
- package/src/cdp/commands/perf/index.ts +2 -2
- package/src/cdp/commands/tab/index.ts +1 -1
- package/src/session/commands.ts +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Both still do things capture does not. Playwright MCP is cross-browser — the s
|
|
|
46
46
|
|
|
47
47
|
## See it
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Eleven short clips. Every overlay is real: the text is extracted from the command's actual stdout, the boxes are drawn at the coordinates the command printed, and the inset images are files a command actually wrote.
|
|
50
50
|
|
|
51
51
|
Each player below contains the full clip. Use its controls to play, pause, scrub, or fullscreen.
|
|
52
52
|
|
|
@@ -118,6 +118,30 @@ No storage-state dance and no separate automation profile. Attach over `--port`,
|
|
|
118
118
|
|
|
119
119
|
`capture session start --target <tab-id> --port 9860` · [full clip, 30s](demo/8-live-session.mp4)
|
|
120
120
|
|
|
121
|
+
### 9. The cards paint first. Then one image moves them 400 pixels.
|
|
122
|
+
|
|
123
|
+
<video src="https://github.com/user-attachments/assets/3257f961-a9b4-4e20-b23e-4da86622ae31" controls muted playsinline></video>
|
|
124
|
+
|
|
125
|
+
Record the load once, then ask it different questions. `perf vitals` reads the largest paint off the trace — nearly all of it one image's load, named by element and URL — and lists the shifts that image caused. `perf insights` returns the element each shift moved, with the rectangle it was in before and after: `old_rect [28,99,1224,174]` → `new_rect [28,499,1224,174]`. Then `measure explain` measures that same element on the settled page and prints `x=28 y=499.75 w=1224 h=172.64`. The trace engine and the DOM agree on where the KPI row ended up.
|
|
126
|
+
|
|
127
|
+
`capture perf insights <trace> --name CLSCulprits --full` · [full clip, 24s](demo/9-perf-vitals.mp4)
|
|
128
|
+
|
|
129
|
+
### 10. The panels are closed. The browser is still holding all five.
|
|
130
|
+
|
|
131
|
+
<video src="https://github.com/user-attachments/assets/20cccb4d-9715-4dfc-a5ec-60772b2e26e9" controls muted playsinline></video>
|
|
132
|
+
|
|
133
|
+
A console opens and closes five session panels. The deck ends empty and the page reports zero open — but two heap snapshots disagree. `heap diff` lists ten detached nodes still reachable and names each one by the constructor that built it: `<div class="panel" id="session-1">`. `heap census` puts 1,049,008 retained bytes behind one of them, and `heap retainers` walks the edge keeping it alive — a `ClosedSession` object holding the panel on its `element` property.
|
|
134
|
+
|
|
135
|
+
`capture heap retainers <snap> --node <node-id>` · [full clip, 24s](demo/10-heap-detached.mp4)
|
|
136
|
+
|
|
137
|
+
### 11. The API never answered. The dashboard didn't change by one pixel.
|
|
138
|
+
|
|
139
|
+
<video src="https://github.com/user-attachments/assets/bb29c58d-c9bb-4640-8756-d649925499d3" controls muted playsinline></video>
|
|
140
|
+
|
|
141
|
+
The agent reads `$518.40` off a revenue dashboard, installs one rule document that fails the metrics API, and reloads. The skeletons shimmer, the cards fill, and the page shows `$518.40` again. `measure diff --pixels` reports **0 changed pixels across 1280×800**, while the HAR for that one URL carries both loads side by side: `200 · 56 bytes`, then `response incomplete: failed`. Mocking the route is the setup. The measurement is what shows the failure left nothing on screen to see.
|
|
142
|
+
|
|
143
|
+
`capture tab mock start --rules <rules.json>` · [full clip, 26s](demo/11-mock-silent-failure.mp4)
|
|
144
|
+
|
|
121
145
|
## Quick start
|
|
122
146
|
|
|
123
147
|
Needs Node and a Chrome. `capture tab launch` starts a headless browser that capture owns and reaps — it looks for `$CAPTURE_BROWSER`, then a `~/.cache/puppeteer` Chrome, then a system Chrome. If a CDP-enabled browser is already running, capture can attach to that instead.
|
package/bin/capture
CHANGED
|
@@ -10512,7 +10512,7 @@ function validateHarAppendBatch(value, source) {
|
|
|
10512
10512
|
return { entries, incompleteLifecycles };
|
|
10513
10513
|
}
|
|
10514
10514
|
function captureVersion() {
|
|
10515
|
-
const version = "1.4.
|
|
10515
|
+
const version = "1.4.14";
|
|
10516
10516
|
return typeof version === "string" && version.length > 0 ? version : "development";
|
|
10517
10517
|
}
|
|
10518
10518
|
function token() {
|
|
@@ -12614,7 +12614,7 @@ function wallTime(value) {
|
|
|
12614
12614
|
}
|
|
12615
12615
|
}
|
|
12616
12616
|
function captureVersion2() {
|
|
12617
|
-
const version = "1.4.
|
|
12617
|
+
const version = "1.4.14";
|
|
12618
12618
|
return typeof version === "string" && version.length > 0 ? version : "development";
|
|
12619
12619
|
}
|
|
12620
12620
|
function deepFreeze(value) {
|
|
@@ -16091,7 +16091,7 @@ var init_commands = __esm({
|
|
|
16091
16091
|
};
|
|
16092
16092
|
SESSION_TAB_ATTACH_TIMEOUT_MS = 5e3;
|
|
16093
16093
|
COMMAND_BLOCK = `<command name="session">
|
|
16094
|
-
the
|
|
16094
|
+
the work's evidence bundle \u2014 \`start\` opens or adopts a tab, records its network traffic (HAR) and external logs, and collects every artifact into one directory; while running, every command auto-targets its tab
|
|
16095
16095
|
use when collecting or reading the traffic, logs, and artifacts of scoped work against one page
|
|
16096
16096
|
</command>`;
|
|
16097
16097
|
START_USAGE = `capture session start [--url <url> | --target <tab-id>] [--hold] [--port <n>] [--artifact-dir <path>] \u2014 open or adopt a tab, record HAR, and set the active capture context.
|
|
@@ -230686,7 +230686,7 @@ var init_tab = __esm({
|
|
|
230686
230686
|
init_network();
|
|
230687
230687
|
init_mock();
|
|
230688
230688
|
COMMAND_BLOCK3 = `<command name="tab">
|
|
230689
|
-
browser and tab plumbing \u2014
|
|
230689
|
+
browser and tab plumbing \u2014 launch or quit a browser capture owns, discover endpoints and tabs, open/close/reset tabs, and set the tab's network conditions (throttling, offline, mocked responses)
|
|
230690
230690
|
use when starting, finding, opening, closing, or resetting a browser tab, or changing its network conditions
|
|
230691
230691
|
</command>`;
|
|
230692
230692
|
TAB_USAGE = `<command name="tab" description="browser and tab lifecycle">
|
|
@@ -243961,8 +243961,8 @@ var init_measure = __esm({
|
|
|
243961
243961
|
init_map_ax2();
|
|
243962
243962
|
init_map_paint();
|
|
243963
243963
|
COMMAND_BLOCK6 = `<command name="measure">
|
|
243964
|
-
|
|
243965
|
-
use
|
|
243964
|
+
static page measurement \u2014 \`snap\` waits for the page to settle, then records its layout, styles, text, and accessibility into one artifact; every other leaf answers questions from that artifact without re-driving the browser
|
|
243965
|
+
use when a claim depends on what is rendered right now: element geometry, overflow, clipping, stacking, computed style and where it came from, text and contrast, focus order, scroll containers, paint coverage, or the difference between two snapshots
|
|
243966
243966
|
</command>`;
|
|
243967
243967
|
MEASURE_USAGE = `<command name="measure" description="enriched snapshot substrate and read-only queries">
|
|
243968
243968
|
<model>\`snap\` drives the page (or a base snapshot) and writes one settled artifact directory; every other leaf below reads that artifact and never re-drives the browser unless its target is a URL, which first creates a snapshot. Findings exit 0 \u2014 a report, not a failure. \`--gate\` (exit 2 on findings or changes) is accepted only by check and diff.</model>
|
|
@@ -245996,8 +245996,8 @@ var init_motion2 = __esm({
|
|
|
245996
245996
|
init_jank2();
|
|
245997
245997
|
init_response2();
|
|
245998
245998
|
COMMAND_BLOCK7 = `<command name="motion">
|
|
245999
|
-
|
|
246000
|
-
use
|
|
245999
|
+
screen recording \u2014 \`rec\` screencasts the tab through an interaction; every other leaf answers what moved, where, and how long it took from that recording's frames
|
|
246000
|
+
use when a claim depends on change over time: element motion across frames, which screen regions changed, layout shifts and long tasks, or the time from an input to a settled screen; for trace-event timing use \`perf\` instead
|
|
246001
246001
|
</command>`;
|
|
246002
246002
|
MOTION_USAGE = `<command name="motion" description="recording lifecycle and read-only queries over a finalized recording">
|
|
246003
246003
|
<model>\`rec\` drives and records the browser, one-shot or composed across intervening commands; every other leaf below reads the finalized recording artifact. Findings exit 0 \u2014 a report, not a failure; input and precondition errors exit 1. No leaf accepts --gate.</model>
|
|
@@ -265772,8 +265772,8 @@ var init_perf = __esm({
|
|
|
265772
265772
|
init_vitals();
|
|
265773
265773
|
init_insights2();
|
|
265774
265774
|
COMMAND_BLOCK8 = `<command name="perf">
|
|
265775
|
-
|
|
265776
|
-
use
|
|
265775
|
+
Chrome performance tracing \u2014 \`trace\` records a DevTools performance trace over a page load or an interaction; \`vitals\` and \`insights\` read it back without re-running anything
|
|
265776
|
+
use when a claim depends on runtime performance: LCP, INP, and CLS with attribution, or DevTools' computed insights such as render-blocking requests, forced reflow, and layout-shift culprits
|
|
265777
265777
|
</command>`;
|
|
265778
265778
|
HELP7 = `<command name="perf" description="the Chrome performance-trace substrate">
|
|
265779
265779
|
<model>\`trace\` drives (and records) the browser, one-shot or composed across intervening commands; the other leaves are cheap reads over the finalized trace artifact. Findings exit 0 \u2014 a report, not a failure; input/precondition errors exit 1. No leaf accepts --gate.</model>
|
|
@@ -266726,8 +266726,8 @@ var init_heap2 = __esm({
|
|
|
266726
266726
|
init_retainers();
|
|
266727
266727
|
init_diff4();
|
|
266728
266728
|
COMMAND_BLOCK9 = `<command name="heap">
|
|
266729
|
-
|
|
266730
|
-
use
|
|
266729
|
+
JavaScript memory \u2014 \`snapshot\` writes the tab's V8 heap snapshot; every other leaf queries that object graph without touching the browser
|
|
266730
|
+
use when a claim depends on memory: what the heap holds per constructor, which objects exist, what keeps one alive, duplicated strings, or what grew between two snapshots when hunting a leak
|
|
266731
266731
|
</command>`;
|
|
266732
266732
|
HELP13 = `<command name="heap" description="the V8 heap-snapshot substrate">
|
|
266733
266733
|
<model>\`snapshot\` drives the browser; every other leaf is a read of the finalized snapshot artifact and never touches Chrome. Retained sizes are dominator-subtree sums of Chrome's own self_size. Findings exit 0; input/precondition errors exit 1. No leaf accepts --gate.</model>
|
|
@@ -267060,7 +267060,7 @@ var init_lighthouse = __esm({
|
|
|
267060
267060
|
init_lifecycle();
|
|
267061
267061
|
init_render();
|
|
267062
267062
|
COMMAND_BLOCK10 = `<command name="lighthouse">
|
|
267063
|
-
|
|
267063
|
+
Google Lighthouse audits \u2014 capture runs Lighthouse against a URL and stores its scored report unmodified
|
|
267064
267064
|
use for one Lighthouse report's audited accessibility, SEO, performance, or best-practices conditions, categories, scores, and audits
|
|
267065
267065
|
</command>`;
|
|
267066
267066
|
HELP14 = `capture lighthouse <url> [--categories <list>] [--preset mobile|desktop] [--limit <N>] [--out <path>] \u2014 run Lighthouse's third-party scored diagnostic sweep against a URL and store its report
|
|
@@ -267289,14 +267289,14 @@ function rootHelp() {
|
|
|
267289
267289
|
|
|
267290
267290
|
${ROOT_BLOCKS.join("\n\n")}
|
|
267291
267291
|
|
|
267292
|
-
Selecting a noun: session, page, and tab address the live browser
|
|
267292
|
+
Selecting a noun: session, page, and tab address the live browser; measure, motion, perf, and heap each record once and then answer many questions from that recording \u2014 a settled snapshot, a screencast, a performance trace, a heap snapshot; lighthouse, cdp, and lib are third-party audit, raw protocol, and local-library surfaces. Record with the noun whose artifact holds the facts you need, then query it.
|
|
267293
267293
|
|
|
267294
267294
|
I/O contract: flags and positionals on input; one rendered prose block on stdout. --json mirrors the same result as JSON, but the rendered block is the contract. stderr carries in-flight diagnostics only. --artifact-dir <path> selects the root for a session bundle (\`session start\`) or a sessionless artifact-producing leaf's one-shot bundle; leaf help states when it writes one. --out always names one caller-owned file, never a bundle directory.
|
|
267295
267295
|
|
|
267296
267296
|
A CDP-enabled browser must be running; \`capture tab list\` is the probe, and \`capture tab launch\` starts one capture owns and reaps when nothing is (never hand-roll a detached browser \u2014 nothing reaps that). Capture never signals a browser it did not start, so attaching to your own with --port is unchanged. CDP_PORT / CDP_TARGET pin the browser + tab for target-selecting commands \u2014 precedence: explicit flag > active session > env. \`session start\` adopts only an explicit --target.`;
|
|
267297
267297
|
}
|
|
267298
267298
|
function printVersion() {
|
|
267299
|
-
const declared = "1.4.
|
|
267299
|
+
const declared = "1.4.14";
|
|
267300
267300
|
if (declared) {
|
|
267301
267301
|
console.log(declared);
|
|
267302
267302
|
return;
|
package/package.json
CHANGED
package/src/capture.ts
CHANGED
|
@@ -61,7 +61,7 @@ function rootHelp(): string {
|
|
|
61
61
|
|
|
62
62
|
${ROOT_BLOCKS.join('\n\n')}
|
|
63
63
|
|
|
64
|
-
Selecting a noun: session, page, and tab address the live browser
|
|
64
|
+
Selecting a noun: session, page, and tab address the live browser; measure, motion, perf, and heap each record once and then answer many questions from that recording — a settled snapshot, a screencast, a performance trace, a heap snapshot; lighthouse, cdp, and lib are third-party audit, raw protocol, and local-library surfaces. Record with the noun whose artifact holds the facts you need, then query it.
|
|
65
65
|
|
|
66
66
|
I/O contract: flags and positionals on input; one rendered prose block on stdout. --json mirrors the same result as JSON, but the rendered block is the contract. stderr carries in-flight diagnostics only. --artifact-dir <path> selects the root for a session bundle (\`session start\`) or a sessionless artifact-producing leaf's one-shot bundle; leaf help states when it writes one. --out always names one caller-owned file, never a bundle directory.
|
|
67
67
|
|
|
@@ -7,8 +7,8 @@ import { cmdHeapRetainers } from './retainers.js';
|
|
|
7
7
|
import { cmdHeapDiff } from './diff.js';
|
|
8
8
|
|
|
9
9
|
export const COMMAND_BLOCK = `<command name="heap">
|
|
10
|
-
|
|
11
|
-
use
|
|
10
|
+
JavaScript memory — \`snapshot\` writes the tab's V8 heap snapshot; every other leaf queries that object graph without touching the browser
|
|
11
|
+
use when a claim depends on memory: what the heap holds per constructor, which objects exist, what keeps one alive, duplicated strings, or what grew between two snapshots when hunting a leak
|
|
12
12
|
</command>`;
|
|
13
13
|
|
|
14
14
|
const HELP = `<command name="heap" description="the V8 heap-snapshot substrate">
|
|
@@ -16,7 +16,7 @@ import { stopAndReapCollectorHostAtSessionStop } from '../host/lifecycle.js';
|
|
|
16
16
|
import { capped, emitResult, fact, formatArtifactList, line, lineList, text, type FactLine, type JsonValue, type RenderableResult } from '../../output/render.js';
|
|
17
17
|
|
|
18
18
|
export const COMMAND_BLOCK = `<command name="lighthouse">
|
|
19
|
-
|
|
19
|
+
Google Lighthouse audits — capture runs Lighthouse against a URL and stores its scored report unmodified
|
|
20
20
|
use for one Lighthouse report's audited accessibility, SEO, performance, or best-practices conditions, categories, scores, and audits
|
|
21
21
|
</command>`;
|
|
22
22
|
|
|
@@ -24,8 +24,8 @@ import { cmdMeasureMapPaint } from './map-paint.js';
|
|
|
24
24
|
|
|
25
25
|
/** Root-help representation of this branch, assembled by `src/capture.ts`. */
|
|
26
26
|
export const COMMAND_BLOCK = `<command name="measure">
|
|
27
|
-
|
|
28
|
-
use
|
|
27
|
+
static page measurement — \`snap\` waits for the page to settle, then records its layout, styles, text, and accessibility into one artifact; every other leaf answers questions from that artifact without re-driving the browser
|
|
28
|
+
use when a claim depends on what is rendered right now: element geometry, overflow, clipping, stacking, computed style and where it came from, text and contrast, focus order, scroll containers, paint coverage, or the difference between two snapshots
|
|
29
29
|
</command>`;
|
|
30
30
|
|
|
31
31
|
export const MEASURE_USAGE = `<command name="measure" description="enriched snapshot substrate and read-only queries">
|
|
@@ -16,8 +16,8 @@ import { cmdMotionResponse } from './response.js';
|
|
|
16
16
|
|
|
17
17
|
/** Root-help representation of this branch, assembled by `src/capture.ts`. */
|
|
18
18
|
export const COMMAND_BLOCK = `<command name="motion">
|
|
19
|
-
|
|
20
|
-
use
|
|
19
|
+
screen recording — \`rec\` screencasts the tab through an interaction; every other leaf answers what moved, where, and how long it took from that recording's frames
|
|
20
|
+
use when a claim depends on change over time: element motion across frames, which screen regions changed, layout shifts and long tasks, or the time from an input to a settled screen; for trace-event timing use \`perf\` instead
|
|
21
21
|
</command>`;
|
|
22
22
|
|
|
23
23
|
export const MOTION_USAGE = `<command name="motion" description="recording lifecycle and read-only queries over a finalized recording">
|
|
@@ -5,8 +5,8 @@ import { cmdPerfVitals } from './vitals.js';
|
|
|
5
5
|
import { cmdPerfInsights } from './insights.js';
|
|
6
6
|
|
|
7
7
|
export const COMMAND_BLOCK = `<command name="perf">
|
|
8
|
-
|
|
9
|
-
use
|
|
8
|
+
Chrome performance tracing — \`trace\` records a DevTools performance trace over a page load or an interaction; \`vitals\` and \`insights\` read it back without re-running anything
|
|
9
|
+
use when a claim depends on runtime performance: LCP, INP, and CLS with attribution, or DevTools' computed insights such as render-blocking requests, forced reflow, and layout-shift culprits
|
|
10
10
|
</command>`;
|
|
11
11
|
|
|
12
12
|
const HELP = `<command name="perf" description="the Chrome performance-trace substrate">
|
|
@@ -21,7 +21,7 @@ import { tabMockMain } from './mock/index.js';
|
|
|
21
21
|
|
|
22
22
|
/** Root-help representation of this branch, assembled by `src/capture.ts`. */
|
|
23
23
|
export const COMMAND_BLOCK = `<command name="tab">
|
|
24
|
-
browser and tab plumbing —
|
|
24
|
+
browser and tab plumbing — launch or quit a browser capture owns, discover endpoints and tabs, open/close/reset tabs, and set the tab's network conditions (throttling, offline, mocked responses)
|
|
25
25
|
use when starting, finding, opening, closing, or resetting a browser tab, or changing its network conditions
|
|
26
26
|
</command>`;
|
|
27
27
|
|
package/src/session/commands.ts
CHANGED
|
@@ -383,7 +383,7 @@ export async function waitForPageLoad(
|
|
|
383
383
|
|
|
384
384
|
/** Root-help representation of this branch, assembled by `src/capture.ts`. */
|
|
385
385
|
export const COMMAND_BLOCK = `<command name="session">
|
|
386
|
-
the
|
|
386
|
+
the work's evidence bundle — \`start\` opens or adopts a tab, records its network traffic (HAR) and external logs, and collects every artifact into one directory; while running, every command auto-targets its tab
|
|
387
387
|
use when collecting or reading the traffic, logs, and artifacts of scoped work against one page
|
|
388
388
|
</command>`;
|
|
389
389
|
|