Isolates code generation scripts (`scripts/generate-cli.ts`,
`scripts/update_metrics.ts`) and unit tests
(`tests/ToolHandler.test.ts`, `tests/cli.test.ts`,
`tests/tools/pages.test.ts`, `tests/tools/screencast.test.ts`,
`tests/tools/slim/tools.test.ts`, `tests/tools/tools.test.ts`) from
discovering `~/.config/cd4a/config.json` on the developer's machine by
using `ServerConfig.applyDefaults` or stubbing
`ConfigLocator.prototype.locate`.
`chrome-devtools fill 1 <uid> -` reported success but cleared the field,
`type_text 1 -` typed an empty string, and values like `--weird` could
not be passed at all, not even after `--`.
yargs re-parses command positionals as `--name value` pairs. In that
pass yargs-parser treats any value starting with `-` (other than a
negative number) as the next flag and substitutes the string default
`''`. yargs also never fills positionals from the tokens after `--`.
Neither can be fixed via configuration (`unknown-options-as-args` and
`nargs` hit the same re-parse), and the upstream fix for the lone `-`
(yargs/yargs-parser#472) is unreleased and only covers that one case.
The CLI now shields such tokens before yargs sees them: a lone `-` is
always shielded, and everything after the first `--` is shielded with
the separator dropped. Shielded tokens are replaced by opaque
placeholders and restored when building the tool arguments. Unknown
flags such as `--weird` or `--pageid` without `--` are still rejected by
strict mode; the error tip and docs/cli.md now explain the `--` form.
Related upstream issues:
- https://github.com/yargs/yargs/issues/1312
- https://github.com/yargs/yargs/issues/1821
- https://github.com/yargs/yargs-parser/pull/472Fixes#2984
Prepares the server for applying configuration changes at runtime.
- createTools() always returns every tool. The DevTools comments tools
are
gated by their `devtoolsComments` condition like other tools, instead of
not being created.
- Slim tools are marked with `slim: true`. Slim mode selects which set
of
tools is registered, so slim tools may reuse the names of regular tools
and other tools do not need a "not slim" condition.
- McpServer keeps the registered tool handles so tools can be updated in
place, and declares the `tools.listChanged` capability with debounced
`notifications/tools/list_changed`.
- The docs, CLI and metrics scripts use the single tool list. The
DevTools
comments tools are now tracked in the tool call metrics.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
The PR refactors the the methods in a full ConfigParser class to make
each logical step easier to follow.
The methods are help as public to ease the migration, else test would
need to be re-done.
Tightens the conditions of tools to only allow existing Config
arguments.
- `chrome-devtools-mcp.js` is the `npx chrome-devtools-mcp`
- `chrome-devtools.js` is the new CLI
- `-cli-options.js` is the corresponding options
- all these files are in the bin folder to indicate they are executable
The script will be used to generate CLI for the MCP server at
`src/bin/cliDefinitions.ts`.
It uses the live server JSON schemas to make it more compatible with the
actual MCP server at runtime. The code definitions are used to extend
the CLI with tool categories.