
This is a comprehensive guide for building OpenCLI adapters that let you turn websites into command-line interfaces. It walks through the full cycle: discovering APIs through browser DevTools, choosing authentication strategies across five tiers (from public APIs to full UI automation), writing TypeScript adapters using the cli() API, and testing. The workflow assumes you're an AI agent with browser access and pushes hard on active exploration, clicking around pages to trigger lazy-loaded endpoints rather than relying on static analysis. Includes platform-specific helpers for Bilibili's Wbi signing and decision trees for picking between cookie-based fetch, header injection, or XHR interception. If you need to scrape or automate a Chinese web platform without an official API, this gives you the playbook.
$ npx -y skills add joeseesun/opencli-skill --skill qiaomu-opencli-explorer --agent claude-codeInstalls into .claude/skills of the current project.
本文档教你(或 AI Agent)如何为 OpenCLI 添加一个新网站的命令。
从零到发布,覆盖 API 发现、方案选择、适配器编写、测试验证全流程。
[!TIP] 只想为一个具体页面快速生成一个命令? 看 opencli-oneshot skill(~150 行,4 步搞定)。 本文档适合从零探索一个新站点的完整流程。
[!TIP] 想要全自动生成? 直接运行
opencli generate <url> [--goal <goal>],内部会自动走完 explore → synthesize → cascade → verify 全流程。 返回SkillOutput(success / blocked / needs-human-check)。如果自动生成失败或需要人工介入,再按本文档的手动流程继续。
[!CAUTION] 你(AI Agent)必须通过浏览器打开目标网站去探索!
不要只靠opencli explore命令或静态分析来发现 API。
你拥有浏览器工具,必须主动用它们浏览网页、观察网络请求、模拟用户交互。
很多 API 是懒加载的(用户必须点击某个按钮/标签才会触发网络请求)。字幕、评论、关注列表等深层数据不会在页面首次加载时出现在 Network 面板中。如果你不主动去浏览和交互页面,你永远发现不了这些 API。
Sponsors