Thank you for your interest in contributing to BAP. This document covers the process for contributing to this project.
- Node.js >= 20.0.0
- pnpm 9.x (
corepack enable && corepack prepare pnpm@9.15.0 --activate, or usenpx pnpm) - Python >= 3.10 if you are touching
packages/python-sdk - Git
git clone https://github.com/browseragentprotocol/bap.git
cd bap
pnpm install
pnpm buildpnpm typecheck # Type checking across all packages
pnpm lint # ESLint
pnpm test # Vitest test suites
pnpm check:artifacts # Verify npm package contents and Python version alignmentpackages/
protocol/ # Core types, schemas, and shared utilities (Zod)
logger/ # Structured logging
client/ # TypeScript WebSocket client SDK
server-playwright/ # Playwright-based BAP server
mcp/ # MCP (Model Context Protocol) bridge
cli/ # Shell CLI for browser automation
python-sdk/ # Python client SDK
Dependency order: protocol -> logger -> client / server-playwright -> mcp / cli
All packages are built with tsup and managed with turborepo.
git checkout -b feature/your-feature-name- Protocol changes go in
packages/protocol/src/types/ - Server handler changes go in
packages/server-playwright/src/server.ts - Client SDK changes go in
packages/client/src/index.ts - CLI commands go in
packages/cli/src/commands/
pnpm build # Build all packages (respects dependency order)
pnpm typecheck # Must pass with zero errors
pnpm lint # Must pass with zero errors (warnings are acceptable)
pnpm test # All tests must pass
pnpm check:artifacts # Release artifact sanity checks- Keep PRs focused on a single change
- Include tests for new functionality
- Update relevant README files if adding user-facing features
- Reference any related issues
- TypeScript strict mode is enabled across all packages
- ESLint with
typescript-eslintrules - Prettier for formatting (
pnpm format) - Use Zod schemas for all protocol types (no raw
interfacefor wire types) - All new protocol fields must be optional for backward compatibility
Tests use Vitest. Each package has its own test configuration.
# Run all tests
pnpm test
# Run tests for a specific package
pnpm --filter @browseragentprotocol/protocol test
# Run with coverage
pnpm test:coverageFor Python SDK changes, also run:
cd packages/python-sdk
python -m pip install -e .[dev]
python -m pytest
python -m build
twine check dist/*- Schema validation tests go in
packages/protocol/src/__tests__/ - CLI flag/command tests go in
packages/cli/__tests__/ - MCP tool tests go in
packages/mcp/src/__tests__/ - Integration tests that require a browser go in
packages/server-playwright/src/__tests__/ - Python SDK tests go in
packages/python-sdk/tests/
BAP uses JSON-RPC 2.0 over WebSocket. If you are changing the protocol:
- Update Zod schemas in
packages/protocol/src/types/ - Export new types from
packages/protocol/src/types/index.ts - Implement server handling in
packages/server-playwright/src/server.ts - Add client passthrough in
packages/client/src/index.ts - Add schema validation tests
- All new fields must be optional to maintain backward compatibility
- Use GitHub Issues
- Include BAP version, Node.js version, and browser type
- For bugs: include steps to reproduce, expected vs actual behavior
- For feature requests: describe the use case and proposed API
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.