feat: add playwright

This commit is contained in:
2026-09-12 18:56:00 +02:00
parent a6cb0beade
commit dfe9926c7c
4 changed files with 313 additions and 1 deletions
+6
View File
@@ -67,6 +67,12 @@ This relative path assumes the configuration file is in the selected global conf
The plugin supplies session-local `todoread` and `todowrite` tools when no other plugin provides them. In OpenCode V2 2.0.2, custom tools cannot open permission prompts: an `ask` or `deny` rule blocks these todo tools rather than bypassing the rule. Explicitly allow them if you want to use them.
The plugin also adds an MCP server named `playwright` unless one with that exact name is already configured; existing configurations are preserved, including disabled servers. It first looks from the current project directory through its ancestors for an executable declared as `playwright-mcp` by an installed `@playwright/mcp` package, then checks `PATH` for an executable whose resolved package is genuinely `@playwright/mcp`. This direct MCP installation is preferred and is launched without a package runner.
If the MCP package is absent but an installed `playwright` package, an `@playwright/test` package with its `playwright` dependency available, or a genuine `playwright` package CLI on `PATH` is found, the plugin configures `npx -y @playwright/mcp@latest`. The ordinary CLI is only evidence that Playwright is local; it is never run as an MCP server. Detection performs no network access and launches nothing, but the first MCP connection requires `npx`, registry access to download/update `@playwright/mcp@latest`, Node.js supported by that package, and browser binaries and system dependencies.
Only when neither Playwright MCP nor ordinary Playwright is verified locally does OpenCode start the official Microsoft image over stdio with `docker run -i --rm --init --pull=always mcr.microsoft.com/playwright/mcp`. Setup does not start the container. The fallback requires Docker when OpenCode first connects, may pull the image then, and currently supports only headless Chromium. If `npx`, Docker, registry access, or other runtime prerequisites for the selected path are unavailable, the Playwright MCP connection fails without preventing the rest of the plugin from loading. Configure your own server named `playwright` (it may be disabled) to override automatic selection.
When an MCP server named `codegraph` is already configured, its tools are exposed directly to `coordinate` and retain the built-in `build` agent's matching allow, ask, and deny rules. The plugin does not configure or start a missing server, and no other MCP server is exposed this way.
## ChatGPT subscription quota