OpenCLI

repository·main·Indexed 12 days ago

https://github.com/jackwener/opencli

An AI-powered tool that converts websites and Electron apps into deterministic CLI interfaces. OpenCLI allows humans and AI agents to automate browser-based tasks—such as navigation, form filling, and data extraction—using existing logged-in Chrome sessions via a Browser Bridge Extension. It includes built-in adapters for over 100 sites, support for external tool registration, and specialized skills for AI agents like Claude Code and Cursor.

Tokens
295.5K
Snippets
922
Records
1.4K
Agent score
95%

What's inside OpenCLI

  1. Overview of OpenCLI

    main

    OpenCLI is a tool designed to turn any website or Electron application into a Command Line Interface (CLI). It enables terminal-based control over desktop apps (like Cursor, Codex, or ChatGPT) and web browsers using the Chrome DevTools Protocol (CDP).

    Key capabilities include:

    • Desktop App Control: Drive Electron apps directly from the terminal.
    • Browser Automation: Allows for clicking, typing, extracting data, and taking screenshots via scriptable browser primitives.
    • Account Safety: Reuses existing Chrome login states, meaning credentials and tokens are never exposed or handled by the CLI itself.
    • AI Agent Integration: Provides browser primitives and adapter-authoring skills to help AI agents perform reconnaissance, extraction, and verification.
    • Deterministic & Scriptable: Produces consistent output schemas, making it suitable for piping, scripting, and CI/CD pipelines.
  2. Overview of Xiaohongshu (Rednote) automation

    main

    Xiaohongshu (xiaohongshu.com, also known as redbook or rednote) is a social platform for image/video notes and feeds. Automation tasks typically involve searching, publishing, and reading note content or comments.

    Key Requirements:

    • Authentication: Most read/write operations require an active login state via the web_session cookie. Unauthenticated users encounter login walls on search, explore, and user profiles.
    • Host Separation:
      • Main Site (www.xiaohongshu.com): Used for feeds, search, and note details.
      • Creator Center (creator.xiaohongshu.com): A separate host used for publishing notes, managing drafts, and viewing creator statistics. While they share SSO (Single Sign-On) via cookies, they use entirely different routing structures and DOMs.
  3. Overview of Twitter / X automation capabilities

    main

    Twitter (now x.com) is a social feed platform where automation tasks primarily involve reading timelines, posting tweets, replying, searching, bookmarking, and viewing profiles.

    Critical Requirement: Most read/write operations require an authenticated session using auth_token and ct0 cookies. Accessing the site without being logged in will result in a redirect to the login wall (/i/flow/login).

  4. Use the Substack adapter for OpenCLI

    main

    The Substack adapter allows you to interact with substack.com via OpenCLI. It operates in two modes:

    1. Public Mode (search): Uses public APIs to search for articles and newsletters. This mode does not require a browser or a login.
    2. Browser Mode (feed, publication): Requires the Browser Bridge extension and an active Chrome session where substack.com is accessible. This mode is used to access personalized feeds and specific publication data.

    Prerequisites:

    • For feed and publication commands: You must have Chrome installed and the opencli-extension (Browser Bridge) installed and running.
  5. Use the Dongchedi adapter for OpenCLI

    main

    The Dongchedi adapter allows you to scrape car data from dongchedi.com using plain HTTP GET requests. It works by parsing the __NEXT_DATA__ JSON embedded in server-rendered (SSR) pages, meaning it requires no login, no cookies, and no complex signature replication (like X-Bogus).

    To use this adapter, you need a series_id, which can be obtained via the search command or extracted from a URL like https://www.dongchedi.com/auto/series/<id>.

    # Example: Search for a car series
    opencli dongchedi search "宝马X5" --limit 5
    
    # Example: Get overview for a specific series
    opencli dongchedi series 5273
  6. Ctrip (携程) OpenCLI Adapter Overview

    main

    The Ctrip adapter for OpenCLI allows users to search for travel-related information including destinations, hotels, flights, trains, buses, and more. It operates in two modes:

    1. Public Mode: Uses direct API endpoints for lightweight lookups like search and hotel-suggest.
    2. Browser + Cookie Mode: Requires the Browser Bridge extension to scrape data from ctrip.com for more complex searches like hotel-search, flight, train, etc. This mode relies on an active browser session to handle cookies and dynamic content.

    Domain: ctrip.com

  7. Use the Hupu (虎扑) adapter

    main

    The Hupu adapter allows you to interact with bbs.hupu.com via OpenCLI. It supports both Public mode (reading hot threads) and Browser mode (reading mentions, replying, and liking, which requires an active Hupu login session in a running Chrome browser with the Browser Bridge extension installed).

    Prerequisites

    • Chrome running and able to access bbs.hupu.com and my.hupu.com.
    • Browser Bridge extension installed.
    • For authenticated actions (mentions, reply, like, unlike), a valid Hupu login session must be active in Chrome.
  8. Use the Douban adapter via OpenCLI

    main

    The Douban adapter allows you to search for movies, books, and music, retrieve Top 250 lists, fetch subject details, and download posters or stills from douban.com.

    Mode: 🔐 Browser (Cookie) Prerequisites:

    • A Chrome browser logged into douban.com.
    • The Browser Bridge extension must be installed.

    Note: Searching for books and retrieving book details requires an active, logged-in Douban browser session for stable bulk usage.

  9. Drive Qwen (通义千问) from the terminal

    main

    You can control the Qwen chat interface directly from your terminal using OpenCLI. This mode operates via a Browser Bridge, meaning it uses your existing Chrome browser session on www.qianwen.com. No API key is required, but you must be signed in to the website in Chrome and have the Browser Bridge extension installed.

    Key Characteristics:

    • Mode: 🔐 Browser
    • Domain: www.qianwen.com
    • Session Persistence: Commands default to using persistent site sessions. Consecutive commands will continue in the same conversation. To use a one-shot tab instead, pass --site-session ephemeral.
    • Authentication: read works in guest mode, but history and most write commands require you to be logged in.
    opencli qwen status
  10. Use the WeChat (微信公众号) adapter

    main

    The WeChat adapter allows you to search for official account articles via Sogou Weixin, download articles as Markdown, manage drafts, and create new drafts.

    Prerequisites:

    • A running Chrome instance with an active login session at mp.weixin.qq.com (required for accessing articles behind the login wall and managing drafts).
    • The Browser Bridge extension must be installed.
    • To use --cover-image with create-draft, the Browser Bridge must support file uploads.
  11. Inspect Homebrew formulae and casks with OpenCLI

    main

    The Homebrew adapter allows you to inspect Homebrew formulae and casks, as well as official install-rank analytics, directly via the CLI. This mode is public and does not require a browser or authentication. It interacts with the formulae.brew.sh domain.

    # Inspect a formula
    opencli homebrew formula wget
    
    # Inspect a cask
    opencli homebrew cask firefox
    
    # View popular installs
    opencli homebrew popular