OpenCLI: Universal CLI Hub for Websites & Apps
OpenCLI: A Revolutionary Command-Line Interface for Websites, Electron Apps, and Local Tools
Introduction
OpenCLI is an innovative command-line tool designed to transform any website, desktop application (Electron-based), or local CLI utility into a powerful, seamless interface accessible via the terminal. Unlike traditional web scraping tools that require manual scripting, OpenCLI leverages browser session reuse, AI-driven discovery, and a robust architecture to provide intuitive access to online services and applications directly from your command line.
This tool is particularly beneficial for AI agents, developers, and power users who need efficient ways to interact with websites, automate workflows, or integrate third-party tools into their existing CLI environments. OpenCLI supports a vast array of platforms—from social media (Twitter/X, Reddit, Zhihu) to e-commerce (Coupang), financial data (Bloomberg, Yahoo Finance), and productivity apps (GitHub CLI, Docker, Obsidian).
Core Features & Innovations
1. Browser Session Reuse: Account-Safe Authentication
One of OpenCLI’s standout features is its ability to reuse Chrome login sessions without exposing credentials. This means:
- You log into a website in your browser (e.g., Bilibili, Twitter).
- OpenCLI connects via a lightweight Browser Bridge extension and micro-daemon.
- Commands execute seamlessly using the existing session, ensuring security while maintaining convenience.
⚠️ Important Note: Ensure you are logged into the target website in Chrome before running any commands. If authentication fails or returns empty data, verify your login status first.
2. AI Agent Integration: Discover & Execute Commands Automatically
OpenCLI is designed to work seamlessly with AI agents by:
- Exploring APIs (
opencli explore) to discover available endpoints and capabilities. - Generating adapters (
opencli synthesize) for new websites or services. - Cascading authentication strategies (PUBLIC → COOKIE → HEADER) to handle different login methods.
For developers, AI agents can now:
- Run
opencli listto discover available tools. - Register local CLI tools with
opencli register mycli. - Automatically invoke any tool via the command line without manual configuration.
This makes OpenCLI an ideal companion for AI-driven workflows, allowing agents to interact with websites and apps as if they were native CLI utilities.
3. Universal CLI Hub: Integrating External Tools
OpenCLI acts as a universal hub for existing command-line tools, enabling:
- Unified discovery of tools like
gh(GitHub CLI),docker,kubectl, orobsidian. - Auto-installation if a tool is missing (e.g., installing
ghviabrew install gh). - Passthrough execution, ensuring external commands work exactly as intended.
Example:
opencli gh pr list --limit 5 # Lists GitHub pull requests without needing to run 'gh' manually.
4. Electron App CLIification: Turning Any Desktop App into a Terminal Tool
OpenCLI extends its capabilities beyond websites by allowing users to turn any Electron-based application (e.g., Antigravity Ultra, ChatGPT desktop app) into a CLI tool.
Key benefits:
- Recombine and script Electron apps seamlessly.
- Extend functionality with custom adapters.
- AI-native control, enabling AI agents to interact with desktop applications directly from the terminal.
Example use cases include:
- Controlling ChatGPT Desktop via
opencli chatgpt send "Hello". - Managing Antigravity Ultra workflows (
opencli antigravity watch).
5. Dynamic Loader & Self-Healing Setup
OpenCLI employs a dual-engine architecture:
- YAML declarative pipelines: Define adapters in
.yamlfiles for easy customization. - Browser runtime TypeScript injections: For dynamic, real-time interactions with websites.
Additionally:
opencli setupverifies Browser Bridge connectivity.opencli doctordiagnoses issues with the daemon, extension, and live browser commands.
Installation & Quick Setup
Prerequisites
Before using OpenCLI, ensure you have:
- Node.js (v20.0.0 or later) installed.
- A Chrome browser logged into the target website (e.g., Bilibili, Twitter).
Installation Methods
Method 1: Install via npm (Recommended)
npm install -g @jackwener/opencli
After installation, you can use OpenCLI directly:
opencli list # List all available commands
opencli bilibili hot # Fetch trending videos from Bilibili
opencli zhihu hot -f json # Get Zhihu hot questions in JSON format
Method 2: Install from Source (For Developers)
git clone https://github.com/jackwener/opencli.git
cd opencli
npm install
npm run build
npm link
Now, OpenCLI is globally linked:
opencli list
Updating OpenCLI
To update to the latest version:
npm install -g @jackwener/opencli@latest
Built-in Commands: A Comprehensive Registry
OpenCLI supports a vast array of commands across different platforms. Below is an overview of some key categories:
Social Media & Platforms
| Site | Example Commands |
|---------------|------------------------------------------|
| Twitter/X | trending, bookmarks, search |
| Reddit | hot, frontpage, popular |
| Bilibili | hot, search, user-videos |
| Xiaohongshu | search, feed, creator-profile |
| Zhihu | hot, question, download |
| YouTube | search, video, transcript |
Productivity & Development
| Tool | Example Commands |
|---------------|------------------------------------------|
| GitHub CLI (gh) | pr list, repo clone |
| Docker | docker ps, docker build |
| Obsidian | search query="AI" |
| Kubernetes (kubectl) | get pods, describe pod |
Desktop App Adapters
OpenCLI supports adapters for popular Electron apps:
- Cursor (IDE automation)
- Antigravity Ultra (Scripting & workflows)
- ChatGPT Desktop (AI interactions)
- Discord (Message management)
Example:
opencli discord send "Hello, server!" --channel 12345
Desktop App Adapters: Detailed Documentation
Each desktop adapter comes with its own documentation for setup and usage. Below are some key adapters:
Cursor IDE Adapter
- Controls Cursor’s composer, chat, and code extraction.
- Example:
opencli cursor dump --file output.json
Antigravity Ultra Adapter
- Allows scripting and extending Antigravity workflows.
- Example:
opencli antigravity watch "https://example.com"
ChatGPT Desktop Adapter
- Enables AI interactions with the ChatGPT desktop app.
- Example:
opencli chatgpt ask "Explain quantum computing."
External CLI Hub: Auto-Discovery & Passthrough
OpenCLI acts as a universal hub for existing command-line tools. Users can:
- Discover commands via
opencli list. - Register their own local CLIs with
opencli register mycli. - Execute any tool without manual setup.
Example workflow:
# If 'gh' is not installed, OpenCLI auto-installs it.
opencli gh repo clone jackwener/opencli.git
# Run a GitHub CLI command directly.
opencli gh pr list --limit 5
Download Support: Media & Content Extraction
OpenCLI supports downloading images, videos, and articles from supported platforms:
Supported Platforms
| Platform | Supported Content Types |
|-------------------|--------------------------------------|
| Xiaohongshu | Images, Videos |
| Bilibili | Videos (requires yt-dlp) |
| Twitter/X | Images, Videos |
| Zhihu | Articles (Markdown) |
Prerequisites for Video Downloads
Install yt-dlp:
pip install yt-dlp # or brew install yt-dlp
Usage Examples
Download Media from Xiaohongshu
opencli xiaohongshu download --note-id abc123 --output ./xhs
Download Bilibili Video (with Quality Control)
opencli bilibili download --bvid BV1xxx --quality 1080p --output ./video
Export Zhihu Article to Markdown
opencli zhihu download "https://zhuanlan.zhihu.com/p/xxx" --output ./article.md --download-images
Output Formats: Flexible Data Export
OpenCLI supports multiple output formats for commands:
table(default rich terminal table)jsonyamlmd(Markdown)csv
Example:
opencli bilibili hot -f json | jq '.' # Pipe JSON to jq for parsing
opencli bilibili hot -f yaml > output.yaml # Save as YAML
For AI Agents: Developer Guide
If you’re developing an AI agent that interacts with OpenCLI, follow these steps:
Quick Mode (One-Shot Command)
- Provide a URL and goal (e.g., "fetch trending videos from Bilibili").
- Run:
opencli generate https://bilibili.com --goal "hot"
Full Workflow
- Explore (
opencli explore) to discover APIs. - Synthesize (
opencli synthesize) to create adapters. - Cascade (
opencli cascade) for authentication strategies.
Example:
# Step 1: Explore API endpoints
opencli explore https://api.example.com/data --site mysite
# Step 2: Generate YAML adapter
opencli synthesize mysite
# Step 3: Register the command
opencli register mysite
Testing & Debugging
Running Tests
OpenCLI includes a comprehensive testing suite:
npm run build
npx vitest run tests/e2e/ # End-to-end tests
npx vitest run src/ # Unit tests
Debugging Tools
opencli doctor– Checks extension and daemon connectivity.curl localhost:19825/status– Inspects daemon status.curl localhost:19825/logs– View extension logs.
Troubleshooting Common Issues
"Extension Not Connected"
Ensure the Browser Bridge extension is installed and enabled in Chrome (chrome://extensions).
Empty Data or 'Unauthorized' Errors
- Your login session may have expired. Refresh the page in Chrome.
- Verify you are logged into the target website before running commands.
Node API Errors
Ensure Node.js v20.0.0+ is installed. Some dependencies require modern APIs.
Releasing New Versions
To release a new version:
npm version patch # Creates a minor update (e.g., 1.0.1 → 1.0.2)
git push --follow-tags
The CI pipeline will automatically build, create a GitHub release, and publish to npm.
License
OpenCLI is released under the Apache-2.0 License, ensuring open-source compatibility while protecting intellectual property rights.
Conclusion
OpenCLI represents a significant leap forward in CLI tooling by: ✅ Unifying access to websites, Electron apps, and local tools. ✅ Ensuring security via Chrome session reuse. ✅ Empowering AI agents with seamless integration. ✅ Supporting dynamic adapters for custom workflows.
Whether you’re a developer building AI agents, a power user automating tasks, or simply curious about turning websites into CLI tools, OpenCLI provides an intuitive and powerful solution. With its self-healing setup, auto-installation capabilities, and extensive command registry, OpenCLI is designed to streamline interactions with the digital world from your terminal.
Try it out today!
opencli list # Discover available commands
opencli bilibili hot --limit 5 # Fetch trending videos
opencli gh repo clone jackwener/opencli.git # Auto-install GitHub CLI
For more details, explore the official documentation and check out the GitHub Releases page.
Enjoying this project?
Discover more amazing open-source projects on TechLogHub. We curate the best developer tools and projects.
Repository:https://github.com/jackwener/opencli
GitHub - jackwener/opencli: OpenCLI: Universal CLI Hub for Websites & Apps
OpenCLI is an innovative command-line tool designed to transform any website, desktop application (Electron-based), or local CLI utility into a powerful, seamle...
github - jackwener/opencli