Skip to content

feat(cli): render pages in a local Chrome over CDP with --render-cdp #2306 - #2307

Draft
nc9 wants to merge 2 commits into
mainfrom
boat/render-cdp-2306
Draft

nc9 wants to merge 2 commits into
mainfrom
boat/render-cdp-2306

Conversation

@nc9

@nc9 nc9 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Closes #2306

--render-cdp <url> and [render] cdp_url render pages in a Chrome the user runs, over the DevTools Protocol. New cdp-render DocumentFetcher in packages/fetchers (no new dependency: JSON over the runtime's WebSocket), wired in the audit controller; auto reuses createHybridDocumentFetcher.

Acceptance criteria

  • Signed out, --render-cdp <endpoint> --render-mode all renders every crawled HTML page and the report marks it rendered. Evidence: live run of squirrel audit against a fake CDP browser, signed out: render: {requested:true, mode:"all", pagesRendered:2}, stored pages fetcher_id = cdp-render; unit test "returns the rendered DOM with the main document's status, headers and redirect chain".
  • auto: only client-rendered shells open in the browser. Live run: browser visited only /a (the shell), mode:"auto"; test "renderStrategy auto is the HTTP-first hybrid".
  • Unreachable endpoint: audit finishes on plain HTTP and states why. Live run: fallbackReason: "Chrome endpoint unreachable (connection refused)", 0 of 2 rendered, console line "Local browser rendering fell back to plain HTTP (...)"; test "goes to plain HTTP for the whole run, once and with the reason".
  • robots.txt and page limits unchanged: the crawler decides which URLs reach the fetcher and the fetcher is only called for those; nothing else opens a browser tab. Redirect hops are vetted with the crawl's egress policy (test "fails a redirect hop to a metadata address..."). Note: respect_robots defaults to false, so a robots-disallowed page is crawled in plain HTTP too; with it on, the crawler skips it before the fetcher.
  • --render-cdp with --http refused ("--render-cdp and --http cannot be combined"); also refused with --render and --render-mode off. Test: "validateAuditFlags with --render-cdp".
  • Documented in docs/guides/browser-rendering.mdx (new section), docs/cli/audit.mdx, docs/configuration/index.mdx.

Also: per-page failure, timeout, bot wall (401/403/429/503) and non-HTML fall back to plain HTTP; non-public hosts no longer turn rendering off when a local Chrome is set; shell completions updated; changelog entry added.

Verification (run in foreground)

  • format:check, lint, typecheck: packages/fetchers, packages/config, apps/cli all clean.
  • bun scripts/changelog.ts check OK; scripts/test-suites.ts --check OK; make validate in docs/ OK (78 pass); bun run docs:check OK.
  • CI suites: --run rest 3978 pass 0 fail; --run cli 4682 pass, 14 skip, 0 fail. New tests: packages/fetchers/src/cdp-render.test.ts (10), apps/cli/tests/controllers/render-cdp-2306.test.ts (14).

Agent skill: the squirrelscan skill may want a line about --render-cdp; a skills issue is for the maintainer to file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: render pages in a local Chrome over CDP (--render-cdp)

1 participant