cc-dev-template 0.1.64 → 0.1.66
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/bin/install.js
CHANGED
|
@@ -254,8 +254,6 @@ if (fs.existsSync(mergeSettingsPath)) {
|
|
|
254
254
|
const configs = [
|
|
255
255
|
{ file: 'read-guard-hook.json', name: 'Context guard for large reads' },
|
|
256
256
|
{ file: 'statusline-config.json', name: 'Custom status line' },
|
|
257
|
-
{ file: 'bash-overflow-hook.json', name: 'Bash overflow guard hook' },
|
|
258
|
-
{ file: 'env-config.json', name: 'Environment variables' },
|
|
259
257
|
// Spinner verbs - choose one (Helldivers or Factorio)
|
|
260
258
|
{ file: 'spinner-verbs-helldivers.json', name: 'Helldivers spinner verbs' }
|
|
261
259
|
// { file: 'spinner-verbs-factorio.json', name: 'Factorio spinner verbs' }
|
|
@@ -310,7 +308,10 @@ deprecatedMcpServers.forEach(server => {
|
|
|
310
308
|
const deprecatedFiles = [
|
|
311
309
|
path.join(CLAUDE_DIR, 'hooks', 'bash-precheck.sh'),
|
|
312
310
|
path.join(CLAUDE_DIR, 'hooks', 'bash-wrapper-helper.sh'),
|
|
313
|
-
path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json')
|
|
311
|
+
path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json'),
|
|
312
|
+
path.join(CLAUDE_DIR, 'hooks', 'bash-overflow-guard.sh'),
|
|
313
|
+
path.join(CLAUDE_DIR, 'scripts', 'bash-overflow-hook.json'),
|
|
314
|
+
path.join(CLAUDE_DIR, 'scripts', 'env-config.json')
|
|
314
315
|
];
|
|
315
316
|
|
|
316
317
|
deprecatedFiles.forEach(file => {
|
|
@@ -354,6 +355,43 @@ if (fs.existsSync(settingsFile)) {
|
|
|
354
355
|
});
|
|
355
356
|
}
|
|
356
357
|
|
|
358
|
+
// Remove bash-overflow-guard hooks from settings
|
|
359
|
+
if (settings.hooks) {
|
|
360
|
+
['PostToolUse'].forEach(hookType => {
|
|
361
|
+
if (settings.hooks[hookType] && Array.isArray(settings.hooks[hookType])) {
|
|
362
|
+
const originalLength = settings.hooks[hookType].length;
|
|
363
|
+
settings.hooks[hookType] = settings.hooks[hookType].filter(hook => {
|
|
364
|
+
const command = hook.hooks?.[0]?.command || '';
|
|
365
|
+
return !command.includes('bash-overflow-guard');
|
|
366
|
+
});
|
|
367
|
+
if (settings.hooks[hookType].length < originalLength) {
|
|
368
|
+
console.log(`✓ Removed deprecated bash-overflow-guard hook from ${hookType}`);
|
|
369
|
+
settingsModified = true;
|
|
370
|
+
cleanupPerformed = true;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Remove BASH_MAX_OUTPUT_LENGTH from env
|
|
377
|
+
if (settings.env && settings.env.BASH_MAX_OUTPUT_LENGTH !== undefined) {
|
|
378
|
+
delete settings.env.BASH_MAX_OUTPUT_LENGTH;
|
|
379
|
+
console.log('✓ Removed deprecated BASH_MAX_OUTPUT_LENGTH env var');
|
|
380
|
+
settingsModified = true;
|
|
381
|
+
cleanupPerformed = true;
|
|
382
|
+
// Remove env object if empty
|
|
383
|
+
if (Object.keys(settings.env).length === 0) {
|
|
384
|
+
delete settings.env;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Set subagent model to Opus
|
|
389
|
+
if (!settings.env) settings.env = {};
|
|
390
|
+
if (settings.env.CLAUDE_CODE_SUBAGENT_MODEL !== 'opus') {
|
|
391
|
+
settings.env.CLAUDE_CODE_SUBAGENT_MODEL = 'opus';
|
|
392
|
+
console.log('✓ Set CLAUDE_CODE_SUBAGENT_MODEL=opus');
|
|
393
|
+
settingsModified = true;
|
|
394
|
+
}
|
|
357
395
|
|
|
358
396
|
if (settingsModified) {
|
|
359
397
|
fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
|
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
|
+
```
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# bash-overflow-guard.sh - Intercept large Bash outputs to preserve context
|
|
3
|
-
#
|
|
4
|
-
# PostToolUse hook that catches large Bash outputs, saves them to a file,
|
|
5
|
-
# and tells Claude to use Grep to search the file instead of consuming context.
|
|
6
|
-
|
|
7
|
-
set -e
|
|
8
|
-
|
|
9
|
-
# Configuration
|
|
10
|
-
MAX_CHARS=${BASH_OVERFLOW_MAX_CHARS:-20000} # ~5k tokens
|
|
11
|
-
OVERFLOW_DIR="${HOME}/.claude/bash-overflow"
|
|
12
|
-
|
|
13
|
-
# Read hook input from stdin
|
|
14
|
-
input=$(cat)
|
|
15
|
-
|
|
16
|
-
# Parse the tool response
|
|
17
|
-
tool_name=$(echo "$input" | jq -r '.tool_name // empty')
|
|
18
|
-
|
|
19
|
-
# Only process Bash tool
|
|
20
|
-
if [[ "$tool_name" != "Bash" ]]; then
|
|
21
|
-
exit 0
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
# Extract stdout from the response
|
|
25
|
-
# tool_response can be a string or object depending on output
|
|
26
|
-
stdout=$(echo "$input" | jq -r '.tool_response // empty')
|
|
27
|
-
|
|
28
|
-
# If tool_response is an object, try to get stdout field
|
|
29
|
-
if echo "$stdout" | jq -e 'type == "object"' > /dev/null 2>&1; then
|
|
30
|
-
stdout=$(echo "$stdout" | jq -r '.stdout // .output // empty')
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Measure size
|
|
34
|
-
char_count=${#stdout}
|
|
35
|
-
line_count=$(echo "$stdout" | wc -l | tr -d ' ')
|
|
36
|
-
|
|
37
|
-
# Check if output exceeds threshold
|
|
38
|
-
if [[ $char_count -gt $MAX_CHARS ]]; then
|
|
39
|
-
# Create overflow directory
|
|
40
|
-
mkdir -p "$OVERFLOW_DIR"
|
|
41
|
-
|
|
42
|
-
# Generate filename with timestamp
|
|
43
|
-
timestamp=$(date +%Y%m%d_%H%M%S)
|
|
44
|
-
overflow_file="$OVERFLOW_DIR/bash_output_${timestamp}.txt"
|
|
45
|
-
|
|
46
|
-
# Save output to file
|
|
47
|
-
echo "$stdout" > "$overflow_file"
|
|
48
|
-
|
|
49
|
-
# Calculate approximate token count (rough heuristic: 4 chars per token)
|
|
50
|
-
approx_tokens=$((char_count / 4))
|
|
51
|
-
|
|
52
|
-
# Return block decision with guidance
|
|
53
|
-
cat << EOF
|
|
54
|
-
{
|
|
55
|
-
"decision": "block",
|
|
56
|
-
"reason": "Bash output too large for context (${line_count} lines, ~${approx_tokens} tokens). Output saved to: ${overflow_file}\n\nUse the Grep tool to search this file:\n Grep(pattern: \"your-pattern\", path: \"${overflow_file}\")\n\nOr read specific sections:\n Read(file_path: \"${overflow_file}\", offset: 1, limit: 100)"
|
|
57
|
-
}
|
|
58
|
-
EOF
|
|
59
|
-
exit 0
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Output is small enough, allow it through
|
|
63
|
-
exit 0
|