Skip to content

Commit 9f5ab15

Browse files
authored
builtin playwright tool (#629)
1 parent 5abc873 commit 9f5ab15

16 files changed

+2535
-65
lines changed

.github/copilot-instructions.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ The gh-aw tool provides:
479479
- **Markdown workflow parsing**: Converts natural language workflows from markdown to GitHub Actions YAML
480480
- **Workflow management**: Add, remove, enable, disable agentic workflows
481481
- **AI processor integration**: Supports Claude, Codex, and other AI processors
482+
- **Browser automation**: Playwright integration for web testing and accessibility analysis
482483
- **Local execution**: Run workflows locally for testing
483484
- **Package management**: Install workflow packages from GitHub repositories
484485

@@ -493,6 +494,36 @@ on:
493494
---
494495
```
495496

497+
### Playwright Browser Automation
498+
Playwright is integrated as a neutral tool for browser automation, web testing, and accessibility analysis:
499+
500+
```yaml
501+
---
502+
engine: claude
503+
504+
tools:
505+
playwright:
506+
docker_image_version: "v1.41.0"
507+
allowed_domains: ["github.com", "*.github.com"]
508+
509+
safe-outputs:
510+
create-issue:
511+
title-prefix: "[Accessibility] "
512+
labels: [accessibility, playwright]
513+
max: 1
514+
---
515+
```
516+
517+
**Key Features**:
518+
- **Containerized execution**: Uses Microsoft's official Playwright Docker images
519+
- **Domain restrictions**: Network access controlled via `allowed_domains` configuration
520+
- **Multi-browser support**: Chromium, Firefox, Safari engines
521+
- **Accessibility analysis**: WCAG compliance scanning and accessibility tree analysis
522+
- **Visual testing**: Screenshots and visual regression testing
523+
- **Security**: Isolated container environment with network controls
524+
525+
**Documentation**: See [Playwright Guide](docs/playwright.md) for complete configuration and examples.
526+
496527
### Workflow File Structure
497528
- **`.md` files**: Natural language workflow definitions in `.github/workflows/`
498529
- **`.lock.yml` files**: Compiled GitHub Actions YAML (generated by `gh aw compile`)

CLAUDE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ The gh-aw tool provides:
479479
- **Markdown workflow parsing**: Converts natural language workflows from markdown to GitHub Actions YAML
480480
- **Workflow management**: Add, remove, enable, disable agentic workflows
481481
- **AI processor integration**: Supports Claude, Codex, and other AI processors
482+
- **Browser automation**: Playwright integration for web testing and accessibility analysis
482483
- **Local execution**: Run workflows locally for testing
483484
- **Package management**: Install workflow packages from GitHub repositories
484485

@@ -493,6 +494,36 @@ on:
493494
---
494495
```
495496

497+
### Playwright Browser Automation
498+
Playwright is integrated as a neutral tool for browser automation, web testing, and accessibility analysis:
499+
500+
```yaml
501+
---
502+
engine: claude
503+
504+
tools:
505+
playwright:
506+
docker_image_version: "v1.41.0"
507+
allowed_domains: ["github.com", "*.github.com"]
508+
509+
safe-outputs:
510+
create-issue:
511+
title-prefix: "[Accessibility] "
512+
labels: [accessibility, playwright]
513+
max: 1
514+
---
515+
```
516+
517+
**Key Features**:
518+
- **Containerized execution**: Uses Microsoft's official Playwright Docker images
519+
- **Domain restrictions**: Network access controlled via `allowed_domains` configuration
520+
- **Multi-browser support**: Chromium, Firefox, Safari engines
521+
- **Accessibility analysis**: WCAG compliance scanning and accessibility tree analysis
522+
- **Visual testing**: Screenshots and visual regression testing
523+
- **Security**: Isolated container environment with network controls
524+
525+
**Documentation**: See [Playwright Guide](docs/playwright.md) for complete configuration and examples.
526+
496527
### Workflow File Structure
497528
- **`.md` files**: Natural language workflow definitions in `.github/workflows/`
498529
- **`.lock.yml` files**: Compiled GitHub Actions YAML (generated by `gh aw compile`)

docs/src/content/docs/reference/frontmatter.md

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ engine:
172172
AWS_REGION: us-west-2
173173
CUSTOM_API_ENDPOINT: https://api.example.com
174174
DEBUG_MODE: "true"
175-
error_patterns: # Optional: custom error detection patterns
176-
- pattern: 'ERROR:\s+(.+)'
177-
level_group: 0
178-
message_group: 1
179-
description: "Application errors"
180175
```
181176

182177
**Fields:**
@@ -185,7 +180,6 @@ engine:
185180
- **`model`** (optional): Specific LLM model to use
186181
- **`max-turns`** (optional): Maximum number of chat iterations per run (cost-control option)
187182
- **`env`** (optional): Custom environment variables to pass to the agentic engine as key-value pairs
188-
- **`error_patterns`** (optional): Custom regex patterns for detecting errors in agent logs (see [Error Validation](#error-validation-engineerror_patterns))
189183

190184
**Model Defaults:**
191185
- **Claude**: Uses the default model from the claude-code-base-action (typically latest Claude model)
@@ -352,6 +346,91 @@ error_patterns:
352346
- **Flexible Pattern Matching**: Support for complex regex patterns with capture groups
353347
- **Engine Agnostic**: Works with any engine when custom patterns are provided
354348

349+
## Tools Configuration (`tools:`)
350+
351+
The `tools:` section specifies which tools and MCP (Model Context Protocol) servers are available to the AI engine. This enables integration with GitHub APIs, browser automation, and other external services.
352+
353+
### GitHub Tool
354+
355+
Enable GitHub API access for issue management, pull requests, and repository operations:
356+
357+
```yaml
358+
tools:
359+
github:
360+
# Uses default GitHub API access with workflow permissions
361+
```
362+
363+
Extended GitHub tool configuration:
364+
```yaml
365+
tools:
366+
github:
367+
docker_image_version: "latest" # Optional: specify MCP server version
368+
```
369+
370+
### Playwright Tool
371+
372+
Enable browser automation and web testing capabilities using containerized Playwright:
373+
374+
```yaml
375+
tools:
376+
playwright:
377+
allowed_domains: ["github.com", "*.example.com"]
378+
```
379+
380+
**Playwright Configuration Options:**
381+
382+
```yaml
383+
tools:
384+
playwright:
385+
docker_image_version: "latest" # Optional: Playwright Docker image version
386+
allowed_domains: ["defaults", "github", "*.custom.com"] # Domain access control
387+
```
388+
389+
**Domain Configuration:**
390+
391+
The `allowed_domains` field supports the same ecosystem bundle resolution as the top-level `network:` configuration, with **localhost-only** as the default for enhanced security:
392+
393+
**Ecosystem Bundle Examples:**
394+
```yaml
395+
tools:
396+
playwright:
397+
allowed_domains:
398+
- "defaults" # Basic infrastructure domains
399+
- "github" # GitHub domains (github.com, api.github.com, etc.)
400+
- "node" # Node.js ecosystem
401+
- "python" # Python ecosystem
402+
- "*.example.com" # Custom domain with wildcard
403+
```
404+
405+
**Security Model:**
406+
- **Default**: `["localhost", "127.0.0.1"]` - localhost access only
407+
- **Ecosystem bundles**: Use same identifiers as `network:` configuration
408+
- **Custom domains**: Support exact matches and wildcard patterns
409+
- **Containerized execution**: Isolated Docker environment for security
410+
411+
**Available Ecosystem Identifiers:**
412+
Same as `network:` configuration: `defaults`, `github`, `node`, `python`, `containers`, `java`, `rust`, `playwright`, etc.
413+
414+
### Custom MCP Tools
415+
416+
Add custom Model Context Protocol servers:
417+
418+
```yaml
419+
tools:
420+
custom-api:
421+
mcp:
422+
command: "node"
423+
args: ["custom-mcp-server.js"]
424+
env:
425+
API_KEY: "${{ secrets.CUSTOM_API_KEY }}"
426+
```
427+
428+
**Tool Execution:**
429+
- Tools are configured as MCP servers that run alongside the AI engine
430+
- Each tool provides specific capabilities (APIs, browser automation, etc.)
431+
- Tools run in isolated environments with controlled access
432+
- Domain restrictions apply to network-enabled tools like Playwright
433+
355434
## Network Permissions (`network:`)
356435

357436
> This is only supported by the claude engine today.

pkg/cli/templates/instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ The YAML frontmatter supports these fields:
164164
- `web-fetch:` - Web content fetching tools
165165
- `web-search:` - Web search tools
166166
- `bash:` - Shell command tools
167+
- `playwright:` - Browser automation tools
167168
- Custom tool names for MCP servers
168169

169170
- **`safe-outputs:`** - Safe output processing configuration

0 commit comments

Comments
 (0)