AUTOCLI(1)

NAME

AutoCLIAutoCLI is a Blazing fast, memory-safe command-line tool — Fetch information from any website with a single command.…

SYNOPSIS

$https://github.com/nashsu/autocli/releases

INFO

1.7k stars
150 forks
0 views

DESCRIPTION

AutoCLI is a Blazing fast, memory-safe command-line tool — Fetch information from any website with a single command. Covers Twitter/X, Reddit, YouTube, HackerNews, Bilibili, Zhihu, Xiaohongshu, and 55+ sites, with support for controlling Electron desktop apps, integrating local CLI tools (gh, docker, kubectl), now powered by AutoCLI.ai .

README

AutoCLI

English | 中文 | 日本語

autocli

https://autocli.ai — AI-powered adapter marketplace & cloud API


Blazing fast, memory-safe command-line tool — Fetch information from any website with a single command. Covers Twitter/X, Reddit, YouTube, HackerNews, Bilibili, Zhihu, Xiaohongshu, and 55+ sites, with support for controlling Electron desktop apps, integrating local CLI tools (gh, docker, kubectl), powered by browser session reuse and AI-native discovery capabilities.

A complete rewrite in pure Rust based on OpenCLI (TypeScript). Feature-equivalent, up to 12x faster, 10x less memory, single 4.7MB binary, zero runtime dependencies.

The perfect companion for OpenClaw/Agent — Give your AI Agent the ability to reach information across the entire web, fetching real-time data from 55+ sites with a single command. Built for AI Agents: Configure autocli list in AGENT.md or .cursorrules, and AI can automatically discover all available tools. Register your local CLI (autocli register mycli), and AI can seamlessly invoke all your tools.

🚀 Performance Comparison

Metric🦀 autocli (Rust)📦 opencli (Node.js)Improvement
💾 Memory Usage (Public Commands)15 MB99 MB6.6x
💾 Memory Usage (Browser Commands)9 MB95 MB10.6x
📏 Binary Size4.7 MB~50 MB (node_modules)10x
🔗 Runtime DependenciesNoneNode.js 20+Zero deps
Test Pass Rate103/122 (84%)104/122 (85%)Near parity

⚡ Real-world Command Timing Comparison:

Command🦀 autocli📦 opencliSpeedup
bilibili hot1.66s20.1s🔥 12x
zhihu hot1.77s20.5s🔥 11.6x
xueqiu search 茅台1.82s9.2s5x
xiaohongshu search5.1s14s2.7x

Based on automated testing of 122 commands (55 sites), macOS Apple Silicon environment.

Features

  • 55 sites, 333 commands — Covers Bilibili, Twitter, Reddit, Zhihu, Xiaohongshu, YouTube, Hacker News, and more
  • Browser session reuse — Reuse logged-in sessions via Chrome extension, no need to manage tokens
  • Declarative YAML Pipeline — Describe data scraping workflows in YAML, add new adapters with zero code
  • AI-native discoveryexplore analyzes website APIs, generate auto-creates adapters with one command, cascade probes authentication strategies
  • AI-powered generationgenerate --ai uses LLM to analyze any website and create working adapters automatically, with cloud sharing via autocli.ai
  • Download media & articles — Download videos (via yt-dlp), articles as Markdown with images localized
  • External CLI passthrough — Integrate GitHub CLI, Docker, Kubernetes, and other tools
  • Multi-format output — table, JSON, YAML, CSV, Markdown
  • Single binary — Compiles to a 4MB static binary with zero runtime dependencies

Installation

Just one file, download and use. No Node.js, Python, or any runtime needed — just put it in your PATH and go.

One-line Install Script (macOS / Linux)

curl -fsSL https://raw.githubusercontent.com/nashsu/autocli/main/scripts/install.sh | sh

Automatically detects your system and architecture, downloads the corresponding binary, and installs to /usr/local/bin/.

Windows (PowerShell)

Invoke-WebRequest -Uri "https://github.com/nashsu/autocli/releases/latest/download/autocli-x86_64-pc-windows-msvc.zip" -OutFile autocli.zip
Expand-Archive autocli.zip -DestinationPath .
Move-Item autocli.exe "$env:LOCALAPPDATA\Microsoft\WindowsApps\"

Manual Download (Simplest)

Download the file for your platform from GitHub Releases:

PlatformFile
macOS (Apple Silicon)autocli-aarch64-apple-darwin.tar.gz
macOS (Intel)autocli-x86_64-apple-darwin.tar.gz
Linux (x86_64)autocli-x86_64-unknown-linux-musl.tar.gz
Linux (ARM64)autocli-aarch64-unknown-linux-musl.tar.gz
Windows (x64)autocli-x86_64-pc-windows-msvc.zip

After extracting, place autocli (or autocli.exe on Windows) in your system PATH.

Build from Source

git clone https://github.com/nashsu/autocli.git
cd autocli
cargo build --release
cp target/release/autocli /usr/local/bin/   # macOS / Linux

Update

Simply re-run the install command or download the latest release to overwrite the existing binary.

Chrome Extension Setup (required for browser commands)

  1. Download autocli-chrome-extension.zip from GitHub Releases
  2. Extract to any directory
  3. Open Chrome and go to chrome://extensions
  4. Enable "Developer mode" (top right toggle)
  5. Click "Load unpacked" and select the extracted folder
  6. The extension will automatically connect to the autocli daemon

Public mode commands (hackernews, devto, lobsters, etc.) work without the extension.

Skill Install

One-click install autocli skill for your AI Agent:

npx skills add https://github.com/nashsu/autocli-skill

Quick Start

# View all available commands
autocli --help

View commands for a specific site

autocli hackernews --help

Get Hacker News top stories (public API, no browser needed)

autocli hackernews top --limit 10

JSON format output

autocli hackernews top --limit 5 --format json

Get Bilibili trending videos (requires browser + Cookie)

autocli bilibili hot --limit 20

Search Twitter (requires browser + login)

autocli twitter search "rust lang" --limit 10

Run diagnostics

autocli doctor

Generate shell completions

autocli completion bash >> ~/.bashrc autocli completion zsh >> ~/.zshrc autocli completion fish > ~/.config/fish/completions/autocli.fish

AI Commands

Powered by autocli.ai — Get your API token, share adapters with the community, and let AI generate adapters for any website.

Step 1: Authenticate

autocli auth

This will:

  1. Open your browser to https://autocli.ai/get-token
  2. Prompt you to enter the token
  3. Verify the token with the server
  4. Save it to ~/.autocli/config.json

Step 2: Generate Adapter with AI

# AI analyzes the page and generates a working adapter
autocli generate https://www.moltbook.com/ --goal 'list' --ai

Search for products

autocli generate https://www.amazon.com/ --goal 'search' --ai

How it works:

  1. Searches autocli.ai for existing adapters matching the URL
  2. If found, shows an interactive list for you to choose:
    ? Existing adapters found, please select:
    > [exact]   example hot (by alice) - Get trending posts
      [domain]  example search (by bob) - Search articles
      🔄 Regenerate (using AI)
    
  3. If no match or you choose "Regenerate", AI analyzes the page (DOM structure + API requests) and generates a new YAML adapter
  4. The generated adapter is saved locally and uploaded to autocli.ai for the community

Step 3: Search Existing Adapters

# Search by URL
autocli search https://www.example.com

Domain name also works (auto-prepends https://)

autocli search example.com

Searches autocli.ai for community-shared adapters matching the URL. Select one from the interactive list to download and save it locally — ready to use immediately.

Environment Variables

VariableDescriptionDefault
AUTOCLI_API_BASEOverride server URLhttps://www.autocli.ai

Built-in Commands

Run autocli --help to see all available commands.

SiteCommandsMode
hackernewstop new best ask show jobs search userPublic
devtotop tag userPublic
lobstershot newest active tagPublic
stackoverflowhot search bounties unansweredPublic
steamtop-sellersPublic
linux-dohot latest search categories category topicPublic
arxivsearch paperPublic
wikipediasearch summary random trendingPublic
apple-podcastssearch episodes topPublic
xiaoyuzhoupodcast podcast-episodes episodePublic
bbcnewsPublic
hftopPublic
sinafinancenewsPublic
googlenews search suggest trendsPublic / Browser
v2exhot latest topic node user member replies nodes daily me notificationsPublic / Browser
bloombergmain markets economics industries tech politics businessweek opinions feeds newsPublic / Browser
twittertrending bookmarks profile search timeline thread following followers notifications post reply delete like article follow unfollow bookmark unbookmark download accept reply-dm block unblock hide-replyBrowser
bilibilihot search me favorite history feed subtitle dynamic ranking following user-videos downloadBrowser
reddithot frontpage popular search subreddit read user user-posts user-comments upvote save comment subscribe saved upvotedBrowser
zhihuhot search question downloadBrowser
xiaohongshusearch notifications feed user download publish creator-notes creator-note-detail creator-notes-summary creator-profile creator-statsBrowser
xueqiufeed hot-stock hot search stock watchlist earnings-dateBrowser
weibohot searchBrowser
doubansearch top250 subject marks reviews movie-hot book-hotBrowser
wereadshelf search book highlights notes notebooks rankingBrowser
youtubesearch video transcriptBrowser
mediumfeed search userBrowser
substackfeed search publicationBrowser
sinabloghot search article userBrowser
bosssearch detail recommend joblist greet batchgreet send chatlist chatmsg invite mark exchange resume statsBrowser
jikefeed search create like comment repost notifications post topic userBrowser
facebookfeed profile search friends groups events notifications memories add-friend join-groupBrowser
instagramexplore profile search user followers following follow unfollow like unlike comment save unsave savedBrowser
tiktokexplore search profile user following follow unfollow like unlike comment save unsave live notifications friendsBrowser
yollomigenerate video edit upload models remove-bg upscale face-swap restore try-on background object-removerBrowser
yahoo-financequoteBrowser
barchartquote options greeks flowBrowser
linkedinsearchBrowser
reuterssearchBrowser
smzdmsearchBrowser
ctripsearchBrowser
coupangsearch add-to-cartBrowser
grokaskBrowser
jimenggenerate historyBrowser
chaoxingassignments examsBrowser
weixindownloadBrowser
doubaostatus new send read askBrowser
cursorstatus send read new dump composer model extract-code ask screenshot history exportDesktop
codexstatus send read new dump extract-diff model ask screenshot history exportDesktop
chatwisestatus new send read ask model history export screenshotDesktop
chatgptstatus new send read askDesktop
doubao-appstatus new send read ask screenshot dumpDesktop
notionstatus search read new write sidebar favorites exportDesktop
discord-appstatus send read channels servers search membersDesktop
antigravitystatus send read new dump extract-code model watchDesktop

Mode legend: Public = No browser needed, calls API directly; Browser = Requires Chrome + extension; Desktop = Requires the desktop app to be running

AI Discovery Capabilities

Two approaches to auto-generate adapters:

# 🤖 AI-powered (recommended): LLM analyzes page and generates adapter
autocli generate https://www.example.com --goal hot --ai
# Searches autocli.ai for existing adapters first, then generates with AI if needed

🔧 Rule-based: heuristic analysis without AI

autocli generate https://www.example.com --goal hot

Explore website API surface (endpoints, framework, stores)

autocli explore https://www.example.com --site mysite

With interactive fuzzing (click buttons to trigger hidden APIs)

autocli explore https://www.example.com --auto --click "Comments,CC"

Auto-detect authentication strategy (PUBLIC → COOKIE → HEADER)

autocli cascade https://api.example.com/hot

Discovery features:

  • .json suffix probing (Reddit-style REST discovery)
  • __INITIAL_STATE__ extraction (SSR sites like Bilibili, Xiaohongshu)
  • Pinia/Vuex store discovery and action mapping
  • Auto search endpoint discovery with --goal search
  • Framework detection (Vue/React/Next.js/Nuxt)

Download

Download media and articles from supported sites:

# Download Bilibili video (requires yt-dlp)
autocli bilibili download BV1xxx --output ./videos --quality 1080p

Download Zhihu article as Markdown with images

autocli zhihu download "https://zhuanlan.zhihu.com/p/xxx" --output ./articles

Download WeChat article as Markdown with images

autocli weixin download "https://mp.weixin.qq.com/s/xxx" --output ./articles

Download Twitter/X media (images + videos)

autocli twitter download nash_su --limit 10 --output ./twitter autocli twitter download --tweet-url "https://x.com/user/status/123" --output ./twitter

Download features:

  • Videos via yt-dlp (cookies extracted from browser automatically, no Keychain prompt)
  • Articles as Markdown with YAML frontmatter (title, author, date, source)
  • Images downloaded and localized (remote URLs replaced with local images/img_001.jpg)
  • Output directory structure: output/article_title/title.md + output/article_title/images/

External CLI Integration

Integrated external tools (passthrough execution):

ToolDescription
ghGitHub CLI
dockerDocker CLI
kubectlKubernetes CLI
obsidianObsidian note management
readwiseReadwise reading management
gwsGoogle Workspace CLI
# Passthrough to GitHub CLI
autocli gh repo list

Passthrough to kubectl

autocli kubectl get pods

Output Formats

Switch output format via the --format global flag:

autocli hackernews top --format table    # ASCII table (default)
autocli hackernews top --format json     # JSON
autocli hackernews top --format yaml     # YAML
autocli hackernews top --format csv      # CSV
autocli hackernews top --format md       # Markdown table

Authentication Strategies

Each command uses a different authentication strategy:

StrategyDescriptionRequires Browser
publicPublic API, no authentication neededNo
cookieRequires browser CookieYes
headerRequires specific request headersYes
interceptRequires network request interceptionYes
uiRequires UI interactionYes

Custom Adapters

Add custom adapters by creating YAML files under ~/.autocli/adapters/:

# ~/.autocli/adapters/mysite/hot.yaml
site: mysite
name: hot
description: My site hot posts
strategy: public
browser: false

args: limit: type: int default: 20 description: Number of items

columns: [rank, title, score]

pipeline:

  • fetch: https://api.mysite.com/hot
  • select: data.posts
  • map: rank: "${{ index + 1 }}" title: "${{ item.title }}" score: "${{ item.score }}"
  • limit: "${{ args.limit }}"

Pipeline Steps

StepFunctionExample
fetchHTTP requestfetch: https://api.example.com/data
evaluateExecute JS in browserevaluate: "document.title"
navigatePage navigationnavigate: https://example.com
clickClick elementclick: "#button"
typeType texttype: { selector: "#input", text: "hello" }
waitWaitwait: 2000
selectSelect nested dataselect: data.items
mapData mappingmap: { title: "${{ item.title }}" }
filterData filteringfilter: "item.score > 10"
sortSortsort: { by: score, order: desc }
limitTruncatelimit: "${{ args.limit }}"
interceptNetwork interceptionintercept: { pattern: "*/api/*" }
tapState management bridgetap: { action: "store.fetch", url: "*/api/*" }
downloadDownloaddownload: { type: media }

Template Expressions

Pipelines use the ${{ expression }} syntax:

# Variable access
"${{ args.limit }}"
"${{ item.title }}"
"${{ index + 1 }}"

Comparison and logic

"${{ item.score > 10 }}" "${{ item.title && !item.deleted }}"

Ternary expressions

"${{ item.active ? 'yes' : 'no' }}"

Pipe filters

"${{ item.title | truncate(30) }}" "${{ item.tags | join(', ') }}" "${{ item.name | lower | trim }}"

String interpolation

"https://api.com/${{ item.id }}.json"

Fallback

"${{ item.subtitle || 'N/A' }}"

Math functions

"${{ Math.min(args.limit, 50) }}"

Built-in filters (16): default, join, upper, lower, trim, truncate, replace, keys, length, first, last, json, slugify, sanitize, ext, basename

Configuration

Environment Variables

VariableDefaultDescription
OPENCLI_VERBOSE-Enable verbose output
OPENCLI_DAEMON_PORT19825Daemon port
OPENCLI_CDP_ENDPOINT-CDP direct endpoint (bypasses Daemon)
OPENCLI_BROWSER_COMMAND_TIMEOUT60Command timeout (seconds)
OPENCLI_BROWSER_CONNECT_TIMEOUT30Browser connection timeout (seconds)
OPENCLI_BROWSER_EXPLORE_TIMEOUT120Explore timeout (seconds)

File Paths

PathDescription
~/.autocli/adapters/User custom adapters
~/.autocli/plugins/User plugins
~/.autocli/external-clis.yamlUser external CLI registry

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                       User / AI Agent                           │
│                     autocli <site> <command>                  │
└─────────────────────┬───────────────────────────────────────────┘
                      │
                      ▼
┌─────────────────────────────────────────────────────────────────┐
│                      CLI Layer (clap)                            │
│  main.rs → discovery → clap dynamic subcommands → execution.rs  │
│  ┌───────────┐  ┌───────────────┐  ┌──────────────────┐        │
│  │ Built-in   │  │ Site adapter  │  │ External CLI     │        │
│  │ commands   │  │ commands      │  │ passthrough      │        │
│  │ explore    │  │ bilibili hot  │  │ gh, docker, k8s  │        │
│  │ doctor     │  │ twitter feed  │  │                  │        │
│  └───────────┘  └───────┬───────┘  └──────────────────┘        │
└─────────────────────────┼───────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────────┐
│                   Execution Engine (execution.rs)                │
│             Arg validation → Capability routing → Timeout ctrl  │
│                    ┌─────────┼─────────┐                        │
│                    ▼         ▼         ▼                        │
│              YAML Pipeline  Rust Func  External CLI              │
└────────────────┬────────────────────────────────────────────────┘
                 │
                 ▼
┌──────────────────────────────────────────────────────────────────┐
│  Pipeline Engine                    Browser Bridge                │
│  ┌────────────┐                      ┌─────────────────────┐    │
│  │ fetch      │                      │ BrowserBridge       │    │
│  │ evaluate   │  ──── IPage ────▶    │ DaemonClient (HTTP) │    │
│  │ navigate   │                      │ CdpPage (WebSocket) │    │
│  │ map/filter │                      └──────────┬──────────┘    │
│  │ sort/limit │                                 │               │
│  │ intercept  │                      Daemon (axum:19825)        │
│  │ tap        │                        HTTP + WebSocket          │
│  └────────────┘                                 │               │
│                                                 ▼               │
│  Expression Engine (pest)            Chrome Extension (CDP)      │
│  ${{ expr | filter }}                chrome.debugger API         │
└──────────────────────────────────────────────────────────────────┘

Workspace Structure

autocli/
├── crates/
│   ├── autocli-core/        # Core data models: Strategy, CliCommand, Registry, IPage trait, Error
│   ├── autocli-pipeline/    # Pipeline engine: pest expressions, executor, 14 step types
│   ├── autocli-browser/     # Browser bridge: Daemon, DaemonPage, CdpPage, DOM helpers
│   ├── autocli-output/      # Output rendering: table, json, yaml, csv, markdown
│   ├── autocli-discovery/   # Adapter discovery: YAML parsing, build.rs compile-time embedding
│   ├── autocli-external/    # External CLI: loading, detection, passthrough execution
│   ├── autocli-ai/          # AI capabilities: explore, synthesize, cascade, generate
│   └── autocli-cli/         # CLI entry point: clap, execution orchestration, doctor, completion
├── adapters/                   # 333 YAML adapter definitions
│   ├── hackernews/
│   ├── bilibili/
│   ├── twitter/
│   └── ...(55 sites)
└── resources/
    └── external-clis.yaml      # External CLI registry

Improvements over the TypeScript Original

ImprovementOriginal (TypeScript)autocli (Rust)
DistributionNode.js + npm install (~100MB)Single binary (4.1MB)
Startup speedRead manifest JSON → parse → registerCompile-time embedding, zero file I/O
Template engineJS eval (security risk)pest PEG parser (type-safe)
Concurrent fetchNon-browser mode pool=5FuturesUnordered, concurrency=10
Error systemSingle hint stringStructured error chain + multiple suggestions
HTTP connectionsNew fetch each timereqwest connection pool reuse
Memory safetyGCOwnership system, zero GC pauses

Development

# Build
cargo build

Test (166 tests)

cargo test --workspace

Release build (with LTO, ~4MB)

cargo build --release

Add a new adapter

1. Create a YAML file under adapters/<site>/

2. Recompile (build.rs auto-embeds)

cargo build

Supported Sites

Click to expand all 55 sites
SiteCommandsStrategy
hackernews8public
bilibili12cookie
twitter24cookie/intercept
reddit15public/cookie
zhihu2cookie
xiaohongshu11cookie
douban7cookie
weibo2cookie
v2ex11public/cookie
bloomberg10cookie
youtube4cookie
wikipedia4public
google4public/cookie
facebook10cookie
instagram14cookie
tiktok15cookie
notion8ui
cursor12ui
chatgpt6public
stackoverflow4public
devto3public
lobsters4public
medium3cookie
substack3cookie
weread7cookie
xueqiu7cookie
boss14cookie
jike10cookie
Other 27 sites......

Star History

Star History Chart

Acknowledgements

This project is built on top of OpenCLI by jackwener. We gratefully acknowledge the original work that made this project possible.

License

Apache-2.0

SEE ALSO

clihub4/5/2026AUTOCLI(1)