### Project Setup and Local Testing Source: https://github.com/jackwener/opencli/blob/main/docs/developer/contributing.md Follow these steps to fork, clone, install dependencies, build, and optionally link the OpenCLI project locally for development and testing. ```bash # 1. Fork & clone git clone git@github.com:/opencli.git cd opencli # 2. Install dependencies npm install # 3. Build npm run build # 4. Run a few checks npx tsc --noEmit npm run build # 5. Link globally (optional, for testing `opencli` command) npm link ``` -------------------------------- ### Local Plugin Directory Setup Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/rate-limiter-plugin.md Create the necessary directory structure for local plugin installation. ```bash mkdir -p ~/.opencli/plugins/rate-limiter ``` -------------------------------- ### Install OpenCLI from Source Source: https://github.com/jackwener/opencli/blob/main/README.md Installs OpenCLI from its source repository. This includes cloning the repository, installing dependencies, building the project, and linking it globally. ```bash git clone git@github.com:jackwener/opencli.git cd opencli npm install npm run build npm link ``` -------------------------------- ### Install Third-Party Plugins Source: https://github.com/jackwener/opencli/blob/main/docs/guide/extending-opencli.md Install plugins from various sources, including GitHub repositories, cloneable URLs, or local directories. Use `plugin list` to view installed plugins and `plugin update --all` to update them. ```bash opencli plugin install github:user/opencli-plugin-my-tool ``` ```bash opencli plugin install https://github.com/user/opencli-plugin-my-tool ``` ```bash opencli plugin install file:///absolute/path/to/plugin ``` ```bash opencli plugin list ``` ```bash opencli plugin update --all ``` ```bash opencli plugin uninstall my-tool ``` -------------------------------- ### JSON Output Example Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/douban.md This command demonstrates how to get the output in JSON format, which can be useful for programmatic processing. ```bash opencli douban top250 -f json ``` -------------------------------- ### Browser Tab Targeting Examples Source: https://github.com/jackwener/opencli/blob/main/docs/guide/browser-bridge.md These commands demonstrate how to open URLs, list tabs, create new tabs, evaluate JavaScript, select tabs, get tab titles, and close tabs using session names. ```bash opencli browser baidu open https://www.baidu.com/ ``` ```bash opencli browser baidu tab list ``` ```bash opencli browser baidu tab new https://www.baidu.com/ ``` ```bash opencli browser baidu eval --tab 'document.title' ``` ```bash opencli browser baidu tab select ``` ```bash opencli browser baidu get title ``` ```bash opencli browser baidu tab close ``` -------------------------------- ### Install and Build OpenCLI Source: https://github.com/jackwener/opencli/blob/main/CONTRIBUTING.md Steps to fork, clone, install dependencies, and build the project locally. Optionally links the CLI globally for testing. ```bash git clone git@github.com:/opencli.git cd opencli npm install npm run build npx tsc --noEmit npm test npm link ``` -------------------------------- ### Plugin Manifest Example (`opencli-plugin.json`) Source: https://github.com/jackwener/opencli/blob/main/docs/guide/plugins.md An example of a plugin manifest file used to declare metadata like name, version, and compatibility. ```json { "name": "my-plugin", "version": "1.0.0", "opencli": ">=1.0.0", "description": "My awesome plugin" } ``` -------------------------------- ### Discover Installed Commands Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-usage/SKILL.md Use `opencli list` to discover available commands, grouped by site. For machine-readable output, use the `-f json` flag. You can also filter the list or get help for specific sites and commands. ```bash opencli list # table, grouped by site opencli list -f json # machine-readable; pipe to jq or your agent opencli list | grep -i twitter # find commands for a specific site opencli --help # see that site's commands + flags opencli --help # see positional args and command-specific flags ``` -------------------------------- ### Install OpenCLI From Source Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-usage/SKILL.md Clone the OpenCLI repository and install dependencies from source. This allows you to run commands using `npx tsx` without a global installation. ```bash git clone git@github.com:jackwener/OpenCLI.git cd OpenCLI && npm install npx tsx src/main.ts # same surface, no global install ``` -------------------------------- ### Fetch Source Guide Summary Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/notebooklm.md Fetches a guide summary and keywords for a specified source in the current notebook. The `-f json` flag formats the output as JSON. ```bash opencli notebooklm source-guide "Quarterly report" -f json ``` -------------------------------- ### Get Popular Installs in JSON Format Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/homebrew.md Retrieve the popular Homebrew installs data formatted as JSON output. This is useful for programmatic consumption. ```bash opencli homebrew popular -f json ``` -------------------------------- ### Install Monorepo Sub-Plugins Source: https://github.com/jackwener/opencli/blob/main/docs/guide/extending-opencli.md Install sub-plugins from a monorepo hosted on GitHub or directly from local sub-plugin directories using `file://`. ```bash opencli plugin install github:user/opencli-plugins ``` ```bash opencli plugin install github:user/opencli-plugins/cnn ``` ```bash opencli plugin install file:///absolute/path/opencli-plugins/packages/cnn ``` ```bash opencli plugin install file:///absolute/path/opencli-plugins/packages/reuters ``` -------------------------------- ### Authenticate with Spotify Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/spotify.md Run this command for first-time setup to authenticate with Spotify and store tokens locally. Ensure you have completed the setup steps, including creating a Spotify app and configuring your environment variables. ```bash opencli spotify auth ``` -------------------------------- ### BOSS Zhipin Search Examples Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/boss.md Demonstrates various ways to use the `opencli boss search` command. Ensure Chrome is running and logged into zhipin.com with the Browser Bridge extension installed. ```bash opencli boss search --limit 5 ``` ```bash opencli boss search -f json ``` ```bash opencli boss search -v ``` -------------------------------- ### Custom Plugin Implementation Example Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/rate-limiter-plugin.md Example of a custom OpenCLI plugin using the onAfterExecute hook to log command completion. ```javascript // ~/.opencli/plugins/my-plugin/index.js import { onAfterExecute } from '@jackwener/opencli/hooks' onAfterExecute(async (ctx) => { // ctx.command — e.g. "bilibili/comments" // ctx.args — coerced command arguments // ctx.error — set if the command threw console.error(`[my-plugin] finished: ${ctx.command}`) }) ``` -------------------------------- ### Install Monorepo Sub-plugins Source: https://github.com/jackwener/opencli/blob/main/docs/guide/plugins.md Commands to install all enabled sub-plugins from a monorepo or a specific sub-plugin. ```bash # Install ALL enabled sub-plugins from a monorepo opencli plugin install github:user/opencli-plugins # Install a SPECIFIC sub-plugin opencli plugin install github:user/opencli-plugins/polymarket ``` -------------------------------- ### Install Rate Limiter Plugin Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/rate-limiter-plugin.md Install the rate limiter plugin using the OpenCLI plugin manager. ```bash opencli plugin install github:jackwener/opencli-plugin-rate-limiter ``` -------------------------------- ### Install OpenCLI via npm Source: https://github.com/jackwener/opencli/blob/main/docs/guide/installation.md Use this command to globally install the latest stable version of OpenCLI using npm. ```bash npm install -g @jackwener/opencli ``` -------------------------------- ### Verify OpenCLI Installation Source: https://github.com/jackwener/opencli/blob/main/docs/guide/installation.md Run these commands to check the installed version, list available commands, and diagnose connectivity issues. ```bash opencli --version # Check version opencli list # List all commands opencli doctor # Diagnose connectivity ``` -------------------------------- ### TypeScript Site Adapter Example Source: https://github.com/jackwener/opencli/blob/main/docs/developer/contributing.md Define a new site adapter using the `cli()` API. This example shows how to configure site details, arguments, and the main function for processing data. Ensure to use `CliError` subclasses for expected failures. ```typescript import { cli, Strategy } from '@jackwener/opencli/registry'; import { CommandExecutionError, EmptyResultError } from '@jackwener/opencli/errors'; cli({ site: 'mysite', name: 'search', description: 'Search MySite', access: 'read', // 'read' | 'write' example: 'opencli mysite search -f yaml', domain: 'www.mysite.com', strategy: Strategy.COOKIE, args: [ { name: 'query', positional: true, required: true, help: 'Search query' }, { name: 'limit', type: 'int', default: 10, help: 'Max results' }, ], columns: ['title', 'url', 'date'], func: async (page, kwargs) => { const { query, limit = 10 } = kwargs; // ... browser automation logic if (!Array.isArray(data)) throw new CommandExecutionError('MySite returned an unexpected response'); if (!data.length) throw new EmptyResultError('mysite search', 'Try a different keyword'); return data.slice(0, Number(limit)).map((item: any) => ({ title: item.title, url: item.url, date: item.created_at, })); }, }); ``` -------------------------------- ### Start Antigravity Server with Environment Timeout Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/desktop/antigravity.md Start the Antigravity server and set the default timeout using the OPENCLI_ANTIGRAVITY_TIMEOUT environment variable. ```bash OPENCLI_ANTIGRAVITY_TIMEOUT=300 opencli antigravity serve ``` -------------------------------- ### Install yt-dlp Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/download.md Install yt-dlp for video downloads from streaming platforms. Use pip for Python environments or Homebrew for macOS. ```bash # Install yt-dlp pip install yt-dlp # or brew install yt-dlp ``` -------------------------------- ### Install OpenCLI Skills for AI Agents Source: https://github.com/jackwener/opencli/blob/main/README.md Installs the OpenCLI skills package for AI agents, enabling them to interact with websites. Alternatively, specific skills can be installed. ```bash npx skills add jackwener/opencli npx skills add jackwener/opencli --skill opencli-adapter-author npx skills add jackwener/opencli --skill opencli-autofix npx skills add jackwener/opencli --skill opencli-browser npx skills add jackwener/opencli --skill opencli-usage npx skills add jackwener/opencli --skill smart-search ``` -------------------------------- ### Example OpenCLI Command Execution Source: https://github.com/jackwener/opencli/blob/main/designs/self-repair-protocol.md This is an example of how an agent would typically run an OpenCLI command as part of its task, assuming the `opencli-autofix` skill is loaded. ```bash # Agent runs a command as part of its task opencli weibo hot --limit 5 -f json ``` -------------------------------- ### Monorepo Plugin Manifest Example Source: https://github.com/jackwener/opencli/blob/main/docs/guide/plugins.md Example of a plugin manifest for a monorepo, declaring multiple sub-plugins with their paths and metadata. ```json { "version": "1.0.0", "opencli": ">=1.0.0", "description": "My plugin collection", "plugins": { "polymarket": { "path": "packages/polymarket", "description": "Prediction market analysis", "version": "1.2.0" }, "defi": { "path": "packages/defi", "description": "DeFi protocol data", "version": "0.8.0", "opencli": ">=1.2.0" }, "experimental": { "path": "packages/experimental", "disabled": true } } } ``` -------------------------------- ### Install OpenCLI Source: https://github.com/jackwener/opencli/blob/main/README.md Installs the OpenCLI package globally using npm. Requires Node.js version 21 or higher. ```bash node --version npm install -g @jackwener/opencli ``` -------------------------------- ### OpenCLI Semantic Locator Examples Source: https://github.com/jackwener/opencli/blob/main/docs/design/browser-agent-runtime.md Demonstrates the usage of semantic locators with the OpenCLI browser command for actions like clicking, filling forms, and retrieving text. These examples show how to target elements using roles, names, labels, and test IDs. ```bash opencli browser click --role button --name "Submit" ``` ```bash opencli browser fill --label "Email" "me@example.com" ``` ```bash opencli browser get text --testid invoice-total ``` -------------------------------- ### Manage OpenCLI Plugins Source: https://github.com/jackwener/opencli/blob/main/docs/guide/plugins.md Commands for installing, listing, updating, and removing plugins. ```bash # Install a plugin opencli plugin install github:ByteYue/opencli-plugin-github-trending # List installed plugins opencli plugin list # Update one plugin opencli plugin update github-trending # Update all installed plugins opencli plugin update --all # Use the plugin (it's just a regular command) opencli github-trending repos --limit 10 # Remove a plugin opencli plugin uninstall github-trending ``` -------------------------------- ### Verify OpenCLI Setup Source: https://github.com/jackwener/opencli/blob/main/README.md Runs a diagnostic check to ensure OpenCLI is set up correctly and can connect to the browser. ```bash opencli doctor ``` -------------------------------- ### Start Antigravity Server with Custom Timeout Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/desktop/antigravity.md Start the Antigravity server with a custom timeout for replies. This prevents requests from hanging indefinitely. ```bash opencli antigravity serve --timeout 300 ``` -------------------------------- ### Example of Good Column Naming Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/output-design.md This example shows the recommended approach to column naming, using consistent camelCase, English terms, and separating units from field names. ```javascript columns: ['rank', 'stockCode', 'stockName', 'price', 'changePct', 'volume', 'updateTime'] ``` -------------------------------- ### Start Remote Chrome Instance Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/remote-chrome.md Start a Chrome instance with remote debugging enabled on the target machine. Ensure the specified port is accessible. ```bash # On the remote machine (or your Mac) /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ --remote-debugging-port=9222 ``` -------------------------------- ### Reference Adapters Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/site-memory/bilibili.md Examples of existing adapters that can be used as references for developing new ones. ```APIDOC ## Reference Adapters | Template Type | Reference File | |---|---| | User Profile / Video List | `clis/bilibili/user-videos.js` / `me.js` | | Video Details / Subtitles | `clis/bilibili/download.js` / `subtitle.js` | | Comments | `clis/bilibili/comments.js` | | Search | `clis/bilibili/search.js` | | Popular / Ranking | `clis/bilibili/hot.js` / `ranking.js` | | Dynamics | `clis/bilibili/dynamic.js` | | Following | `clis/bilibili/following.js` | | Favorites | `clis/bilibili/favorite.js` | | Watch History | `clis/bilibili/history.js` | General utility: `clis/bilibili/utils.js`. For new adapters, `import { apiGet, fetchJson } from './utils.js'` and avoid rewriting existing functionality. ``` -------------------------------- ### Start a New Qwen Conversation Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/qwen.md Initiate a fresh conversation session. ```bash opencli qwen new ``` -------------------------------- ### Customize Popular Installs Query Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/homebrew.md Filter popular installs by type (formula or cask), time window (e.g., 90 days), and limit the number of results. The `--type` and `--window` options are validated against published Homebrew analytics values. ```bash opencli homebrew popular --type cask --window 90d --limit 50 opencli homebrew popular --type formula --window 365d --limit 100 ``` -------------------------------- ### CLI Starting Daemon Source: https://github.com/jackwener/opencli/blob/main/docs/superpowers/specs/2026-03-31-daemon-lifecycle-redesign.md Message displayed when the daemon is not running and the CLI needs to spawn it. ```text ⏳ Starting daemon... ``` -------------------------------- ### Success Envelope: Get Value Operation Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-browser/SKILL.md Example JSON output for a successful 'get value' operation, showing the retrieved value and match level. ```json { "value": "kalevin@example.com", "matches_n": 1, "match_level": "stable" } ``` -------------------------------- ### Install Plugins from Various Sources Source: https://github.com/jackwener/opencli/blob/main/docs/guide/plugins.md Demonstrates different ways to specify plugin sources, including GitHub shorthand, full URLs, and local paths. ```bash # GitHub shorthand opencli plugin install github:user/repo opencli plugin install github:user/repo/subplugin # install specific sub-plugin from monorepo opencli plugin install https://github.com/user/repo # Any git-cloneable URL opencli plugin install https://gitlab.example.com/team/repo.git opencli plugin install ssh://git@gitlab.example.com/team/repo.git opencli plugin install git@gitlab.example.com:team/repo.git # Local plugin (for development) opencli plugin install file:///path/to/plugin opencli plugin install /path/to/plugin ``` -------------------------------- ### Basic OpenCLI Usage Examples Source: https://github.com/jackwener/opencli/blob/main/docs/guide/getting-started.md Demonstrates fundamental OpenCLI commands for listing available commands, interacting with public APIs, and executing browser-based commands. ```bash opencli list ``` ```bash opencli hackernews top --limit 5 ``` ```bash opencli bilibili hot --limit 5 ``` ```bash opencli zhihu hot -f json ``` -------------------------------- ### Initialize and Verify a User Adapter Source: https://github.com/jackwener/opencli/blob/main/docs/guide/extending-opencli.md Create a user adapter for a fast local development loop without a separate project directory. These are loaded from `~/.opencli/clis//.js`. ```bash opencli browser init cnn/top # edit ~/.opencli/clis/cnn/top.js opencli browser verify cnn/top opencli cnn top ``` -------------------------------- ### SMZDM Search Commands Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/smzdm.md Demonstrates various ways to use the smzdm search command, including quick start, JSON output, and verbose mode. Ensure Chrome is running and logged into smzdm.com with the Browser Bridge extension installed. ```bash # Quick start opencli smzdm search --limit 5 ``` ```bash # JSON output opencli smzdm search -f json ``` ```bash # Verbose mode opencli smzdm search -v ``` -------------------------------- ### Manage OpenCLI Plugins Source: https://github.com/jackwener/opencli/blob/main/README.zh-CN.md Commands for installing, listing, updating, and uninstalling OpenCLI plugins. Plugin versions are recorded in plugins.lock.json. ```bash opencli plugin install github:user/opencli-plugin-my-tool # 安装 ``` ```bash opencli plugin list # 查看已安装 ``` ```bash opencli plugin update my-tool # 更新到最新 ``` ```bash opencli plugin update --all # 更新全部已安装插件 ``` ```bash opencli plugin uninstall my-tool # 卸载 ``` -------------------------------- ### Install OpenCLI Globally Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-usage/SKILL.md Install OpenCLI globally using npm. This command requires Node.js version 21 or higher. After installation, you can run `opencli doctor` to check your environment. ```bash npm install -g @jackwener/opencli # binary: opencli, requires Node >= 21 opencli doctor # run before browser-dependent work (see below) ``` -------------------------------- ### Initialize Fresh Application with Deno Deploy Source: https://github.com/jackwener/opencli/blob/main/src/browser/__fixtures__/article-extract/deno-v2.html This code initializes a Fresh application by importing necessary components and calling the `boot` function. It's used for setting up Fresh projects on Deno Deploy. ```typescript import { boot } from "/_fresh/js/818f2beaef9f24fbde2bf36a04236503800c8c49/fresh-runtime.js"; import { SkipToMainLink } from "/_fresh/js/818f2beaef9f24fbde2bf36a04236503800c8c49/SkipToMainLink.js"; import { OramaSearch } from "/_fresh/js/818f2beaef9f24fbde2bf36a04236503800c8c49/OramaSearch.js"; import { NavItemWithChildren } from "/_fresh/js/818f2beaef9f24fbde2bf36a04236503800c8c49/NavItemWithChildren.js"; import { CookieOptOut } from "/_fresh/js/818f2beaef9f24fbde2bf36a04236503800c8c49/AnalyticsOptOut.js"; boot({ SkipToMainLink, OramaSearch, NavItemWithChildren, CookieOptOut, },"[[1,4,12,46,59,84,89],{\"slots\":2,\"props\":3},[],{},{\"slots\":5,\"props\":6},[],{\"projectId\":7,\"apiKey\":8,\"dataSourceIDs\":9,\"class\":11},\"af2a2800-bfac-4b67-a58e-51ada826e1c0\",\"c1_SHxojDzeso5ITKAGMDjvgpZk43Ff0pFiQhmdGfiLBtnUWKKJFnWGSNs_Zb7\",[10],\"ad8a33af-4669-444e-9bed-b0716b0a9e63\",\"lg:hidden\",{\"slots\":13,\"props\":14},[],{\"entry\":15,\"path\":44,\"activeNav\":45},{\"content\":16,\"children\":17},\"Products\",[18,23,27,31,36,40],{\"href\":19,\"content\":20,\"subhead\":21,\"category\":22},\"/\",\"Deno\",\"Modern runtime for JavaScript and TypeScript\",\"Open Source\",{\"href\":24,\"content\":25,\"subhead\":26,\"category\":22},\"https://fresh.deno.dev\",\"Fresh\",\"Web framework designed for the edge\",{\"href\":28,\"content\":29,\"subhead\":30,\"category\":22},\"https://jsr.io\",\"JSR\",\"TypeScript-first ESM package registry\",{\"href\":32,\"content\":33,\"subhead\":34,\"category\":35},\"/deploy\",\"Deno Deploy\",\"Easy serverless hosting for your JavaScript projects\",\"Commercial\",{\"href\":37,\"content\":38,\"subhead\":39,\"category\":35},\"/enterprise\",\"Deno for Enterprise\",\"Enterprise support for runtime projects\",{\"href\":41,\"content\":42,\"subhead\":43,\"category\":35},\"/subhosting\",\"Subhosting\",\"Extend your platform using Deno Deploy's secure infrastructure\",\"/blog/v2.0\",[\"Signal\",-2],{\"slots\":47,\"props\":48},[],{\"entry\":49,\"path\":44,\"activeNav\":45},{\"content\":50,\"children\":51},\"Modules\",[52,55,56],{\"href\":53,\"content\":54},\"https://jsr.io/@std\",\"Standard Library\",{\"href\":28,\"content\":29},{\"href\":57,\"content\":58},\"/npm/\",\"Node.js & npm\",{\"slots\":60,\"props\":61},[],{\"entry\":62,\"path\":44,\"activeNav\":45},{\"content\":63,\"children\":64},\"Community\",[65,68,71,75,78,81],{\"href\":66,\"content\":67,\"icon\":67},\"https://discord.gg/deno\",\"Discord\",{\"href\":69,\"content\":70,\"icon\":70},\"https://github.com/denoland\",\"GitHub\",{\"href\":72,\"content\":73,\"icon\":74},\"https://bsky.app/profile/deno.land\",\"Bluesky\",\"BlueSky\",{\"href\":76,\"content\":77,\"icon\":77},\"https://twitter.com/deno_land\",\"X\",{\"href\":79,\"content\":80,\"icon\":80},\"https://www.youtube.com/c/deno_land\",\"YouTube\",{\"href\":82,\"content\":83,\"icon\":83},\"https://fosstodon.org/@deno_land\",\"Mastodon\",{\"slots\":85,\"props\":86},[],{\"projectId\":7,\"apiKey\":8,\"dataSourceIDs\":87,\"class\":88},[10],\"hidden lg:block max-w-64\",{\"slots\":90,\"props\":91},[],{}"]); ``` -------------------------------- ### Bluesky Starter Packs Command Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/bluesky.md Retrieves a user's starter packs. Use the --handle flag to specify the user. ```bash opencli bluesky starter-packs --handle bsky.app ``` -------------------------------- ### AI-Assisted Adapter Development Workflow Source: https://github.com/jackwener/opencli/blob/main/docs/developer/ts-adapter.md Use `opencli-adapter-author` and `opencli browser` primitives to scaffold and verify adapters. This includes reconnaissance, network inspection, state analysis, and automated verification. ```bash # Recon on the target site opencli browser open https://example.com opencli browser network opencli browser state # Scaffold + verify opencli browser init mysite/trending opencli browser verify mysite/trending ``` -------------------------------- ### OpenCLI Browser Login Form Recipe Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-browser/SKILL.md A step-by-step recipe for filling and submitting a login form, including state observation, typing credentials, verification, and waiting for a post-login element. ```bash opencli browser login open "https://example.com/login" opencli browser login state # find [N] for email, password, submit opencli browser login type 4 "me@example.com" opencli browser login type 5 "hunter2" opencli browser login get value 4 # verify (autocomplete can eat chars) opencli browser login click 6 # submit opencli browser login wait selector "[data-testid=account-menu]" --timeout 15000 opencli browser login state # fresh refs on the logged-in page ``` -------------------------------- ### Scaffolding and Verification Commands Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-usage/SKILL.md Use these commands to generate a skeleton for a new adapter, perform semantic checks on the loaded registry, and run verification tests. ```bash opencli browser init / # generates a skeleton ``` ```bash opencli validate [target] # semantic checks on the loaded registry (description, domain, pipeline step names, func|pipeline|_lazy presence, arg duplicates) — no network, no browser ``` ```bash opencli verify [target] [--smoke] # run the command with synthetic args ``` ```bash opencli browser verify / # end-to-end smoke inside the bridge ``` -------------------------------- ### Example Repair Session Workflow Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-autofix/SKILL.md This illustrates a typical repair session, from initial failure to filing an upstream issue, including user interaction and AI actions. ```markdown 1. User runs: opencli zhihu hot → Fails: SELECTOR "Could not find element: .HotList-item" 2. AI runs: opencli zhihu hot --trace retain-on-failure 2>trace-error.yaml → Gets trace summary with final state and failed action evidence 3. AI reads summary/state: page loaded but uses ".HotItem" instead of ".HotList-item" 4. AI explores: opencli browser open https://www.zhihu.com/hot && opencli browser state → Confirms new class name ".HotItem" with child ".HotItem-content" 5. AI patches: Edit adapter at `adapterSourcePath` — replace ".HotList-item" with ".HotItem" 6. AI verifies: opencli zhihu hot → Success: returns hot topics 7. AI prepares upstream issue draft, shows it to the user 8. User approves → AI runs: gh issue create --repo jackwener/OpenCLI --title "[autofix] zhihu/hot: SELECTOR" --body "..." ``` -------------------------------- ### OpenCLI Comparison Guide Source: https://github.com/jackwener/opencli/blob/main/docs/design/browser-agent-runtime.md Clarifies OpenCLI's goal as an adapter-first CLI with reliable primitives, not a direct 'Playwright in CLI form' replacement. ```bash Playwright in CLI form ``` -------------------------------- ### AI Adapter Development Workflow Source: https://github.com/jackwener/opencli/blob/main/docs/developer/ai-workflow.md This sequence outlines the steps for developing an adapter using OpenCLI, from initial skill pickup to final verification. ```bash # 1. Pick up the skill (Claude Code) # skills/opencli-adapter-author/SKILL.md # 2. Reconnaissance opencli browser analyze https://example.com # Fallback primitives when analyze says deeper inspection is needed: # opencli browser open https://example.com # opencli browser network # inspect XHR / fetch calls # opencli browser state # extract __INITIAL_STATE__ / __NEXT_DATA__ # 3. Scaffold + verify opencli browser init / opencli browser verify / ``` -------------------------------- ### Create a Pipeline Adapter Source: https://github.com/jackwener/opencli/blob/main/CONTRIBUTING.md Example of creating a site adapter using the pipeline API for data-fetching commands. Define site, name, description, domain, strategy, arguments, and pipeline steps. ```typescript import { cli, Strategy } from '@jackwener/opencli/registry'; cli({ site: 'mysite', name: 'trending', description: 'Trending posts on MySite', domain: 'www.mysite.com', strategy: Strategy.PUBLIC, browser: false, args: [ { name: 'query', positional: true, required: true, help: 'Search keyword' }, { name: 'limit', type: 'int', default: 20, help: 'Number of items' }, ], columns: ['rank', 'title', 'score', 'url'], pipeline: [ { fetch: { url: 'https://api.mysite.com/trending' } }, { map: { rank: '${{ index + 1 }}', title: '${{ item.title }}', score: '${{ item.score }}', url: '${{ item.url }}', }}, { limit: '${{ args.limit }}' }, ], }); ``` -------------------------------- ### Get Wikipedia Search Results in JSON Format Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/wikipedia.md To get search results in JSON format, use the `-f json` flag. ```bash opencli wikipedia search "Rust" -f json ``` -------------------------------- ### Notes.md Format Example Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/site-memory.md This is an example of the `notes.md` file format, which includes a date, author, and specific notes related to code or data interpretation. ```markdown ## 2026-04-20 by opencli-user 写 `convertible.js` 时遇到: - f237 推断是溢价率(排序对比法,页面对照) - `fltt=2` 不加的话价格是整数 × 10^f152 - `fs=b:MK0354` 过滤可转债 ``` -------------------------------- ### Running Adapter Project Tests Source: https://github.com/jackwener/opencli/blob/main/docs/developer/testing.md If you specifically need to run the adapter project tests, use this command. ```bash npm run test:adapter ``` -------------------------------- ### Install OpenCLI Globally Source: https://github.com/jackwener/opencli/blob/main/README.md Installs the latest version of OpenCLI globally using npm. It also includes a command to refresh the packaged OpenCLI skills. ```bash npm install -g @jackwener/opencli@latest # If you use the packaged OpenCLI skills, refresh them too npx skills add jackwener/opencli ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/jackwener/opencli/blob/main/CONTRIBUTING.md Examples of commit messages following the Conventional Commits specification. Use scopes like site names or module names. ```git feat(twitter): add thread command fix(browser): handle CDP timeout gracefully docs: update CONTRIBUTING.md test(reddit): add e2e test for save command chore: bump vitest to v4 ``` -------------------------------- ### Start Antigravity Server with Custom Port Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/desktop/antigravity.md Start the Antigravity server, which acts as an Anthropic-compatible API proxy, on a specified port. The default port is 8082. ```bash opencli antigravity serve --port 8082 ``` -------------------------------- ### Adapter Description Best Practices Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/output-design.md Craft a concise and informative adapter description that clearly states what data the adapter provides, its default behavior, and any important parameters. Avoid generic or redundant phrases. ```markdown 1. What the data is: e.g., "A-share gain ranking" vs "Market index intraday." 2. Default behavior: e.g., "Sorted by gain by default, top 20 items." 3. Important parameters: e.g., "Supports `market` parameter for switching between Shanghai/Shenzhen/Beijing exchanges." Keep descriptions around 30 characters per line. ``` -------------------------------- ### Start Antigravity with Remote Debugging Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/desktop/antigravity.md Start the Antigravity desktop app with the Chrome DevTools remote-debugging-port flag enabled. This is a prerequisite for connecting via CDP. ```bash /Applications/Antigravity.app/Contents/MacOS/Electron \ --remote-debugging-port=9224 ``` -------------------------------- ### Start New Conversation Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/chatgpt.md Start a new, fresh chat conversation in ChatGPT. This command opens a new tab or session depending on the site session configuration. ```bash # Start a fresh chat opencli chatgpt new ``` -------------------------------- ### Run Unit and Adapter Tests Source: https://github.com/jackwener/opencli/blob/main/docs/superpowers/plans/2026-03-28-perf-smart-wait.md Executes the full suite of unit and adapter tests to verify the implemented changes. ```bash npx vitest run --project unit --project adapter ``` -------------------------------- ### OpenCLI Plugin Management Source: https://github.com/jackwener/opencli/blob/main/README.md Provides commands for managing OpenCLI plugins. Includes installing plugins from GitHub, listing installed plugins, updating all plugins, and uninstalling specific plugins. ```bash opencli plugin install github:user/opencli-plugin-my-tool opencli plugin list opencli plugin update --all opencli plugin uninstall my-tool ``` -------------------------------- ### Create a func() Adapter Source: https://github.com/jackwener/opencli/blob/main/CONTRIBUTING.md Example of creating a site adapter using the func() API for complex browser interactions. Define site, name, description, domain, strategy, arguments, and the async function for page manipulation. ```typescript import { cli, Strategy } from '@jackwener/opencli/registry'; cli({ site: 'mysite', name: 'search', description: 'Search MySite', domain: 'www.mysite.com', strategy: Strategy.COOKIE, args: [ { name: 'query', positional: true, required: true, help: 'Search query' }, { name: 'limit', type: 'int', default: 10, help: 'Max results' }, ], columns: ['title', 'url', 'date'], func: async (page, kwargs) => { const { query, limit = 10 } = kwargs; await page.goto('https://www.mysite.com'); const data = await page.evaluate(` (async () => { const res = await fetch('/api/search?q=${encodeURIComponent(query)}', { credentials: 'include' }); return (await res.json()).results; })() `); return data.slice(0, Number(limit)).map((item: any) => ({ title: item.title, url: item.url, date: item.created_at, })); }, }); ``` -------------------------------- ### Bluesky Following Command Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/bluesky.md Lists the accounts a user is following. Use the --handle flag to specify the user. ```bash opencli bluesky following --handle bsky.app ``` -------------------------------- ### Example of Poor Column Naming Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/output-design.md This example demonstrates poor column naming practices, including mixed languages, inconsistent casing, and including units within the field name. ```javascript columns: ['股票代码', 'name', 'PRICE', 'change%', 'vol', 'time'] ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/jackwener/opencli/blob/main/docs/developer/contributing.md Examples of commit messages following the Conventional Commits specification, illustrating different types of changes like features, fixes, documentation, tests, and chores. ```text feat(twitter): add thread command fix(browser): handle CDP timeout gracefully docs: update CONTRIBUTING.md test(reddit): add e2e test for save command chore: bump vitest to v4 ``` -------------------------------- ### CI/CD Chrome Setup with xvfb Source: https://github.com/jackwener/opencli/blob/main/docs/advanced/remote-chrome.md In CI/CD environments, use `xvfb` to run a real Chrome instance with remote debugging enabled. This setup ensures a headed browser is available for automation tasks. ```yaml steps: - uses: browser-actions/setup-chrome@latest id: setup-chrome - run: | xvfb-run --auto-servernum \ ${{ steps.setup-chrome.outputs.chrome-path }} \ --remote-debugging-port=9222 & ``` -------------------------------- ### Read Web Page as Markdown Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/web.md Fetches a web page and exports its content as Markdown. This is the basic usage of the web adapter. ```bash opencli web read --url https://example.com/article ``` -------------------------------- ### OpenCLI Browser HN Chaining Example Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-browser/SKILL.md Demonstrates good chaining practice for atomic operations using '&&' to maintain a live session and session state. ```bash opencli browser hn open "https://news.ycombinator.com" \ && opencli browser hn state \ && opencli browser hn click 3 ``` -------------------------------- ### Install interceptor for network requests Source: https://github.com/jackwener/opencli/blob/main/skills/opencli-adapter-author/references/api-discovery.md This JavaScript code snippet is designed to be evaluated in the browser context to install an interceptor. It configures the interceptor with a specific domain and path, then triggers a page navigation to capture a request and its response. ```javascript // func 里 await page.evaluateWithArgs(installInterceptorCode, { config: { domain: 'api.xxx.com', path: '/foo' }, }); await page.goto('https://xxx.com/trigger-page'); // 等页面自己发那条请求 const intercepted = await page.evaluate('window.__opencli_intercepted'); return intercepted.response; ``` -------------------------------- ### Grok New Source: https://github.com/jackwener/opencli/blob/main/docs/adapters/browser/grok.md Start a fresh conversation with Grok. ```APIDOC ## grok new ### Description Start a fresh conversation. ### Command `opencli grok new` ### Output Columns `Status` ``` -------------------------------- ### Browser Command Help Source: https://github.com/jackwener/opencli/blob/main/docs/design/browser-agent-runtime.md Documentation note regarding the 'select' command, clarifying its use for native '