chrome-cdp-cli 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,619 +26,727 @@ class CommandSchemaRegistry {
26
26
  }
27
27
  initializeBuiltInCommands() {
28
28
  this.registerCommand({
29
- name: 'help',
30
- aliases: ['h'],
31
- description: 'Show help information for commands',
32
- usage: 'chrome-cdp-cli help [command]',
29
+ name: "help",
30
+ aliases: ["h"],
31
+ description: "Show help information for commands",
32
+ usage: "cdp help [command]",
33
33
  examples: [
34
- { command: 'chrome-cdp-cli help', description: 'Show general help' },
35
- { command: 'chrome-cdp-cli help eval', description: 'Show help for eval command' }
34
+ { command: "cdp help", description: "Show general help" },
35
+ { command: "cdp help eval", description: "Show help for eval command" },
36
36
  ],
37
37
  options: [],
38
38
  arguments: [
39
39
  {
40
- name: 'command',
41
- description: 'Command to show help for',
42
- type: 'string',
43
- required: false
44
- }
45
- ]
40
+ name: "command",
41
+ description: "Command to show help for",
42
+ type: "string",
43
+ required: false,
44
+ },
45
+ ],
46
46
  });
47
47
  this.registerCommand({
48
- name: 'version',
49
- aliases: ['v'],
50
- description: 'Show version information',
51
- usage: 'chrome-cdp-cli version',
48
+ name: "version",
49
+ aliases: ["v"],
50
+ description: "Show version information",
51
+ usage: "cdp version",
52
52
  examples: [
53
- { command: 'chrome-cdp-cli version', description: 'Display version number' }
53
+ { command: "cdp version", description: "Display version number" },
54
54
  ],
55
55
  options: [],
56
- arguments: []
56
+ arguments: [],
57
57
  });
58
58
  this.registerCommand({
59
- name: 'eval',
60
- aliases: ['js', 'execute'],
61
- description: 'Execute JavaScript code in the browser',
62
- usage: 'chrome-cdp-cli [global-options] eval [options] <expression>',
59
+ name: "eval",
60
+ aliases: ["js", "execute"],
61
+ description: "Execute JavaScript code in the browser",
62
+ usage: "cdp [global-options] eval [options] <expression>",
63
63
  examples: [
64
- { command: 'chrome-cdp-cli eval "document.title"', description: 'Get page title' },
65
- { command: 'chrome-cdp-cli eval --file script.js', description: 'Execute JavaScript file' },
66
- { command: 'chrome-cdp-cli --format json eval "performance.timing"', description: 'Get performance data as JSON' },
67
- { command: 'chrome-cdp-cli --verbose eval "console.log(\'Debug info\')"', description: 'Execute with verbose logging' },
68
- { command: 'chrome-cdp-cli --config ~/.chrome-cdp-cli.yaml eval "document.readyState"', description: 'Use custom configuration' },
69
- { command: 'chrome-cdp-cli eval --no-await-promise "Promise.resolve(42)"', description: 'Execute without awaiting promises' }
64
+ { command: 'cdp eval "document.title"', description: "Get page title" },
65
+ {
66
+ command: "cdp eval --file script.js",
67
+ description: "Execute JavaScript file",
68
+ },
69
+ {
70
+ command: 'cdp --format json eval "performance.timing"',
71
+ description: "Get performance data as JSON",
72
+ },
73
+ {
74
+ command: "cdp --verbose eval \"console.log('Debug info')\"",
75
+ description: "Execute with verbose logging",
76
+ },
77
+ {
78
+ command: 'cdp --config ~/.cdp.yaml eval "document.readyState"',
79
+ description: "Use custom configuration",
80
+ },
81
+ {
82
+ command: 'cdp eval --no-await-promise "Promise.resolve(42)"',
83
+ description: "Execute without awaiting promises",
84
+ },
70
85
  ],
71
86
  options: [
72
87
  {
73
- name: 'expression',
74
- short: 'e',
75
- description: 'JavaScript expression to execute',
76
- type: 'string',
77
- required: false
88
+ name: "expression",
89
+ short: "e",
90
+ description: "JavaScript expression to execute",
91
+ type: "string",
92
+ required: false,
78
93
  },
79
94
  {
80
- name: 'file',
81
- short: 'f',
82
- description: 'JavaScript file to execute',
83
- type: 'string',
84
- required: false
95
+ name: "file",
96
+ short: "f",
97
+ description: "JavaScript file to execute",
98
+ type: "string",
99
+ required: false,
85
100
  },
86
101
  {
87
- name: 'await-promise',
88
- description: 'Await promise results',
89
- type: 'boolean',
90
- default: true
102
+ name: "await-promise",
103
+ description: "Await promise results",
104
+ type: "boolean",
105
+ default: true,
91
106
  },
92
107
  {
93
- name: 'return-by-value',
94
- description: 'Return result by value instead of object reference',
95
- type: 'boolean',
96
- default: true
97
- }
108
+ name: "return-by-value",
109
+ description: "Return result by value instead of object reference",
110
+ type: "boolean",
111
+ default: true,
112
+ },
98
113
  ],
99
114
  arguments: [
100
115
  {
101
- name: 'expression',
102
- description: 'JavaScript expression to execute (alternative to --expression)',
103
- type: 'string',
104
- required: false
105
- }
106
- ]
116
+ name: "expression",
117
+ description: "JavaScript expression to execute (alternative to --expression)",
118
+ type: "string",
119
+ required: false,
120
+ },
121
+ ],
107
122
  });
108
123
  this.registerCommand({
109
- name: 'screenshot',
110
- aliases: ['ss', 'capture'],
111
- description: 'Capture page screenshot',
112
- usage: 'chrome-cdp-cli [global-options] screenshot [options]',
124
+ name: "screenshot",
125
+ aliases: ["ss", "capture"],
126
+ description: "Capture page screenshot",
127
+ usage: "cdp [global-options] screenshot [options]",
113
128
  examples: [
114
- { command: 'chrome-cdp-cli screenshot', description: 'Take basic screenshot' },
115
- { command: 'chrome-cdp-cli screenshot --filename page.png --full-page', description: 'Full page screenshot' },
116
- { command: 'chrome-cdp-cli --quiet screenshot --filename result.png', description: 'Silent screenshot capture' },
117
- { command: 'chrome-cdp-cli --profile production screenshot --format jpeg --quality 90', description: 'Production screenshot with custom quality' },
118
- { command: 'chrome-cdp-cli screenshot --width 800 --height 600 --format jpeg --quality 90', description: 'Custom size and quality' },
119
- { command: 'chrome-cdp-cli screenshot --clip-x 100 --clip-y 100 --clip-width 400 --clip-height 300', description: 'Screenshot specific region' }
129
+ { command: "cdp screenshot", description: "Take basic screenshot" },
130
+ {
131
+ command: "cdp screenshot --filename page.png --full-page",
132
+ description: "Full page screenshot",
133
+ },
134
+ {
135
+ command: "cdp --quiet screenshot --filename result.png",
136
+ description: "Silent screenshot capture",
137
+ },
138
+ {
139
+ command: "cdp --profile production screenshot --format jpeg --quality 90",
140
+ description: "Production screenshot with custom quality",
141
+ },
142
+ {
143
+ command: "cdp screenshot --width 800 --height 600 --format jpeg --quality 90",
144
+ description: "Custom size and quality",
145
+ },
146
+ {
147
+ command: "cdp screenshot --clip-x 100 --clip-y 100 --clip-width 400 --clip-height 300",
148
+ description: "Screenshot specific region",
149
+ },
120
150
  ],
121
151
  options: [
122
152
  {
123
- name: 'filename',
124
- short: 'o',
125
- description: 'Output filename',
126
- type: 'string'
153
+ name: "filename",
154
+ short: "o",
155
+ description: "Output filename",
156
+ type: "string",
127
157
  },
128
158
  {
129
- name: 'width',
130
- short: 'w',
131
- description: 'Viewport width',
132
- type: 'number'
159
+ name: "width",
160
+ short: "w",
161
+ description: "Viewport width",
162
+ type: "number",
133
163
  },
134
164
  {
135
- name: 'height',
136
- short: 'h',
137
- description: 'Viewport height',
138
- type: 'number'
165
+ name: "height",
166
+ short: "h",
167
+ description: "Viewport height",
168
+ type: "number",
139
169
  },
140
170
  {
141
- name: 'format',
142
- description: 'Image format',
143
- type: 'string',
144
- choices: ['png', 'jpeg', 'webp'],
145
- default: 'png'
171
+ name: "image-format",
172
+ description: "Image encoding format",
173
+ type: "string",
174
+ choices: ["png", "jpeg", "webp"],
175
+ default: "png",
146
176
  },
147
177
  {
148
- name: 'quality',
149
- description: 'Image quality (0-100, JPEG/WebP only)',
150
- type: 'number'
178
+ name: "quality",
179
+ description: "Image quality (0-100, JPEG/WebP only)",
180
+ type: "number",
151
181
  },
152
182
  {
153
- name: 'full-page',
154
- description: 'Capture full page',
155
- type: 'boolean',
156
- default: false
183
+ name: "full-page",
184
+ description: "Capture full page",
185
+ type: "boolean",
186
+ default: false,
157
187
  },
158
188
  {
159
- name: 'clip-x',
160
- description: 'Clip rectangle X coordinate',
161
- type: 'number'
189
+ name: "clip-x",
190
+ description: "Clip rectangle X coordinate",
191
+ type: "number",
162
192
  },
163
193
  {
164
- name: 'clip-y',
165
- description: 'Clip rectangle Y coordinate',
166
- type: 'number'
194
+ name: "clip-y",
195
+ description: "Clip rectangle Y coordinate",
196
+ type: "number",
167
197
  },
168
198
  {
169
- name: 'clip-width',
170
- description: 'Clip rectangle width',
171
- type: 'number'
199
+ name: "clip-width",
200
+ description: "Clip rectangle width",
201
+ type: "number",
172
202
  },
173
203
  {
174
- name: 'clip-height',
175
- description: 'Clip rectangle height',
176
- type: 'number'
204
+ name: "clip-height",
205
+ description: "Clip rectangle height",
206
+ type: "number",
177
207
  },
178
208
  {
179
- name: 'clip-scale',
180
- description: 'Clip rectangle scale',
181
- type: 'number',
182
- default: 1
183
- }
209
+ name: "clip-scale",
210
+ description: "Clip rectangle scale",
211
+ type: "number",
212
+ default: 1,
213
+ },
184
214
  ],
185
- arguments: []
215
+ arguments: [],
186
216
  });
187
217
  this.registerCommand({
188
- name: 'click',
218
+ name: "click",
189
219
  aliases: [],
190
- description: 'Click on an element',
191
- usage: 'chrome-cdp-cli [global-options] click [options] <selector>',
220
+ description: "Click on an element",
221
+ usage: "cdp [global-options] click [options] <selector>",
192
222
  examples: [
193
- { command: 'chrome-cdp-cli click "#submit-button"', description: 'Click element by ID' },
194
- { command: 'chrome-cdp-cli click ".nav-link:first-child"', description: 'Click first navigation link' },
195
- { command: 'chrome-cdp-cli --timeout 10000 click ".slow-loading-button"', description: 'Click with extended timeout' },
196
- { command: 'chrome-cdp-cli --verbose click "[data-testid=checkout]"', description: 'Click with verbose logging' }
223
+ {
224
+ command: 'cdp click "#submit-button"',
225
+ description: "Click element by ID",
226
+ },
227
+ {
228
+ command: 'cdp click ".nav-link:first-child"',
229
+ description: "Click first navigation link",
230
+ },
231
+ {
232
+ command: 'cdp --timeout 10000 click ".slow-loading-button"',
233
+ description: "Click with extended timeout",
234
+ },
235
+ {
236
+ command: 'cdp --verbose click "[data-testid=checkout]"',
237
+ description: "Click with verbose logging",
238
+ },
197
239
  ],
198
240
  options: [],
199
241
  arguments: [
200
242
  {
201
- name: 'selector',
202
- description: 'CSS selector for element to click',
203
- type: 'string',
204
- required: true
205
- }
206
- ]
243
+ name: "selector",
244
+ description: "CSS selector for element to click",
245
+ type: "string",
246
+ required: true,
247
+ },
248
+ ],
207
249
  });
208
250
  this.registerCommand({
209
- name: 'fill',
210
- aliases: ['type'],
211
- description: 'Fill a form field with text',
212
- usage: 'chrome-cdp-cli [global-options] fill [options] <selector> <text>',
251
+ name: "fill",
252
+ aliases: ["type"],
253
+ description: "Fill a form field with text",
254
+ usage: "cdp [global-options] fill [options] <selector> <text>",
213
255
  examples: [
214
- { command: 'chrome-cdp-cli fill "#username" "john@example.com"', description: 'Fill username field' },
215
- { command: 'chrome-cdp-cli fill "input[name=password]" "secret123"', description: 'Fill password field' },
216
- { command: 'chrome-cdp-cli fill "#country" "United States"', description: 'Select dropdown option by text' },
217
- { command: 'chrome-cdp-cli --debug fill "#notes" "Additional information"', description: 'Fill with debug logging' }
256
+ {
257
+ command: 'cdp fill "#username" "john@example.com"',
258
+ description: "Fill username field",
259
+ },
260
+ {
261
+ command: 'cdp fill "input[name=password]" "secret123"',
262
+ description: "Fill password field",
263
+ },
264
+ {
265
+ command: 'cdp fill "#country" "United States"',
266
+ description: "Select dropdown option by text",
267
+ },
268
+ {
269
+ command: 'cdp --debug fill "#notes" "Additional information"',
270
+ description: "Fill with debug logging",
271
+ },
218
272
  ],
219
273
  options: [],
220
274
  arguments: [
221
275
  {
222
- name: 'selector',
223
- description: 'CSS selector for form field',
224
- type: 'string',
225
- required: true
276
+ name: "selector",
277
+ description: "CSS selector for form field",
278
+ type: "string",
279
+ required: true,
226
280
  },
227
281
  {
228
- name: 'text',
229
- description: 'Text to fill in the field',
230
- type: 'string',
231
- required: true
232
- }
233
- ]
282
+ name: "text",
283
+ description: "Text to fill in the field",
284
+ type: "string",
285
+ required: true,
286
+ },
287
+ ],
234
288
  });
235
289
  this.registerCommand({
236
- name: 'fill_form',
290
+ name: "fill_form",
237
291
  aliases: [],
238
- description: 'Fill multiple form fields in batch',
239
- usage: 'chrome-cdp-cli [global-options] fill_form [options]',
292
+ description: "Fill multiple form fields in batch",
293
+ usage: "cdp [global-options] fill_form [options]",
240
294
  examples: [
241
- { command: 'chrome-cdp-cli fill_form --fields \'[{"selector":"#name","value":"John"},{"selector":"#email","value":"john@example.com"}]\'', description: 'Fill multiple fields' },
242
- { command: 'chrome-cdp-cli fill_form --fields-file form-data.json', description: 'Fill form from JSON file' },
243
- { command: 'chrome-cdp-cli --quiet fill_form --fields \'[{"selector":"#username","value":"testuser"}]\' --stop-on-error', description: 'Silent batch fill with error handling' }
295
+ {
296
+ command: 'cdp fill_form --fields \'[{"selector":"#name","value":"John"},{"selector":"#email","value":"john@example.com"}]\'',
297
+ description: "Fill multiple fields",
298
+ },
299
+ {
300
+ command: "cdp fill_form --fields-file form-data.json",
301
+ description: "Fill form from JSON file",
302
+ },
303
+ {
304
+ command: 'cdp --quiet fill_form --fields \'[{"selector":"#username","value":"testuser"}]\' --stop-on-error',
305
+ description: "Silent batch fill with error handling",
306
+ },
244
307
  ],
245
308
  options: [
246
309
  {
247
- name: 'fields',
248
- description: 'JSON array of field objects with selector and value',
249
- type: 'string',
250
- required: true
251
- }
310
+ name: "fields",
311
+ description: "JSON array of field objects with selector and value",
312
+ type: "string",
313
+ required: true,
314
+ },
252
315
  ],
253
- arguments: []
316
+ arguments: [],
254
317
  });
255
318
  this.registerCommand({
256
- name: 'hover',
257
- aliases: ['mouseover'],
258
- description: 'Hover over an element',
259
- usage: 'chrome-cdp-cli hover <selector>',
319
+ name: "hover",
320
+ aliases: ["mouseover"],
321
+ description: "Hover over an element",
322
+ usage: "cdp hover <selector>",
260
323
  examples: [
261
- { command: 'chrome-cdp-cli hover ".dropdown-trigger"', description: 'Hover over dropdown trigger' }
324
+ {
325
+ command: 'cdp hover ".dropdown-trigger"',
326
+ description: "Hover over dropdown trigger",
327
+ },
262
328
  ],
263
329
  options: [],
264
330
  arguments: [
265
331
  {
266
- name: 'selector',
267
- description: 'CSS selector for element to hover over',
268
- type: 'string',
269
- required: true
270
- }
271
- ]
332
+ name: "selector",
333
+ description: "CSS selector for element to hover over",
334
+ type: "string",
335
+ required: true,
336
+ },
337
+ ],
272
338
  });
273
339
  this.registerCommand({
274
- name: 'drag',
340
+ name: "drag",
275
341
  aliases: [],
276
- description: 'Perform drag and drop operations',
277
- usage: 'chrome-cdp-cli drag <fromSelector> <toSelector>',
342
+ description: "Perform drag and drop operations",
343
+ usage: "cdp drag <fromSelector> <toSelector>",
278
344
  examples: [
279
- { command: 'chrome-cdp-cli drag "#item1" "#dropzone"', description: 'Drag item1 to dropzone' }
345
+ {
346
+ command: 'cdp drag "#item1" "#dropzone"',
347
+ description: "Drag item1 to dropzone",
348
+ },
280
349
  ],
281
350
  options: [],
282
351
  arguments: [
283
352
  {
284
- name: 'sourceSelector',
285
- description: 'CSS selector for element to drag from',
286
- type: 'string',
287
- required: true
353
+ name: "sourceSelector",
354
+ description: "CSS selector for element to drag from",
355
+ type: "string",
356
+ required: true,
288
357
  },
289
358
  {
290
- name: 'targetSelector',
291
- description: 'CSS selector for element to drag to',
292
- type: 'string',
293
- required: true
294
- }
295
- ]
359
+ name: "targetSelector",
360
+ description: "CSS selector for element to drag to",
361
+ type: "string",
362
+ required: true,
363
+ },
364
+ ],
296
365
  });
297
366
  this.registerCommand({
298
- name: 'press_key',
367
+ name: "press_key",
299
368
  aliases: [],
300
- description: 'Simulate keyboard input with modifiers',
301
- usage: 'chrome-cdp-cli press_key <key> [options]',
369
+ description: "Simulate keyboard input with modifiers",
370
+ usage: "cdp press_key <key> [options]",
302
371
  examples: [
303
- { command: 'chrome-cdp-cli press_key "Enter"', description: 'Press Enter key' },
304
- { command: 'chrome-cdp-cli press_key "s" --modifiers ctrl', description: 'Press Ctrl+S' }
372
+ { command: 'cdp press_key "Enter"', description: "Press Enter key" },
373
+ {
374
+ command: 'cdp press_key "s" --modifiers ctrl',
375
+ description: "Press Ctrl+S",
376
+ },
305
377
  ],
306
378
  options: [
307
379
  {
308
- name: 'modifiers',
309
- description: 'Key modifiers (ctrl, alt, shift, meta)',
310
- type: 'string'
311
- }
380
+ name: "modifiers",
381
+ description: "Key modifiers (ctrl, alt, shift, meta)",
382
+ type: "string",
383
+ },
312
384
  ],
313
385
  arguments: [
314
386
  {
315
- name: 'key',
316
- description: 'Key to press',
317
- type: 'string',
318
- required: true
319
- }
320
- ]
387
+ name: "key",
388
+ description: "Key to press",
389
+ type: "string",
390
+ required: true,
391
+ },
392
+ ],
321
393
  });
322
394
  this.registerCommand({
323
- name: 'upload_file',
395
+ name: "upload_file",
324
396
  aliases: [],
325
- description: 'Upload files to file input elements',
326
- usage: 'chrome-cdp-cli upload_file <selector> <filePath>',
397
+ description: "Upload files to file input elements",
398
+ usage: "cdp upload_file <selector> <filePath>",
327
399
  examples: [
328
- { command: 'chrome-cdp-cli upload_file "input[type=file]" "/path/to/file.txt"', description: 'Upload file to input' }
400
+ {
401
+ command: 'cdp upload_file "input[type=file]" "/path/to/file.txt"',
402
+ description: "Upload file to input",
403
+ },
329
404
  ],
330
405
  options: [],
331
406
  arguments: [
332
407
  {
333
- name: 'selector',
334
- description: 'CSS selector for file input element',
335
- type: 'string',
336
- required: true
408
+ name: "selector",
409
+ description: "CSS selector for file input element",
410
+ type: "string",
411
+ required: true,
337
412
  },
338
413
  {
339
- name: 'filePath',
340
- description: 'Path to file to upload',
341
- type: 'file',
342
- required: true
343
- }
344
- ]
414
+ name: "filePath",
415
+ description: "Path to file to upload",
416
+ type: "file",
417
+ required: true,
418
+ },
419
+ ],
345
420
  });
346
421
  this.registerCommand({
347
- name: 'wait_for',
422
+ name: "wait_for",
348
423
  aliases: [],
349
- description: 'Wait for elements to appear or meet conditions',
350
- usage: 'chrome-cdp-cli wait_for <selector> [options]',
424
+ description: "Wait for elements to appear or meet conditions",
425
+ usage: "cdp wait_for <selector> [options]",
351
426
  examples: [
352
- { command: 'chrome-cdp-cli wait_for "#loading"', description: 'Wait for loading element to appear' },
353
- { command: 'chrome-cdp-cli wait_for ".content" --timeout 10000', description: 'Wait up to 10 seconds' }
427
+ {
428
+ command: 'cdp wait_for "#loading"',
429
+ description: "Wait for loading element to appear",
430
+ },
431
+ {
432
+ command: 'cdp wait_for ".content" --timeout 10000',
433
+ description: "Wait up to 10 seconds",
434
+ },
354
435
  ],
355
436
  options: [
356
437
  {
357
- name: 'timeout',
358
- description: 'Maximum wait time in milliseconds',
359
- type: 'number',
360
- default: 30000
361
- }
438
+ name: "timeout",
439
+ description: "Maximum wait time in milliseconds",
440
+ type: "number",
441
+ default: 30000,
442
+ },
362
443
  ],
363
444
  arguments: [
364
445
  {
365
- name: 'selector',
366
- description: 'CSS selector for element to wait for',
367
- type: 'string',
368
- required: true
369
- }
370
- ]
446
+ name: "selector",
447
+ description: "CSS selector for element to wait for",
448
+ type: "string",
449
+ required: true,
450
+ },
451
+ ],
371
452
  });
372
453
  this.registerCommand({
373
- name: 'handle_dialog',
454
+ name: "handle_dialog",
374
455
  aliases: [],
375
- description: 'Handle browser dialogs (alert, confirm, prompt)',
376
- usage: 'chrome-cdp-cli handle_dialog <action> [options]',
456
+ description: "Handle browser dialogs (alert, confirm, prompt)",
457
+ usage: "cdp handle_dialog <action> [options]",
377
458
  examples: [
378
- { command: 'chrome-cdp-cli handle_dialog accept', description: 'Accept dialog' },
379
- { command: 'chrome-cdp-cli handle_dialog dismiss', description: 'Dismiss dialog' },
380
- { command: 'chrome-cdp-cli handle_dialog accept --text "Hello"', description: 'Accept prompt with text' }
459
+ { command: "cdp handle_dialog accept", description: "Accept dialog" },
460
+ { command: "cdp handle_dialog dismiss", description: "Dismiss dialog" },
461
+ {
462
+ command: 'cdp handle_dialog accept --text "Hello"',
463
+ description: "Accept prompt with text",
464
+ },
381
465
  ],
382
466
  options: [
383
467
  {
384
- name: 'text',
385
- description: 'Text to enter in prompt dialog',
386
- type: 'string'
387
- }
468
+ name: "text",
469
+ description: "Text to enter in prompt dialog",
470
+ type: "string",
471
+ },
388
472
  ],
389
473
  arguments: [
390
474
  {
391
- name: 'action',
392
- description: 'Action to take (accept, dismiss)',
393
- type: 'string',
394
- required: true
395
- }
396
- ]
475
+ name: "action",
476
+ description: "Action to take (accept, dismiss)",
477
+ type: "string",
478
+ required: true,
479
+ },
480
+ ],
397
481
  });
398
482
  this.registerCommand({
399
- name: 'navigate',
400
- aliases: ['goto', 'open'],
401
- description: 'Navigate to a URL',
402
- usage: 'chrome-cdp-cli navigate <url>',
483
+ name: "navigate",
484
+ aliases: ["goto", "open"],
485
+ description: "Navigate to a URL",
486
+ usage: "cdp navigate <url>",
403
487
  examples: [
404
- { command: 'chrome-cdp-cli navigate "https://example.com"', description: 'Navigate to example.com' }
488
+ {
489
+ command: 'cdp navigate "https://example.com"',
490
+ description: "Navigate to example.com",
491
+ },
405
492
  ],
406
493
  options: [],
407
494
  arguments: [
408
495
  {
409
- name: 'url',
410
- description: 'URL to navigate to',
411
- type: 'url',
412
- required: true
413
- }
414
- ]
496
+ name: "url",
497
+ description: "URL to navigate to",
498
+ type: "url",
499
+ required: true,
500
+ },
501
+ ],
415
502
  });
416
503
  this.registerCommand({
417
- name: 'snapshot',
418
- aliases: ['dom'],
419
- description: 'Capture DOM snapshot',
420
- usage: 'chrome-cdp-cli snapshot [options]',
504
+ name: "dom",
505
+ aliases: ["snapshot"],
506
+ description: "Capture DOM snapshot",
507
+ usage: "cdp dom [options]",
421
508
  examples: [
422
- { command: 'chrome-cdp-cli snapshot', description: 'Basic DOM snapshot' },
423
- { command: 'chrome-cdp-cli snapshot --format html --filename dom.html', description: 'Save as HTML file' }
509
+ { command: "cdp dom", description: "Basic DOM snapshot" },
510
+ {
511
+ command: "cdp dom --format html --filename dom.html",
512
+ description: "Save as HTML file",
513
+ },
424
514
  ],
425
515
  options: [
426
516
  {
427
- name: 'filename',
428
- short: 'o',
429
- description: 'Output filename',
430
- type: 'string'
517
+ name: "filename",
518
+ short: "o",
519
+ description: "Output filename",
520
+ type: "string",
431
521
  },
432
522
  {
433
- name: 'format',
434
- description: 'Output format',
435
- type: 'string',
436
- choices: ['text', 'html', 'json'],
437
- default: 'text'
523
+ name: "format",
524
+ description: "Output format",
525
+ type: "string",
526
+ choices: ["text", "html", "json"],
527
+ default: "text",
438
528
  },
439
529
  {
440
- name: 'include-styles',
441
- description: 'Include computed styles',
442
- type: 'boolean',
443
- default: true
530
+ name: "include-styles",
531
+ description: "Include computed styles",
532
+ type: "boolean",
533
+ default: true,
444
534
  },
445
535
  {
446
- name: 'include-attributes',
447
- description: 'Include element attributes',
448
- type: 'boolean',
449
- default: true
536
+ name: "include-attributes",
537
+ description: "Include element attributes",
538
+ type: "boolean",
539
+ default: true,
450
540
  },
451
541
  {
452
- name: 'include-paint-order',
453
- description: 'Include paint order information',
454
- type: 'boolean',
455
- default: false
542
+ name: "include-paint-order",
543
+ description: "Include paint order information",
544
+ type: "boolean",
545
+ default: false,
456
546
  },
457
547
  {
458
- name: 'include-text-index',
459
- description: 'Include text index information',
460
- type: 'boolean',
461
- default: false
548
+ name: "include-text-index",
549
+ description: "Include text index information",
550
+ type: "boolean",
551
+ default: false,
462
552
  },
463
553
  {
464
- name: 'color',
465
- description: 'Enable color output (default: auto-detect)',
466
- type: 'boolean'
554
+ name: "color",
555
+ description: "Enable color output (default: auto-detect)",
556
+ type: "boolean",
467
557
  },
468
558
  {
469
- name: 'no-color',
470
- description: 'Disable color output',
471
- type: 'boolean',
472
- default: false
473
- }
559
+ name: "no-color",
560
+ description: "Disable color output",
561
+ type: "boolean",
562
+ default: false,
563
+ },
474
564
  ],
475
- arguments: []
565
+ arguments: [],
476
566
  });
477
567
  this.registerCommand({
478
- name: 'console',
479
- aliases: [],
480
- description: 'List console messages',
481
- usage: 'chrome-cdp-cli console [options]',
568
+ name: "log",
569
+ aliases: ["console"],
570
+ description: "Follow console messages in real-time",
571
+ usage: "cdp log [options]",
482
572
  examples: [
483
- { command: 'chrome-cdp-cli console', description: 'Get all console messages' },
484
- { command: 'chrome-cdp-cli console --latest', description: 'Get the latest console message' },
485
- { command: 'chrome-cdp-cli console --types error,warn', description: 'Get only error and warning messages' }
486
- ],
487
- options: [
573
+ { command: "cdp log", description: "Follow all console messages" },
488
574
  {
489
- name: 'latest',
490
- description: 'Get only the latest message',
491
- type: 'boolean'
575
+ command: "cdp log --types error,warn",
576
+ description: "Follow only errors and warnings",
492
577
  },
493
578
  {
494
- name: 'types',
495
- description: 'Filter by message types (comma-separated: log,info,warn,error,debug)',
496
- type: 'string'
579
+ command: 'cdp log --textPattern "API"',
580
+ description: "Follow messages matching /API/i",
497
581
  },
498
582
  {
499
- name: 'textPattern',
500
- description: 'Filter by text pattern (regex)',
501
- type: 'string'
583
+ command: "cdp log --format json",
584
+ description: "Output as JSON (one object per line)",
502
585
  },
586
+ { command: "cdp log --format pretty", description: "Colorized output" },
587
+ ],
588
+ options: [
503
589
  {
504
- name: 'maxMessages',
505
- description: 'Maximum number of messages to return',
506
- type: 'number'
590
+ name: "types",
591
+ description: "Filter by message types (comma-separated: log,info,warn,error,debug)",
592
+ type: "string",
507
593
  },
508
594
  {
509
- name: 'startTime',
510
- description: 'Filter messages after this timestamp',
511
- type: 'number'
595
+ name: "textPattern",
596
+ description: "Filter by text pattern (regex, case-insensitive)",
597
+ type: "string",
512
598
  },
513
599
  {
514
- name: 'endTime',
515
- description: 'Filter messages before this timestamp',
516
- type: 'number'
600
+ name: "follow",
601
+ short: "f",
602
+ description: "Alias flag — follow mode is always active",
603
+ type: "boolean",
517
604
  },
518
605
  {
519
- name: 'startMonitoring',
520
- description: 'Start monitoring if not already active',
521
- type: 'boolean'
522
- }
606
+ name: "format",
607
+ description: "Output format: text, json, or pretty (default: text)",
608
+ type: "string",
609
+ choices: ["text", "json", "pretty"],
610
+ },
523
611
  ],
524
- arguments: []
612
+ arguments: [],
525
613
  });
526
614
  this.registerCommand({
527
- name: 'network',
615
+ name: "network",
528
616
  aliases: [],
529
- description: 'List network requests',
530
- usage: 'chrome-cdp-cli network [options]',
617
+ description: "Follow network requests in real-time",
618
+ usage: "cdp network [options]",
531
619
  examples: [
532
- { command: 'chrome-cdp-cli network', description: 'Get all network requests' },
533
- { command: 'chrome-cdp-cli network --latest', description: 'Get the latest network request' },
534
- { command: 'chrome-cdp-cli network --filter methods=POST', description: 'Get only POST requests' }
620
+ { command: "cdp network", description: "Follow all network requests" },
621
+ {
622
+ command: "cdp network --methods POST,PUT",
623
+ description: "Follow only POST and PUT requests",
624
+ },
625
+ {
626
+ command: 'cdp network --urlPattern "/api/"',
627
+ description: "Follow requests matching URL pattern",
628
+ },
629
+ {
630
+ command: "cdp network --statusCodes 404,500",
631
+ description: "Follow requests with error status",
632
+ },
633
+ { command: "cdp network --format json", description: "Output as JSON" },
535
634
  ],
536
635
  options: [
537
636
  {
538
- name: 'latest',
539
- description: 'Get only the latest request',
540
- type: 'boolean'
637
+ name: "methods",
638
+ description: "Filter by HTTP methods (comma-separated: GET,POST,PUT,DELETE,...)",
639
+ type: "string",
640
+ },
641
+ {
642
+ name: "urlPattern",
643
+ description: "Filter by URL pattern (regex, case-insensitive)",
644
+ type: "string",
541
645
  },
542
646
  {
543
- name: 'filter',
544
- description: 'Filter requests (JSON string with methods, urlPattern, statusCodes, etc.)',
545
- type: 'string'
546
- }
647
+ name: "statusCodes",
648
+ description: "Filter by HTTP status codes (comma-separated: 200,404,500)",
649
+ type: "string",
650
+ },
651
+ {
652
+ name: "follow",
653
+ short: "f",
654
+ description: "Alias flag — follow mode is always active",
655
+ type: "boolean",
656
+ },
657
+ {
658
+ name: "format",
659
+ description: "Output format: text, json, or pretty (default: text)",
660
+ type: "string",
661
+ choices: ["text", "json", "pretty"],
662
+ },
547
663
  ],
548
- arguments: []
664
+ arguments: [],
549
665
  });
550
666
  this.registerCommand({
551
- name: 'install_cursor_command',
552
- aliases: ['install-cursor'],
553
- description: 'Install Cursor IDE commands for Chrome automation',
554
- usage: 'chrome-cdp-cli install_cursor_command [options]',
667
+ name: "install_cursor_command",
668
+ aliases: ["install-cursor"],
669
+ description: "Install Cursor IDE commands for Chrome automation",
670
+ usage: "cdp install_cursor_command [options]",
555
671
  examples: [
556
- { command: 'chrome-cdp-cli install_cursor_command', description: 'Install with default settings' },
557
- { command: 'chrome-cdp-cli install_cursor_command --target-directory ./commands --force', description: 'Install to custom directory' }
672
+ {
673
+ command: "cdp install_cursor_command",
674
+ description: "Install with default settings",
675
+ },
676
+ {
677
+ command: "cdp install_cursor_command --target-directory ./commands --force",
678
+ description: "Install to custom directory",
679
+ },
558
680
  ],
559
681
  options: [
560
682
  {
561
- name: 'target-directory',
562
- description: 'Target directory for installation',
563
- type: 'string'
683
+ name: "target-directory",
684
+ description: "Target directory for installation",
685
+ type: "string",
564
686
  },
565
687
  {
566
- name: 'include-examples',
567
- description: 'Include example files',
568
- type: 'boolean',
569
- default: true
688
+ name: "include-examples",
689
+ description: "Include example files",
690
+ type: "boolean",
691
+ default: true,
570
692
  },
571
693
  {
572
- name: 'force',
573
- description: 'Force overwrite existing files',
574
- type: 'boolean',
575
- default: false
576
- }
694
+ name: "force",
695
+ description: "Force overwrite existing files",
696
+ type: "boolean",
697
+ default: false,
698
+ },
577
699
  ],
578
- arguments: []
700
+ arguments: [],
579
701
  });
580
702
  this.registerCommand({
581
- name: 'install_claude_skill',
582
- aliases: ['install-claude'],
583
- description: 'Install Claude Code skill for Chrome automation',
584
- usage: 'chrome-cdp-cli install_claude_skill [options]',
703
+ name: "install_claude_skill",
704
+ aliases: ["install-claude"],
705
+ description: "Install Claude Code skill for Chrome automation",
706
+ usage: "cdp install_claude_skill [options]",
585
707
  examples: [
586
- { command: 'chrome-cdp-cli install_claude_skill', description: 'Install with default settings' },
587
- { command: 'chrome-cdp-cli install_claude_skill --skill-type browser --include-references', description: 'Install browser skill with references' }
708
+ {
709
+ command: "cdp install_claude_skill",
710
+ description: "Install with default settings",
711
+ },
712
+ {
713
+ command: "cdp install_claude_skill --skill-type browser --include-references",
714
+ description: "Install browser skill with references",
715
+ },
588
716
  ],
589
717
  options: [
590
718
  {
591
- name: 'skill-type',
592
- description: 'Type of skill to install',
593
- type: 'string',
594
- choices: ['browser', 'automation', 'testing'],
595
- default: 'browser'
719
+ name: "skill-type",
720
+ description: "Type of skill to install",
721
+ type: "string",
722
+ choices: ["browser", "automation", "testing"],
723
+ default: "browser",
596
724
  },
597
725
  {
598
- name: 'target-directory',
599
- description: 'Target directory for installation',
600
- type: 'string'
726
+ name: "target-directory",
727
+ description: "Target directory for installation",
728
+ type: "string",
601
729
  },
602
730
  {
603
- name: 'include-examples',
604
- description: 'Include example files',
605
- type: 'boolean',
606
- default: true
731
+ name: "include-examples",
732
+ description: "Include example files",
733
+ type: "boolean",
734
+ default: true,
607
735
  },
608
736
  {
609
- name: 'include-references',
610
- description: 'Include reference documentation',
611
- type: 'boolean',
612
- default: true
737
+ name: "include-references",
738
+ description: "Include reference documentation",
739
+ type: "boolean",
740
+ default: true,
613
741
  },
614
742
  {
615
- name: 'force',
616
- description: 'Force overwrite existing files',
617
- type: 'boolean',
618
- default: false
619
- }
620
- ],
621
- arguments: []
622
- });
623
- this.registerCommand({
624
- name: 'restart',
625
- aliases: [],
626
- description: 'Restart the proxy server process. Use this command when console or network command output becomes stale (not refreshing or showing old data). Restarting will clear the message store and start fresh monitoring.',
627
- usage: 'chrome-cdp-cli restart [options]',
628
- examples: [
629
- { command: 'chrome-cdp-cli restart', description: 'Restart the proxy server when logs are stale' },
630
- { command: 'chrome-cdp-cli restart --force', description: 'Force restart even if proxy is healthy' }
631
- ],
632
- options: [
633
- {
634
- name: 'force',
635
- short: 'f',
636
- type: 'boolean',
637
- description: 'Force restart even if proxy is healthy',
638
- default: false
639
- }
743
+ name: "force",
744
+ description: "Force overwrite existing files",
745
+ type: "boolean",
746
+ default: false,
747
+ },
640
748
  ],
641
- arguments: []
749
+ arguments: [],
642
750
  });
643
751
  }
644
752
  }