Conversation
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.
Adds CLI-only shorthands for element uids and URLs. The MCP server, tool schemas, pageId handling, and snapshot output are unchanged.
@<uid>is accepted for uid params:@is stripped:click 1 @1_5is the same asclick 1 1_5.@<uid>fills the first optional uid param that is not set yet:take_screenshot 1 @1_5becomestake_screenshot 1 --uid 1_5.evaluate_script, extra@<uid>args are appended to the element--args.--uid @1_5also works.urlparam:navigate_page 1 https://web.devbecomesnavigate_page 1 --url https://web.dev. Only absolute URLs withhttp,https,file,chrome,chrome-extension,about, ordataschemes count;example.comdoes not.Implementation:
expandShorthandArgs()insrc/config/cli-commands.tsrewrites argv before yargs parses it, so yargs config and strict mode are unchanged. It:take_screenshot 1 --uid 1_4 @1_5still fails with "Unknown argument".@in uid slots, sofill 1 @1_5 @handlekeeps the value@handle.Usage lines show the shorthands (e.g.
take_screenshot <pageId> ... [@uid],navigate_page <pageId> ... [url]), anddocs/cli.mdhas a new "Shorthands" section.The agent tip printed on argument errors now asks for exact command names from
--help, usesclick 1 @1_2as the correct example, and lists the@<uid>and URL shorthands for optional parameters. Unknown commands are not rerouted or auto-corrected.The
chrome-devtools-cliskill (skills/chrome-devtools-cli/SKILL.md) now uses the shorthands in its workflow, usage notes, and examples (e.g.click 1 @1_4,take_screenshot 1 @1_4,navigate_page 1 "https://example.com"). I ran each changed example throughexpandShorthandArgsto check it expands to the expected flags.Manually verified with the built CLI on wikipedia.org:
navigate_page 1 <url>,take_screenshot 1 @uid,evaluate_script ... @uid,fill 1 @uid "@devtools", andclick 1 @uid.