cc-dev-template 0.1.63 → 0.1.65
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.
package/package.json
CHANGED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-browser
|
|
3
|
+
description: Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
|
|
4
|
+
allowed-tools: Bash(agent-browser:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Browser Automation with agent-browser
|
|
8
|
+
|
|
9
|
+
## Core Workflow
|
|
10
|
+
|
|
11
|
+
Every browser automation follows this pattern:
|
|
12
|
+
|
|
13
|
+
1. **Navigate**: `agent-browser open <url>`
|
|
14
|
+
2. **Snapshot**: `agent-browser snapshot -i` (get element refs like `@e1`, `@e2`)
|
|
15
|
+
3. **Interact**: Use refs to click, fill, select
|
|
16
|
+
4. **Re-snapshot**: After navigation or DOM changes, get fresh refs
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
agent-browser open https://example.com/form
|
|
20
|
+
agent-browser snapshot -i
|
|
21
|
+
# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Submit"
|
|
22
|
+
|
|
23
|
+
agent-browser fill @e1 "user@example.com"
|
|
24
|
+
agent-browser fill @e2 "password123"
|
|
25
|
+
agent-browser click @e3
|
|
26
|
+
agent-browser wait --load networkidle
|
|
27
|
+
agent-browser snapshot -i # Check result
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Essential Commands
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Navigation
|
|
34
|
+
agent-browser open <url> # Navigate (aliases: goto, navigate)
|
|
35
|
+
agent-browser close # Close browser
|
|
36
|
+
|
|
37
|
+
# Snapshot
|
|
38
|
+
agent-browser snapshot -i # Interactive elements with refs (recommended)
|
|
39
|
+
agent-browser snapshot -s "#selector" # Scope to CSS selector
|
|
40
|
+
|
|
41
|
+
# Interaction (use @refs from snapshot)
|
|
42
|
+
agent-browser click @e1 # Click element
|
|
43
|
+
agent-browser fill @e2 "text" # Clear and type text
|
|
44
|
+
agent-browser type @e2 "text" # Type without clearing
|
|
45
|
+
agent-browser select @e1 "option" # Select dropdown option
|
|
46
|
+
agent-browser check @e1 # Check checkbox
|
|
47
|
+
agent-browser press Enter # Press key
|
|
48
|
+
agent-browser scroll down 500 # Scroll page
|
|
49
|
+
|
|
50
|
+
# Get information
|
|
51
|
+
agent-browser get text @e1 # Get element text
|
|
52
|
+
agent-browser get url # Get current URL
|
|
53
|
+
agent-browser get title # Get page title
|
|
54
|
+
|
|
55
|
+
# Wait
|
|
56
|
+
agent-browser wait @e1 # Wait for element
|
|
57
|
+
agent-browser wait --load networkidle # Wait for network idle
|
|
58
|
+
agent-browser wait --url "**/page" # Wait for URL pattern
|
|
59
|
+
agent-browser wait 2000 # Wait milliseconds
|
|
60
|
+
|
|
61
|
+
# Capture
|
|
62
|
+
agent-browser screenshot # Screenshot to temp dir
|
|
63
|
+
agent-browser screenshot --full # Full page screenshot
|
|
64
|
+
agent-browser pdf output.pdf # Save as PDF
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Common Patterns
|
|
68
|
+
|
|
69
|
+
### Form Submission
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
agent-browser open https://example.com/signup
|
|
73
|
+
agent-browser snapshot -i
|
|
74
|
+
agent-browser fill @e1 "Jane Doe"
|
|
75
|
+
agent-browser fill @e2 "jane@example.com"
|
|
76
|
+
agent-browser select @e3 "California"
|
|
77
|
+
agent-browser check @e4
|
|
78
|
+
agent-browser click @e5
|
|
79
|
+
agent-browser wait --load networkidle
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Authentication with State Persistence
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Login once and save state
|
|
86
|
+
agent-browser open https://app.example.com/login
|
|
87
|
+
agent-browser snapshot -i
|
|
88
|
+
agent-browser fill @e1 "$USERNAME"
|
|
89
|
+
agent-browser fill @e2 "$PASSWORD"
|
|
90
|
+
agent-browser click @e3
|
|
91
|
+
agent-browser wait --url "**/dashboard"
|
|
92
|
+
agent-browser state save auth.json
|
|
93
|
+
|
|
94
|
+
# Reuse in future sessions
|
|
95
|
+
agent-browser state load auth.json
|
|
96
|
+
agent-browser open https://app.example.com/dashboard
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Data Extraction
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
agent-browser open https://example.com/products
|
|
103
|
+
agent-browser snapshot -i
|
|
104
|
+
agent-browser get text @e5 # Get specific element text
|
|
105
|
+
agent-browser get text body > page.txt # Get all page text
|
|
106
|
+
|
|
107
|
+
# JSON output for parsing
|
|
108
|
+
agent-browser snapshot -i --json
|
|
109
|
+
agent-browser get text @e1 --json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Parallel Sessions
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
agent-browser --session site1 open https://site-a.com
|
|
116
|
+
agent-browser --session site2 open https://site-b.com
|
|
117
|
+
|
|
118
|
+
agent-browser --session site1 snapshot -i
|
|
119
|
+
agent-browser --session site2 snapshot -i
|
|
120
|
+
|
|
121
|
+
agent-browser session list
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Visual Browser (Debugging)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
agent-browser --headed open https://example.com
|
|
128
|
+
agent-browser highlight @e1 # Highlight element
|
|
129
|
+
agent-browser record start demo.webm # Record session
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### iOS Simulator (Mobile Safari)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# List available iOS simulators
|
|
136
|
+
agent-browser device list
|
|
137
|
+
|
|
138
|
+
# Launch Safari on a specific device
|
|
139
|
+
agent-browser -p ios --device "iPhone 16 Pro" open https://example.com
|
|
140
|
+
|
|
141
|
+
# Same workflow as desktop - snapshot, interact, re-snapshot
|
|
142
|
+
agent-browser -p ios snapshot -i
|
|
143
|
+
agent-browser -p ios tap @e1 # Tap (alias for click)
|
|
144
|
+
agent-browser -p ios fill @e2 "text"
|
|
145
|
+
agent-browser -p ios swipe up # Mobile-specific gesture
|
|
146
|
+
|
|
147
|
+
# Take screenshot
|
|
148
|
+
agent-browser -p ios screenshot mobile.png
|
|
149
|
+
|
|
150
|
+
# Close session (shuts down simulator)
|
|
151
|
+
agent-browser -p ios close
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Requirements:** macOS with Xcode, Appium (`npm install -g appium && appium driver install xcuitest`)
|
|
155
|
+
|
|
156
|
+
**Real devices:** Works with physical iOS devices if pre-configured. Use `--device "<UDID>"` where UDID is from `xcrun xctrace list devices`.
|
|
157
|
+
|
|
158
|
+
## Ref Lifecycle (Important)
|
|
159
|
+
|
|
160
|
+
Refs (`@e1`, `@e2`, etc.) are invalidated when the page changes. Always re-snapshot after:
|
|
161
|
+
|
|
162
|
+
- Clicking links or buttons that navigate
|
|
163
|
+
- Form submissions
|
|
164
|
+
- Dynamic content loading (dropdowns, modals)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
agent-browser click @e5 # Navigates to new page
|
|
168
|
+
agent-browser snapshot -i # MUST re-snapshot
|
|
169
|
+
agent-browser click @e1 # Use new refs
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Semantic Locators (Alternative to Refs)
|
|
173
|
+
|
|
174
|
+
When refs are unavailable or unreliable, use semantic locators:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
agent-browser find text "Sign In" click
|
|
178
|
+
agent-browser find label "Email" fill "user@test.com"
|
|
179
|
+
agent-browser find role button click --name "Submit"
|
|
180
|
+
agent-browser find placeholder "Search" type "query"
|
|
181
|
+
agent-browser find testid "submit-btn" click
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Deep-Dive Documentation
|
|
185
|
+
|
|
186
|
+
| Reference | When to Use |
|
|
187
|
+
|-----------|-------------|
|
|
188
|
+
| [references/commands.md](references/commands.md) | Full command reference with all options |
|
|
189
|
+
| [references/snapshot-refs.md](references/snapshot-refs.md) | Ref lifecycle, invalidation rules, troubleshooting |
|
|
190
|
+
| [references/session-management.md](references/session-management.md) | Parallel sessions, state persistence, concurrent scraping |
|
|
191
|
+
| [references/authentication.md](references/authentication.md) | Login flows, OAuth, 2FA handling, state reuse |
|
|
192
|
+
| [references/video-recording.md](references/video-recording.md) | Recording workflows for debugging and documentation |
|
|
193
|
+
| [references/proxy-support.md](references/proxy-support.md) | Proxy configuration, geo-testing, rotating proxies |
|
|
194
|
+
|
|
195
|
+
## Ready-to-Use Templates
|
|
196
|
+
|
|
197
|
+
| Template | Description |
|
|
198
|
+
|----------|-------------|
|
|
199
|
+
| [templates/form-automation.sh](templates/form-automation.sh) | Form filling with validation |
|
|
200
|
+
| [templates/authenticated-session.sh](templates/authenticated-session.sh) | Login once, reuse state |
|
|
201
|
+
| [templates/capture-workflow.sh](templates/capture-workflow.sh) | Content extraction with screenshots |
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
./templates/form-automation.sh https://example.com/form
|
|
205
|
+
./templates/authenticated-session.sh https://app.example.com/login
|
|
206
|
+
./templates/capture-workflow.sh https://example.com ./output
|
|
207
|
+
```
|