@every-env/compound-plugin 2.36.5 → 2.37.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.
@@ -0,0 +1,173 @@
1
+ # Video Recording
2
+
3
+ Capture browser automation as video for debugging, documentation, or verification.
4
+
5
+ **Related**: [commands.md](commands.md) for full command reference, [SKILL.md](../SKILL.md) for quick start.
6
+
7
+ ## Contents
8
+
9
+ - [Basic Recording](#basic-recording)
10
+ - [Recording Commands](#recording-commands)
11
+ - [Use Cases](#use-cases)
12
+ - [Best Practices](#best-practices)
13
+ - [Output Format](#output-format)
14
+ - [Limitations](#limitations)
15
+
16
+ ## Basic Recording
17
+
18
+ ```bash
19
+ # Start recording
20
+ agent-browser record start ./demo.webm
21
+
22
+ # Perform actions
23
+ agent-browser open https://example.com
24
+ agent-browser snapshot -i
25
+ agent-browser click @e1
26
+ agent-browser fill @e2 "test input"
27
+
28
+ # Stop and save
29
+ agent-browser record stop
30
+ ```
31
+
32
+ ## Recording Commands
33
+
34
+ ```bash
35
+ # Start recording to file
36
+ agent-browser record start ./output.webm
37
+
38
+ # Stop current recording
39
+ agent-browser record stop
40
+
41
+ # Restart with new file (stops current + starts new)
42
+ agent-browser record restart ./take2.webm
43
+ ```
44
+
45
+ ## Use Cases
46
+
47
+ ### Debugging Failed Automation
48
+
49
+ ```bash
50
+ #!/bin/bash
51
+ # Record automation for debugging
52
+
53
+ agent-browser record start ./debug-$(date +%Y%m%d-%H%M%S).webm
54
+
55
+ # Run your automation
56
+ agent-browser open https://app.example.com
57
+ agent-browser snapshot -i
58
+ agent-browser click @e1 || {
59
+ echo "Click failed - check recording"
60
+ agent-browser record stop
61
+ exit 1
62
+ }
63
+
64
+ agent-browser record stop
65
+ ```
66
+
67
+ ### Documentation Generation
68
+
69
+ ```bash
70
+ #!/bin/bash
71
+ # Record workflow for documentation
72
+
73
+ agent-browser record start ./docs/how-to-login.webm
74
+
75
+ agent-browser open https://app.example.com/login
76
+ agent-browser wait 1000 # Pause for visibility
77
+
78
+ agent-browser snapshot -i
79
+ agent-browser fill @e1 "demo@example.com"
80
+ agent-browser wait 500
81
+
82
+ agent-browser fill @e2 "password"
83
+ agent-browser wait 500
84
+
85
+ agent-browser click @e3
86
+ agent-browser wait --load networkidle
87
+ agent-browser wait 1000 # Show result
88
+
89
+ agent-browser record stop
90
+ ```
91
+
92
+ ### CI/CD Test Evidence
93
+
94
+ ```bash
95
+ #!/bin/bash
96
+ # Record E2E test runs for CI artifacts
97
+
98
+ TEST_NAME="${1:-e2e-test}"
99
+ RECORDING_DIR="./test-recordings"
100
+ mkdir -p "$RECORDING_DIR"
101
+
102
+ agent-browser record start "$RECORDING_DIR/$TEST_NAME-$(date +%s).webm"
103
+
104
+ # Run test
105
+ if run_e2e_test; then
106
+ echo "Test passed"
107
+ else
108
+ echo "Test failed - recording saved"
109
+ fi
110
+
111
+ agent-browser record stop
112
+ ```
113
+
114
+ ## Best Practices
115
+
116
+ ### 1. Add Pauses for Clarity
117
+
118
+ ```bash
119
+ # Slow down for human viewing
120
+ agent-browser click @e1
121
+ agent-browser wait 500 # Let viewer see result
122
+ ```
123
+
124
+ ### 2. Use Descriptive Filenames
125
+
126
+ ```bash
127
+ # Include context in filename
128
+ agent-browser record start ./recordings/login-flow-2024-01-15.webm
129
+ agent-browser record start ./recordings/checkout-test-run-42.webm
130
+ ```
131
+
132
+ ### 3. Handle Recording in Error Cases
133
+
134
+ ```bash
135
+ #!/bin/bash
136
+ set -e
137
+
138
+ cleanup() {
139
+ agent-browser record stop 2>/dev/null || true
140
+ agent-browser close 2>/dev/null || true
141
+ }
142
+ trap cleanup EXIT
143
+
144
+ agent-browser record start ./automation.webm
145
+ # ... automation steps ...
146
+ ```
147
+
148
+ ### 4. Combine with Screenshots
149
+
150
+ ```bash
151
+ # Record video AND capture key frames
152
+ agent-browser record start ./flow.webm
153
+
154
+ agent-browser open https://example.com
155
+ agent-browser screenshot ./screenshots/step1-homepage.png
156
+
157
+ agent-browser click @e1
158
+ agent-browser screenshot ./screenshots/step2-after-click.png
159
+
160
+ agent-browser record stop
161
+ ```
162
+
163
+ ## Output Format
164
+
165
+ - Default format: WebM (VP8/VP9 codec)
166
+ - Compatible with all modern browsers and video players
167
+ - Compressed but high quality
168
+
169
+ ## Limitations
170
+
171
+ - Recording adds slight overhead to automation
172
+ - Large recordings can consume significant disk space
173
+ - Some headless environments may have codec limitations
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+ # Template: Authenticated Session Workflow
3
+ # Purpose: Login once, save state, reuse for subsequent runs
4
+ # Usage: ./authenticated-session.sh <login-url> [state-file]
5
+ #
6
+ # RECOMMENDED: Use the auth vault instead of this template:
7
+ # echo "<pass>" | agent-browser auth save myapp --url <login-url> --username <user> --password-stdin
8
+ # agent-browser auth login myapp
9
+ # The auth vault stores credentials securely and the LLM never sees passwords.
10
+ #
11
+ # Environment variables:
12
+ # APP_USERNAME - Login username/email
13
+ # APP_PASSWORD - Login password
14
+ #
15
+ # Two modes:
16
+ # 1. Discovery mode (default): Shows form structure so you can identify refs
17
+ # 2. Login mode: Performs actual login after you update the refs
18
+ #
19
+ # Setup steps:
20
+ # 1. Run once to see form structure (discovery mode)
21
+ # 2. Update refs in LOGIN FLOW section below
22
+ # 3. Set APP_USERNAME and APP_PASSWORD
23
+ # 4. Delete the DISCOVERY section
24
+
25
+ set -euo pipefail
26
+
27
+ LOGIN_URL="${1:?Usage: $0 <login-url> [state-file]}"
28
+ STATE_FILE="${2:-./auth-state.json}"
29
+
30
+ echo "Authentication workflow: $LOGIN_URL"
31
+
32
+ # ================================================================
33
+ # SAVED STATE: Skip login if valid saved state exists
34
+ # ================================================================
35
+ if [[ -f "$STATE_FILE" ]]; then
36
+ echo "Loading saved state from $STATE_FILE..."
37
+ if agent-browser --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
38
+ agent-browser wait --load networkidle
39
+
40
+ CURRENT_URL=$(agent-browser get url)
41
+ if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
42
+ echo "Session restored successfully"
43
+ agent-browser snapshot -i
44
+ exit 0
45
+ fi
46
+ echo "Session expired, performing fresh login..."
47
+ agent-browser close 2>/dev/null || true
48
+ else
49
+ echo "Failed to load state, re-authenticating..."
50
+ fi
51
+ rm -f "$STATE_FILE"
52
+ fi
53
+
54
+ # ================================================================
55
+ # DISCOVERY MODE: Shows form structure (delete after setup)
56
+ # ================================================================
57
+ echo "Opening login page..."
58
+ agent-browser open "$LOGIN_URL"
59
+ agent-browser wait --load networkidle
60
+
61
+ echo ""
62
+ echo "Login form structure:"
63
+ echo "---"
64
+ agent-browser snapshot -i
65
+ echo "---"
66
+ echo ""
67
+ echo "Next steps:"
68
+ echo " 1. Note the refs: username=@e?, password=@e?, submit=@e?"
69
+ echo " 2. Update the LOGIN FLOW section below with your refs"
70
+ echo " 3. Set: export APP_USERNAME='...' APP_PASSWORD='...'"
71
+ echo " 4. Delete this DISCOVERY MODE section"
72
+ echo ""
73
+ agent-browser close
74
+ exit 0
75
+
76
+ # ================================================================
77
+ # LOGIN FLOW: Uncomment and customize after discovery
78
+ # ================================================================
79
+ # : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
80
+ # : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
81
+ #
82
+ # agent-browser open "$LOGIN_URL"
83
+ # agent-browser wait --load networkidle
84
+ # agent-browser snapshot -i
85
+ #
86
+ # # Fill credentials (update refs to match your form)
87
+ # agent-browser fill @e1 "$APP_USERNAME"
88
+ # agent-browser fill @e2 "$APP_PASSWORD"
89
+ # agent-browser click @e3
90
+ # agent-browser wait --load networkidle
91
+ #
92
+ # # Verify login succeeded
93
+ # FINAL_URL=$(agent-browser get url)
94
+ # if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
95
+ # echo "Login failed - still on login page"
96
+ # agent-browser screenshot /tmp/login-failed.png
97
+ # agent-browser close
98
+ # exit 1
99
+ # fi
100
+ #
101
+ # # Save state for future runs
102
+ # echo "Saving state to $STATE_FILE"
103
+ # agent-browser state save "$STATE_FILE"
104
+ # echo "Login successful"
105
+ # agent-browser snapshot -i
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+ # Template: Content Capture Workflow
3
+ # Purpose: Extract content from web pages (text, screenshots, PDF)
4
+ # Usage: ./capture-workflow.sh <url> [output-dir]
5
+ #
6
+ # Outputs:
7
+ # - page-full.png: Full page screenshot
8
+ # - page-structure.txt: Page element structure with refs
9
+ # - page-text.txt: All text content
10
+ # - page.pdf: PDF version
11
+ #
12
+ # Optional: Load auth state for protected pages
13
+
14
+ set -euo pipefail
15
+
16
+ TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
17
+ OUTPUT_DIR="${2:-.}"
18
+
19
+ echo "Capturing: $TARGET_URL"
20
+ mkdir -p "$OUTPUT_DIR"
21
+
22
+ # Optional: Load authentication state
23
+ # if [[ -f "./auth-state.json" ]]; then
24
+ # echo "Loading authentication state..."
25
+ # agent-browser state load "./auth-state.json"
26
+ # fi
27
+
28
+ # Navigate to target
29
+ agent-browser open "$TARGET_URL"
30
+ agent-browser wait --load networkidle
31
+
32
+ # Get metadata
33
+ TITLE=$(agent-browser get title)
34
+ URL=$(agent-browser get url)
35
+ echo "Title: $TITLE"
36
+ echo "URL: $URL"
37
+
38
+ # Capture full page screenshot
39
+ agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
40
+ echo "Saved: $OUTPUT_DIR/page-full.png"
41
+
42
+ # Get page structure with refs
43
+ agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
44
+ echo "Saved: $OUTPUT_DIR/page-structure.txt"
45
+
46
+ # Extract all text content
47
+ agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
48
+ echo "Saved: $OUTPUT_DIR/page-text.txt"
49
+
50
+ # Save as PDF
51
+ agent-browser pdf "$OUTPUT_DIR/page.pdf"
52
+ echo "Saved: $OUTPUT_DIR/page.pdf"
53
+
54
+ # Optional: Extract specific elements using refs from structure
55
+ # agent-browser get text @e5 > "$OUTPUT_DIR/main-content.txt"
56
+
57
+ # Optional: Handle infinite scroll pages
58
+ # for i in {1..5}; do
59
+ # agent-browser scroll down 1000
60
+ # agent-browser wait 1000
61
+ # done
62
+ # agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
63
+
64
+ # Cleanup
65
+ agent-browser close
66
+
67
+ echo ""
68
+ echo "Capture complete:"
69
+ ls -la "$OUTPUT_DIR"
@@ -0,0 +1,62 @@
1
+ #!/bin/bash
2
+ # Template: Form Automation Workflow
3
+ # Purpose: Fill and submit web forms with validation
4
+ # Usage: ./form-automation.sh <form-url>
5
+ #
6
+ # This template demonstrates the snapshot-interact-verify pattern:
7
+ # 1. Navigate to form
8
+ # 2. Snapshot to get element refs
9
+ # 3. Fill fields using refs
10
+ # 4. Submit and verify result
11
+ #
12
+ # Customize: Update the refs (@e1, @e2, etc.) based on your form's snapshot output
13
+
14
+ set -euo pipefail
15
+
16
+ FORM_URL="${1:?Usage: $0 <form-url>}"
17
+
18
+ echo "Form automation: $FORM_URL"
19
+
20
+ # Step 1: Navigate to form
21
+ agent-browser open "$FORM_URL"
22
+ agent-browser wait --load networkidle
23
+
24
+ # Step 2: Snapshot to discover form elements
25
+ echo ""
26
+ echo "Form structure:"
27
+ agent-browser snapshot -i
28
+
29
+ # Step 3: Fill form fields (customize these refs based on snapshot output)
30
+ #
31
+ # Common field types:
32
+ # agent-browser fill @e1 "John Doe" # Text input
33
+ # agent-browser fill @e2 "user@example.com" # Email input
34
+ # agent-browser fill @e3 "SecureP@ss123" # Password input
35
+ # agent-browser select @e4 "Option Value" # Dropdown
36
+ # agent-browser check @e5 # Checkbox
37
+ # agent-browser click @e6 # Radio button
38
+ # agent-browser fill @e7 "Multi-line text" # Textarea
39
+ # agent-browser upload @e8 /path/to/file.pdf # File upload
40
+ #
41
+ # Uncomment and modify:
42
+ # agent-browser fill @e1 "Test User"
43
+ # agent-browser fill @e2 "test@example.com"
44
+ # agent-browser click @e3 # Submit button
45
+
46
+ # Step 4: Wait for submission
47
+ # agent-browser wait --load networkidle
48
+ # agent-browser wait --url "**/success" # Or wait for redirect
49
+
50
+ # Step 5: Verify result
51
+ echo ""
52
+ echo "Result:"
53
+ agent-browser get url
54
+ agent-browser snapshot -i
55
+
56
+ # Optional: Capture evidence
57
+ agent-browser screenshot /tmp/form-result.png
58
+ echo "Screenshot saved: /tmp/form-result.png"
59
+
60
+ # Cleanup
61
+ agent-browser close
62
+ echo "Done"