mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
1d39295f4b
* feat: plugin system (Stage 0-2) - Stage 0: discoverPlugins() scans ~/.opencli/plugins/ at startup - Stage 1: demo plugin repos (github-trending, hot-digest) - Stage 2: opencli plugin install/uninstall/list commands - package.json exports ./registry for TS plugin peerDep support - 17 new/updated tests, tsc --noEmit clean * fix: CDPBridge connect timeout unit mismatch (seconds vs ms) opts.timeout is passed in seconds from runtime.ts but CDPBridge was using it as milliseconds, causing instant timeout (30ms). * feat: add registry-api public entry point for TS plugin peerDep support - Add src/registry-api.ts: re-exports core registration API (cli, Strategy, getRegistry) without transitive side-effects, safe for plugin imports - Update package.json exports: './registry' -> './dist/registry-api.js' - Update src/registry.ts: use globalThis shared registry to ensure single instance across npm-linked plugin modules - Update .gitignore for plugin-related artifacts * fix: symlink host opencli into plugin node_modules on install After npm install, replace the npm-installed @jackwener/opencli with a symlink to the running host's package root. This ensures TS plugins always resolve '@jackwener/opencli/registry' against the host installation, avoiding version mismatches when the published npm package lags behind. * fix: transpile TS plugins to JS on install, deduplicate .ts/.js discovery - installPlugin: after symlinking host opencli, transpile any .ts files to .js using esbuild from the host's node_modules/.bin/ - discoverPluginDir: skip .ts files when a .js sibling exists (production node cannot load .ts directly) - scanPluginCommands: deduplicate basenames via Set to avoid showing 'aggregate, aggregate' when both .ts and .js exist * docs: add plugin system user guide - New docs/guide/plugins.md covering: - Installation/uninstallation commands - Creating YAML plugins (zero-dep) - Creating TS plugins (with peerDep) - TS plugin install lifecycle (clone → deps → symlink → transpile) - Example plugins and troubleshooting - Add Plugins to VitePress sidebar (EN + ZH) - Link from getting-started.md Next Steps * fix: address review issues in plugin system - Security: replace execSync with execFileSync to prevent shell injection - Replace deprecated npm --production with --omit=dev - Tighten parseSource regex to [\w.-]+ to reject special chars - Fix ZH sidebar plugin link (/guide/plugins → /zh/guide/plugins) - Return plugin name from installPlugin() to avoid duplicated logic - Use execFileSync for esbuild transpilation - Fix misleading comment in linkHostOpencli --------- Co-authored-by: jackwener <jakevingoo@gmail.com>
2.5 KiB
2.5 KiB
Getting Started
Make any website or Electron App your CLI. Zero risk · Reuse Chrome login · AI-powered discovery · Browser + Desktop automation
OpenCLI turns any website or Electron app into a command-line interface — Bilibili, Zhihu, 小红书, Twitter/X, Reddit, YouTube, Antigravity, and many more — powered by browser session reuse and AI-native discovery.
Highlights
- CLI All Electron — CLI-ify apps like Antigravity Ultra! Now AI can control itself natively.
- Account-safe — Reuses Chrome's logged-in state; your credentials never leave the browser.
- AI Agent ready —
explorediscovers APIs,synthesizegenerates adapters,cascadefinds auth strategies. - Self-healing setup —
opencli setupverifies Browser Bridge connectivity;opencli doctordiagnoses daemon, extension, and live browser connectivity. - Dynamic Loader — Simply drop
.tsor.yamladapters into theclis/folder for auto-registration. - Dual-Engine Architecture — Supports both YAML declarative data pipelines and robust browser runtime TypeScript injections.
Quick Start
Install via npm
npm install -g @jackwener/opencli
Basic Usage
opencli list # See all commands
opencli hackernews top --limit 5 # Public API, no browser
opencli bilibili hot --limit 5 # Browser command
opencli zhihu hot -f json # JSON output
Output Formats
All built-in commands support --format / -f:
opencli bilibili hot -f table # Default: rich terminal table
opencli bilibili hot -f json # JSON (pipe to jq or LLMs)
opencli bilibili hot -f yaml # YAML (human-readable)
opencli bilibili hot -f md # Markdown
opencli bilibili hot -f csv # CSV
opencli bilibili hot -v # Verbose: show pipeline debug