Compress agent skills

This commit is contained in:
2026-05-11 12:05:04 +01:00
parent e145482cd3
commit 7fed91d98b
20 changed files with 1009 additions and 2350 deletions

View File

@@ -0,0 +1,34 @@
# JavaScript Evaluation
Use `eval` to run JavaScript in the browser context.
Simple expressions can use regular shell quoting:
```bash
agent-browser eval 'document.title'
agent-browser eval 'document.querySelectorAll("img").length'
```
For complex JavaScript, use `--stdin` to avoid shell quoting corruption:
```bash
agent-browser eval --stdin <<'EVALEOF'
JSON.stringify(
Array.from(document.querySelectorAll("img"))
.filter(i => !i.alt)
.map(i => ({ src: i.src.split("/").pop(), width: i.width }))
)
EVALEOF
```
Use base64 for generated scripts:
```bash
agent-browser eval -b "$(printf '%s' 'Array.from(document.querySelectorAll("a")).map(a => a.href)' | base64)"
```
Rules of thumb:
- Single-line with no nested quotes: regular `eval 'expression'`.
- Nested quotes, arrow functions, template literals, or multiline: `eval --stdin`.
- Programmatic scripts: `eval -b`.