Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. 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 |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces two new commands, run-script and adapter, to the chrome-devtools CLI, enabling the execution of local JavaScript files and site-specific custom adapters with injected helper utilities and domain protection. Feedback on these changes suggests extracting the duplicated ctx helper definition and the hardcoded 100ms polling interval into shared constants or helpers to improve maintainability. Additionally, it is recommended to avoid prepending www. when constructing target URLs for domain protection to prevent navigation failures on domains that do not use the subdomain.
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.
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 `@skill/chrome-devtools/examples/deepwiki_adapter.js`:
- Around line 33-34: The readWiki flow currently performs navigation and then
waits in the same execution context, which breaks because setting
window.location.href tears down the Runtime.evaluate context. Update readWiki in
deepwiki_adapter.js so it only scrapes the current page and does not navigate or
call ctx.waitForSelector; move the wiki navigation responsibility to run_adapter
or its caller, and keep readWiki focused on reading article/wiki-content from
the already loaded page.
In `@skill/chrome-devtools/examples/search_deepwiki.js`:
- Around line 4-33: The search_deepwiki example is incompatible with the
run-script wrapper because it re-wraps execution in a nested async IIFE, which
causes the returned value to be lost. Update the script to match the injected
async context used by run_script, using the existing ctx helpers directly in the
top-level flow of search_deepwiki.js. Also remove the window.location.href
navigation fallback, since changing pages breaks the evaluation context;
instead, validate the current DeepWiki page up front and fail fast or move this
example to an adapter-based approach.
In `@src/commands/evaluate.rs`:
- Around line 203-208: The fallback navigation in evaluate::evaluate is
rewriting bare domains too aggressively by forcing every non-HTTP target into
https://www.<domain>. Update the target_url construction for domains[0] so it
preserves the original host when no scheme is present, and only prepends a
scheme or otherwise normalizes the input without assuming a www subdomain. Keep
the logic localized around the target_domain/target_url branch so adapters with
apex hosts or existing subdomains navigate correctly.
- Around line 228-268: The wrapper built in evaluate.rs injects script_content
directly into an async IIFE, so exported adapter definitions like export async
function will fail to parse before the {function_name} existence check runs.
Update the evaluation path around the iife/script_content handling to either
execute adapters as modules or preprocess the loaded source to remove export
keywords before injection, and make the supported adapter format explicit in the
evaluate flow.
- Around line 110-149: The injected `script_content` in `evaluate` is executed
as a bare statement inside the async IIFE, so any returned value from a user
script is lost. Update the `iife` construction in `evaluate` to return or await
the injected expression so `run-script` preserves the result from scripts like
the documented async IIFE, while keeping the surrounding `ctx` helpers
unchanged.
In `@src/lib.rs`:
- Around line 435-459: `parse_args` currently ignores malformed tokens and empty
keys, which lets bad `--arg` input slip through and fail later with a misleading
error. Update `parse_args` in `src/lib.rs` to return
`anyhow::Result<serde_json::Value>`, validate every argument has a non-empty key
before inserting into the map, and return descriptive `anyhow!` errors for
tokens without `=` or invalid keys. Then update the caller that builds the
request from `parse_args` to handle the `Result` and surface the error
immediately.
🪄 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: 606dbb73-c001-49af-be28-c6dd8211bb2f
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
Cargo.tomlskill/chrome-devtools/SKILL.mdskill/chrome-devtools/examples/deepwiki_adapter.jsskill/chrome-devtools/examples/search_deepwiki.jssrc/commands/evaluate.rssrc/commands/executor.rssrc/lib.rswiki/adapter.mdwiki/run-script.md
* remove in-adapter navigation from deepwiki examples to avoid tearing down execution context * require pre-navigation and simplify async script structure with direct ctx usage * add `strip_export_keywords` to support ES module-style adapters without syntax errors * fix domain auto-navigation to preserve exact host (avoid forcing `www`) * make `parse_args` return `Result`, validate key=value format, and reject malformed inputs * update callers to handle parsing errors and add tests for new validations
* introduce `POLL_INTERVAL_MS` constant for configurable polling frequency * replace hardcoded 100ms delays in `waitForText` and `waitForSelector` * ensure consistent polling behavior across `run_script` and `run_adapter`
|
@coderabbitai full review |
|
/gemini review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces the run-script and adapter commands to the chrome-devtools CLI, enabling the execution of local JavaScript files and site-specific custom adapters with injected helper utilities and domain protection. The review feedback highlights several opportunities to improve robustness, including refining domain matching to handle ports and schemes, restricting comment parsing to actual comment lines, preserving leading zeros in CLI arguments, making export keyword stripping safer, supporting HTTP for local development, validating function names to prevent arbitrary code execution, extending the ctx.fill helper to support checkboxes and radio buttons, and making script_args optional.
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.
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/commands/evaluate.rs (1)
111-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the injected
ctxwrapper into one testable helper.The wrapper string is duplicated almost verbatim in
run_scriptandrun_adapter, so helper changes now have to stay in sync in two places. As per coding guidelines, "Pure conversion and formatting logic should be extracted into testable functions".♻️ Suggested shape
+fn build_ctx_wrapper(script_args: &serde_json::Value, body: &str) -> Result<String> { + let args_str = serde_json::to_string(script_args)?; + Ok(format!( + r#"(async () => {{ + const ctx = {{ + args: {args_str}, + wait: async (ms) => new Promise(r => setTimeout(r, ms)), + waitForText: async (text, timeout = 30000) => {{ /* ... */ }}, + waitForSelector: async (selector, timeout = 30000) => {{ /* ... */ }}, + click: async (selector) => {{ /* ... */ }}, + fill: async (selector, value) => {{ /* ... */ }} + }}; + + {body} + }})()"# + )) +}Also applies to: 262-303
🤖 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/evaluate.rs` around lines 111 - 147, The injected ctx wrapper is duplicated between run_script and run_adapter, so extract the shared IIFE/context-building string into one testable helper and have both call sites reuse it. Move the wrapper construction (including args_str, waitForText, waitForSelector, click, and fill) into a dedicated function or helper near evaluate::run_script/run_adapter, then call that helper from both paths so future changes only happen in one place.Source: Coding guidelines
🤖 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/evaluate.rs`:
- Around line 168-181: Normalize the adapter domain before comparison in
url_matches_domain so scheme and any path are stripped just like the current URL
host. Update the matching logic to compare only the hostname from the raw
`@domain` text against the host extracted from url_matches_domain, and keep the
existing exact/subdomain match behavior. This should be handled within
url_matches_domain in evaluate.rs so run_adapter() stops auto-navigating when
the adapter domain is written as https://example.com or includes a path.
- Around line 153-165: The parse_adapter_domains helper is matching any `@domain`
substring, which can pick up strings or comments inside adapter code instead of
only metadata. Update parse_adapter_domains to only accept JSDoc metadata lines
that actually declare `@domain` in the adapter header, using a stricter pattern or
by limiting parsing to the comment block associated with the adapter. Keep the
existing function name and domain extraction flow, but ensure only genuine
adapter metadata lines are collected.
In `@wiki/adapter.md`:
- Around line 69-81: The Wiki docs still show the outdated readWiki flow, so
update the example to match the fixed implementation in
skill/chrome-devtools/examples/deepwiki_adapter.js: in readWiki, remove the
ctx.args.url handling and the window.location.href navigation, and keep only the
scraping logic that reads the already-loaded page. Make sure the documented
readWiki signature and behavior match the actual adapter example so the wiki no
longer instructs users to tear down the Runtime.evaluate context before
ctx.waitForSelector runs.
In `@wiki/run-script.md`:
- Around line 28-69: Update the wiki’s Search DeepWiki example to match the
fixed behavior in search_deepwiki.js: remove the nested async IIFE wrapper, use
the top-level ctx-driven script structure that returns results directly, and
replace the in-script window.location.href navigation with an explicit “navigate
first” requirement. Keep the unique flow around ctx.args.query, ctx.fill,
ctx.click, ctx.waitForSelector, and the final return results aligned with the
actual example file so readers don’t copy the broken pattern.
---
Nitpick comments:
In `@src/commands/evaluate.rs`:
- Around line 111-147: The injected ctx wrapper is duplicated between run_script
and run_adapter, so extract the shared IIFE/context-building string into one
testable helper and have both call sites reuse it. Move the wrapper construction
(including args_str, waitForText, waitForSelector, click, and fill) into a
dedicated function or helper near evaluate::run_script/run_adapter, then call
that helper from both paths so future changes only happen in one place.
🪄 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: cd31527e-f906-4ecf-a845-b0ff586f05f0
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
Cargo.tomlskill/chrome-devtools/SKILL.mdskill/chrome-devtools/examples/deepwiki_adapter.jsskill/chrome-devtools/examples/search_deepwiki.jssrc/commands/evaluate.rssrc/commands/executor.rssrc/constants.rssrc/lib.rswiki/adapter.mdwiki/run-script.md
…RL matching, and update docs/tests * extract shared `build_ctx_object` for consistent ctx helpers across run-script and adapter * harden `@domain` parsing to only accept valid comment metadata and ignore false positives * add hostname normalization and improve domain matching logic (scheme/path/port aware) * simplify run-script execution flow and remove duplicated inline ctx code * expand tests for parsing, normalization, and ctx helper generation * update docs to clarify async execution model and navigation requirements
… reliability * handle checkbox/radio inputs correctly in `fill` helper * validate adapter function names as safe JS identifiers to prevent injection * refine export stripping to only affect real declarations * normalize hosts and detect local domains to choose correct navigation scheme * default `script_args` to empty object when omitted * preserve non-canonical numeric args (e.g., leading zeros, `+` prefix) * add tests covering identifier validation, local host detection, and parsing edge cases
|
@coderabbitai full review |
|
/gemini review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces the run-script and adapter commands to evaluate local JavaScript files and custom site adapters inside the browser context, complete with injected automation helpers (ctx), domain protection, and CLI argument parsing. The review feedback highlights an opportunity to support contenteditable elements in the ctx.fill helper and identifies a bug in normalize_host where IPv6 addresses are incorrectly truncated when stripping ports, suggesting a robust fix and additional unit tests.
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.
There was a problem hiding this comment.
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/evaluate.rs`:
- Around line 340-373: The auto-navigation in evaluate::run (the block that
calls crate::commands::navigate::navigate after building target_url) should
re-check the current URL against domains before continuing. After navigation
completes, call client.current_url(session_id).await? again and verify it still
matches at least one entry via url_matches_domain; if it does not, abort instead
of running the adapter on the wrong page.
🪄 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: 6f3b9cbc-3e8e-4d9c-841d-54d587eb727d
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
Cargo.tomlskill/chrome-devtools/SKILL.mdskill/chrome-devtools/examples/deepwiki_adapter.jsskill/chrome-devtools/examples/search_deepwiki.jssrc/commands/evaluate.rssrc/commands/executor.rssrc/constants.rssrc/lib.rswiki/adapter.mdwiki/run-script.md
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the run-script and adapter commands to the chrome-devtools CLI, enabling the execution of local JavaScript files and site-specific adapters with injected automation helpers (ctx) and automatic domain-based navigation. Feedback on these changes highlights several improvement opportunities: float arguments in parse_args lack a round-trip check, which can mutate formatted decimals; ctx.fill should explicitly guard against programmatically filling file inputs to avoid browser security errors; normalize_host strips ports, which can cause different local development ports to incorrectly match; and strip_export_keywords naively strips exports line-by-line, potentially corrupting multi-line string literals or comments.
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.
- Introduced CUSTOM_SCRIPTING.md guide for creating `run-script` and `adapter` files - Added flexible argument parsing (positional + named) with automatic mapping to ctx.args - Implemented comment-based @url/@Navigate auto-navigation for scripts - Added domain-aware adapter execution with @Domain protection - Enhanced ctx helpers (wait, waitForSelector, click, fill) for SPA compatibility - Updated SKILL.md examples to reference new scripting/adapters - Replaced DeepWiki examples with Hacker News search scripts/adapters - Improved argument parsing to support trailing raw args (`query`, `_0`, `_1`, etc.) - Added URL encoding for safe interpolation in auto-navigation - Refined evaluate.rs to remove intrusive hints and improve DOM input handling
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/evaluate.rs`:
- Around line 213-236: `run-script` in `evaluate.rs` is only checking
`url_matches_domain()`/host equality before skipping navigation, which can leave
the tab on the wrong query or path. Update the `current_url` vs
`interpolated_url` check in `run_script` to compare against the fully built
target navigation URL (the same `nav_url` logic used before
`crate::commands::navigate::navigate`), and after navigating re-read the page
URL and verify it matches that full target before continuing.
In `@src/lib.rs`:
- Around line 452-456: The float parsing branch in the argument/value parser is
rewriting non-canonical numeric tokens instead of preserving them like the
integer branch does. Update the logic in the function that matches
`v.parse::<f64>()` to only emit `serde_json::Value::Number` when the original
text is canonical, and otherwise fall back to
`serde_json::Value::String(v.to_string())` just like the integer path. Add a
regression test near `test_parse_args_preserves_leading_zeros` covering cases
such as `01.50`, `1e3`, and `+3.5` to ensure they remain strings when
non-canonical.
- Around line 340-347: The CLI parsing for raw_args in the main args struct is
swallowing later flags because trailing_var_arg and allow_hyphen_values make
option parsing stop after the first positional. Update the parsing shape around
raw_args, output, and track_navigation so those flags remain reachable after
script arguments, either by requiring explicit -- delimiter/options-first
ordering or by changing the argument definition to keep options parsed
separately. Locate the fix in the struct that defines raw_args, output, and
track_navigation.
🪄 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: d644c000-0340-448e-9d05-c863ebc2fc68
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
Cargo.tomlREADME.mdskill/chrome-devtools/CUSTOM_SCRIPTING.mdskill/chrome-devtools/SKILL.mdskill/chrome-devtools/examples/hn_adapter.jsskill/chrome-devtools/examples/search_hn.jssrc/commands/evaluate.rssrc/commands/executor.rssrc/constants.rssrc/lib.rswiki/adapter.mdwiki/run-script.md
💤 Files with no reviewable changes (1)
- README.md
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces custom scripting and site-specific adapters to the chrome-devtools CLI, adding the run-script and adapter commands along with helper utilities, documentation, and examples. The review feedback highlights several opportunities to improve robustness, including handling trailing slashes during URL comparisons to prevent spurious auto-navigation, encoding spaces as %20 instead of + for safer URL interpolation, stopping script metadata parsing at the first non-comment line to avoid false positives, and extending the fill helper to support HTMLSelectElement.
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.
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/constants.rs (1)
3-6: 📐 Maintainability & Code Quality | 🔵 TrivialExplain why 100ms was chosen.
The comment describes what this constant is for but not why 100ms is the right value. Per coding guidelines, comments should explain why, not what. Consider noting the trade-off between responsiveness and CPU/JS engine overhead.
/// Polling interval for the injected `ctx` wait helpers (waitForText / -/// waitForSelector) in run-script and adapter execution. +/// waitForSelector) in run-script and adapter execution. 100ms balances +/// responsiveness (<10% added latency on average) with minimal CPU/JS +/// engine overhead.🤖 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/constants.rs` around lines 3 - 6, Update the comment on POLL_INTERVAL_MS in constants.rs to explain why the 100ms value was chosen, not just what it is used for. In the POLL_INTERVAL_MS definition, mention the trade-off between responsiveness in waitForText/waitForSelector and avoiding excessive CPU/JS engine overhead during run-script and adapter execution.Source: Coding guidelines
skill/chrome-devtools/CUSTOM_SCRIPTING.md (1)
71-98: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winEmbedded example "Run with" comments don't match the actual example files.
This guide's copies of
search_hn.js(line 76) andhn_adapter.js(line 107) show positional invocation (... search_hn.js "Rust"/... hn_adapter.js search "Rust"), but the real files underskill/chrome-devtools/examples/use named-argument style (-a query="Rust"). Keep the embedded snippets in sync with the actual example files to avoid confusing users copying commands straight from the doc.Also applies to: 100-134
🤖 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 `@skill/chrome-devtools/CUSTOM_SCRIPTING.md` around lines 71 - 98, The embedded “Run with” example in the CUSTOM_SCRIPTING guide is out of sync with the real example scripts. Update the snippets for search_hn.js and hn_adapter.js so their invocation matches the actual files under skill/chrome-devtools/examples/, using the named-argument form instead of positional arguments. Keep the example command text in sync wherever these script names appear so users copy the correct usage.src/commands/executor.rs (1)
574-628: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNear-duplicate argument-extraction logic between
run-scriptandadapter.Both blocks repeat the identical pattern for
file_path/script_args/output/track_navigationextraction, differing only by the extrafunction_nameforadapter. Consider extracting a small helper to reduce duplication.♻️ Possible refactor
+struct ScriptCommonArgs<'a> { + file_path: &'a str, + script_args: serde_json::Value, + output: Option<&'a str>, + track_navigation: bool, +} + +fn extract_script_common_args<'a>(args: &'a serde_json::Value) -> Result<ScriptCommonArgs<'a>> { + let file_path = args + .get("file_path") + .and_then(|v| v.as_str()) + .ok_or_else(|| anyhow!("file_path required"))?; + let script_args = args.get("script_args").cloned().unwrap_or_else(|| json!({})); + let output = args.get("output").and_then(|v| v.as_str()); + let track_navigation = args + .get("track_navigation") + .and_then(|v| v.as_bool()) + .unwrap_or(false); + Ok(ScriptCommonArgs { file_path, script_args, output, track_navigation }) +}🤖 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/executor.rs` around lines 574 - 628, Extract the repeated argument parsing in `executor.rs` for the `run-script` and `adapter` match arms into a small shared helper. Keep the existing behavior for `file_path`, `script_args`, `output`, and `track_navigation`, and let `adapter` reuse the same helper while still handling its extra `function_name` requirement. Use the `run_script` and `run_adapter` call sites to centralize the common extraction logic and remove duplication.
🤖 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/lib.rs`:
- Around line 331-370: The CLI docs for the RunScript and Adapter commands need
to reflect clap’s #[arg(last = true)] behavior for raw_args: options like output
and track_navigation must appear before positional arguments, or be placed after
a -- separator. Update the usage/synopsis text and examples associated with the
RunScript and Adapter variants in lib.rs so they show the correct ordering and
avoid suggesting forms like run-script foo.js query --output out.json.
---
Nitpick comments:
In `@skill/chrome-devtools/CUSTOM_SCRIPTING.md`:
- Around line 71-98: The embedded “Run with” example in the CUSTOM_SCRIPTING
guide is out of sync with the real example scripts. Update the snippets for
search_hn.js and hn_adapter.js so their invocation matches the actual files
under skill/chrome-devtools/examples/, using the named-argument form instead of
positional arguments. Keep the example command text in sync wherever these
script names appear so users copy the correct usage.
In `@src/commands/executor.rs`:
- Around line 574-628: Extract the repeated argument parsing in `executor.rs`
for the `run-script` and `adapter` match arms into a small shared helper. Keep
the existing behavior for `file_path`, `script_args`, `output`, and
`track_navigation`, and let `adapter` reuse the same helper while still handling
its extra `function_name` requirement. Use the `run_script` and `run_adapter`
call sites to centralize the common extraction logic and remove duplication.
In `@src/constants.rs`:
- Around line 3-6: Update the comment on POLL_INTERVAL_MS in constants.rs to
explain why the 100ms value was chosen, not just what it is used for. In the
POLL_INTERVAL_MS definition, mention the trade-off between responsiveness in
waitForText/waitForSelector and avoiding excessive CPU/JS engine overhead during
run-script and adapter execution.
🪄 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: af2e9eb6-46c8-4082-88b1-03ccf57d9ab5
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (12)
Cargo.tomlREADME.mdskill/chrome-devtools/CUSTOM_SCRIPTING.mdskill/chrome-devtools/SKILL.mdskill/chrome-devtools/examples/hn_adapter.jsskill/chrome-devtools/examples/search_hn.jssrc/commands/evaluate.rssrc/commands/executor.rssrc/constants.rssrc/lib.rswiki/adapter.mdwiki/run-script.md
💤 Files with no reviewable changes (1)
- README.md
* clarify argument parsing rules and recommend `-a/--arg` usage in docs * enforce `--` separator for positional arguments and update examples * add shared `ScriptExecArgs` helper to deduplicate run-script/adapter parsing * simplify executor logic for script and adapter commands * enhance CLI help text for argument ordering and behavior * document polling interval rationale for wait helpers
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the run-script and adapter commands to the Chrome DevTools CLI, allowing users to execute local JavaScript files and site-specific adapters with injected automation helpers, auto-navigation, and parsed arguments. The review feedback highlights a critical bug in the DOM fill helper's prototype setter lookup that would cause TypeErrors on textareas and select elements, as well as a parsing issue with block comments in target URLs. Additionally, the reviewer recommends relaxing the strict post-navigation URL check to handle redirects gracefully and correcting several documentation examples that omit the literal -- separator required by clap for trailing positional arguments.
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.
…ing, and robust value setter * update CLI docs and examples to require `--` separator for raw positional args in `run-script` and `adapter` * add `parse_script_url_marker` to reliably extract `@url`/`@navigate` from leading comment blocks (supports line, block, JSDoc; trims `*/`; skips blanks; stops at first code line) * refactor auto-navigation to use new parser and downgrade URL mismatch to warning instead of hard failure * fix input value setting by resolving setter from element’s own prototype (`Object.getPrototypeOf(el)`) to avoid incompatible receiver errors * expand tests for URL marker parsing and add regression tests for prototype-based value setter * update wiki documentation to reflect `--` semantics and argument passing rules
|
@coderabbitai full review |
|
/gemini review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces two new features to the Chrome DevTools CLI: run-script for executing local JavaScript files with injected helpers and auto-navigation, and adapter for running domain-protected custom site adapter functions. It adds corresponding documentation, examples, and CLI argument parsing logic. The review feedback highlights two valuable improvements: traversing the prototype chain in the fill helper to reliably locate the native value setter for custom elements, and correctly stripping basic auth credentials in normalize_host before extracting the hostname.
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.
…ion with additional tests
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces two new commands, run-script and adapter, to execute local JavaScript files and site-specific custom adapters inside the browser page context. It adds an injected helper context (ctx) with automation utilities, parses flexible CLI arguments into typed JS values, and supports comment-based auto-navigation and domain protection. Comprehensive documentation, examples, and unit tests are also provided. Feedback on the changes suggests improving parse_adapter_domains to stop scanning at the first non-comment line and to support block comments, preventing potential false positives.
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.
…and add tests for block comments
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Summary by CodeRabbit
key=value, positional, and typed parsing, plus automatic page navigation when needed.ctxhelper behavior, and Hacker News search examples.