pxtree

v0.1.2
io.github.alabsi91/pxtree Checked 3 days ago Published 2 months ago

Measures how a webpage actually renders and prints it as compact text for AI coding agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

measure

Measures how a webpage renders in headless Chromium and returns compact text: a facts line, changes since the last run, a findings summary, then an indented tree, one line per element. Findings are measurements that passed a threshold, never verdicts. Parameters: target (URL, host or HTML file path), viewports, schemes, scroll, element, children, colors, wait, script (Playwright page code), screenshot, timeout, diff, diffKey, report (tree, findings, summary, changes or none), aria (names, roles, states). One call returns the report, aria tree and screenshot for every viewport, scheme and scro…

ParameterTypeDescription
target *stringA string: URL, host like localhost:5173, or HTML file path under the working directory
ariabooleanA boolean: add Playwright's aria snapshot of the page, or of each element match, after the report
childrenbooleanA boolean. With element: include what is inside the matches. Default true
colorsbooleanA boolean: print hex colors in [text] and [renders]
diffbooleanA boolean: compare with the previous run of the same target and settings. Default true
diffKeystringA name string that replaces script and wait in the since-last-run key, to compare a scripted run with a plain run that used the same name
elementstringA CSS selector string: print only matching elements and their ancestor lines
maxCharsnumberA number: the longest report in characters. Past it the tree is cut at a line; facts, since last run and summary stay. Default 80000
reportstringOne of "tree", "findings", "summary", "changes", "none". tree: everything. findings: only lines with findings and their ancestors. summary: no tree. changes: facts line and since last run. none: facts…
schemesarrayAn array of "light" and "dark", the prefers-color-scheme per run. Default ["light"]
screenshotbooleanA boolean: save a PNG per run under the OS temp directory and return its path
scriptstringA string: the body of async (page) => {}, or a whole function like async (page) => {}, run with the Playwright page before measuring. It is trusted code that runs as Node in the server process with it…
scrollA stop or an array of stops: a number or digit string is a window y offset, "end" is the bottom, anything else is a CSS selector to scroll to the top. An array measures each stop in turn, one run per…
timeoutnumberA number of milliseconds to reach DOMContentLoaded. The script, a wait, reveal, settle and measuring each get this long again. Default 30000
viewportsarrayAn array of { width, height } with integer numbers, one run each. Default [{ width: 1280, height: 800 }]
waitAfter the script: a number or digit string of milliseconds to sleep, at most timeout, or a CSS selector string to wait up to timeout for

read_me_first

Read once per session before the first measure. How to use pxtree and how to read its output.