Reading the repo
Opening the box…
Reading the repo
Opening the box…
How to install on Linux
Written by AI from the README.
Saved setup from 48 min ago
Will it work on Linux?
CONTRIBUTING.mdThanks for your interest in contributing to OpenCLI.
# 1. Fork & clone
git clone git@github.com:<your-username>/opencli.git
cd opencli
# 2. Install dependencies
npm install
# 3. Build
npm run build
# 4. Run a few checks
npx tsc --noEmit
npm test
# 5. Link globally (optional, for testing `opencli` command)
npm link
All adapters use TypeScript. Use the pipeline API for data-fetching commands, and func() for complex browser interactions.
Create a file like clis/<site>/<command>.js:
import { cli, Strategy } from '@jackwener/opencli/registry';
cli({
site: 'mysite',
name: 'trending',
description: 'Trending posts on MySite',
domain: 'www.mysite.com',
strategy: Strategy.PUBLIC,
access: 'read',
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 }}' },
],
});
See hackernews/top.js for a real example.
The fetch step also supports JSON request bodies and explicit per-item batches.
Use method: 'POST' with body for GraphQL or JSON APIs; nested body fields can
reference ${{ args.query }}, ${{ data }}, or ${{ item.id }} in a batch.
See Pipeline JSON requests
for complete examples, concurrency behavior, and validation rules.
Create a file like clis/<site>/<command>.js:
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 (q: string) => {
const res = await fetch('/api/search?q=' + encodeURIComponent(q), {
credentials: 'include'
});
return (await res.json()).results;
}, query);
return data.slice(0, Number(limit)).map((item: any) => ({
title: item.title,
url: item.url,
date: item.created_at,
}));
},
});
Install the opencli-adapter-author skill if you need the full adapter workflow — recon → API discovery → field decoding → opencli browser verify.
# Validate adapter
opencli validate
# Test your command
opencli <site> <command> --limit 3 -f json
# Verbose mode for debugging
opencli <site> <command> -v
Use positional for the primary, required argument of a command (the "what" — query, symbol, id, url, username). Use named options (--flag) for secondary/optional configuration (limit, format, sort, page, filters, language, date).
Rule of thumb: Think about how the user will type the command. opencli xueqiu stock SH600519 is more natural than opencli xueqiu stock --symbol SH600519.
| Arg type | Positional? | Examples |
|----------|-------------|----------|
| Main target (query, symbol, id, url, username) | ✅ positional: true | search '茅台', stock SH600519, download BV1xxx |
| Configuration (limit, format, sort, page, type, filters) | ❌ Named --flag | --limit 10, --format json, --sort hot, --location seattle |
Do not convert an argument to positional just because it appears first in the file. If the argument is optional, acts like a filter, or selects a mode/configuration, it should usually stay a named option.
Pipeline example:
args: [
{ name: 'query', positional: true, required: true, help: 'Search query' }, // ← primary arg
{ name: 'limit', type: 'int', default: 20, help: 'Max results' }, // ← config arg
]
TS example:
args: [
{ name: 'query', positional: true, required: true, help: 'Search query' },
{ name: 'limit', type: 'int', default: 10, help: 'Max results' },
]
See TESTING.md for the full guide and exact test locations.
npm test # Default local gate: unit + extension + adapter tests
npm run test:adapter # Adapter-only project (useful while iterating on adapters)
npx vitest run tests/e2e/ # E2E tests
npx vitest run # All tests
any where possible..js extensions in imports (TypeScript output).kebab-case for files, camelCase for variables/functions, PascalCase for types/classes.We use Conventional Commits:
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
Common scopes: site name (twitter, reddit) or module name (browser, pipeline, engine).
git checkout -b feat/mysite-trendingnpx tsc --noEmit # Type check
npm test # Default local gate: unit + extension + adapter
npm run test:adapter # Adapter-only project (optional while iterating on adapters)
opencli validate # Adapter validation
By contributing, you agree that your contributions will be licensed under the Apache-2.0 License.
Then run bash setup.sh. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
git clone https://github.com/jackwener/OpenCLI.git cd OpenCLI
Node.js >=20.18.1
# needs nvm: https://github.com/nvm-sh/nvm nvm install --lts
npm ci
npm run dev
npm test
For desktop use, start with OpenCLIApp. It bundles the OpenCLI runtime,
keeps the managed opencli command installed, and gives you a system tray UI
for setup, diagnostics, updates, browser-login keepalive, and Web → Markdown.
Option A — OpenCLIApp (recommended for macOS / Windows):
Download the latest app from https://opencli.info/download, install it, then
open the app once and use the System page to install or repair the opencli
command.
Option B — npm global install (CLI-only / CI / servers): OpenCLI requires Node.js >= 20.18.1 when installed through npm.
node --version
npm install -g @jackwener/opencli
OpenCLI connects to Chrome/Chromium through a lightweight Browser Bridge extension plus a small local daemon. The daemon auto-starts when needed.
Option A — Chrome Web Store (recommended): Install OpenCLI from the Chrome Web Store.
Option B — Manual install:
opencli-extension-v{version}.zip from the GitHub Releases page.chrome://extensions, and enable Developer mode.opencli doctor
Each Chrome profile runs its own OpenCLI extension instance. If you use multiple Chrome profiles, list the connected profiles and assign local aliases:
opencli profile list
opencli profile rename <contextId> work
opencli profile use work
opencli --profile work browser main state
With only one connected profile, OpenCLI uses it automatically. With multiple connected profiles and no default, OpenCLI asks you to choose instead of guessing.
opencli list
opencli hackernews top --limit 5
opencli bilibili hot --limit 5
No reports for Linux yet.
GitManual AI Agent reads the 9 key files and writes a step-by-step guide for Linux. Once written, it's saved for everyone.