From 372bfb7735dac70d36d61e38d992711e0ed6f97f Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Thu, 11 Sep 2025 13:25:12 +0200 Subject: [PATCH] chore: re-wrap cli --- README.md | 32 ++++++++++++++------------------ src/index.ts | 7 ++++--- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 7d1da29a..7811e4a2 100644 --- a/README.md +++ b/README.md @@ -151,26 +151,22 @@ Run `npx chrome-devtools-mcp@latest --help` to see all available configuration o ```sh Options: - --version Show version number [boolean] - -u, --browserUrl The browser URL to connect to [string] - --headless Whether to run in headless (no UI) mode [boolean] [default: false] - -e, --executablePath Path to custom Chrome executable [string] - --isolated If specified, creates a temporary user-data-dir that is automatically - cleaned up after the browser is closed. [boolean] [default: false] - --channel System installed browser channel to use. - [string] [choices: "stable", "canary", "beta", "dev"] - --help Show help [boolean] + --version Show version number [boolean] + -u, --browserUrl The browser URL to connect to [string] + --headless Whether to run in headless (no UI) mode [boolean] [default: false] + -e, --executablePath Path to custom Chrome executable [string] + --isolated If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. [boolean] [default: false] + --channel System installed browser channel to use. [string] [choices: "stable", "canary", "beta", "dev"] + --help Show help [boolean] Examples: - npx chrome-devtools-mcp@latest --browserUrl Connect to an existing browser instance - http://127.0.0.1:9222 - npx chrome-devtools-mcp@latest --channel beta Use Chrome Beta installed on this system - npx chrome-devtools-mcp@latest --channel canary Use Chrome Canary installed on this system - npx chrome-devtools-mcp@latest --channel dev Use Chrome Dev installed on this system - npx chrome-devtools-mcp@latest --channel stable Use stable Chrome installed on this system - npx chrome-devtools-mcp@latest --logFile Save logs to a file - /tmp/log.txt - npx chrome-devtools-mcp@latest --help Print CLI options + npx chrome-devtools-mcp@latest --browserUrl http://127.0.0.1:9222 Connect to an existing browser instance + npx chrome-devtools-mcp@latest --channel beta Use Chrome Beta installed on this system + npx chrome-devtools-mcp@latest --channel canary Use Chrome Canary installed on this system + npx chrome-devtools-mcp@latest --channel dev Use Chrome Dev installed on this system + npx chrome-devtools-mcp@latest --channel stable Use stable Chrome installed on this system + npx chrome-devtools-mcp@latest --logFile /tmp/log.txt Save logs to a file + npx chrome-devtools-mcp@latest --help Print CLI options ``` diff --git a/src/index.ts b/src/index.ts index 9a5a242b..ed4fcc76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,9 +34,8 @@ import path from 'node:path'; import fs from 'node:fs'; import assert from 'node:assert'; -export const args = yargs(hideBin(process.argv)) +export const yargsInstance = yargs(hideBin(process.argv)) .scriptName('npx chrome-devtools-mcp@latest') - .wrap(100) .option('browserUrl', { type: 'string', description: 'The browser URL to connect to', @@ -102,7 +101,9 @@ export const args = yargs(hideBin(process.argv)) ['$0 --help', 'Print CLI options'], ]) - .help() + .help(); +export const args = yargsInstance + .wrap(Math.min(120, yargsInstance.terminalWidth())) .parseSync(); if (args.logFile) {