diff --git a/scripts/generate-cli.ts b/scripts/generate-cli.ts index c5db4974d..6cb63647e 100644 --- a/scripts/generate-cli.ts +++ b/scripts/generate-cli.ts @@ -16,7 +16,7 @@ import {createTools} from '../build/src/tools/tools.js'; const OUTPUT_PATH = path.join( import.meta.dirname, - '../src/bin/cliDefinitions.ts', + '../src/bin/chrome-devtools-cli-options.ts', ); async function fetchTools() { diff --git a/src/bin/chrome-devtools-cli-options.ts b/src/bin/chrome-devtools-cli-options.ts index 6e317a333..bf5a77420 100644 --- a/src/bin/chrome-devtools-cli-options.ts +++ b/src/bin/chrome-devtools-cli-options.ts @@ -110,7 +110,7 @@ export const commands: Commands = { name: 'geolocation', type: 'string', description: - 'Geolocation (`x`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.', + 'Geolocation (`x`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit to clear the geolocation override.', required: false, }, userAgent: { @@ -155,11 +155,18 @@ export const commands: Commands = { description: 'An optional list of arguments to pass to the function.', required: false, }, + dialogAction: { + name: 'dialogAction', + type: 'string', + description: + 'Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.', + required: false, + }, }, }, fill: { description: - 'Type text into a input, text area or select an option from a element.', category: 'Input automation', args: { uid: { @@ -184,25 +191,6 @@ export const commands: Commands = { }, }, }, - fill_form: { - description: 'Fill out multiple form elements at once', - category: 'Input automation', - args: { - elements: { - name: 'elements', - type: 'array', - description: 'Elements from snapshot to fill out.', - required: true, - }, - includeSnapshot: { - name: 'includeSnapshot', - type: 'boolean', - description: - 'Whether to include a snapshot in the response. Default is false.', - required: false, - }, - }, - }, get_console_message: { description: 'Gets a console message by its ID. You can get all messages by calling list_console_messages.', @@ -233,14 +221,14 @@ export const commands: Commands = { name: 'requestFilePath', type: 'string', description: - 'The absolute or relative path to save the request body to. If omitted, the body is returned inline.', + 'The absolute or relative path to a .network-request file to save the request body to. If omitted, the body is returned inline.', required: false, }, responseFilePath: { name: 'responseFilePath', type: 'string', description: - 'The absolute or relative path to save the response body to. If omitted, the body is returned inline.', + 'The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.', required: false, }, }, @@ -324,7 +312,7 @@ export const commands: Commands = { name: 'pageSize', type: 'integer', description: - 'Maximum number of messages to return. When omitted, returns all requests.', + 'Maximum number of messages to return. When omitted, returns all messages.', required: false, }, pageIdx: { @@ -388,7 +376,7 @@ export const commands: Commands = { }, }, list_pages: { - description: 'Get a list of pages open in the browser.', + description: 'Get a list of pages open in the browser.', category: 'Navigation automation', args: {}, }, @@ -601,8 +589,8 @@ export const commands: Commands = { }, take_memory_snapshot: { description: - 'Capture a memory heapsnapshot of the currently selected page to memory leak debugging', - category: 'Performance', + 'Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.', + category: 'Memory', args: { filePath: { name: 'filePath', @@ -637,7 +625,7 @@ export const commands: Commands = { name: 'uid', type: 'string', description: - 'The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.', + 'The uid of an element on the page from the page content snapshot. If omitted, takes a page screenshot.', required: false, }, fullPage: { @@ -722,24 +710,4 @@ export const commands: Commands = { }, }, }, - wait_for: { - description: 'Wait for the specified text to appear on the selected page.', - category: 'Navigation automation', - args: { - text: { - name: 'text', - type: 'array', - description: - 'Non-empty list of texts. Resolves when any value appears on the page.', - required: true, - }, - timeout: { - name: 'timeout', - type: 'integer', - description: - 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.', - required: false, - }, - }, - }, } as const; diff --git a/src/bin/cliDefinitions.ts b/src/bin/cliDefinitions.ts deleted file mode 100644 index bf5a77420..000000000 --- a/src/bin/cliDefinitions.ts +++ /dev/null @@ -1,713 +0,0 @@ -/** - * @license - * Copyright 2026 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -// NOTE: do not edit manually. Auto-generated by 'npm run cli:generate'. - -export interface ArgDef { - name: string; - type: string; - description: string; - required: boolean; - default?: string | number | boolean; - enum?: ReadonlyArray; -} -export type Commands = Record< - string, - { - description: string; - category: string; - args: Record; - } ->; -export const commands: Commands = { - click: { - description: 'Clicks on the provided element', - category: 'Input automation', - args: { - uid: { - name: 'uid', - type: 'string', - description: - 'The uid of an element on the page from the page content snapshot', - required: true, - }, - dblClick: { - name: 'dblClick', - type: 'boolean', - description: 'Set to true for double clicks. Default is false.', - required: false, - }, - includeSnapshot: { - name: 'includeSnapshot', - type: 'boolean', - description: - 'Whether to include a snapshot in the response. Default is false.', - required: false, - }, - }, - }, - close_page: { - description: - 'Closes the page by its index. The last open page cannot be closed.', - category: 'Navigation automation', - args: { - pageId: { - name: 'pageId', - type: 'number', - description: - 'The ID of the page to close. Call list_pages to list pages.', - required: true, - }, - }, - }, - drag: { - description: 'Drag an element onto another element', - category: 'Input automation', - args: { - from_uid: { - name: 'from_uid', - type: 'string', - description: 'The uid of the element to drag', - required: true, - }, - to_uid: { - name: 'to_uid', - type: 'string', - description: 'The uid of the element to drop into', - required: true, - }, - includeSnapshot: { - name: 'includeSnapshot', - type: 'boolean', - description: - 'Whether to include a snapshot in the response. Default is false.', - required: false, - }, - }, - }, - emulate: { - description: 'Emulates various features on the selected page.', - category: 'Emulation', - args: { - networkConditions: { - name: 'networkConditions', - type: 'string', - description: 'Throttle network. Omit to disable throttling.', - required: false, - enum: ['Offline', 'Slow 3G', 'Fast 3G', 'Slow 4G', 'Fast 4G'], - }, - cpuThrottlingRate: { - name: 'cpuThrottlingRate', - type: 'number', - description: - 'Represents the CPU slowdown factor. Omit or set the rate to 1 to disable throttling', - required: false, - }, - geolocation: { - name: 'geolocation', - type: 'string', - description: - 'Geolocation (`x`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit to clear the geolocation override.', - required: false, - }, - userAgent: { - name: 'userAgent', - type: 'string', - description: - 'User agent to emulate. Set to empty string to clear the user agent override.', - required: false, - }, - colorScheme: { - name: 'colorScheme', - type: 'string', - description: - 'Emulate the dark or the light mode. Set to "auto" to reset to the default.', - required: false, - enum: ['dark', 'light', 'auto'], - }, - viewport: { - name: 'viewport', - type: 'string', - description: - "Emulate device viewports 'xx[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.", - required: false, - }, - }, - }, - evaluate_script: { - description: - 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,\nso returned values have to be JSON-serializable.', - category: 'Debugging', - args: { - function: { - name: 'function', - type: 'string', - description: - 'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => {\n return document.title\n}` or `async () => {\n return await fetch("example.com")\n}`.\nExample with arguments: `(el) => {\n return el.innerText;\n}`\n', - required: true, - }, - args: { - name: 'args', - type: 'array', - description: 'An optional list of arguments to pass to the function.', - required: false, - }, - dialogAction: { - name: 'dialogAction', - type: 'string', - description: - 'Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.', - required: false, - }, - }, - }, - fill: { - description: - 'Type text into an input, text area or select an option from a