create-harness-vibe-coding 0.8.7 → 0.8.8
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/README-CN.md +157 -105
- package/README.md +160 -244
- package/bin/create-harness-vibe-coding.js +2 -2
- package/docs/images/harness-architecture-light.png +0 -0
- package/docs/images/harness-architecture.drawio +164 -0
- package/package.json +46 -44
- package/src/generator.js +5 -5
- package/src/index.js +14 -9
- package/src/prompts.js +37 -37
- package/templates/common/.claude/agents/architect-manager.md +45 -45
- package/templates/common/.claude/agents/context-master.md +75 -75
- package/templates/common/.claude/agents/debugger.md +41 -41
- package/templates/common/.claude/agents/explore-manager.md +41 -41
- package/templates/common/.claude/agents/implement-manager.md +49 -49
- package/templates/common/.claude/agents/implementer.md +40 -40
- package/templates/common/.claude/agents/memory-master.md +64 -64
- package/templates/common/.claude/agents/planner.md +34 -34
- package/templates/common/.claude/agents/researcher.md +41 -41
- package/templates/common/.claude/agents/review-manager.md +56 -56
- package/templates/common/.claude/agents/verifier.md +29 -29
- package/templates/common/.claude/commands/wf-help.md +1 -1
- package/templates/common/.claude/rules/ecc/common.md +44 -44
- package/templates/common/.claude/skills/wf-auto/SKILL.md +8 -6
- package/templates/common/.claude/skills/wf-readme/SKILL.md +49 -49
- package/templates/common/.claude/skills/wf-remove/SKILL.md +7 -7
- package/templates/common/.harness-version +54 -14
- package/templates/common/.opencode/agents/architect-manager.md +52 -0
- package/templates/common/.opencode/agents/architect.md +35 -0
- package/templates/common/.opencode/agents/context-master.md +81 -0
- package/templates/common/.opencode/agents/debugger.md +43 -0
- package/templates/common/.opencode/agents/docs-researcher.md +42 -0
- package/templates/common/.opencode/agents/explore-manager.md +49 -0
- package/templates/common/.opencode/agents/implement-manager.md +56 -0
- package/templates/common/.opencode/agents/implementer.md +42 -0
- package/templates/common/.opencode/agents/memory-master.md +70 -0
- package/templates/common/.opencode/agents/planner.md +38 -0
- package/templates/common/.opencode/agents/reflector.md +39 -0
- package/templates/common/.opencode/agents/researcher.md +42 -0
- package/templates/common/.opencode/agents/review-manager.md +63 -0
- package/templates/common/.opencode/agents/reviewer.md +37 -0
- package/templates/common/.opencode/agents/tdd-guide.md +83 -0
- package/templates/common/.opencode/agents/test-writer.md +54 -0
- package/templates/common/.opencode/agents/verifier.md +37 -0
- package/templates/common/.opencode/commands/wf-help.md +23 -0
- package/templates/common/CLAUDE.md +85 -88
- package/templates/common/Harness/PROGRESS.md +17 -17
- package/templates/common/Harness/README.md +16 -5
- package/templates/common/Harness/WF-AUTO-ANGLES.md +170 -0
- package/templates/common/Harness/WF-AUTO-SPARK.md +5 -5
- package/templates/common/Harness/WF-AUTO.md +85 -96
- package/templates/common/Harness/architecture.md +124 -124
- package/templates/common/Harness/context-loading.md +111 -111
- package/templates/common/Harness/extension.md +66 -66
- package/templates/common/Harness/lifecycle.md +20 -20
- package/templates/common/Harness/research/PRD.md +56 -56
- package/templates/common/Harness/research/README.md +169 -169
- package/templates/common/Harness/research/research-results.md +66 -66
- package/templates/common/Harness/subagents.md +208 -208
- package/templates/common/Harness/tasks/_template/ARTIFACTS.md +2 -2
- package/templates/common/Harness/tasks/_template/NOTES.md +2 -2
- package/templates/common/MEMORY.md +1 -1
- package/templates/common/README.md +36 -36
- package/templates/common/memory/agent-lessons-patterns.md +21 -21
- package/templates/common/memory/tool-usage-reflections.md +21 -21
- package/templates/common/memory/user-corrections-preferences.md +21 -21
- package/templates/common/opencode.json +19 -0
- package/templates/common/scripts/scan-clean.mjs +415 -415
- package/templates/common/scripts/validate-harness.mjs +274 -245
- package/templates/common/scripts/wf-remove.mjs +56 -39
- package/templates/common/scripts/wf-update-check.mjs +599 -599
- package/templates/optional/catalog.json +41 -33
- package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +193 -193
- package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +48 -48
- package/templates/optional/skills/github-pr-review/Harness/workflows/github-pr-review.md +28 -28
- package/templates/optional/skills/python-backend/Harness/workflows/python-backend.md +34 -34
- package/templates/optional/skills/ts-react-frontend/Harness/workflows/ts-react-frontend.md +34 -34
- package/templates/optional/skills/ui-ux-review/Harness/workflows/ui-ux-review.md +26 -26
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"skills": [
|
|
3
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"skills": [
|
|
3
|
+
{
|
|
4
4
|
"id": "browser-e2e",
|
|
5
5
|
"title": "Browser E2E",
|
|
6
6
|
"description": "Mandatory real-browser smoke workflow using Playwright, Chrome DevTools/CDP, or documented manual evidence.",
|
|
7
7
|
"files": ["skills/browser-e2e"],
|
|
8
8
|
"tags": ["e2e", "browser", "playwright", "cdp"]
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"id": "ui-ux-review",
|
|
12
|
-
"title": "UI/UX Review",
|
|
13
|
-
"description": "Screenshot-driven responsive, accessibility, and visual polish review workflow.",
|
|
14
|
-
"files": ["skills/ui-ux-review"],
|
|
15
|
-
"tags": ["ui", "ux", "accessibility", "review"]
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"id": "github-pr-review",
|
|
19
|
-
"title": "GitHub PR Review",
|
|
20
|
-
"description": "GitHub CLI based PR diff, checks, review findings, and CI evidence workflow.",
|
|
21
|
-
"files": ["skills/github-pr-review"],
|
|
22
|
-
"tags": ["github", "pr", "review", "ci"]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"id": "python-backend",
|
|
26
|
-
"title": "Python Backend",
|
|
27
|
-
"description": "Python backend workflow for FastAPI or similar APIs with unittest or pytest verification.",
|
|
28
|
-
"files": ["skills/python-backend"],
|
|
29
|
-
"tags": ["python", "fastapi", "unittest", "pytest", "api"]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"id": "ts-react-frontend",
|
|
33
|
-
"title": "TypeScript React Frontend",
|
|
34
|
-
"description": "TypeScript React workflow for typecheck, component tests, builds, and browser smoke.",
|
|
35
|
-
"files": ["skills/ts-react-frontend"],
|
|
36
|
-
"tags": ["typescript", "react", "vite", "frontend"]
|
|
37
|
-
}
|
|
38
|
-
],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "ui-ux-review",
|
|
12
|
+
"title": "UI/UX Review",
|
|
13
|
+
"description": "Screenshot-driven responsive, accessibility, and visual polish review workflow.",
|
|
14
|
+
"files": ["skills/ui-ux-review"],
|
|
15
|
+
"tags": ["ui", "ux", "accessibility", "review"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "github-pr-review",
|
|
19
|
+
"title": "GitHub PR Review",
|
|
20
|
+
"description": "GitHub CLI based PR diff, checks, review findings, and CI evidence workflow.",
|
|
21
|
+
"files": ["skills/github-pr-review"],
|
|
22
|
+
"tags": ["github", "pr", "review", "ci"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "python-backend",
|
|
26
|
+
"title": "Python Backend",
|
|
27
|
+
"description": "Python backend workflow for FastAPI or similar APIs with unittest or pytest verification.",
|
|
28
|
+
"files": ["skills/python-backend"],
|
|
29
|
+
"tags": ["python", "fastapi", "unittest", "pytest", "api"]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "ts-react-frontend",
|
|
33
|
+
"title": "TypeScript React Frontend",
|
|
34
|
+
"description": "TypeScript React workflow for typecheck, component tests, builds, and browser smoke.",
|
|
35
|
+
"files": ["skills/ts-react-frontend"],
|
|
36
|
+
"tags": ["typescript", "react", "vite", "frontend"]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
39
|
"presets": {
|
|
40
40
|
"web-app": ["ts-react-frontend", "browser-e2e", "ui-ux-review"],
|
|
41
41
|
"fullstack": ["ts-react-frontend", "python-backend", "browser-e2e", "github-pr-review"]
|
|
@@ -72,6 +72,14 @@
|
|
|
72
72
|
"installMode": "recommend-only",
|
|
73
73
|
"url": "https://github.com/colbymchenry/codegraph",
|
|
74
74
|
"tags": ["code graph", "architecture", "analysis"]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "oh-my-openagent",
|
|
78
|
+
"title": "oh-my-openagent",
|
|
79
|
+
"description": "Community OpenCode plugin harness: curated agents (Sisyphus/Prometheus/Hephaestus), lifecycle hooks, hash-anchored edits, and Team Mode. For OpenCode and Codex CLI.",
|
|
80
|
+
"installMode": "recommend-only",
|
|
81
|
+
"url": "https://github.com/code-yeongyu/oh-my-openagent",
|
|
82
|
+
"tags": ["opencode", "agents", "harness", "ecosystem"]
|
|
75
83
|
}
|
|
76
84
|
]
|
|
77
85
|
}
|
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: wf-browser
|
|
1
|
+
---
|
|
2
|
+
name: wf-browser
|
|
3
3
|
description: AI-driven browser automation for E2E testing, web scraping, form filling, and UI verification. Powered by Browser Use (89.1% WebVoyager benchmark). Use for Claude /wf-browser, Codex $wf-browser, browser testing, web automation, page interaction, form filling, screenshot verification, or any task requiring real browser control. Dual mode: CLI (fast iteration, no LLM needed) + Python Agent API (complex multi-step workflows with AI reasoning).
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# WF Browser — AI Browser Automation
|
|
7
|
-
|
|
8
|
-
Load:
|
|
9
|
-
|
|
10
|
-
- `Harness/workflows/browser-e2e.md`
|
|
11
|
-
- Official `browser-use` skill at `~/.claude/skills/browser-use/SKILL.md` (auto-installed if missing)
|
|
12
|
-
- `Harness/PROGRESS.md` when work is active
|
|
13
|
-
|
|
14
|
-
## Modes
|
|
15
|
-
|
|
16
|
-
Choose based on task complexity:
|
|
17
|
-
|
|
18
|
-
### Mode 1: CLI (fast iteration, ~50ms per call)
|
|
19
|
-
|
|
20
|
-
Best for: single-page checks, quick screenshots, form fills, element inspection. No LLM needed — Claude Code reasons and issues CLI commands.
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
browser-use --headed open https://example.com # Open page (headed = visible browser)
|
|
24
|
-
browser-use state # Get page title, text, interactive elements with indices
|
|
25
|
-
browser-use screenshot evidence.png # Capture screenshot as evidence
|
|
26
|
-
browser-use click 5 # Click element by index from state output
|
|
27
|
-
browser-use input 3 "user@example.com" # Fill input field by index
|
|
28
|
-
browser-use eval "document.title" # Run JavaScript in page
|
|
29
|
-
browser-use close # Close browser when done
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Daemon keeps the browser open between commands — no cold-start per action.
|
|
33
|
-
|
|
34
|
-
### Mode 2: Python Agent API (multi-step AI reasoning)
|
|
35
|
-
|
|
36
|
-
Best for: complex multi-page workflows, dynamic navigation, data extraction across pages. Needs LLM API key.
|
|
37
|
-
|
|
38
|
-
```python
|
|
39
|
-
from browser_use.beta import Agent, BrowserProfile
|
|
40
|
-
from browser_use.llm import ChatAnthropic
|
|
41
|
-
|
|
42
|
-
agent = Agent(
|
|
43
|
-
task="Go to github.com, search for 'browser-use', click the first result, and report the star count",
|
|
44
|
-
llm=ChatAnthropic(model="claude-haiku-4-5-20251001"),
|
|
45
|
-
browser_profile=BrowserProfile(headless=False),
|
|
46
|
-
)
|
|
47
|
-
history = await agent.run()
|
|
48
|
-
print(history.final_result())
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Environment Setup
|
|
52
|
-
|
|
53
|
-
Run once per machine:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
# 1. Install browser-use with CLI extras
|
|
57
|
-
pip install "browser-use[cli]"
|
|
58
|
-
|
|
59
|
-
# 2. Install Chromium browser
|
|
60
|
-
browser-use install
|
|
61
|
-
|
|
62
|
-
# 3. Verify installation
|
|
63
|
-
browser-use doctor
|
|
64
|
-
|
|
65
|
-
# 4. (Optional) Set LLM API key for Agent mode
|
|
66
|
-
# Create .env file with: ANTHROPIC_API_KEY=sk-ant-...
|
|
67
|
-
# Or: OPENAI_API_KEY=sk-...
|
|
68
|
-
# Or: BROWSER_USE_API_KEY=bu-...
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Windows GBK Encoding Fix
|
|
72
|
-
|
|
73
|
-
If you see `UnicodeEncodeError: 'gbk' codec can't encode character`, the install is auto-patched. If not, set env var before commands:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
set PYTHONIOENCODING=utf-8
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Windows Daemon Patches
|
|
80
|
-
|
|
81
|
-
Browser Use v0.13.1 has two known issues on Windows that are auto-patched on install. If `browser-use open` fails with "Failed to start daemon" or socket timeout, re-apply:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
python -c "
|
|
85
|
-
import browser_use.skill_cli.main as m
|
|
86
|
-
p = m.__file__
|
|
87
|
-
c = open(p, encoding='utf-8').read()
|
|
88
|
-
# Patch 1: auto-clean stale state on dead PID
|
|
89
|
-
c = c.replace(
|
|
90
|
-
'probe = _probe_session(session)\n\n\t# Socket reachable',
|
|
91
|
-
'probe = _probe_session(session)\n\n\t# Auto-clean stale state\n\tif not probe.socket_reachable and not probe.pid_alive and probe.phase:\n\t\t_clean_session_files(session)\n\t\tprobe = _probe_session(session)\n\n\t# Socket reachable'
|
|
92
|
-
)
|
|
93
|
-
# Patch 2: auto-recover from stale session instead of erroring
|
|
94
|
-
c = c.replace(
|
|
95
|
-
\"f'Error: Session {session!r} is alive (phase={probe.phase}) but socket unreachable.\",\"
|
|
96
|
-
\"f'Warning: Session {session!r} has stale state (phase={probe.phase}), auto-cleaning...\",\"
|
|
97
|
-
)
|
|
98
|
-
c = c.replace(
|
|
99
|
-
\"sys.exit(1)\n\n\t\telif probe.phase == 'shutting_down'\",
|
|
100
|
-
\"_terminate_pid(probe.pid)\n\t\t\t_clean_session_files(session)\n\n\t\telif probe.phase == 'shutting_down'\"
|
|
101
|
-
)
|
|
102
|
-
# Patch 3: extend daemon startup timeout (15s -> 30s)
|
|
103
|
-
c = c.replace('deadline = time.time() + 15', 'deadline = time.time() + 30')
|
|
104
|
-
open(p, 'w', encoding='utf-8').write(c)
|
|
105
|
-
print('Patches applied')
|
|
106
|
-
"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Requirements
|
|
110
|
-
|
|
111
|
-
| Requirement | Version | Check |
|
|
112
|
-
|-------------|---------|-------|
|
|
113
|
-
| Python | >= 3.11 | `python --version` |
|
|
114
|
-
| pip | any | `pip --version` |
|
|
115
|
-
| Chromium | auto-installed | `browser-use doctor` |
|
|
116
|
-
| LLM API key | for Agent mode only | check `.env` |
|
|
117
|
-
|
|
118
|
-
## Common Patterns
|
|
119
|
-
|
|
120
|
-
### Login Persistence
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
# Use real Chrome profile (preserves cookies/logins)
|
|
124
|
-
browser-use --profile "Default" open https://app.target.com
|
|
125
|
-
# Or connect to running Chrome with remote debugging
|
|
126
|
-
browser-use connect
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### E2E Test Flow
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
browser-use --headed open https://yourapp.local
|
|
133
|
-
browser-use state # Verify page loaded
|
|
134
|
-
browser-use screenshot step1-landing.png # Evidence
|
|
135
|
-
browser-use input 3 "test@email.com" # Fill email
|
|
136
|
-
browser-use input 5 "password123" # Fill password
|
|
137
|
-
browser-use click 8 # Click login button
|
|
138
|
-
browser-use wait text "Dashboard" # Wait for navigation text
|
|
139
|
-
browser-use state # Verify logged in
|
|
140
|
-
browser-use screenshot step2-dashboard.png # Evidence
|
|
141
|
-
browser-use close
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Console & Network Log Capture
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
browser-use eval "console.log('checkpoint');" # Inject log marker
|
|
148
|
-
browser-use eval "document.title" # Read page state via JS
|
|
149
|
-
browser-use get text 5 # Get text of element index 5
|
|
150
|
-
browser-use get value 3 # Get value of input element index 3
|
|
151
|
-
# For full console/network: use Python Agent mode with Playwright's page.on('console') and page.on('request')
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Error Recovery
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# If daemon crashes or gets stuck:
|
|
158
|
-
browser-use close # Clean shutdown
|
|
159
|
-
# Then restart:
|
|
160
|
-
browser-use open <url> # Fresh daemon starts automatically
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Verification Contract
|
|
164
|
-
|
|
165
|
-
Every browser task must produce:
|
|
166
|
-
|
|
167
|
-
1. **State evidence**: `browser-use state` output or screenshot
|
|
168
|
-
2. **Action log**: sequence of commands issued
|
|
169
|
-
3. **Result assertion**: explicit before/after state comparison
|
|
170
|
-
|
|
171
|
-
No browser/UI claim without real-browser evidence.
|
|
172
|
-
|
|
173
|
-
## Architecture Note
|
|
174
|
-
|
|
175
|
-
Browser Use wraps Playwright with AI reasoning. The daemon keeps Chromium running between CLI commands (~50ms latency). The Agent mode adds an LLM observation→decision→action loop on top. This replaces fragile CSS-selector scripts with semantic element targeting via accessibility tree snapshots.
|
|
176
|
-
|
|
177
|
-
Benchmarks: 89.1% WebVoyager (SOTA), 78k+ GitHub stars, MIT license.
|
|
178
|
-
|
|
179
|
-
## Security
|
|
180
|
-
|
|
181
|
-
- **Never log or screenshot credentials** — redact password fields, API keys, tokens before capturing evidence
|
|
182
|
-
- **Chrome profiles contain sensitive data** — only use `--profile` with explicit user approval; never share profile data
|
|
183
|
-
- **Screenshots may capture PII** — review before saving to task evidence directory
|
|
184
|
-
- **Scraping targets need approval** — confirm the target site's ToS allow automated access before scraping
|
|
185
|
-
- **`browser-use input` commands with passwords** — use placeholder values in documentation; never hardcode real credentials
|
|
186
|
-
- **Agent mode sandbox** — run Agent API with `allowed_domains` restriction when possible
|
|
187
|
-
|
|
188
|
-
## Return
|
|
189
|
-
|
|
190
|
-
- CLI commands issued and their output
|
|
191
|
-
- screenshot paths
|
|
192
|
-
- agent history (if Agent mode used)
|
|
193
|
-
- verification pass/fail with evidence
|
|
194
|
-
- remaining risks (flaky selectors, auth issues, CAPTCHAs)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WF Browser — AI Browser Automation
|
|
7
|
+
|
|
8
|
+
Load:
|
|
9
|
+
|
|
10
|
+
- `Harness/workflows/browser-e2e.md`
|
|
11
|
+
- Official `browser-use` skill at `~/.claude/skills/browser-use/SKILL.md` (auto-installed if missing)
|
|
12
|
+
- `Harness/PROGRESS.md` when work is active
|
|
13
|
+
|
|
14
|
+
## Modes
|
|
15
|
+
|
|
16
|
+
Choose based on task complexity:
|
|
17
|
+
|
|
18
|
+
### Mode 1: CLI (fast iteration, ~50ms per call)
|
|
19
|
+
|
|
20
|
+
Best for: single-page checks, quick screenshots, form fills, element inspection. No LLM needed — Claude Code reasons and issues CLI commands.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
browser-use --headed open https://example.com # Open page (headed = visible browser)
|
|
24
|
+
browser-use state # Get page title, text, interactive elements with indices
|
|
25
|
+
browser-use screenshot evidence.png # Capture screenshot as evidence
|
|
26
|
+
browser-use click 5 # Click element by index from state output
|
|
27
|
+
browser-use input 3 "user@example.com" # Fill input field by index
|
|
28
|
+
browser-use eval "document.title" # Run JavaScript in page
|
|
29
|
+
browser-use close # Close browser when done
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Daemon keeps the browser open between commands — no cold-start per action.
|
|
33
|
+
|
|
34
|
+
### Mode 2: Python Agent API (multi-step AI reasoning)
|
|
35
|
+
|
|
36
|
+
Best for: complex multi-page workflows, dynamic navigation, data extraction across pages. Needs LLM API key.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from browser_use.beta import Agent, BrowserProfile
|
|
40
|
+
from browser_use.llm import ChatAnthropic
|
|
41
|
+
|
|
42
|
+
agent = Agent(
|
|
43
|
+
task="Go to github.com, search for 'browser-use', click the first result, and report the star count",
|
|
44
|
+
llm=ChatAnthropic(model="claude-haiku-4-5-20251001"),
|
|
45
|
+
browser_profile=BrowserProfile(headless=False),
|
|
46
|
+
)
|
|
47
|
+
history = await agent.run()
|
|
48
|
+
print(history.final_result())
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Environment Setup
|
|
52
|
+
|
|
53
|
+
Run once per machine:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Install browser-use with CLI extras
|
|
57
|
+
pip install "browser-use[cli]"
|
|
58
|
+
|
|
59
|
+
# 2. Install Chromium browser
|
|
60
|
+
browser-use install
|
|
61
|
+
|
|
62
|
+
# 3. Verify installation
|
|
63
|
+
browser-use doctor
|
|
64
|
+
|
|
65
|
+
# 4. (Optional) Set LLM API key for Agent mode
|
|
66
|
+
# Create .env file with: ANTHROPIC_API_KEY=sk-ant-...
|
|
67
|
+
# Or: OPENAI_API_KEY=sk-...
|
|
68
|
+
# Or: BROWSER_USE_API_KEY=bu-...
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Windows GBK Encoding Fix
|
|
72
|
+
|
|
73
|
+
If you see `UnicodeEncodeError: 'gbk' codec can't encode character`, the install is auto-patched. If not, set env var before commands:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
set PYTHONIOENCODING=utf-8
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Windows Daemon Patches
|
|
80
|
+
|
|
81
|
+
Browser Use v0.13.1 has two known issues on Windows that are auto-patched on install. If `browser-use open` fails with "Failed to start daemon" or socket timeout, re-apply:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -c "
|
|
85
|
+
import browser_use.skill_cli.main as m
|
|
86
|
+
p = m.__file__
|
|
87
|
+
c = open(p, encoding='utf-8').read()
|
|
88
|
+
# Patch 1: auto-clean stale state on dead PID
|
|
89
|
+
c = c.replace(
|
|
90
|
+
'probe = _probe_session(session)\n\n\t# Socket reachable',
|
|
91
|
+
'probe = _probe_session(session)\n\n\t# Auto-clean stale state\n\tif not probe.socket_reachable and not probe.pid_alive and probe.phase:\n\t\t_clean_session_files(session)\n\t\tprobe = _probe_session(session)\n\n\t# Socket reachable'
|
|
92
|
+
)
|
|
93
|
+
# Patch 2: auto-recover from stale session instead of erroring
|
|
94
|
+
c = c.replace(
|
|
95
|
+
\"f'Error: Session {session!r} is alive (phase={probe.phase}) but socket unreachable.\",\"
|
|
96
|
+
\"f'Warning: Session {session!r} has stale state (phase={probe.phase}), auto-cleaning...\",\"
|
|
97
|
+
)
|
|
98
|
+
c = c.replace(
|
|
99
|
+
\"sys.exit(1)\n\n\t\telif probe.phase == 'shutting_down'\",
|
|
100
|
+
\"_terminate_pid(probe.pid)\n\t\t\t_clean_session_files(session)\n\n\t\telif probe.phase == 'shutting_down'\"
|
|
101
|
+
)
|
|
102
|
+
# Patch 3: extend daemon startup timeout (15s -> 30s)
|
|
103
|
+
c = c.replace('deadline = time.time() + 15', 'deadline = time.time() + 30')
|
|
104
|
+
open(p, 'w', encoding='utf-8').write(c)
|
|
105
|
+
print('Patches applied')
|
|
106
|
+
"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Requirements
|
|
110
|
+
|
|
111
|
+
| Requirement | Version | Check |
|
|
112
|
+
|-------------|---------|-------|
|
|
113
|
+
| Python | >= 3.11 | `python --version` |
|
|
114
|
+
| pip | any | `pip --version` |
|
|
115
|
+
| Chromium | auto-installed | `browser-use doctor` |
|
|
116
|
+
| LLM API key | for Agent mode only | check `.env` |
|
|
117
|
+
|
|
118
|
+
## Common Patterns
|
|
119
|
+
|
|
120
|
+
### Login Persistence
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Use real Chrome profile (preserves cookies/logins)
|
|
124
|
+
browser-use --profile "Default" open https://app.target.com
|
|
125
|
+
# Or connect to running Chrome with remote debugging
|
|
126
|
+
browser-use connect
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### E2E Test Flow
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
browser-use --headed open https://yourapp.local
|
|
133
|
+
browser-use state # Verify page loaded
|
|
134
|
+
browser-use screenshot step1-landing.png # Evidence
|
|
135
|
+
browser-use input 3 "test@email.com" # Fill email
|
|
136
|
+
browser-use input 5 "password123" # Fill password
|
|
137
|
+
browser-use click 8 # Click login button
|
|
138
|
+
browser-use wait text "Dashboard" # Wait for navigation text
|
|
139
|
+
browser-use state # Verify logged in
|
|
140
|
+
browser-use screenshot step2-dashboard.png # Evidence
|
|
141
|
+
browser-use close
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Console & Network Log Capture
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
browser-use eval "console.log('checkpoint');" # Inject log marker
|
|
148
|
+
browser-use eval "document.title" # Read page state via JS
|
|
149
|
+
browser-use get text 5 # Get text of element index 5
|
|
150
|
+
browser-use get value 3 # Get value of input element index 3
|
|
151
|
+
# For full console/network: use Python Agent mode with Playwright's page.on('console') and page.on('request')
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Error Recovery
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# If daemon crashes or gets stuck:
|
|
158
|
+
browser-use close # Clean shutdown
|
|
159
|
+
# Then restart:
|
|
160
|
+
browser-use open <url> # Fresh daemon starts automatically
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Verification Contract
|
|
164
|
+
|
|
165
|
+
Every browser task must produce:
|
|
166
|
+
|
|
167
|
+
1. **State evidence**: `browser-use state` output or screenshot
|
|
168
|
+
2. **Action log**: sequence of commands issued
|
|
169
|
+
3. **Result assertion**: explicit before/after state comparison
|
|
170
|
+
|
|
171
|
+
No browser/UI claim without real-browser evidence.
|
|
172
|
+
|
|
173
|
+
## Architecture Note
|
|
174
|
+
|
|
175
|
+
Browser Use wraps Playwright with AI reasoning. The daemon keeps Chromium running between CLI commands (~50ms latency). The Agent mode adds an LLM observation→decision→action loop on top. This replaces fragile CSS-selector scripts with semantic element targeting via accessibility tree snapshots.
|
|
176
|
+
|
|
177
|
+
Benchmarks: 89.1% WebVoyager (SOTA), 78k+ GitHub stars, MIT license.
|
|
178
|
+
|
|
179
|
+
## Security
|
|
180
|
+
|
|
181
|
+
- **Never log or screenshot credentials** — redact password fields, API keys, tokens before capturing evidence
|
|
182
|
+
- **Chrome profiles contain sensitive data** — only use `--profile` with explicit user approval; never share profile data
|
|
183
|
+
- **Screenshots may capture PII** — review before saving to task evidence directory
|
|
184
|
+
- **Scraping targets need approval** — confirm the target site's ToS allow automated access before scraping
|
|
185
|
+
- **`browser-use input` commands with passwords** — use placeholder values in documentation; never hardcode real credentials
|
|
186
|
+
- **Agent mode sandbox** — run Agent API with `allowed_domains` restriction when possible
|
|
187
|
+
|
|
188
|
+
## Return
|
|
189
|
+
|
|
190
|
+
- CLI commands issued and their output
|
|
191
|
+
- screenshot paths
|
|
192
|
+
- agent history (if Agent mode used)
|
|
193
|
+
- verification pass/fail with evidence
|
|
194
|
+
- remaining risks (flaky selectors, auth issues, CAPTCHAs)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Browser E2E Workflow
|
|
2
|
-
|
|
3
|
-
Optional workflow for browser-visible testing and automation. Installed when `browser-use` CLI is available.
|
|
4
|
-
|
|
5
|
-
## When Active
|
|
6
|
-
|
|
7
|
-
This workflow is active when:
|
|
8
|
-
1. `browser-use` CLI is installed and `browser-use doctor` passes
|
|
9
|
-
2. `Harness/workflows/browser-e2e.md` exists (this file)
|
|
1
|
+
# Browser E2E Workflow
|
|
2
|
+
|
|
3
|
+
Optional workflow for browser-visible testing and automation. Installed when `browser-use` CLI is available.
|
|
4
|
+
|
|
5
|
+
## When Active
|
|
6
|
+
|
|
7
|
+
This workflow is active when:
|
|
8
|
+
1. `browser-use` CLI is installed and `browser-use doctor` passes
|
|
9
|
+
2. `Harness/workflows/browser-e2e.md` exists (this file)
|
|
10
10
|
3. A task explicitly references `/wf-browser`, `$wf-browser`, or browser E2E testing
|
|
11
|
-
|
|
12
|
-
## Contract
|
|
13
|
-
|
|
11
|
+
|
|
12
|
+
## Contract
|
|
13
|
+
|
|
14
14
|
Browser evidence in this project follows the contract:
|
|
15
15
|
|
|
16
16
|
1. **Every browser claim needs real-browser evidence** - screenshot, state snapshot, or console output
|
|
@@ -74,46 +74,46 @@ data-testid="loading-spinner"
|
|
|
74
74
|
- [ ] Clean up any dev server or browser processes
|
|
75
75
|
|
|
76
76
|
## Quick Install
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# One-time setup
|
|
80
|
-
pip install "browser-use[cli]"
|
|
81
|
-
browser-use install
|
|
82
|
-
browser-use doctor
|
|
83
|
-
|
|
84
|
-
# Windows: if you see GBK encoding errors, set:
|
|
85
|
-
set PYTHONIOENCODING=utf-8
|
|
86
|
-
|
|
87
|
-
# Verify
|
|
88
|
-
browser-use open https://example.com
|
|
89
|
-
browser-use state
|
|
90
|
-
browser-use screenshot test.png
|
|
91
|
-
browser-use close
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Fallback
|
|
95
|
-
|
|
96
|
-
If `browser-use` is not installed, fall back to:
|
|
97
|
-
|
|
98
|
-
1. Playwright/Puppeteer MCP server (if configured)
|
|
99
|
-
2. Chrome DevTools Protocol (CDP) manual inspection
|
|
100
|
-
3. `Harness/WF.md#Browser And API Evidence` manual check contract
|
|
101
|
-
|
|
102
|
-
## Integration Points
|
|
103
|
-
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# One-time setup
|
|
80
|
+
pip install "browser-use[cli]"
|
|
81
|
+
browser-use install
|
|
82
|
+
browser-use doctor
|
|
83
|
+
|
|
84
|
+
# Windows: if you see GBK encoding errors, set:
|
|
85
|
+
set PYTHONIOENCODING=utf-8
|
|
86
|
+
|
|
87
|
+
# Verify
|
|
88
|
+
browser-use open https://example.com
|
|
89
|
+
browser-use state
|
|
90
|
+
browser-use screenshot test.png
|
|
91
|
+
browser-use close
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Fallback
|
|
95
|
+
|
|
96
|
+
If `browser-use` is not installed, fall back to:
|
|
97
|
+
|
|
98
|
+
1. Playwright/Puppeteer MCP server (if configured)
|
|
99
|
+
2. Chrome DevTools Protocol (CDP) manual inspection
|
|
100
|
+
3. `Harness/WF.md#Browser And API Evidence` manual check contract
|
|
101
|
+
|
|
102
|
+
## Integration Points
|
|
103
|
+
|
|
104
104
|
- **WF mode**: when browser-visible changes are made, follow the evidence contract in `Harness/WF.md#Browser And API Evidence`
|
|
105
105
|
- **Harness Bridge**: use `Harness/HARNESS_BRIDGE.md` for UI contract, API contract, seeded test data, runtime state probes, and network trace collection.
|
|
106
106
|
- **wf-browser**: Claude Code uses `.claude/skills/wf-browser/SKILL.md`; Codex uses `.agents/skills/wf-browser/SKILL.md`. Both load this workflow.
|
|
107
|
-
- **MEMORY.md**: registered as optional workflow skill
|
|
107
|
+
- **MEMORY.md**: registered as optional workflow skill
|
|
108
108
|
- **README.md**: routing table row "Browser E2E testing or automation" -> browser-e2e
|
|
109
|
-
|
|
110
|
-
## File Locations
|
|
111
|
-
|
|
112
|
-
| File | Purpose |
|
|
113
|
-
|------|---------|
|
|
109
|
+
|
|
110
|
+
## File Locations
|
|
111
|
+
|
|
112
|
+
| File | Purpose |
|
|
113
|
+
|------|---------|
|
|
114
114
|
| `.claude/skills/wf-browser/SKILL.md` | Claude Code skill adapter |
|
|
115
115
|
| `.agents/skills/wf-browser/SKILL.md` | Codex repo skill adapter |
|
|
116
116
|
| `Harness/workflows/browser-e2e.md` | This file - workflow contract and install guide |
|
|
117
|
-
| `~/.claude/skills/browser-use/SKILL.md` | Official Browser Use skill (user-level, auto-downloaded) |
|
|
118
|
-
| `pip show browser-use \| findstr Location` | Python package install location (run to find) |
|
|
119
|
-
| `~/.browser-use/` | Daemon state and browser profiles |
|
|
117
|
+
| `~/.claude/skills/browser-use/SKILL.md` | Official Browser Use skill (user-level, auto-downloaded) |
|
|
118
|
+
| `pip show browser-use \| findstr Location` | Python package install location (run to find) |
|
|
119
|
+
| `~/.browser-use/` | Daemon state and browser profiles |
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
# GitHub PR Review Workflow
|
|
2
|
-
|
|
3
|
-
## Required Evidence
|
|
4
|
-
|
|
5
|
-
- PR URL or number and base/head refs.
|
|
6
|
-
- Diff or changed-file summary.
|
|
7
|
-
- CI/check status and relevant failing logs.
|
|
8
|
-
- Review findings with exact file and line references when available.
|
|
9
|
-
|
|
10
|
-
## Common Commands
|
|
11
|
-
|
|
12
|
-
```powershell
|
|
13
|
-
gh pr view --web
|
|
14
|
-
gh pr view --json number,title,baseRefName,headRefName,mergeStateStatus,statusCheckRollup
|
|
15
|
-
gh pr diff
|
|
16
|
-
git diff --stat
|
|
17
|
-
npm test
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Use repository-specific test commands when they differ from npm.
|
|
21
|
-
|
|
22
|
-
## Fallback
|
|
23
|
-
|
|
24
|
-
If `gh` is unavailable or unauthenticated, use local git refs, remote URLs, and `git diff` against the target branch. Ask for missing PR context only when it cannot be inferred.
|
|
25
|
-
|
|
26
|
-
## Windows Notes
|
|
27
|
-
|
|
28
|
-
Quote branch names containing special characters. In PowerShell, pipe JSON output to tools that are available locally, or read it directly if `jq` is not installed.
|
|
1
|
+
# GitHub PR Review Workflow
|
|
2
|
+
|
|
3
|
+
## Required Evidence
|
|
4
|
+
|
|
5
|
+
- PR URL or number and base/head refs.
|
|
6
|
+
- Diff or changed-file summary.
|
|
7
|
+
- CI/check status and relevant failing logs.
|
|
8
|
+
- Review findings with exact file and line references when available.
|
|
9
|
+
|
|
10
|
+
## Common Commands
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
gh pr view --web
|
|
14
|
+
gh pr view --json number,title,baseRefName,headRefName,mergeStateStatus,statusCheckRollup
|
|
15
|
+
gh pr diff
|
|
16
|
+
git diff --stat
|
|
17
|
+
npm test
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use repository-specific test commands when they differ from npm.
|
|
21
|
+
|
|
22
|
+
## Fallback
|
|
23
|
+
|
|
24
|
+
If `gh` is unavailable or unauthenticated, use local git refs, remote URLs, and `git diff` against the target branch. Ask for missing PR context only when it cannot be inferred.
|
|
25
|
+
|
|
26
|
+
## Windows Notes
|
|
27
|
+
|
|
28
|
+
Quote branch names containing special characters. In PowerShell, pipe JSON output to tools that are available locally, or read it directly if `jq` is not installed.
|