remote-browser: make 'cli' a true passthrough and say so
cli used to share the flag parser with the built-in verbs, so a playwright-cli argument that looked like ours could be swallowed. After 'cli' the args now go through untouched, '--' is honoured, and the skill documents that the built-ins are a convenience layer rather than a subset: goto/click/storage/tracing/route/ run-code/pdf/webmcp all work in the attached session with exit codes intact.
This commit is contained in:
1 parent
a21791c630
commit
12258063ce
2 files changed
+32
-5
No files matched your search
+12
-1
@@ -13,7 +13,11 @@
|
||||
# remote-browser setup --name deck --host deck [--port 9222] [--transport ssh]
|
||||
# remote-browser check [--profile deck] step-by-step readiness test
|
||||
# remote-browser tabs | status | text | html | shot
|
||||
# remote-browser cli <playwright-cli args> anything not wrapped (console, requests…)
|
||||
# remote-browser cli <playwright-cli args> full passthrough to playwright-cli
|
||||
# (console, requests, storage, tracing,
|
||||
# run-code, pdf, tab-*, goto/click…);
|
||||
# ours flags are not parsed after `cli`
|
||||
# remote-browser cli -- <args> explicit end-of-options form
|
||||
#
|
||||
# Options: --profile/-p NAME, --index N, --match SUBSTR, --limit CHARS, --out FILE.
|
||||
# Read-only by intent: no click/type/navigate helper exists, because driving an
|
||||
@@ -37,9 +41,16 @@ PROFILE=${REMOTE_BROWSER_PROFILE:-}
|
||||
CMD=""
|
||||
ARGS=()
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ -n "$CMD" ] && [ "$CMD" = cli ]; then
|
||||
# `cli` is a full passthrough: everything after it belongs to playwright-cli,
|
||||
# including flags that look like ours.
|
||||
ARGS+=("$1"); shift; continue
|
||||
fi
|
||||
case "$1" in
|
||||
--profile|-p) PROFILE=${2:-}; shift 2 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
--) shift; if [ -z "$CMD" ]; then CMD=${1:-}; shift; fi
|
||||
while [ $# -gt 0 ]; do ARGS+=("$1"); shift; done ;;
|
||||
*) if [ -z "$CMD" ]; then CMD=$1; else ARGS+=("$1"); fi; shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -25,16 +25,32 @@ remote-browser tabs --profile deck # index, title, url
|
||||
remote-browser text --profile deck --match linkedin --limit 4000
|
||||
remote-browser html --profile deck --index 3 --limit 20000
|
||||
remote-browser shot --profile deck --index 3 --out /tmp/x.png
|
||||
remote-browser cli --profile deck console # anything not wrapped
|
||||
remote-browser --profile deck cli console # full playwright-cli passthrough
|
||||
```
|
||||
|
||||
Profile defaults to `$REMOTE_BROWSER_PROFILE`, so a single-device setup needs no flag.
|
||||
|
||||
### `cli` is not a subset
|
||||
|
||||
The built-in verbs are a convenience layer. `remote-browser --profile X cli <anything>` runs that exact
|
||||
`playwright-cli` command in the **attached** session — `goto`, `click`, `fill`, `console`, `requests`, `storage`
|
||||
(`state-save`, `cookie-list`, `localstorage-*`), `tracing-start/stop`, `video-start/stop`, `route` mocking,
|
||||
`run-code`, `pdf`, `tab-*`, `webmcp-list`, `resize`, and the rest of `playwright-cli --help`. Nothing is filtered or
|
||||
re-implemented, and exit codes propagate.
|
||||
|
||||
Two contract details:
|
||||
|
||||
- Everything after `cli` is passed through untouched, so put the profile **before** it:
|
||||
`remote-browser --profile deck cli console`. (`--profile` after a built-in verb, e.g. `remote-browser tabs --profile
|
||||
deck`, is still parsed by us; after `cli` it is not.)
|
||||
- `run-code` wants a function: `cli run-code '() => page.title()'`, not `'page.title()'`.
|
||||
|
||||
## Rules
|
||||
|
||||
- **Read-only.** There is no click/type/navigate helper, on purpose. Driving an authenticated session (LinkedIn,
|
||||
Gmail, banking) risks the account being restricted, and the user has ruled LinkedIn automation out explicitly. If
|
||||
a task needs clicking, say so and let them do it.
|
||||
- **Read-only by default, not by force.** No click/type/navigate helper is wrapped, because driving an
|
||||
authenticated session (LinkedIn, Gmail, banking) risks the account being restricted and the user ruled LinkedIn
|
||||
automation out. The capability is still reachable through `cli` — use it for the user's own pages only when they
|
||||
ask for it, and say what you are about to do first.
|
||||
- **Screenshots may contain private data.** Write to `/tmp`, never a Git repo; name the path; never restate
|
||||
credentials, tokens, cookies or payment details you see in a capture.
|
||||
- `chrome://` / `edge://` tabs (newtab, apps, inspect) return little text — Chrome blocks script there. Use `shot`.
|
||||
|
||||
Reference in new issue
Block a user