create-harness-vibe-coding 0.6.1 → 0.6.3
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 +1 -1
- package/templates/common/.claude/commands/wf-review.md +1 -1
- package/templates/common/.claude/settings.json +1 -0
- package/templates/common/.claude/skills/wf-review/SKILL.md +2 -2
- package/templates/common/docs/README.md +1 -1
- package/templates/common/docs/harness/architecture.md +93 -81
- package/templates/common/docs/research/README.md +2 -2
- package/templates/optional/skills/browser-e2e/.claude/commands/wf-browser.md +25 -0
- package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +164 -0
- package/templates/optional/skills/browser-e2e/docs/workflows/browser-e2e.md +55 -34
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ Cross-model peer review. Invokes the OTHER agent CLI to review changes from a fr
|
|
|
20
20
|
- Check `which codex && echo CODEX || echo NO_CODEX` to detect Codex
|
|
21
21
|
- Check `which claude && echo CLAUDE || echo NO_CLAUDE` to detect Claude
|
|
22
22
|
- Use the OTHER CLI — the one NOT running this session. Never self-review.
|
|
23
|
-
- If only one CLI is available: warn,
|
|
23
|
+
- If only one CLI is available: warn the user, suggest installing the other CLI. Do NOT proceed with self-review.
|
|
24
24
|
|
|
25
25
|
## Flow
|
|
26
26
|
|
|
@@ -14,7 +14,7 @@ Cross-model peer review via the OTHER agent CLI. Fresh eyes on your changes.
|
|
|
14
14
|
|
|
15
15
|
## How It Works
|
|
16
16
|
|
|
17
|
-
1. **Detect
|
|
17
|
+
1. **Detect available CLIs**: Check `which codex` and `which claude`. Use the OTHER CLI — never the one running this session.
|
|
18
18
|
2. **Prepare context**: Gather diff (`git diff`), relevant architecture docs, the specific question
|
|
19
19
|
3. **Invoke the OTHER CLI** — the one we're NOT currently running under
|
|
20
20
|
4. **Read and synthesize**: Present the raw output, then add analysis
|
|
@@ -25,7 +25,7 @@ Cross-model peer review via the OTHER agent CLI. Fresh eyes on your changes.
|
|
|
25
25
|
|---|---|
|
|
26
26
|
| Claude → Codex | `git diff \| codex exec "..."` (include full diff, not just commit message) |
|
|
27
27
|
| Codex → Claude | `git diff \| claude -p "..."` |
|
|
28
|
-
| Either (fallback) |
|
|
28
|
+
| Either (fallback) | warn user, suggest installing the other CLI. Do NOT proceed with same-model review. |
|
|
29
29
|
|
|
30
30
|
**Anti-self-review rule**: Detect which runtime we're in, then use the OTHER one. Never invoke the same CLI that's running the session.
|
|
31
31
|
|
|
@@ -103,7 +103,7 @@ Routing priority: if a request explicitly says `/wf <task>`, `/wf-max [task]`, `
|
|
|
103
103
|
```text
|
|
104
104
|
Harness/README.md router only
|
|
105
105
|
Harness/MEMORY.md resource index
|
|
106
|
-
Harness/PLAN.md
|
|
106
|
+
Harness/PLAN.md project-level plan (redirects to tasks/<id>/PLAN.md)
|
|
107
107
|
Harness/SETUP.md install/bootstrap contract
|
|
108
108
|
Harness/PROGRESS.md global task index and cross-task decisions
|
|
109
109
|
Harness/tasks/<id>/PROGRESS.md per-task progress, phase, heartbeat
|
|
@@ -1,114 +1,126 @@
|
|
|
1
|
-
# Harness Architecture
|
|
1
|
+
# Harness Architecture - create-harness-vibe-coding
|
|
2
2
|
|
|
3
|
-
> **Responsibility**:
|
|
4
|
-
> **Does NOT cover**:
|
|
5
|
-
>
|
|
6
|
-
> Philosophical sources: arc42 Chapter 5 (Building Block View) + C4 Model Level 3 (Component) + matklad's lightweight ARCHITECTURE.md.
|
|
3
|
+
> **Responsibility**: Define the repository structure and scaffold generation boundaries.
|
|
4
|
+
> **Does NOT cover**: Generated target-project business architecture.
|
|
7
5
|
|
|
8
6
|
---
|
|
9
7
|
|
|
10
8
|
## 1. Layering Rules
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
```text
|
|
11
|
+
bin/
|
|
12
|
+
CLI executable shim. Calls src/index.js.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
│ standard library │
|
|
29
|
-
├──────────────────────────┤
|
|
30
|
-
│ infrastructure/ │ ← Adapter implementations (data sources,
|
|
31
|
-
│ Implements domain │ external services)
|
|
32
|
-
│ ports │
|
|
33
|
-
└──────────────────────────┘
|
|
14
|
+
src/
|
|
15
|
+
CLI orchestration and scaffold generation logic.
|
|
16
|
+
May read templates/ and write the chosen target directory.
|
|
17
|
+
|
|
18
|
+
templates/
|
|
19
|
+
Source of generated scaffold assets.
|
|
20
|
+
Must stay declarative: markdown, skill files, agent files, scripts, and optional workflow docs.
|
|
21
|
+
|
|
22
|
+
Harness/ and .claude/
|
|
23
|
+
Dogfood runtime for this repository's own agent work.
|
|
24
|
+
Must not be treated as package source unless intentionally copied into templates/.
|
|
25
|
+
|
|
26
|
+
tests/
|
|
27
|
+
Node test suite for CLI behavior, generator behavior, package contents, and generated harness validation.
|
|
34
28
|
```
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
- domain must never import infrastructure/ or interfaces/
|
|
38
|
-
- application only depends on domain
|
|
39
|
-
- harness coordinates workflows but contains no domain business rules
|
|
40
|
-
- All cross-layer communication goes through port protocols defined in domain
|
|
30
|
+
Hard constraints:
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
- `templates/common/**` and `templates/optional/**` are the source of generated output.
|
|
33
|
+
- Root `Harness/**` is this repository's operating harness; changing it does not change generated projects.
|
|
34
|
+
- Generated output paths are normalized by `harnessDest()` in `src/generator.js`.
|
|
35
|
+
- Existing-project safety is owned by conflict planning in `src/generator.js`, not by template prose alone.
|
|
36
|
+
- Package publication is constrained by `package.json#files`; root dogfood files are not package contents.
|
|
43
37
|
|
|
44
38
|
## 2. Interface Decoupling
|
|
45
39
|
|
|
46
|
-
Use interfaces
|
|
47
|
-
|
|
48
|
-
- Define a port when code crosses a layer, process, network, storage, SDK, browser, or permission boundary.
|
|
49
|
-
- Keep domain and application logic independent from infrastructure adapters.
|
|
50
|
-
- Pass data through explicit contracts instead of reaching into another feature's internals.
|
|
51
|
-
- Prefer direct calls inside the same cohesive module when there is only one caller, one implementation, and no boundary to protect.
|
|
52
|
-
- Avoid speculative abstraction: do not add factories, plugin systems, service locators, generic repositories, or config layers until the feature has a concrete second use or a real testability/replacement need.
|
|
40
|
+
Use interfaces and module boundaries to protect real seams in the generator, not to decorate straightforward code.
|
|
53
41
|
|
|
54
|
-
|
|
42
|
+
- `src/index.js` owns CLI/user interaction; `src/generator.js` owns planning and file writes.
|
|
43
|
+
- Template files are declarative inputs; source code should not depend on root dogfood `Harness/**`.
|
|
44
|
+
- Optional catalog structure is the extension contract for presets and optional skills.
|
|
45
|
+
- Avoid speculative abstraction: do not add plugin systems, generic runners, extra config layers, or service containers until a real second use or testability boundary exists.
|
|
46
|
+
- When a boundary is real, express it with a small data contract and test it through generated output behavior.
|
|
55
47
|
|
|
56
48
|
## 3. State Design
|
|
57
49
|
|
|
58
|
-
State
|
|
50
|
+
State in this repo should be explicit, serializable, and owned by one layer.
|
|
59
51
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
52
|
+
- Generator plan state is computed in memory and returned as `plan`/`summary`; file writes consume that plan instead of re-deciding conflicts.
|
|
53
|
+
- Filesystem state is authoritative only through existence/type checks and write results.
|
|
54
|
+
- Optional selection state comes from CLI flags plus `templates/optional/catalog.json`; do not duplicate it in template prose.
|
|
55
|
+
- Release state lives in `package.json`, npm, git tags, and GitHub; document commands in `README.md`, not `CLAUDE.md`.
|
|
56
|
+
- Long-running agent work records resumable status in `Harness/tasks/<task-id>/PLAN.md#Heartbeat`.
|
|
65
57
|
|
|
66
|
-
|
|
58
|
+
## 4. Core Components
|
|
67
59
|
|
|
68
|
-
|
|
60
|
+
### 4.1 CLI Entry
|
|
69
61
|
|
|
70
|
-
|
|
62
|
+
- **Location**: `bin/create-harness-vibe-coding.js`, `src/index.js`
|
|
63
|
+
- **Responsibility**: Parse flags, handle interactive/non-interactive modes, print plans/results, and call the generator.
|
|
64
|
+
- **Does NOT handle**: Template walking, conflict classification, or file writing internals.
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
- **Design Decision**:
|
|
74
|
-
- Runner only orchestrates, does not interpret domain meaning — Rationale: keeps harness reusable across different business domains
|
|
75
|
-
- Stop conditions are explicitly modeled — Rationale: prevents agent loops from running indefinitely or silently half-completing
|
|
76
|
-
- **Does NOT handle**: Business rules, domain object creation details, external service implementations
|
|
66
|
+
### 4.2 Prompt Layer
|
|
77
67
|
|
|
78
|
-
|
|
68
|
+
- **Location**: `src/prompts.js`
|
|
69
|
+
- **Responsibility**: Ask basic interactive npx questions: project name and target directory.
|
|
70
|
+
- **Does NOT handle**: Agent-link install intake. That matrix is read by coding agents from `README.md` and `Harness/SETUP.md`.
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
- **Design Decision**:
|
|
82
|
-
- High-risk actions are denied by default, allow rules are explicitly declared — Rationale: the platform must first guarantee security boundaries
|
|
83
|
-
- **Does NOT handle**: Judging whether a business action is correct
|
|
72
|
+
### 4.3 Generator Core
|
|
84
73
|
|
|
85
|
-
|
|
74
|
+
- **Location**: `src/generator.js`
|
|
75
|
+
- **Responsibility**: Resolve optional selections, map template paths to destination paths, detect conflicts, render templates, register optional workflows, and write files.
|
|
76
|
+
- **Critical functions**:
|
|
77
|
+
- `harnessDest()` maps legacy template source paths such as `docs/harness/*` into generated root `Harness/*`.
|
|
78
|
+
- `createPlan()` and `addFileActions()` classify directories and file actions before writes.
|
|
79
|
+
- `registerOptionalContent()` updates generated router/memory docs when optional workflows are selected.
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
- **Design Decision**:
|
|
89
|
-
- Events are append-only, audit records cannot be overwritten in place — Rationale: facilitates replay, debugging, and post-mortem analysis
|
|
90
|
-
- **Does NOT handle**: Saving final data on behalf of business systems
|
|
81
|
+
### 4.4 Template Assets
|
|
91
82
|
|
|
92
|
-
|
|
83
|
+
- **Location**: `templates/common/**`, `templates/optional/**`
|
|
84
|
+
- **Responsibility**: Define generated `CLAUDE.md`, `AGENTS.md`, `README.md`, `Harness/**`, `.claude/**`, optional skills, and optional workflows.
|
|
85
|
+
- **Does NOT handle**: Existing-project decisions. Templates state contracts; generator and agents apply them safely.
|
|
93
86
|
|
|
94
|
-
|
|
95
|
-
- **Design Decision**:
|
|
96
|
-
- State format must be serializable — Rationale: enables replay, resume, testing, and migration
|
|
97
|
-
- **Does NOT handle**: Long-term business database modeling
|
|
87
|
+
### 4.5 Validator
|
|
98
88
|
|
|
99
|
-
|
|
89
|
+
- **Source template**: `templates/common/scripts/validate-harness.mjs`
|
|
90
|
+
- **Generated location**: `Harness/scripts/validate-harness.mjs`
|
|
91
|
+
- **Responsibility**: Validate required scaffold files, skill/agent registrations, router invariants, optional workflow registrations, and strict project-fact placeholders.
|
|
100
92
|
|
|
101
|
-
|
|
102
|
-
- **Design Decision**:
|
|
103
|
-
- Tool contracts explicitly specify input, output, errors, and side effects — Rationale: reduces the probability of agent tool misuse
|
|
104
|
-
- **Does NOT handle**: Internal business implementation of tools
|
|
93
|
+
### 4.6 Dogfood Runtime
|
|
105
94
|
|
|
106
|
-
|
|
95
|
+
- **Location**: root `Harness/**`, `.claude/**`, `CLAUDE.md`, `AGENTS.md`, `MEMORY.md`
|
|
96
|
+
- **Responsibility**: Govern future AI-agent work in this repository.
|
|
97
|
+
- **Does NOT handle**: Changing package output unless edits are made to `templates/**` or source code.
|
|
98
|
+
|
|
99
|
+
## 5. Data Flow
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
CLI args / prompts
|
|
103
|
+
-> src/index.js parse and display
|
|
104
|
+
-> src/generator.js resolve optional catalog
|
|
105
|
+
-> walk templates/common and selected templates/optional
|
|
106
|
+
-> harnessDest maps source paths to generated destinations
|
|
107
|
+
-> createPlan/addFileActions classify create/skip/backup/overwrite/conflict
|
|
108
|
+
-> renderTemplate substitutes projectName
|
|
109
|
+
-> registerOptionalContent updates generated Harness router/memory
|
|
110
|
+
-> write files or return dry-run/json plan
|
|
111
|
+
-> tests and generated validator verify behavior
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 6. Architectural Constraints
|
|
115
|
+
|
|
116
|
+
- Do not add generated-output behavior by editing only root `Harness/`; edit `templates/common/**` or `templates/optional/**`.
|
|
117
|
+
- Do not add user-facing CLI behavior without tests in `tests/cli-smoke.test.js` or `tests/generator.test.js`.
|
|
118
|
+
- Do not add required generated files without updating `templates/common/scripts/validate-harness.mjs` and relevant tests.
|
|
119
|
+
- Do not write Harness docs into generated `docs/`; `Harness/` is the generated root for harness-owned docs.
|
|
120
|
+
- Do not make root `CLAUDE.md` a dumping ground for build commands, architecture, or release process.
|
|
107
121
|
|
|
108
|
-
##
|
|
122
|
+
## 7. Known Follow-Up Risks
|
|
109
123
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
- Rejections and failures must be testable or documented with manual verification steps in the feature doc.
|
|
114
|
-
- Audit events are append-only, never overwritten in place.
|
|
124
|
+
- Interactive confirmation currently happens before full conflict-plan display in interactive mode.
|
|
125
|
+
- Some README tests assert exact prose and can be made more structural.
|
|
126
|
+
- `wf-mode` and `subagent-orchestrator` routing priority should continue to be tightened in templates.
|
|
@@ -6,7 +6,7 @@ Purpose: guide agent research. Record conclusions in [research-results.md](resea
|
|
|
6
6
|
|
|
7
7
|
Use this before PRD, stack choice, external API use, public dependency choice, pricing/legal/security assumptions, or any fact likely to change.
|
|
8
8
|
|
|
9
|
-
Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `Harness/tasks/<task-id>/
|
|
9
|
+
Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `Harness/tasks/<task-id>/PLAN.md`.
|
|
10
10
|
|
|
11
11
|
## Research Agent
|
|
12
12
|
|
|
@@ -104,7 +104,7 @@ Use these patterns when turning research into PRD or feature docs:
|
|
|
104
104
|
|
|
105
105
|
## Write Target
|
|
106
106
|
|
|
107
|
-
- Research process, queries, and limitations: this file or `Harness/tasks/<task-id>/
|
|
107
|
+
- Research process, queries, and limitations: this file or `Harness/tasks/<task-id>/PLAN.md`.
|
|
108
108
|
- Final research decisions: [research-results.md](research-results.md).
|
|
109
109
|
- Product scope: [PRD.md](PRD.md).
|
|
110
110
|
- Architecture consequences: `Harness/architecture.md` and `Harness/domain/ports.md`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# /wf-browser [task]
|
|
2
|
+
|
|
3
|
+
AI-driven browser automation via Browser Use (89.1% WebVoyager benchmark). Dual mode: CLI (~50ms per call, no LLM needed) + Python Agent API (multi-step AI reasoning).
|
|
4
|
+
|
|
5
|
+
## Required
|
|
6
|
+
|
|
7
|
+
- Load `wf-browser` skill.
|
|
8
|
+
- Load `Harness/workflows/browser-e2e.md` for evidence contract and fallback paths.
|
|
9
|
+
- Real-browser evidence required for every browser/UI claim (screenshot, state snapshot, or console output).
|
|
10
|
+
|
|
11
|
+
## Modes
|
|
12
|
+
|
|
13
|
+
**CLI (fast iteration):** `browser-use open/state/click/screenshot/close` — Claude Code reasons, CLI executes.
|
|
14
|
+
**Agent (complex flows):** Python API with LLM observation→decision→action loop.
|
|
15
|
+
|
|
16
|
+
## Flow
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
open page → state (inspect elements)
|
|
20
|
+
→ click/input (interact)
|
|
21
|
+
→ state/screenshot (verify)
|
|
22
|
+
→ close (cleanup)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Keep browser evidence in `Harness/tasks/<task-id>/evidence/*.png`.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wf-browser
|
|
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 /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
|
+
### Requirements
|
|
80
|
+
|
|
81
|
+
| Requirement | Version | Check |
|
|
82
|
+
|-------------|---------|-------|
|
|
83
|
+
| Python | >= 3.11 | `python --version` |
|
|
84
|
+
| pip | any | `pip --version` |
|
|
85
|
+
| Chromium | auto-installed | `browser-use doctor` |
|
|
86
|
+
| LLM API key | for Agent mode only | check `.env` |
|
|
87
|
+
|
|
88
|
+
## Common Patterns
|
|
89
|
+
|
|
90
|
+
### Login Persistence
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Use real Chrome profile (preserves cookies/logins)
|
|
94
|
+
browser-use --profile "Default" open https://app.target.com
|
|
95
|
+
# Or connect to running Chrome with remote debugging
|
|
96
|
+
browser-use connect
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### E2E Test Flow
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
browser-use --headed open https://yourapp.local
|
|
103
|
+
browser-use state # Verify page loaded
|
|
104
|
+
browser-use screenshot step1-landing.png # Evidence
|
|
105
|
+
browser-use input 3 "test@email.com" # Fill email
|
|
106
|
+
browser-use input 5 "password123" # Fill password
|
|
107
|
+
browser-use click 8 # Click login button
|
|
108
|
+
browser-use wait text "Dashboard" # Wait for navigation text
|
|
109
|
+
browser-use state # Verify logged in
|
|
110
|
+
browser-use screenshot step2-dashboard.png # Evidence
|
|
111
|
+
browser-use close
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Console & Network Log Capture
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
browser-use eval "console.log('checkpoint');" # Inject log marker
|
|
118
|
+
browser-use eval "document.title" # Read page state via JS
|
|
119
|
+
browser-use get text 5 # Get text of element index 5
|
|
120
|
+
browser-use get value 3 # Get value of input element index 3
|
|
121
|
+
# For full console/network: use Python Agent mode with Playwright's page.on('console') and page.on('request')
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Error Recovery
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# If daemon crashes or gets stuck:
|
|
128
|
+
browser-use close # Clean shutdown
|
|
129
|
+
# Then restart:
|
|
130
|
+
browser-use open <url> # Fresh daemon starts automatically
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Verification Contract
|
|
134
|
+
|
|
135
|
+
Every browser task must produce:
|
|
136
|
+
|
|
137
|
+
1. **State evidence**: `browser-use state` output or screenshot
|
|
138
|
+
2. **Action log**: sequence of commands issued
|
|
139
|
+
3. **Result assertion**: explicit before/after state comparison
|
|
140
|
+
|
|
141
|
+
No browser/UI claim without real-browser evidence.
|
|
142
|
+
|
|
143
|
+
## Architecture Note
|
|
144
|
+
|
|
145
|
+
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.
|
|
146
|
+
|
|
147
|
+
Benchmarks: 89.1% WebVoyager (SOTA), 78k+ GitHub stars, MIT license.
|
|
148
|
+
|
|
149
|
+
## Security
|
|
150
|
+
|
|
151
|
+
- **Never log or screenshot credentials** — redact password fields, API keys, tokens before capturing evidence
|
|
152
|
+
- **Chrome profiles contain sensitive data** — only use `--profile` with explicit user approval; never share profile data
|
|
153
|
+
- **Screenshots may capture PII** — review before saving to task evidence directory
|
|
154
|
+
- **Scraping targets need approval** — confirm the target site's ToS allow automated access before scraping
|
|
155
|
+
- **`browser-use input` commands with passwords** — use placeholder values in documentation; never hardcode real credentials
|
|
156
|
+
- **Agent mode sandbox** — run Agent API with `allowed_domains` restriction when possible
|
|
157
|
+
|
|
158
|
+
## Return
|
|
159
|
+
|
|
160
|
+
- CLI commands issued and their output
|
|
161
|
+
- screenshot paths
|
|
162
|
+
- agent history (if Agent mode used)
|
|
163
|
+
- verification pass/fail with evidence
|
|
164
|
+
- remaining risks (flaky selectors, auth issues, CAPTCHAs)
|
|
@@ -1,42 +1,63 @@
|
|
|
1
1
|
# Browser E2E Workflow
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Save screenshot, trace, video, or result artifact paths and record them in `Harness/PLAN.md` or the feature doc.
|
|
23
|
-
- Clean up any dev server or browser processes started for verification.
|
|
24
|
-
|
|
25
|
-
## Common Commands
|
|
26
|
-
|
|
27
|
-
```powershell
|
|
28
|
-
npm run dev
|
|
29
|
-
npx playwright test
|
|
30
|
-
npx playwright test --headed
|
|
31
|
-
npx playwright show-report
|
|
32
|
-
```
|
|
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
|
+
3. A task explicitly references `/wf-browser` or browser E2E testing
|
|
11
|
+
|
|
12
|
+
## Contract
|
|
13
|
+
|
|
14
|
+
Browser evidence in this project follows the contract:
|
|
15
|
+
|
|
16
|
+
1. **Every browser claim needs real-browser evidence** — screenshot, state snapshot, or console output
|
|
17
|
+
2. **CLI mode is preferred for deterministic steps** — use `browser-use open/state/click/screenshot` for predictable flows
|
|
18
|
+
3. **Agent mode is for dynamic exploration** — use Browser Use Agent API when the page structure is unknown or changing
|
|
19
|
+
4. **Evidence goes to the task directory** — `Harness/tasks/<task-id>/evidence/*.png`
|
|
20
|
+
|
|
21
|
+
## Quick Install
|
|
33
22
|
|
|
34
|
-
|
|
23
|
+
```bash
|
|
24
|
+
# One-time setup
|
|
25
|
+
pip install "browser-use[cli]"
|
|
26
|
+
browser-use install
|
|
27
|
+
browser-use doctor
|
|
28
|
+
|
|
29
|
+
# Windows: if you see GBK encoding errors, set:
|
|
30
|
+
set PYTHONIOENCODING=utf-8
|
|
31
|
+
|
|
32
|
+
# Verify
|
|
33
|
+
browser-use open https://example.com
|
|
34
|
+
browser-use state
|
|
35
|
+
browser-use screenshot test.png
|
|
36
|
+
browser-use close
|
|
37
|
+
```
|
|
35
38
|
|
|
36
39
|
## Fallback
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
If `browser-use` is not installed, fall back to:
|
|
42
|
+
|
|
43
|
+
1. Playwright/Puppeteer MCP server (if configured)
|
|
44
|
+
2. Chrome DevTools Protocol (CDP) manual inspection
|
|
45
|
+
3. `Harness/WF.md#Browser And API Evidence` manual check contract
|
|
46
|
+
|
|
47
|
+
## Integration Points
|
|
48
|
+
|
|
49
|
+
- **wf-mode**: references this file at line 16 and 42 of `.claude/skills/wf-mode/SKILL.md`
|
|
50
|
+
- **wf-browser**: the `/wf-browser` slash command loads this workflow + the skill via `.claude/commands/wf-browser.md`
|
|
51
|
+
- **MEMORY.md**: registered as optional workflow skill
|
|
52
|
+
- **README.md**: routing table row "Browser E2E testing or automation" → browser-e2e
|
|
39
53
|
|
|
40
|
-
##
|
|
54
|
+
## File Locations
|
|
41
55
|
|
|
42
|
-
|
|
56
|
+
| File | Purpose |
|
|
57
|
+
|------|---------|
|
|
58
|
+
| `.claude/skills/wf-browser/SKILL.md` | Skill definition |
|
|
59
|
+
| `.claude/commands/wf-browser.md` | Slash command bridge |
|
|
60
|
+
| `Harness/workflows/browser-e2e.md` | This file — workflow contract and install guide |
|
|
61
|
+
| `~/.claude/skills/browser-use/SKILL.md` | Official Browser Use skill (user-level, auto-downloaded) |
|
|
62
|
+
| `pip show browser-use \| findstr Location` | Python package install location (run to find) |
|
|
63
|
+
| `~/.browser-use/` | Daemon state and browser profiles |
|