Repository navigation
feat: snapshot --interactive prints only what can be acted on - #12
Merged
Merged
Conversation
b1zya
force-pushed
the
feat-interactive-snapshot
branch
from
October 19, 2026 15:50
6d95cd5 to
a15690c
Compare
b1zya
force-pushed
the
feat-interactive-snapshot
branch
from
October 19, 2026 16:20
a15690c to
5f55856
Compare
A full snapshot of a content page is mostly text an agent never targets. `snapshot --interactive` keeps interactive roles and [cursor=pointer] elements whole (link targets, options, inner text), headings as one line to orient by, and landmarks or named containers only when they hold something kept; every other wrapper is dropped and its kept descendants move up. The daemon still takes the snapshot, so its refs stay valid for click/fill; the client rewrites the command to an inline (raw) snapshot and prunes it, in text, --raw, --json (the tree) and --filename modes. A Wikipedia article goes from 137 KB to 64 KB; pages with forms and applications shrink more.
b1zya
force-pushed
the
feat-interactive-snapshot
branch
from
October 19, 2026 16:38
5f55856 to
07f2a06
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch is stacked on #11, the roll to patchright-core 1.64.1, and targets
roll_1.64.1. Merge #11 first, then retarget this PR tomain.What it does
snapshot --interactiveprints the controls of a page and just enough structure to tell them apart:[cursor=pointer], together with their subtree (link targets, options, inner text).The daemon still takes the snapshot, so its refs stay valid for
clickandfill. The client rewrites the command to an inline (raw) snapshot and prunes the result. All four output modes work: text,--raw,--json(prunes the tree) and--filename.On a Wikipedia article the output goes from 137 KB to 64 KB. Pages with forms or application UIs shrink further.
Background
I took this idea from AhaiMk01/patchright-cli, but implemented it differently. Their
snapshot -iprints every line and only skips refs for non-interactive nodes, so the output does not get smaller.Changes
src/commands/interactiveSnapshot.ts: the pruning, for YAML and JSON, plus the guard rewrite.snapshotcase in the guards, a help overlay flag, a line in SKILL.md, and a CHANGELOG entry.tests/unit/interactiveSnapshot.spec.ts: covers the YAML and JSON pruning and the rewrite.Verification
npm run checkpasses.--raw,--jsonand--filenameall print the pruned tree, andclickon a ref from the pruned output works.🤖 Generated with Claude Code