Sharing a persistent browser QA workflow for OpenCode

mdc-git1 pts0 comments

GitHub - mdc-git/opencode-playwright-interactive: Persistent, interactive browser and Electron QA for OpenCode, powered by a JavaScript REPL and Playwright. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

mdc-git

opencode-playwright-interactive

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>12 Commits<br>12 Commits

skills/playwright-interactive

skills/playwright-interactive

tools

tools

README.md

README.md

View all files

Repository files navigation

OpenCode JavaScript REPL

Persistent, interactive browser and Electron QA for OpenCode, powered by a JavaScript REPL and Playwright.

opencode-playwright-product-video-final.mp4

Advantages

Compared with one-shot shell commands, ad hoc Node scripts, or a fresh browser launch for every check, js_repl keeps JavaScript bindings, imports, and browser objects alive for the current OpenCode session. This makes iterative debugging faster: inspect a page, change the application, query the same page again, and retain the variables and helpers built along the way.

The Playwright skill turns that persistent runtime into an interactive QA loop for browser and Electron applications. It supports targeted inspection, repeatable interactions, screenshots, and follow-up assertions without adding Playwright dependencies or browser binaries to each application workspace. The shared, managed runtime also avoids setup drift between projects while leaving each REPL session isolated.

Install

Copy both directories into an OpenCode project's .opencode/ directory:

.opencode/<br>tools/<br>js_repl.ts<br>LICENSE.txt<br>NOTICE.txt<br>skills/<br>playwright-interactive/<br>SKILL.md<br>LICENSE.txt<br>NOTICE.txt

No project package manifest or workspace install step is required. On first use, js_repl installs its pinned Meriyah parser in ~/.cache/opencode; later sessions reuse it. Fully quit and restart OpenCode after copying or changing a tool or skill.

Requirements

OpenCode with native custom-tool support

Node.js 22.22.0 or newer on PATH

Tools

tools/js_repl.ts exports three native tools:

js_repl: execute plain JavaScript in a persistent, session-isolated Node.js kernel.

js_repl_reset: clear the current session's bindings and terminate its kernel.

js_repl_playwright_setup: install the shared Playwright runtime and Chromium once for every local workspace.

js_repl accepts code and optional timeout_ms (1 to 300000 milliseconds; default 30000). Send JavaScript directly, without Markdown fences.

// First call<br>let counter = 1<br>const path = await import("node:path")<br>console.log(path.basename("/tmp/example"), counter)

// Later call in the same OpenCode session<br>counter += 1<br>console.log(counter)

Top-level const, let, var, function, and class bindings persist between calls. Dynamic imports support Node builtins, installed workspace packages, and local ESM .js/.mjs files. Static imports are not supported; use await import(...).

The kernel exposes opencode.cwd, opencode.homeDir, opencode.tmpDir, tmpDir, and opencode.emitImage(imageLike). Image attachments support PNG, JPEG, WebP, and GIF, with a 5 MiB limit per image and at most four images per execution.

Call js_repl_reset after explicit browser cleanup. Timeouts, cancellation, fatal asynchronous errors, process crashes, and fully closing OpenCode also tear down the kernel. Native custom tools do not receive the plugin session-deletion lifecycle hook, so reset explicitly when a long-lived session no longer needs the REPL.

Playwright Skill

skills/playwright-interactive/ provides persistent browser and Electron QA instructions. Before first use, call js_repl_playwright_setup; it installs Playwright 1.62.0 and Chromium under ~/.cache/opencode/playwright by default, rather than modifying each application workspace. The REPL automatically resolves the shared library and browser path thereafter. Set OPENCODE_PLAYWRIGHT_CACHE_DIR to relocate the managed cache, OPENCODE_PLAYWRIGHT_NPM_PATH or OPENCODE_PLAYWRIGHT_NPX_PATH to select package executables, and...

opencode playwright browser session interactive tools

Related Articles