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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-harness-vibe-coding",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Scaffold a 0-1 product harness for AI-assisted research, PRD, planning, architecture, build, test, and feedback loops",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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, then use it (single-model review is better than none).
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
 
@@ -18,6 +18,7 @@
18
18
  "WebSearch"
19
19
  ],
20
20
  "deny": [
21
+ "EnterPlanMode",
21
22
  "Bash(rm -rf *)",
22
23
  "Bash(sudo *)",
23
24
  "Bash(curl *)",
@@ -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 runtime**: Check `which codex` and `which claude`
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) | try the other CLI; if only one installed, use it (still better than self-review) |
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 active project plan
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 {{projectName}}
1
+ # Harness Architecture - create-harness-vibe-coding
2
2
 
3
- > **Responsibility**: Defines the system layering structure, component overview, and key design decisions.
4
- > **Does NOT cover**: Code details (AI can read code), API documentation (placed in docstrings).
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
- <!-- This is the hardest constraint in the entire architecture. Each layer's "allowed dependencies" must be explicit. -->
10
+ ```text
11
+ bin/
12
+ CLI executable shim. Calls src/index.js.
13
13
 
14
- ```
15
- ┌──────────────────────────┐
16
- │ interfaces/ │ User entry (CLI / API / UI)
17
- │ May depend on: harness│
18
- ├──────────────────────────┤
19
- │ harness/ │ Generic runtime shell: orchestration,
20
- │ May depend on: │ security, auditing, scheduling
21
- │ application │ Contains no business rules
22
- ├──────────────────────────┤
23
- │ application/ │ Business use-case orchestration
24
- │ May depend on: domain
25
- ├──────────────────────────┤
26
- │ domain/ │ ← Pure business objects + port protocols
27
- │ Only depends on: │ Depends on no external implementations
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
- **Hard Constraints**:
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 or ports to protect real boundaries, not to create abstraction for its own sake.
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 must have one owner, legal transitions, and observable recovery behavior.
50
+ State in this repo should be explicit, serializable, and owned by one layer.
59
51
 
60
- - Identify durable state, runtime cache, derived UI state, external system state, and audit/event history separately.
61
- - Name the owner of each state slice; do not let UI, application services, and infrastructure all mutate the same state directly.
62
- - Model long-running workflows with explicit states, guards, and failure transitions in `Harness/state-machines.md`.
63
- - Store resumable progress and recovery decisions in `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` or project-owned durable storage, not only in chat.
64
- - Keep state minimal: derive values when cheap, persist only what must survive reload, retry, or handoff.
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
- ## 4. Harness Core Components
60
+ ### 4.1 CLI Entry
69
61
 
70
- ### 4.1 Runner / Loop
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
- - **Responsibility**: Drives a task from input to completion: loading context, calling application use-cases, handling stop conditions.
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
- ### 4.2 Permission Policy
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
- - **Responsibility**: Decides whether a given tool, file, network, or external action is allowed to execute.
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
- ### 4.3 Event Bus / Audit Trail
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
- - **Responsibility**: Records task lifecycle, tool invocations, failures, human approvals, and final results.
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
- ### 4.4 State / Checkpoint Store
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
- - **Responsibility**: Saves recoverable state, context summaries, task progress, and interrupt points.
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
- ### 4.5 Tool Registry
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
- - **Responsibility**: Registers callable tools along with their input/output contracts, permission labels, and error semantics.
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
- ## 5. Architectural Constraints (Non-Negotiable)
122
+ ## 7. Known Follow-Up Risks
109
123
 
110
- - `domain/` only defines business models, business invariants, and port protocols; does not import `harness/`, `infrastructure/`, or `interfaces/`.
111
- - `harness/` may orchestrate workflows, security gates, auditing, and stop conditions, but must not determine business meaning.
112
- - All cross-layer external capabilities are expressed through `domain` ports; adapter implementations live in `infrastructure/`.
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>/PROGRESS.md`.
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>/PROGRESS.md`.
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
- ## Required Evidence
4
-
5
- - App start command and URL.
6
- - Real-browser load of the changed app before any web/UI acceptance claim.
7
- - Console, runtime, and network check result, including whether React/Vite/client startup errors or failed requests appeared.
8
- - Stable accessible labels/roles and stable test hooks such as `data-testid` are required for critical UI controls and states: inputs, buttons, filters, rows, empty/error/loading states.
9
- - CDP, Playwright, and manual verification must target those selectors for the critical interaction path instead of brittle DOM paths.
10
- - Viewports and browsers checked.
11
- - Screenshot, trace, video, or documented manual screenshot artifact for each critical UI flow.
12
- - Final pass/fail result with exact command output summary.
13
-
14
- ## Chrome DevTools / CDP / MCP Checklist
15
-
16
- - Start the app with the project command and record the URL and port.
17
- - Open a real browser target through available CDP, MCP, browser automation, or manual tooling.
18
- - Wait for a stable app selector, route, or page-ready state, not just HTTP 200.
19
- - Capture runtime exceptions, console errors, and failed network requests before and after the flow.
20
- - Interact through stable accessible labels/roles or `data-testid`, not brittle DOM paths.
21
- - Verify at least one critical flow end-to-end in the real browser target.
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
- If Playwright is not installed, prefer an existing browser test command from `package.json`. Chrome DevTools/CDP, manual screenshot evidence, or framework-specific tools are acceptable when the method, URL, flow, console/runtime/network result, and artifacts are documented.
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
- When no browser automation is available, run the app locally in a real browser, inspect critical flows manually, capture screenshots, and report console or network errors. Do not claim web/UI acceptance from typecheck, build, or unit tests alone. Do not install new dependencies unless the user approves.
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
- ## Windows Notes
54
+ ## File Locations
41
55
 
42
- Use PowerShell syntax for environment variables, for example `$env:PORT='3000'; npm run dev`. Quote paths that contain spaces.
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 |