OPENCLI(1)

NAME

OpenCLIMake Any Website & Tool Your CLI. A universal CLI Hub and AI-native runtime. Transform any website, Electron app, or…

SYNOPSIS

$npm install -g @jackwener/opencli

INFO

14.6k stars
1.4k forks
0 views
TypeScriptDeveloper Tools

DESCRIPTION

Make Any Website & Tool Your CLI. A universal CLI Hub and AI-native runtime. Transform any website, Electron app, or local binary into a standardized command-line interface. Built for AI Agents to discover, learn, and execute tools seamlessly via a unified AGENT.md integration.

README

OpenCLI

Turn websites, browser sessions, Electron apps, and local tools into deterministic interfaces for humans and AI agents. Reuse your logged-in browser, automate live workflows, and crystallize repeated actions into reusable CLI commands.

中文文档 npm Node.js Version License

OpenCLI gives you one surface for three different kinds of automation:

  • Use built-in adapters for sites like Bilibili, Zhihu, Xiaohongshu, Reddit, HackerNews, Twitter/X, and many more.
  • Drive a live browser directly with opencli browser when an AI agent needs to click, type, extract, or inspect a page in real time.
  • Generate new adapters from real browser behavior with explore, synthesize, generate, and cascade.

It also works as a CLI hub for local tools such as gh, docker, and other binaries you register yourself, plus desktop app adapters for Electron apps like Cursor, Codex, Antigravity, ChatGPT, and Notion.

Why OpenCLI


Highlights

  • CLI All Electron — CLI-ify apps like Antigravity Ultra! Now AI can control itself natively.
  • Browser Automationbrowser gives AI agents direct browser control: click, type, extract, screenshot — any interaction, fully scriptable.
  • Website → CLI — Turn any website into a deterministic CLI: 70+ pre-built adapters, or crystallize your own with opencli record.
  • Account-safe — Reuses Chrome/Chromium logged-in state; your credentials never leave the browser.
  • Anti-detection built-in — Patches navigator.webdriver, stubs window.chrome, fakes plugin lists, cleans ChromeDriver/Playwright globals, and strips CDP frames from Error stack traces. Extensive anti-fingerprinting and risk-control evasion measures baked in at every layer.
  • AI Agent readyexplore discovers APIs, synthesize generates adapters, cascade finds auth strategies, browser controls the browser directly.
  • External CLI Hub — Discover, auto-install, and passthrough commands to any external CLI (gh, obsidian, docker, etc). Zero setup.
  • Self-healing setupopencli doctor diagnoses and auto-starts the daemon, extension, and live browser connectivity.
  • Dynamic Loader — Simply drop .ts adapters into the clis/ folder for auto-registration.
  • Zero LLM cost — No tokens consumed at runtime. Run 10,000 times and pay nothing.
  • Deterministic — Same command, same output schema, every time. Pipeable, scriptable, CI-friendly.
  • Broad coverage — 79+ sites across global and Chinese platforms (Bilibili, Zhihu, Xiaohongshu, Reddit, HackerNews, and more), plus desktop Electron apps via CDP.

Quick Start

1. Install OpenCLI

npm install -g @jackwener/opencli

2. Install the Browser Bridge Extension

OpenCLI connects to Chrome/Chromium through a lightweight Browser Bridge extension plus a small local daemon. The daemon auto-starts when needed.

  1. Download the latest opencli-extension.zip from the GitHub Releases page.
  2. Unzip it, open chrome://extensions, and enable Developer mode.
  3. Click Load unpacked and select the unzipped folder.

3. Verify the setup

opencli doctor
opencli daemon status

4. Run your first commands

opencli list
opencli hackernews top --limit 5
opencli bilibili hot --limit 5

For Humans

Use OpenCLI directly when you want a reliable command instead of a live browser session:

  • opencli list shows every registered command.
  • opencli <site> <command> runs a built-in or generated adapter.
  • opencli register mycli exposes a local CLI through the same discovery surface.
  • opencli daemon status and opencli doctor help diagnose browser connectivity.

For AI Agents

Use two different entry points depending on the task:

Install the packaged skills with:

npx skills add jackwener/opencli

Or install only what you need:

npx skills add jackwener/opencli --skill opencli-usage
npx skills add jackwener/opencli --skill opencli-browser
npx skills add jackwener/opencli --skill opencli-explorer
npx skills add jackwener/opencli --skill opencli-oneshot

In practice:

  • start with opencli-explorer when the agent needs a reusable command for a site (it covers both automated and manual flows)
  • use opencli-browser when the agent needs to inspect or steer the page directly

Available browser commands include open, state, click, type, select, keys, wait, get, screenshot, scroll, back, eval, network, init, verify, and close.

Core Concepts

browser: live control

Use opencli browser when the task is inherently interactive and the agent needs to operate the page directly.

Built-in adapters: stable commands

Use site-specific commands such as opencli hackernews top or opencli reddit hot when the capability already exists and you want deterministic output.

explore / synthesize / generate: create new CLIs

Use these commands when the site you need is not covered yet:

  • explore inspects the page, network activity, and capability surface.
  • synthesize turns exploration artifacts into evaluate-based YAML adapters.
  • generate runs the verified generation path and returns either a usable command or a structured explanation of why completion was blocked or needs human review.

cascade: auth strategy discovery

Use cascade to probe fallback auth paths such as public endpoints, cookies, and custom headers before you commit to an adapter design.

CLI Hub and desktop adapters

OpenCLI is not only for websites. It can also:

  • expose local binaries like gh, docker, obsidian, or custom tools through opencli <tool> ...
  • control Electron desktop apps through dedicated adapters and CDP-backed integrations

Prerequisites

  • Node.js: >= 20.0.0 (or Bun >= 1.0)
  • Chrome or Chromium running and logged into the target site for browser-backed commands

Important: Browser-backed commands reuse your Chrome/Chromium login session. If you get empty data or permission-like failures, first confirm the site is already open and authenticated in Chrome/Chromium.

Update

npm install -g @jackwener/opencli@latest

If you use the packaged OpenCLI skills, refresh them too

npx skills add jackwener/opencli

Or refresh only the skills you actually use:

npx skills add jackwener/opencli --skill opencli-usage
npx skills add jackwener/opencli --skill opencli-browser
npx skills add jackwener/opencli --skill opencli-explorer
npx skills add jackwener/opencli --skill opencli-oneshot

For Developers

Install from source:

git clone git@github.com:jackwener/opencli.git
cd opencli
npm install
npm run build
npm link

To load the source Browser Bridge extension:

  1. Open chrome://extensions and enable Developer mode.
  2. Click Load unpacked and select this repository's extension/ directory.

Built-in Commands

SiteCommands
xiaohongshusearch note comments feed user download publish notifications creator-notes creator-notes-summary creator-note-detail creator-profile creator-stats
bilibilihot search history feed ranking download comments dynamic favorite following me subtitle user-videos
tiebahot posts search read
hupuhot search detail mentions reply like unlike
twittertrending search timeline bookmarks post download profile article like likes notifications reply reply-dm thread follow unfollow followers following block unblock bookmark unbookmark delete hide-reply accept
reddithot frontpage popular search subreddit read user user-posts user-comments upvote upvoted save saved comment subscribe
zhihuhot search question download follow like favorite comment answer
amazonbestsellers search product offer discussion movers-shakers new-releases
1688search item assets download store
giteetrending search user
gemininew ask image deep-research deep-research-result
yuanbaonew ask
notebooklmstatus list open current get history summary note-list notes-get source-list source-get source-fulltext source-guide
spotifyauth status play pause next prev volume search queue shuffle repeat
xianyusearch item chat
xiaoecourses detail catalog play-url content
quarkls mkdir mv rename rm save share-tree

79+ adapters in total — → see all supported sites & commands

CLI Hub

OpenCLI acts as a universal hub for your existing command-line tools — unified discovery, pure passthrough execution, and auto-install (if a tool isn't installed, OpenCLI runs brew install <tool> automatically before re-running the command).

External CLIDescriptionExample
ghGitHub CLIopencli gh pr list --limit 5
obsidianObsidian vault managementopencli obsidian search query="AI"
dockerDockeropencli docker ps
lark-cliLark/Feishu — messages, docs, calendar, tasks, 200+ commandsopencli lark-cli calendar +agenda
dingtalkDingTalk — cross-platform CLI for DingTalk's full suite, designed for humans and AI agentsopencli dingtalk msg send --to user "hello"
wecomWeCom/企业微信 — CLI for WeCom open platform, for humans and AI agentsopencli wecom msg send --to user "hello"
vercelVercel — deploy projects, manage domains, env vars, logsopencli vercel deploy --prod

Register your own — add any local CLI so AI agents can discover it via opencli list:

opencli register mycli

Desktop App Adapters

Control Electron desktop apps directly from the terminal. Each adapter has its own detailed documentation:

AppDescriptionDoc
CursorControl Cursor IDE — Composer, chat, code extractionDoc
CodexDrive OpenAI Codex CLI agent headlesslyDoc
AntigravityControl Antigravity Ultra from terminalDoc
ChatGPTAutomate ChatGPT macOS desktop appDoc
ChatWiseMulti-LLM client (GPT-4, Claude, Gemini)Doc
NotionSearch, read, write Notion pagesDoc
DiscordDiscord Desktop — messages, channels, serversDoc
DoubaoControl Doubao AI desktop app via CDPDoc

To add a new Electron app, start with docs/guide/electron-app-cli.md.

Download Support

OpenCLI supports downloading images, videos, and articles from supported platforms.

PlatformContent TypesNotes
xiaohongshuImages, VideosDownloads all media from a note
bilibiliVideosRequires yt-dlp installed
twitterImages, VideosFrom user media tab or single tweet
doubanImagesPoster / still image lists
pixivImagesOriginal-quality illustrations, multi-page
1688Images, VideosDownloads page-visible product media from item pages
zhihuArticles (Markdown)Exports with optional image download
weixinArticles (Markdown)WeChat Official Account articles

For video downloads, install yt-dlp first: brew install yt-dlp

opencli xiaohongshu download abc123 --output ./xhs
opencli bilibili download BV1xxx --output ./bilibili
opencli twitter download elonmusk --limit 20 --output ./twitter
opencli 1688 download 841141931191 --output ./1688-downloads

Output Formats

All built-in commands support --format / -f with table (default), json, yaml, md, and csv.

opencli bilibili hot -f json    # Pipe to jq or LLMs
opencli bilibili hot -f csv     # Spreadsheet-friendly
opencli bilibili hot -v         # Verbose: show pipeline debug steps

Exit Codes

opencli follows Unix sysexits.h conventions so it integrates naturally with shell pipelines and CI scripts:

CodeMeaningWhen
0SuccessCommand completed normally
1Generic errorUnexpected / unclassified failure
2Usage errorBad arguments or unknown command
66Empty resultNo data returned (EX_NOINPUT)
69Service unavailableBrowser Bridge not connected (EX_UNAVAILABLE)
75Temporary failureCommand timed out — retry (EX_TEMPFAIL)
77Auth requiredNot logged in to target site (EX_NOPERM)
78Config errorMissing credentials or bad config (EX_CONFIG)
130InterruptedCtrl-C / SIGINT
opencli spotify status || echo "exit $?"   # 69 if browser not running
opencli github issues 2>/dev/null
[ $? -eq 77 ] && opencli github auth       # auto-auth if not logged in

Plugins

Extend OpenCLI with community-contributed adapters:

opencli plugin install github:user/opencli-plugin-my-tool
opencli plugin list
opencli plugin update --all
opencli plugin uninstall my-tool
PluginTypeDescription
opencli-plugin-github-trendingTSGitHub Trending repositories
opencli-plugin-hot-digestTSMulti-platform trending aggregator
opencli-plugin-juejinTS稀土掘金 (Juejin) hot articles
opencli-plugin-vkTSVK (VKontakte) wall, feed, and search

See Plugins Guide for creating your own plugin.

For AI Agents (Developer Guide)

Quick mode: To generate a single command for a specific page URL, see opencli-oneshot skill — just a URL + one-line goal, 4 steps done.

Full mode: Before writing any adapter code, read opencli-explorer skill. It contains the complete browser exploration workflow, the 5-tier authentication strategy decision tree, and debugging guide.

opencli explore https://example.com --site mysite   # Discover APIs + capabilities
opencli synthesize mysite                            # Generate TS adapters
opencli generate https://example.com --goal "hot"   # One-shot: explore → synthesize → register
opencli cascade https://api.example.com/data         # Auto-probe: PUBLIC → COOKIE → HEADER

Testing

See TESTING.md for how to run and write tests.

Troubleshooting

  • "Extension not connected" — Ensure the Browser Bridge extension is installed and enabled in chrome://extensions in Chrome or Chromium.
  • "attach failed: Cannot access a chrome-extension:// URL" — Another extension may be interfering. Try disabling other extensions temporarily.
  • Empty data or 'Unauthorized' error — Your Chrome/Chromium login session may have expired. Navigate to the target site and log in again.
  • Node API errors — Ensure Node.js >= 20. Some dependencies require modern Node APIs.
  • Daemon issues — Check status: curl localhost:19825/status · View logs: curl localhost:19825/logs

Star History

Star History Chart

License

Apache-2.0

SEE ALSO

clihub4/9/2026OPENCLI(1)