Add --stdin flag for eval command (#348)

Adds --stdin flag to read JavaScript from stdin, enabling heredoc usage
for multiline scripts without shell escaping issues.
This commit is contained in:
Chris Tate
2026-02-02 20:29:43 -06:00
committed by GitHub
parent f770593c66
commit 0dc36f2cff
5 changed files with 50 additions and 17 deletions
+7
View File
@@ -885,6 +885,7 @@ Executes JavaScript code in the browser context and returns the result.
Options:
-b, --base64 Decode script from base64 (avoids shell escaping issues)
--stdin Read script from stdin (useful for heredocs/multiline)
Global Options:
--json Output as JSON
@@ -895,6 +896,12 @@ Examples:
agent-browser eval "window.location.href"
agent-browser eval "document.querySelectorAll('a').length"
agent-browser eval -b "ZG9jdW1lbnQudGl0bGU="
# Read from stdin with heredoc
cat <<'EOF' | agent-browser eval --stdin
const links = document.querySelectorAll('a');
links.length;
EOF
"##
}