Convert websites, Electron apps, and local tools into standardized CLIs for AI agents and humans using OpenCLI's browser automation and adapter framework.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Convert websites, Electron apps, and local tools into standardized CLIs for AI agents and humans using OpenCLI's browser automation and adapter framework.
triggers
["help me use OpenCLI to automate this website","create a CLI adapter for this site","drive my browser with OpenCLI commands","convert this website into a command-line tool","write an OpenCLI adapter for scraping data","automate browser actions with OpenCLI","register a local CLI tool with OpenCLI","control my Chrome browser from the terminal"]
OpenCLI transforms any website, Electron app, or local binary into a standardized command-line interface. It provides AI agents with the ability to operate websites through a logged-in browser, execute built-in adapters for 100+ sites, and create new adapters using browser automation primitives.
Installation
Prerequisites
Node.js >= 21.0.0
Chrome or Chromium browser
Logged-in browser session for target sites
Install OpenCLI CLI
# Check Node.js version
node --version
# Install globally
npm install -g @jackwener/opencli
# Verify installation
opencli doctor
Download opencli-extension-v{version}.zip from GitHub Releases
Unzip and navigate to chrome://extensions
Enable Developer mode
Click Load unpacked and select the folder
Verify Setup
opencli doctor
Core Concepts
Three Automation Modes
Built-in Adapters: Pre-built commands for popular sites (Bilibili, Twitter, Reddit, etc.)
Browser Automation: AI agents operate any website via opencli browser primitives
CLI Hub: Expose local tools and Electron apps through unified interface
Browser Sessions
Browser commands require an explicit <session> identifier:
# Session names are arbitrary but must be consistent
opencli browser work open https://example.com
opencli browser work state
opencli browser work click "button.submit"
opencli browser work close
Multi-Profile Support
# List connected Chrome profiles
opencli profile list
# Rename profile for easier reference
opencli profile rename <contextId> work
# Set default profile
opencli profile use work
# Use specific profile for command
opencli --profile work browser mysession open https://example.com
Using Built-in Adapters
List Available Commands
# Show all registered commands
opencli list
# Show commands for specific site
opencli list bilibili
Common Built-in Commands
# HackerNews top stories
opencli hackernews top --limit 5
# Bilibili trending videos
opencli bilibili hot --limit 10
# Reddit hot posts
opencli reddit hot --subreddit programming --limit 20
# Twitter/X trending
opencli twitter trending
# Xiaohongshu (Little Red Book)
opencli xiaohongshu hot --limit 15
# Zhihu hot questions
opencli zhihu hot --limit 10
Browser Automation Primitives
Navigation Commands
# Open URL in new session
opencli browser mysession open https://github.com/trending
# Get current page state (URL, title, DOM snapshot)
opencli browser mysession state
# Navigate back
opencli browser mysession back
# Close session
opencli browser mysession close
Tab Management
# List all tabs in session
opencli browser mysession tab list
# Create new tab (returns targetId)
opencli browser mysession tab new https://example.com
# Select specific tab as default target
opencli browser mysession tab select <targetId>
# Close tab
opencli browser mysession tab close <targetId>
# Execute command on specific tab
opencli browser mysession state --tab <targetId>
Interaction Commands
# Click element by selector
opencli browser mysession click "button.login"# Type text into element
opencli browser mysession type"input[name='username']""myuser"# Fill form field (clears first, then types)
opencli browser mysession fill "input[name='password']""mypass"# Select dropdown option
opencli browser mysession select"select#country""US"# Send keyboard keys
opencli browser mysession keys "Enter"
opencli browser mysession keys "Control+a"
Waiting and Extraction
# Wait for element to appear
opencli browser mysession wait"div.content"# Wait for specific text
opencli browser mysession wait --text "Loading complete"# Extract data from page
opencli browser mysession extract "h1.title"# Get element properties
opencli browser mysession get "a.link" --attribute href
# Find elements
opencli browser mysession find "article"
{"name":"trending","description":"Get trending posts from mysite","arguments":{"limit":{"type":"number","description":"Number of posts to fetch","default":10}},"output":{"columns":["title","author","url"]}}
Using Recon Workflow
# Analyze site pattern (SPA, SSR, JSONP, etc.)
opencli browser recon analyze https://mysite.com/trending
# Initialize adapter with recon data
opencli browser recon init mysite/trending
# Verify adapter works
opencli browser recon verify mysite/trending
Site Knowledge Persistence
Store common patterns for reuse:
# Site knowledge is saved to ~/.opencli/sites/mysite/# - auth.json (authentication strategy)# - endpoints.json (discovered API endpoints)# - patterns.json (site architecture patterns)
Plugin Management
Create and Install Plugins
# Create new plugin structure
opencli plugin create my-adapters
# Install from local directory
opencli plugin install file://./my-adapters
# Install from GitHub
opencli plugin install github:username/opencli-adapters
# Install from npm
opencli plugin install @myorg/opencli-adapters
# List installed plugins
opencli plugin list
# Uninstall plugin
opencli plugin uninstall my-adapters
Eject and Customize Built-in Adapters
# Eject adapter to local for modification
opencli adapter eject zhihu
# Modified adapter now lives in ~/.opencli/clis/zhihu/# Reset to built-in version
opencli adapter reset zhihu
External CLI Integration
Register Local Tools
# Register any CLI tool
opencli external register gh
opencli external register docker
opencli external register kubectl
# Use through OpenCLI
opencli gh repo list
opencli docker ps
opencli kubectl get pods
Configuration
External CLIs are registered in ~/.opencli/external.json:
exportdefaultasyncfunctionhandler(args, context) {
const session = 'auth-session';
// Browser already logged in via Chrome profileawaitexecuteAdapter('browser', [session, 'open', args.url]);
// Verify authenticationconst state = awaitexecuteAdapter('browser', [session, 'state']);
if (state.url.includes('/login')) {
thrownewError('Not authenticated. Please log in to Chrome.');
}
// Proceed with authenticated actionsconst data = awaitexecuteAdapter('browser', [
session, 'extract', '.user-content'
]);
awaitexecuteAdapter('browser', [session, 'close']);
return { success: true, data };
}
Troubleshooting
Browser Not Connecting
# Check daemon status
opencli doctor
# Verify extension is installed and enabled# Visit chrome://extensions# Check daemon port
lsof -i :19825
# Restart daemon (kill and it will auto-restart)
pkill -f opencli-daemon
Multiple Chrome Profiles
# List profiles to see which are connected
opencli profile list
# If you see multiple profiles, set default
opencli profile use <alias>
# Or specify profile per-command
opencli --profile work browser mysession open https://example.com
Empty or Permission Errors
Issue: Commands return empty data or permission errors
Solution: Ensure you're logged in to the target site in Chrome
# 1. Open Chrome and log in to the site manually# 2. Verify extension is active# 3. Run OpenCLI command
opencli bilibili hot --limit 5
Adapter Not Found
# Verify adapter is installed
opencli list | grep mysite
# Check adapter directory existsls ~/.opencli/clis/mysite/
# Reinstall if needed
opencli plugin install file://path/to/plugin
# For Electron apps or remote Chromeexport OPENCLI_CDP_ENDPOINT=ws://localhost:9222
# Filter targets if multiple existexport OPENCLI_CDP_TARGET=myapp.com
# Test connection
opencli doctor
Debug Mode
# Enable verbose logging
opencli -v browser mysession open https://example.com
# Or via environmentexport OPENCLI_VERBOSE=true# DOM snapshot debuggingexport DEBUG_SNAPSHOT=1
opencli browser mysession state
Adapter Verification
# Initialize adapter with recon workflow
opencli browser recon init mysite/command
# Verify adapter works correctly
opencli browser recon verify mysite/command
# Check output format
opencli mysite command --limit 5
Best Practices
Use explicit session names: Helps track browser automation flows
Always close sessions: Prevents resource leaks (opencli browser <session> close)
Handle authentication: Verify login state before executing commands
Use --tab for multi-tab: Specify --tab <targetId> when working with multiple tabs
Store credentials in browser: Let Chrome manage logins, don't hardcode credentials
Profile separation: Use Chrome profiles for different accounts/contexts
Error handling: Wrap browser commands in try-finally to ensure cleanup
Rate limiting: Be respectful of site resources when creating adapters
Recon first: Use opencli browser recon analyze before building adapters
Persist site knowledge: Save patterns to ~/.opencli/sites/<site>/ for reuse