This change aligns most of our logger allowing them to be omitted when
needed meaning code inside the args will not be executed unconditionally
- example `logger?.(JSON.stringy(X))`.
Currently only changes the type, while in a follow up I will remove the
`debug` package and update the file logs.
## Summary
Fixes a bug in `src/daemon/client.ts` where the MIME type case for WebP
images was `'webp'` instead of the correct `'image/webp'`.
## Problem
In `handleResponse`, the switch statement for determining file extension
used the incorrect string `'webp'` as the MIME type. Since browsers and
servers send `image/webp` as the MIME type, the case never matched, and
all WebP images were saved with a `.png` extension instead of `.webp`.
```ts
// Before (buggy)
case 'webp':
extension = '.webp';
break;
// After (fixed)
case 'image/webp':
extension = '.webp';
break;
```
## Testing
WebP screenshots/images returned by the tool will now correctly receive
the `.webp` extension.
Closes#1898
Signed-off-by: cocoon <54054995+kuishou68@users.noreply.github.com>
Signed-off-by: cocoon <54054995+kuishou68@users.noreply.github.com>
- `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
Note that the implementation for response handling and daemon start/stop
is still a placeholder. The proper handling will be done in follow-ups.
The `generateCustomHelp` function is also fully experimental and it is
likely to get removed before the release. The goal of this PR is to
scaffold the e2e workflow for early manual testing. Automated tests will
be also added in a follow-up.
Note this does not expose the CLI as a binary on the package.
The client is meant to start the daemon if it is not running or connect
to the existing one. Long-running client connections are not needed yet.
Removed previous direct daemon test as we better test it via the client,
the intended way to manage the daemon.
Implements a daemon process needed for the CLI. The daemon has commands
to start/stop itself as well as an ability to forward data to the
managed MCP server. Local sockets or named pipes are used depending on
the platform.
The .sock and .pid files are placed under
XDG_RUNTIME_DIR/chrome-devtools-mcp or /tmp/chrome-devtools-mcp for
short socket paths.
It uses Puppeteer's PipeTransport to avoid re-implementing \0 terminated
messages.
Note the code is not used anywhere at the moment.