Repository navigation
feat(site): site analyze, site verify, and OpenCLI commands through its own runtime - #407
Merged
Merged
Conversation
…anks after ours on every domain spelling
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (11)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Borrowed from OpenCLI (jackwener/OpenCLI), and reusing its adapters directly rather than copying them.
site analyze [url]Scans the page for what an adapter should read: same-site API calls the page made (Resource Timing, scored; analytics/ads dropped), state it embeds (
__NEXT_DATA__,__INITIAL_STATE__, JSON script tags; devtools-extension globals dropped), anti-bot vendors (reuses the humanize markers), webpack bundles, and the adapters already installed. Recommends a strategy in breakage order: page fetch → page state → DOM, with next steps.site verify <name>/<cmd> [args] [--write-fixture]Runs the adapter, then compares the result's shape with
~/.chrome-use/site-fixtures/<name>/<cmd>.json: a missing field, a type change, or a list that came back empty fails with exit 1.--write-fixturerecords the shape (types only, no values). Works for our adapters and OpenCLI ones.OpenCLI commands
When Node.js 20+ is on PATH,
site updateinstalls a pinned@jackwener/opencli(1.8.8;npm install --ignore-scripts, no token) into~/.chrome-use/opencli. Aname/cmdneither of our packs has runs throughopencli_runner.mjs, which loads OpenCLI's own registry, argument coercion, pipeline executor andBasePage, with a page subclass whose transport is chrome-use (open,eval,cookies get,screenshot,tab), so it drives the caller's session and logins.site listmarks them(opencli),site infoshows their args, and the domain hint lists them after ours (separate.index-opencli.json, so ours win regardless of how each pack spells the domain). Ours win on a shared name.AGENT_BROWSER_SITES_NO_OPENCLI=1turns it off;AGENT_BROWSER_OPENCLI_VERSIONoverrides the pin.Verified (release build, real Chrome)
hackernews/best(public),zhihu/hotpipeline andbilibili/feed/bilibili/dynamic(logged-in, WBI signing via Node crypto) return data;zhihu/hotresolves to our adapter when both exist;site verify hackernews/best --write-fixturethensite verifypass.site analyze https://www.v2ex.comfinds/api/nodes/list.json→page-fetch.v2ex/hot, v2ex/latest, v2ex/topicbefore OpenCLI's.cargo test --release: 1481 passed.Summary by CodeRabbit
site analyzeto inspect a page’s data sources and detected anti-bot vendors, with recommended next steps.site listandsite info.site verifyto check adapter results and optionally save a structural fixture for future checks.