Skip to content

feat: add read-page command and document.modelContext support - #10

Merged
aeroxy merged 14 commits into
mainfrom
dev
Jun 19, 2026
Merged

feat: add read-page command and document.modelContext support#10
aeroxy merged 14 commits into
mainfrom
dev

Conversation

@aeroxy

@aeroxy aeroxy commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added a read-page command to extract main page/article content, convert it to clean Markdown, and optionally write output to a file (including title/metadata with non-article fallback behavior).
    • Enhanced third-party tool discovery and execution to prefer WebMCP, with automatic legacy fallback and clearer API-labeled output.
  • Tests
    • Added unit tests covering title/entity handling, iframe unwrapping, readability vs fallback behavior, and output formatting rules.
  • Documentation
    • Updated README, agent guide, skill docs, and added a read-page wiki page with usage and guidance.
  • Chores
    • Added new HTML/DOM conversion and entity-decoding dependencies.

aeroxy added 2 commits June 18, 2026 09:38
Add a `read-page` command that extracts the current page's main article
as clean markdown using dom_smoothie (Readability port) and htmd
(HTML-to-Markdown converter).

Pipeline: single CDP call fetches HTML + URL simultaneously, runs
Readability extraction with DomSmoothie candidate selection, unwraps
iframe tags (innermost-first to handle arbitrary nesting), converts to
markdown stripping only truly inert elements (scripts, styles, svg,
canvas), and enriches output with title/byline/excerpt/site_name/url
metadata.

Non-article pages (SPAs, dashboards, search results) fall back to
full-page conversion so content is never silently dropped. Structural
containers (nav, footer, aside) are preserved for LLM navigation.
…tool commands

Add dual-API detection to list-3p-tools and execute-3p-tool: prefer
document.modelContext (WebMCP Origin Trial) when available, fall back
to window.__dtmcp for older Chrome versions.

- list-3p-tools: probe getTools() first, enrich output with origin
  and annotations (readOnlyHint, untrustedContentHint)
- execute-3p-tool: find tool via getTools(), execute via
  executeTool(tool, paramsJson); track hasModelContext for accurate
  error messages when WebMCP is present but tool not found
- Add awaitPromise:true to list-3p-tools (getTools() returns Promise)
- Surface API source label (WebMCP / DTMCP legacy) in text output
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 12e5fd22-b1af-4cad-bb38-e8eccf63994b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Two features are added: a new read-page CLI command that fetches the active tab's HTML and URL via CDP Runtime.evaluate, runs dom_smoothie Readability extraction with iframe unwrapping and htmd HTML-to-markdown conversion, and outputs text or structured JSON. Third-party tool commands are updated to prefer the document.modelContext WebMCP API over the legacy window.__dtmcp fallback, with enriched metadata and api-labeled output.

Changes

New read-page Command

Layer / File(s) Summary
Dependencies, CLI registration, and executor wiring
Cargo.toml, src/lib.rs, src/commands/mod.rs, src/commands/executor.rs
Adds htmd and dom_smoothie dependencies; introduces Commands::ReadPage with --output; wires telemetry naming, daemon request building, direct-execution dispatch, module export, known-args entry, and inner_execute handler.
Core read_page implementation
src/commands/read_page.rs
Implements extract_title_from_html, decode_html_entities with anti-double-decoding, ReadableMeta struct, extract_content with dom_smoothie Readability and raw-HTML fallback, unwrap_iframes innermost-first loop, format_output for text and structured JSON, and the public async read_page CDP entry point.
Unit tests
src/commands/read_page.rs
Tests for title extraction (case-insensitivity, trimming), entity decoding (multi-entity, anti-double-decoding), iframe unwrapping (basic/nested/unclosed/multiple), Readability fallback behavior, and format_output (title prepending, JSON field omission, inert tag stripping, iframe-in-markdown conversion).
read-page documentation
wiki/read-page.md
Comprehensive guide documenting command purpose, output modes (text/JSON/TOON), processing pipeline stages, element-level inert-stripping rules, iframe unwrapping semantics, title-resolution fallback order, usage guidance vs snapshot, command examples, and dependency references.
README, SKILL, and AGENTS documentation
README.md, skill/chrome-devtools/SKILL.md, AGENTS.md
Updates README with command reference and typical-workflow examples; extends SKILL with extraction capability and pattern 12 markdown usage examples; introduces AGENTS.md with architecture, daemon/session/format concepts, build/test commands, and command implementation conventions.

WebMCP Support in Third-Party Tools

Layer / File(s) Summary
list_3p_tools WebMCP JS and output
src/commands/third_party.rs
Embedded JavaScript detects and prefers document.modelContext.getTools with awaitPromise enabled; returns api/origin/annotations fields and normalizes legacy responses; text output prepends API: header and shows [origin: ...] and annotation key/value pairs per tool.
execute_3p_tool WebMCP JS and output
src/commands/third_party.rs
Adds document.modelContext.executeTool execution path returning {api: 'modelContext', result}; legacy path returns {api: 'dtmcp', result}; conditionalizes not-found error on WebMCP detection; text output shows "Executed '...' via ..." with resolved api label; docstring updated.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant CdpClient
  participant Page

  User->>CLI: read-page
  CLI->>CdpClient: Runtime.evaluate(fetch HTML+URL)
  CdpClient->>Page: Execute JS snippet
  Page-->>CdpClient: {html, url}
  CdpClient-->>CLI: Payload returned
  CLI->>CLI: extract_content(html)
  CLI->>CLI: unwrap_iframes()
  CLI->>CLI: format_output(markdown/json)
  CLI-->>User: Markdown or JSON output
Loading
sequenceDiagram
  participant User
  participant CLI
  participant CdpClient
  participant Page

  User->>CLI: list-3p-tools
  CLI->>CdpClient: Runtime.evaluate(detect & list tools)
  CdpClient->>Page: Check modelContext / __dtmcp
  Page-->>CdpClient: {api, groups, tools, metadata}
  CdpClient-->>CLI: Payload with api discriminator
  CLI->>CLI: Render API header + tool details
  CLI-->>User: Formatted tool list with API label
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • aeroxy/chrome-devtools-cli#7: Both PRs modify src/commands/third_party.rs, specifically list_3p_tools and execute_3p_tool, changing how third-party DevTools are discovered/executed and how results are formatted.
  • aeroxy/chrome-devtools-cli#8: Both PRs extend the shared CLI and output-format routing in src/lib.rs and src/commands/executor.rs for new command support.
  • aeroxy/chrome-devtools-cli#5: Both PRs modify src/commands/executor.rs command argument validation and dispatch logic (known_args and inner_execute) to register new commands.

Poem

🐇 Hippity-hop, I fetch the page,
Through CDP's wire I turn the stage—
Readability trims the noisy sea,
Iframes unwrapped for markdown free!
JSON or text, the rabbit decides,
WebMCP now where modelContext resides. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding a new read-page command for extracting page content and enhancing WebMCP support with document.modelContext.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aeroxy

aeroxy commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new read-page command to extract page content as clean markdown using dom_smoothie and htmd, and updates third-party tool integration to support WebMCP (document.modelContext) alongside the legacy __dtmcp API. Feedback highlights opportunities to optimize performance and safety in src/commands/read_page.rs. Specifically, it is recommended to replace full-string lowercasing with a zero-allocation case-insensitive search helper in extract_title_from_html and unwrap_iframes to avoid excessive memory allocations, and to use a Unicode Private Use Area character instead of a null byte placeholder in decode_html_entities to prevent issues with null-terminated strings.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/commands/third_party.rs (2)

177-185: 💤 Low value

Inconsistent use of params variable in WebMCP path.

Line 177 declares const params = {safe_params_json};, but line 185 passes {safe_params_json} directly to executeTool instead of using the local params variable. While functionally equivalent, this inconsistency differs from the legacy paths (lines 201, 208) which correctly use params.

♻️ Suggested fix for consistency
-                    const result = await document.modelContext.executeTool(tool, {safe_params_json});
+                    const result = await document.modelContext.executeTool(tool, params);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/third_party.rs` around lines 177 - 185, In the WebMCP path
execution block, the code declares a params variable at the beginning but then
passes the raw safe_params_json directly to the executeTool method call instead
of using the declared params variable. Change the executeTool call to use the
params variable that was already defined, making it consistent with how the
legacy paths handle parameter passing in the same function.

131-140: 💤 Low value

Simplify filter_map to map since the closure always returns Some.

The filter_map with an unconditional Some(...) is equivalent to map. This is a minor readability improvement.

♻️ Suggested simplification
                                 let parts: Vec<String> = ann
                                     .as_object()
                                     .map(|obj| {
                                         obj.iter()
-                                            .filter_map(|(k, v)| {
-                                                Some(format!("{}={}", k, v))
-                                            })
+                                            .map(|(k, v)| format!("{}={}", k, v))
                                             .collect()
                                     })
                                     .unwrap_or_default();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/third_party.rs` around lines 131 - 140, The code uses filter_map
with a closure that unconditionally returns Some, which is unnecessary since
filter_map is only needed when you want to selectively filter out values.
Replace the filter_map call on obj.iter() with a simple map call, and remove the
Some(...) wrapper from the closure body so it directly returns the format string
result instead of wrapping it in Some.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/third_party.rs`:
- Around line 182-186: The executeTool method call is passing the entire tool
object as the first argument, but the WebMCP API signature requires a string
tool name. In the if statement where executeTool is called, change the first
parameter from tool to tool.name so that the method receives the tool name
string instead of the tool object.

---

Nitpick comments:
In `@src/commands/third_party.rs`:
- Around line 177-185: In the WebMCP path execution block, the code declares a
params variable at the beginning but then passes the raw safe_params_json
directly to the executeTool method call instead of using the declared params
variable. Change the executeTool call to use the params variable that was
already defined, making it consistent with how the legacy paths handle parameter
passing in the same function.
- Around line 131-140: The code uses filter_map with a closure that
unconditionally returns Some, which is unnecessary since filter_map is only
needed when you want to selectively filter out values. Replace the filter_map
call on obj.iter() with a simple map call, and remove the Some(...) wrapper from
the closure body so it directly returns the format string result instead of
wrapping it in Some.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea6c1f59-b5f7-4c52-bc1b-6471efec0168

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7737c and 2e9b04b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Cargo.toml
  • src/commands/executor.rs
  • src/commands/mod.rs
  • src/commands/read_page.rs
  • src/commands/third_party.rs
  • src/lib.rs

Comment thread src/commands/third_party.rs
@aeroxy

aeroxy commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@aeroxy

aeroxy commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the read-page command to extract page content as clean markdown using dom_smoothie and htmd, along with updating third-party tool integration to support WebMCP. Feedback highlights a bug in the case-insensitive search function find_ci where the search needle is not lowercased, and notes that the manual HTML title extraction and entity decoding are fragile and incomplete, suggesting the use of the html-escape crate. Additionally, adding error handling for potential promise rejections in the WebMCP tool listing is recommended.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs
Comment thread Cargo.toml
Comment thread src/commands/read_page.rs
Comment thread src/commands/third_party.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 11-40: The markdown code fence in AGENTS.md that displays the
repository tree structure is missing a language tag, which causes markdownlint
to flag it. Find the opening fence marker (```) for the repository tree that
starts with "src/" and add the language tag "text" to it by changing ``` to
```text. This satisfies the markdownlint requirement for all code fences to have
a language identifier.

In `@src/commands/read_page.rs`:
- Around line 161-178: The issue is that when no closing tag is found in the
code block starting at line 161, the opening tag is stripped and the loop breaks
immediately, preventing the processing of any subsequent iframe tags in the
document. Replace the `break;` statement on line 165 (after stripping the
unclosed tag and resetting best_open and best_close to None) with `continue;` so
the loop continues to the next iteration and processes remaining tags instead of
exiting prematurely.

In `@src/commands/third_party.rs`:
- Around line 16-30: The promise chain returned by
document.modelContext.getTools() lacks error handling, which allows promise
rejections to propagate uncaught to Runtime.evaluate. Add a .catch() handler to
the getTools() promise chain to handle potential errors (permissions, internal
errors, etc.) and return an appropriate error response or default value, similar
to how the legacy path and execute_3p_tool operations wrap their logic in
try/catch blocks.

In `@wiki/read-page.md`:
- Around line 42-53: Remove the null-valued fields from the JSON response
example in the read-page documentation. Specifically, delete the lines
containing "byline": null and "site_name": null from the example JSON object,
since the formatter omits missing metadata keys entirely rather than including
them with null values. The resulting example should only show fields that have
actual values (markdown, title, excerpt, url).
- Around line 61-67: The code fence containing the pipeline diagram (starting
with "CDP Runtime.evaluate") is missing a language tag, which causes
markdownlint to flag it. Add the language tag `text` to the opening fence by
changing the opening ``` to ```text while keeping the closing ``` and all the
diagram content unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 74df3b87-d1b2-42d4-a836-514fd8f3335a

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7737c and 77163de.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • AGENTS.md
  • Cargo.toml
  • README.md
  • skill/chrome-devtools/SKILL.md
  • src/commands/executor.rs
  • src/commands/mod.rs
  • src/commands/read_page.rs
  • src/commands/third_party.rs
  • src/lib.rs
  • wiki/read-page.md

Comment thread AGENTS.md Outdated
Comment thread src/commands/read_page.rs
Comment thread src/commands/third_party.rs Outdated
Comment thread wiki/read-page.md
Comment thread wiki/read-page.md Outdated
@aeroxy

aeroxy commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command to extract page content as clean, LLM-friendly markdown using dom_smoothie (a Rust port of Mozilla Readability) and htmd (HTML to Markdown). It also updates the third-party tools commands (list-3p-tools and execute-3p-tool) to support WebMCP (document.modelContext) alongside the legacy __dtmcp global. A review comment correctly points out a robustness issue in unwrap_iframes where a malformed or unclosed <iframe> tag (lacking a closing >) would cause the loop to break prematurely, preventing the processing of subsequent valid iframes. The reviewer's suggestion to advance search_from and continue instead of breaking is highly recommended.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs Outdated
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command to extract page content as clean markdown using dom_smoothie and htmd, and updates third-party tool commands to support WebMCP. The review feedback suggests optimizing the case-insensitive search helper, correcting a misleading doc comment regarding HTML entity decoding, and hardening the iframe unwrapping logic against malformed tags.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs Outdated
Comment thread src/commands/read_page.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/third_party.rs`:
- Around line 176-191: The `document.modelContext.executeTool()` method expects
parameters as a JSON string, but the current code in the `executeTool` call
within the async function is passing an object literal by interpolating
safe_params_json directly. Replace the second argument of the executeTool call
from the current object literal syntax to JSON.stringify(params), which will
properly serialize the already-defined params object into a JSON string as
required by the WebMCP specification.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4417a20-63a6-4790-b83a-37c02afe378a

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7737c and 62aadb9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • AGENTS.md
  • Cargo.toml
  • README.md
  • skill/chrome-devtools/SKILL.md
  • src/commands/executor.rs
  • src/commands/mod.rs
  • src/commands/read_page.rs
  • src/commands/third_party.rs
  • src/lib.rs
  • wiki/read-page.md

Comment thread src/commands/third_party.rs
- Reuse needle bytes during case-insensitive matching
- Use html_escape entity decoding directly
- Avoid crossing tag boundaries when locating iframe close tags
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command to extract page content as clean markdown using dom_smoothie and htmd, complete with documentation, tests, and a dedicated wiki page. It also updates third-party tool integration to support WebMCP (document.modelContext) alongside the legacy __dtmcp global. Feedback focuses on fixing a bug in unwrap_iframes where the nested tag check incorrectly matches the < of the closing tag itself, and a minor optimization to reuse the params variable in the WebMCP tool execution block.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs Outdated
Comment thread src/commands/third_party.rs Outdated
- Exclude the current '<' when checking for nested tag boundaries in iframe unwrapping
- Pass resolved `params` to `executeTool` instead of the original serialized param
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the read-page command, which extracts page content as clean markdown using dom_smoothie and htmd, complete with iframe unwrapping, fallback handling, and structured output formats. It also updates the third-party tools commands to support WebMCP (document.modelContext) alongside the legacy __dtmcp global. Feedback focuses on improving robustness: implementing a find_tag_end helper to correctly parse HTML tags with attributes containing > characters, adding a null check for document.documentElement to prevent TypeError on empty tabs, and explicitly mapping the "none" API type to "None" in the CLI output.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs
Comment thread src/commands/read_page.rs Outdated
Comment thread src/commands/third_party.rs
- Safely return empty HTML when document.documentElement is unavailable
- Add quote-aware tag end detection to avoid parsing '>' inside attributes
- Reuse tag parser for title extraction and iframe unwrapping
- Display "None" for third-party tools without an API type
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command that extracts the main article content of a page as clean markdown using dom_smoothie and htmd. It also updates the third-party tools integration to support WebMCP (document.modelContext) alongside the legacy __dtmcp global. The review feedback suggests checking for exceptionDetails first when listing third-party tools to handle JS exceptions gracefully, and avoiding redundant JSON.stringify calls in the evaluated JavaScript for read-page to prevent double serialization and simplify the Rust deserialization logic.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/third_party.rs
Comment thread src/commands/read_page.rs Outdated
Comment thread src/commands/read_page.rs Outdated
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command that extracts the main article content of a page as clean, LLM-friendly markdown using dom_smoothie and htmd. It also updates the third-party tools command to support WebMCP (document.modelContext) alongside the legacy __dtmcp global. The review feedback points out a compilation error in third_party.rs due to an un-prefixed bail! macro, and suggests an optimization in read_page.rs to avoid heap allocation by passing a static array instead of a Vec to skip_tags.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/third_party.rs
Comment thread src/commands/read_page.rs
@aeroxy

aeroxy commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new read-page command to the Chrome DevTools CLI, which extracts the main article content of a page as clean, LLM-friendly markdown using dom_smoothie and htmd. It includes nested iframe unwrapping, fallback mechanisms for non-article pages, and comprehensive unit tests and documentation. Additionally, the third-party tool commands (list-3p-tools and execute-3p-tool) have been updated to support the WebMCP API (document.modelContext) alongside the legacy __dtmcp global. There are no review comments provided, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@aeroxy
aeroxy merged commit 6edca49 into main Jun 19, 2026
1 check passed
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.

1 participant