@dbalabka/chrome-wsl 0.5.1 → 0.6.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.
- package/README.md +13 -0
- package/chrome-wsl +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,10 @@ npx @dbalabka/chrome-wsl
|
|
|
33
33
|
```
|
|
34
34
|
- If portproxy/firewall entries are missing, run the printed admin PowerShell commands on Windows, then rerun the script.
|
|
35
35
|
- The script logs `socat` output to `/tmp/socat-9222.log`.
|
|
36
|
+
- To run Chrome in headless mode (no visible window, requires Chrome 112+):
|
|
37
|
+
```sh
|
|
38
|
+
npx @dbalabka/chrome-wsl --headless
|
|
39
|
+
```
|
|
36
40
|
- To stop the `socat` forwarder:
|
|
37
41
|
```sh
|
|
38
42
|
npx @dbalabka/chrome-wsl --stop
|
|
@@ -70,6 +74,7 @@ To install globally instead of npx:
|
|
|
70
74
|
Then run:
|
|
71
75
|
```sh
|
|
72
76
|
chrome-wsl
|
|
77
|
+
chrome-wsl --headless
|
|
73
78
|
chrome-wsl --stop
|
|
74
79
|
chrome-wsl --uninstall
|
|
75
80
|
```
|
|
@@ -90,6 +95,7 @@ to cofigure the DevTools to connect to `--browser-url=http://127.0.0.1:9222`.
|
|
|
90
95
|
|
|
91
96
|
### Codex
|
|
92
97
|
|
|
98
|
+
Configuration of [Chrome DevTools](https://github.com/ChromeDevTools/chrome-devtools-mcp):
|
|
93
99
|
```toml
|
|
94
100
|
[mcp_servers.chome-devtools]
|
|
95
101
|
command = "npx"
|
|
@@ -97,6 +103,13 @@ args = ["-y", "chrome-devtools-mcp@latest", "--browser-url=http://127.0.0.1:9222
|
|
|
97
103
|
startup_timeout_sec = 20.0
|
|
98
104
|
```
|
|
99
105
|
|
|
106
|
+
Configuratio of [Playwrite](https://github.com/microsoft/playwright-mcp):
|
|
107
|
+
```toml
|
|
108
|
+
[mcp_servers.playwright]
|
|
109
|
+
command = "npx"
|
|
110
|
+
args = ["@playwright/mcp@latest", "--browser=chrome", "--isolated", "--cdp-endpoint=http://127.0.0.1:9222"]
|
|
111
|
+
```
|
|
112
|
+
|
|
100
113
|
To run Codex inside the container and use the same MCP configuration and authorisation token, mount the Codex configuration folder inside the docker container using the following docker composer settings:
|
|
101
114
|
```shell
|
|
102
115
|
services:
|
package/chrome-wsl
CHANGED
|
@@ -459,8 +459,13 @@ stop_chrome() {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
start_chrome() {
|
|
462
|
+
local headless_mode="${1:-0}"
|
|
463
|
+
local headless_args=""
|
|
464
|
+
if [[ "$headless_mode" -eq 1 ]]; then
|
|
465
|
+
headless_args=", \"--headless=new\""
|
|
466
|
+
fi
|
|
462
467
|
local chrome_cmd
|
|
463
|
-
chrome_cmd="\$args = @(\"--remote-debugging-port=${PORT}\", \"--no-first-run\", \"--no-default-browser-check\", \"--user-data-dir=\$env:TEMP\\chrome-profile-stable\"); \$p = Start-Process -FilePath \"${WINDOWS_CHROME_PATH}\" -ArgumentList \$args -PassThru; Write-Output \$p.Id"
|
|
468
|
+
chrome_cmd="\$args = @(\"--remote-debugging-port=${PORT}\", \"--no-first-run\", \"--no-default-browser-check\", \"--user-data-dir=\$env:TEMP\\chrome-profile-stable\"${headless_args}); \$p = Start-Process -FilePath \"${WINDOWS_CHROME_PATH}\" -ArgumentList \$args -PassThru; Write-Output \$p.Id"
|
|
464
469
|
|
|
465
470
|
if [[ -n "$(get_pid "CHROME_PID")" ]]; then
|
|
466
471
|
if port_listening_by_chrome; then
|
|
@@ -499,13 +504,14 @@ ensure_wsl() {
|
|
|
499
504
|
}
|
|
500
505
|
|
|
501
506
|
main() {
|
|
502
|
-
local container="" uninstall_flag=0 stop_flag=0 debug_flag=0
|
|
507
|
+
local container="" uninstall_flag=0 stop_flag=0 debug_flag=0 headless_flag=0
|
|
503
508
|
for arg in "$@"; do
|
|
504
509
|
case "$arg" in
|
|
505
510
|
--container=*) container=${arg#*=} ;;
|
|
506
511
|
--uninstall) uninstall_flag=1 ;;
|
|
507
512
|
--stop) stop_flag=1 ;;
|
|
508
513
|
--debug) debug_flag=1 ;;
|
|
514
|
+
--headless) headless_flag=1 ;;
|
|
509
515
|
esac
|
|
510
516
|
done
|
|
511
517
|
|
|
@@ -584,7 +590,7 @@ main() {
|
|
|
584
590
|
|
|
585
591
|
check_portproxy "$host_ip" || exit 1
|
|
586
592
|
check_firewall_rule || exit 1
|
|
587
|
-
start_chrome
|
|
593
|
+
start_chrome "$headless_flag"
|
|
588
594
|
ensure_socat
|
|
589
595
|
start_socat "$host_ip"
|
|
590
596
|
check_devtools_access_wsl || true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbalabka/chrome-wsl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "WSL helper to start Windows Chrome with remote debugging and socat port forwarding.",
|
|
5
5
|
"bin": "./chrome-wsl",
|
|
6
6
|
"files": [
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|