@bwanamaker/brandobot 0.1.0 → 0.1.1
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/README.md +8 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
An [OpenCode](https://opencode.ai) plugin that controls a browser through [Playwright CLI](https://playwright.dev/agent-cli/introduction).
|
|
4
4
|
|
|
5
|
+
View the [NPM](https://www.npmjs.com/package/@bwanamaker/brandobot) package.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
Add the published package to your OpenCode configuration:
|
|
@@ -15,11 +17,11 @@ Add the published package to your OpenCode configuration:
|
|
|
15
17
|
|
|
16
18
|
Restart OpenCode after changing its configuration. OpenCode installs the package and its Playwright CLI dependency when it starts.
|
|
17
19
|
|
|
18
|
-
Playwright CLI requires Node.js 20 or later.
|
|
20
|
+
Playwright CLI requires Node.js 20 or later. It downloads its managed browser on first use. To install it in advance, ask OpenCode to call `browser({ args: ["install-browser"] })`; on Linux, include `--with-deps` when system browser dependencies also need installing. The CLI defaults to a system Chrome installation; pass `--browser=chromium` to use Playwright-managed Chromium.
|
|
19
21
|
|
|
20
|
-
##
|
|
22
|
+
## Choosing Tools
|
|
21
23
|
|
|
22
|
-
Brandobot
|
|
24
|
+
Brandobot guides the agent to select the appropriate tool:
|
|
23
25
|
|
|
24
26
|
| Request | Tool |
|
|
25
27
|
| --- | --- |
|
|
@@ -27,15 +29,7 @@ Brandobot gives the agent routing guidance for selecting the appropriate tool:
|
|
|
27
29
|
| Test, inspect, navigate, interact with, or screenshot a page | `browser` |
|
|
28
30
|
| Read, summarize, or extract content from a URL | OpenCode `webfetch` |
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`open_url` launches the OpenCode host's platform-default browser, not a Playwright browser. When OpenCode runs locally, this is normally the user's default browser:
|
|
33
|
-
|
|
34
|
-
```text
|
|
35
|
-
open_url({ url: "https://www.brandonwanamaker.com" })
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
It supports only `http` and `https` URLs and returns an error on unsupported platforms or headless Linux environments.
|
|
32
|
+
Use `open_url` only when explicitly asked to open an `http` or `https` URL in the OpenCode host's default browser. For mixed or unclear requests, Brandobot asks a short clarifying question.
|
|
39
33
|
|
|
40
34
|
## Browser Tool
|
|
41
35
|
|
|
@@ -46,10 +40,11 @@ The plugin adds a `browser` tool with these arguments:
|
|
|
46
40
|
| `args` | Yes | Each token after `playwright-cli`; do not include the executable name. |
|
|
47
41
|
| `session` | No | A labeled browser isolated to the current OpenCode conversation. |
|
|
48
42
|
|
|
49
|
-
Use the tool in the same order as the CLI. Start with `open --browser=chromium`, call `snapshot`
|
|
43
|
+
Use the tool in the same order as the CLI. Start with `open --browser=chromium`, call `snapshot` when you need element refs, refresh the snapshot after page-changing actions, and close the session when finished. The `type` command writes to the focused field; use snapshot refs for targeted actions such as `click`. Browser sessions are isolated automatically for each OpenCode conversation. Set `session` to create a separate labeled browser within that same conversation; labels never share state across conversations. Attaching to an existing browser, persistent profiles, external endpoints, and custom Playwright configuration are not supported.
|
|
50
44
|
|
|
51
45
|
```text
|
|
52
46
|
browser({ args: ["open", "https://demo.playwright.dev/todomvc", "--browser=chromium"] })
|
|
47
|
+
browser({ args: ["snapshot"] })
|
|
53
48
|
browser({ args: ["type", "Buy groceries"] })
|
|
54
49
|
browser({ args: ["press", "Enter"] })
|
|
55
50
|
browser({ args: ["snapshot"] })
|
|
@@ -88,7 +83,6 @@ bun install
|
|
|
88
83
|
bun run typecheck
|
|
89
84
|
bun test
|
|
90
85
|
bun run build
|
|
91
|
-
npm pack --dry-run
|
|
92
86
|
```
|
|
93
87
|
|
|
94
88
|
The test runs `playwright-cli --help` through the plugin tool and does not launch or download a browser.
|