Skip to content

The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.

docs(ego-browser): give PowerShell and cmd their own script-invocation form

Zhuowei Wange35e7f73f69c
diff --git a/plugins/ego/README.md b/plugins/ego/README.md
index f9ed3b1..a27eefd 100644
--- a/plugins/ego/README.md
+++ b/plugins/ego/README.md
@@ -6,7 +6,7 @@ and installation instructions for that host.
## Requirements
-- macOS with ego lite installed and open
+- macOS or Windows with ego lite installed and open
- `ego-browser` available on the agent's `PATH`
- An agent host that can read Skills and execute local shell commands
diff --git a/skills/ego-browser/SKILL.md b/skills/ego-browser/SKILL.md
index b616b2b..0a8d092 100644
--- a/skills/ego-browser/SKILL.md
+++ b/skills/ego-browser/SKILL.md
@@ -14,7 +14,10 @@ uncommon options of APIs named below.
## Run browser scripts
-Run JavaScript through a heredoc:
+Pass the script to `ego-browser nodejs`. The form depends on the shell that runs
+the command: heredoc is Bash/Zsh syntax and does not exist in PowerShell or cmd.
+
+### Bash, Zsh, Git Bash
```bash
ego-browser nodejs <<'EOF'
@@ -27,20 +30,55 @@ console.log(await page.snapshot());
EOF
```
-In some sandbox environments, heredoc input may not work; use `-e` instead:
+When a sandbox blocks heredoc input, use `-e` instead. Use single quotes around
+the code and double quotes for JavaScript strings; single quotes within the code
+require shell quoting.
```bash
ego-browser nodejs -e '
const task = await taskSpace("inspect example page");
-const page = task.page("p1");
-await page.goto("https://example.com");
-console.log({ taskSpaceId: task.spaceId, page: page.label });
-console.log(await page.snapshot());
+await task.page("p1").goto("https://example.com");
+console.log(task.spaceId);
'
```
-In Bash/Zsh, use single quotes around the code and double quotes for JavaScript
-strings. Single quotes within the code require shell quoting.
+### PowerShell
+
+PowerShell has no heredoc, and Windows PowerShell 5.1 drops the double quotes
+inside an argument when it calls a native program, which splits the script into
+several arguments. Do not pass a script that contains double quotes or spans
+several lines to `-e`. Write it to a UTF-8 `.mjs` file instead and evaluate an
+ASCII-only one-line entry point, which needs no double quotes of its own:
+
+```powershell
+ego-browser nodejs -e "await import('file:///C:/Users/<name>/ego/task.mjs')"
+```
+
+The imported module runs with the same helpers and `console` as an inline
+script, so the whole task belongs in the `.mjs` file. Use forward slashes in the
+`file:///` URL. Non-ASCII content such as Chinese text must stay inside the
+file: never put it in a `-e` argument.
+
+Do not pipe the file in with `Get-Content`. Windows PowerShell 5.1 reads a UTF-8
+file as ANSI and sends ASCII to native programs, which corrupts non-ASCII text
+and truncates strings. PowerShell has no `<` input redirection either.
+
+### cmd
+
+cmd has no heredoc, but it does support input redirection, so it can run the
+same `.mjs` file directly:
+
+```bat
+ego-browser nodejs < C:\Users\<name>\ego\task.mjs
+```
+
+### When the script fails to parse
+
+`SyntaxError: await is only valid in async functions and the top level bodies of
+modules` almost always means the shell damaged the script before Node received
+it; top-level `await` itself is supported. Do not wrap the code in an async
+IIFE, open a new task space, or resend the same command. Switch to the `.mjs`
+file form above.
The script always runs in Node.js, not in the web Page. Browser helpers and
Node.js APIs belong in the script; Page globals such as `window`, `document`,
diff --git a/skills/ego-browser/references/install.md b/skills/ego-browser/references/install.md
index 36efd4c..0e17988 100644
--- a/skills/ego-browser/references/install.md
+++ b/skills/ego-browser/references/install.md
@@ -6,7 +6,7 @@ The ego-browser skill depends on the ego lite browser: the `ego-browser` command
ego lite website: https://lite.ego.app/
-## Install steps (macOS only)
+## Install on macOS
The install script lives at `scripts/install.sh` in this skill and supports macOS only. It will:
@@ -23,16 +23,26 @@ sh skills/ego-browser/scripts/install.sh
After installing, the script opens the ego lite app directly. If ego lite is already installed, the script skips the download and opens the app directly.
-After the script opens the ego lite app, the user completes the first-run onboarding in the app:
+After the script opens the ego lite app, the user completes the first-run onboarding in the app. Onboarding registers the `ego-browser` command on the PATH, usually under `~/.local/bin`.
+
+## Install on Windows
+
+There is no install script for Windows. Have the user download the installer from https://lite.ego.app/ and run it, then open ego lite.
+
+## Onboarding
+
+Onboarding is a step the user completes in the GUI, on either platform:
- Choose to import data from Chrome or another browser as needed.
-- Onboarding registers the `ego-browser` command on the PATH (usually under `~/.local/bin`).
+- Onboarding registers the `ego-browser` command on the PATH.
-Onboarding is a step the user completes in the GUI. After the script opens ego lite, wait for the user to confirm they've finished onboarding before continuing.
+After the app opens, wait for the user to confirm they've finished onboarding before continuing. On Windows the PATH entry only reaches processes started afterwards, so open a new terminal before checking for the command.
## After installing: confirm `ego-browser` is available
-Once the user has finished onboarding, confirm the command is ready:
+Once the user has finished onboarding, confirm the command is ready.
+
+macOS and Linux shells:
```bash
command -v ego-browser
@@ -45,7 +55,19 @@ export PATH="$HOME/.local/bin:$PATH"
command -v ego-browser
```
-Once the command exists, verify the runtime with a minimal heredoc:
+PowerShell:
+
+```powershell
+Get-Command ego-browser
+```
+
+cmd:
+
+```bat
+where ego-browser
+```
+
+Once the command exists, verify the runtime. In Bash or Zsh:
```bash
ego-browser nodejs <<'EOF'
@@ -53,7 +75,13 @@ console.log('ego-browser ready')
EOF
```
-Printing `ego-browser ready` means the environment is ready.
+In PowerShell or cmd, where heredoc does not exist:
+
+```powershell
+ego-browser nodejs -e "console.log('ego-browser ready')"
+```
+
+Printing `ego-browser ready` means the environment is ready. See the "Run browser scripts" section of `SKILL.md` for the full per-shell rules before writing a real script.
## After that, return to the original task
@@ -61,7 +89,8 @@ Once the environment is ready, return to the user's original task and continue w
## Troubleshooting
-- **Not macOS**: the script supports macOS only (`uname -s` is `Darwin`). On other platforms, have the user download and install from the ego lite website at https://lite.ego.app/.
+- **Not macOS**: `scripts/install.sh` supports macOS only (`uname -s` is `Darwin`). On Windows and other platforms, have the user download and install from the ego lite website at https://lite.ego.app/.
- **Download failed**: the script retries 3 times automatically; if it still fails, it's usually a network issue — have the user check their network and retry.
-- **Gatekeeper still blocks it**: the script already tries to strip quarantine; if the first launch is still blocked, have the user allow ego lite manually under System Settings → Privacy & Security.
-- **Command still unavailable after onboarding**: confirm `~/.local/bin` is on the PATH (see above); or have the user reopen ego lite, finish onboarding, and retry.
+- **Gatekeeper still blocks it (macOS)**: the script already tries to strip quarantine; if the first launch is still blocked, have the user allow ego lite manually under System Settings → Privacy & Security.
+- **SmartScreen blocks the installer (Windows)**: have the user choose "More info" and then "Run anyway" in the SmartScreen dialog.
+- **Command still unavailable after onboarding**: on macOS and Linux, confirm `~/.local/bin` is on the PATH (see above). On Windows, open a new terminal first, because an existing one keeps the PATH it started with. Otherwise have the user reopen ego lite, finish onboarding, and retry.
diff --git a/skills/ego-browser/scripts/install.sh b/skills/ego-browser/scripts/install.sh
index 10eaab0..110af6c 100755
--- a/skills/ego-browser/scripts/install.sh
+++ b/skills/ego-browser/scripts/install.sh
@@ -213,7 +213,7 @@ install_ego_lite() {
}
main() {
- [ "$(uname -s)" = "Darwin" ] || die "this script only supports macOS"
+ [ "$(uname -s)" = "Darwin" ] || die "this script only supports macOS; on Windows and other platforms install from https://lite.ego.app/"
# Install first if not present; otherwise use the ego-browser bundled inside the app.
installed_app_path=$(find_ego_lite_app || true)