The Problem
Websites with no public APIs are stuck behind manual browser interactions. Scraping them means maintaining fragile selectors, handling login sessions, and writing one-off scripts per site. OpenCLI addresses this by turning any logged-in website into a CLI, reusing Chrome's existing session so credentials never leave the browser.
What This Does
OpenCLI is a Node.js/TypeScript CLI that wraps browser automation and data extraction into a command interface. The core is a dual-engine architecture: YAML declarative pipelines for simple data pulls (e.g. src/clis/reddit/hot.yaml) and TypeScript browser runtime scripts for complex interactions (e.g. src/clis/twitter/timeline.ts). A dynamic loader in src/registry.ts auto-registers any .ts or .yaml file dropped into src/clis/, so adding a new site is a matter of writing one adapter file.
The browser layer (src/browser/index.ts) connects via the Playwright MCP Bridge extension, reusing Chrome's logged-in state. The explore command (src/explore.ts) discovers site APIs automatically, and synthesize (src/synthesize.ts) generates adapters from those discoveries. A pipeline executor (src/pipeline/executor.ts) runs the YAML/TS steps, with transform and intercept stages.
How To Use It
Setup — Install globally via npm and run the one-time setup:
npm install -g @jackwener/opencli opencli setup
Configuration — No manual config files needed. setup auto-discovers the PLAYWRIGHTMCPEXTENSIONTOKEN from Chrome and writes it to your MCP client configs (Claude, Cursor, etc.). opencli doctor diagnoses token/config issues across tools and can fix them with --fix.
Running — After setup, commands are direct:
opencli list opencli bilibili hot opencli twitter timeline
Requires Node.js >= 18 and Chrome logged into the target site. The clis/ folder is the extension point — drop a new .yaml or .ts adapter there and it's immediately available.
Real-World Use
A content analyst monitoring Chinese social platforms could run scheduled jobs:
opencli bilibili ranking --format json > bilibilidaily.json opencli zhihu hot --format csv > zhihu_trending.csv
The --format flag supports multiple output formats (src/output.ts), making it suitable for piping into data pipelines or dashboards.
Code Health & Issues
Med — Browser automation is inherently brittle; selectors in src/clis/twitter/.ts will break as sites change. No versioned selector strategy or fallback mechanism is evident. Med — The repo relies on Chrome being pre-logged-in. No documented handling for session expiry or multi-account scenarios. Low — Tests exist (tests/e2e/, src/.test.ts) and CI is configured (.github/workflows/ci.yml), but e2e tests require a live browser and logged-in sessions, making them flaky in CI. Low — The scripts/clean-yaml.cjs and copy-yaml.cjs suggest YAML processing is fragile; likely a workaround for a loader limitation. Low — No explicit secrets in the repo (token is auto-discovered, not committed), which is good.
The Bottom Line
OpenCLI is a practical tool for anyone who needs scripted access to sites without APIs, especially Chinese platforms (Bilibili, Zhihu, Xiaohongshu) that are poorly served by existing tools. The dual-engine design and dynamic loader make it genuinely extensible. It's better suited to individuals or small teams who accept browser-automation fragility than to enterprises needing guaranteed reliability. The 80+ pre-built commands give immediate value, but expect to maintain adapters as target sites evolve.