COMPONENT // OPENCLI_RUNTIME

@jackwener/opencli Deep Dive

Turning active web sessions and Electron desktop applications into deterministic CLI commands and browser primitives for AI agents.

1. Three-Tier System Architecture

OpenCLI eliminates the need for manual API key provisioning, cookie extraction dumps, and anti-bot/CAPTCHA evasion logic through a local three-tier architecture:

2. Dual-Engine Site Adapters

Supports 100+ platforms with standardized flags (-f json|table|md|csv):

# Search Xiaohongshu notes in clean JSON
opencli xiaohongshu search "AGY" --limit 5 -f json

# Fetch top trending HackerNews stories
opencli hackernews top --limit 10 -f md

# Download Bilibili video via yt-dlp pipeline
opencli bilibili download BV1xxx --output ./downloads
3. Browser Primitive Commands

Interactive DOM automation for custom pages via opencli browser:

# Open session in background lease
opencli browser work open "https://github.com" --window background

# Get accessibility reference tree snapshot
opencli browser work state

# Fill form & submit
opencli browser work fill "@input-search" "opencli"
opencli browser work click "@btn-submit"
opencli browser work close

4. Standardized Unix Sysexit Codes

OpenCLI provides deterministic error handling designed specifically for AI agent loops:

Exit Code Meaning Agent Action / Handling Logic
0 SUCCESS Command executed normally with valid output payload.
66 EMPTY_RESULT No data matched or DOM selector drifted; trigger selector auto-repair.
69 BRIDGE_DOWN Chrome is closed or Extension is disconnected from port 19825.
75 TIMEOUT Page wait or navigation exceeded deadline.
77 AUTH_EXPIRED Target website login expired in Chrome; prompt user to re-authenticate.
78 CONFIG_ERROR Malformed syntax or missing session positional argument.