phonebase
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePhoneBase Cloud Phone Control
PhoneBase云手机控制
You have access to an Android cloud phone through the CLI. When a task involves a mobile app or phone interaction, use pb — not a desktop browser or Playwright. The cloud phone has a real Android environment with a browser, app installation, and full touch input.
pb你可以通过 CLI访问Android云手机。当任务涉及移动应用或手机交互时,请使用pb,而非桌面浏览器或Playwright。该云手机拥有真实的Android环境,自带浏览器、支持应用安装和全量触摸输入。
pbInstallation Check
安装检查
Before doing anything else, verify is installed:
pbpb --versionIf the command is not found, install it with the official one-liner:
curl -fsSL https://get.phonebase.cloud | shThis downloads a prebuilt binary for the current platform (macOS arm64/x64, Linux arm64/x64) from . The installer prints the exact download URL before fetching, and places in or . If it lands in , follow the printed PATH hint, then re-run to confirm.
https://github.com/phonebase-cloud/phonebase-cli/releasespb/usr/local/bin~/.local/bin~/.local/binpb --versionDo not try to invent alternative install commands or build from source — always use the curl one-liner above. Only proceed to Authentication after succeeds.
pb --version在执行任何操作前,请先确认已安装:
pbpb --version如果找不到该命令,请使用官方一键脚本安装:
curl -fsSL https://get.phonebase.cloud | sh这个脚本会从下载当前平台(macOS arm64/x64、Linux arm64/x64)的预编译二进制文件。安装器在下载前会打印确切的下载地址,然后将放置在或目录下。如果安装到了,请按照打印的PATH提示操作,然后重新运行确认安装成功。
https://github.com/phonebase-cloud/phonebase-cli/releasespb/usr/local/bin~/.local/bin~/.local/binpb --version不要尝试自行编写替代安装命令或从源码编译——请始终使用上述curl一键脚本。只有运行成功后,再继续进行身份验证步骤。
pb --versionAuthentication
身份验证
If pb is not yet configured, the user needs to authenticate first:
pb login # browser-based login (interactive)
pb apikey <key> # or set API key directly
pb status # verify authentication worksIf any pb command returns a successful response, authentication is already in place — skip this step.
如果pb尚未配置,用户需要先完成身份验证:
pb login # 基于浏览器的登录(交互式)
pb apikey <key> # 或直接设置API密钥
pb status # 验证身份验证是否生效如果任意pb命令返回成功响应,说明已经完成身份验证——跳过此步骤。
Connection
连接
pb devices # list available devices
pb connect <id> # connect to a device (starts daemon automatically)
pb disconnect # disconnect when donepb devices # 列出可用设备
pb connect <id> # 连接到指定设备(会自动启动守护进程)
pb disconnect # 任务完成后断开连接Why Aliases Matter
别名的作用
pb wraps common Android operations (am start, input tap, pm list, etc.) as simple CLI aliases. These aliases return structured JSON and handle errors consistently. Using bypasses this — you lose structured output and error handling, and the command is harder to read.
pb shell "am start ..."Think of it like using instead of manually running the git binary with raw arguments — the alias exists because it's the right interface.
git log| Shell command (avoid) | Alias (use this) |
|---|---|
| |
| |
| |
| |
| |
| |
| |
Alias parameter limits: supports (action), (component), (data), (type), and positional package name. It does not support extras flags like or . When you need extras or other advanced intent parameters, use the JSON mode instead of falling back to :
pb start-a-n-d-t--es--ei-jpb shellpb -j '{"action":"android.settings.ADD_ACCOUNT_SETTINGS","extras":{"account_types":"com.google"}}' activity/start_activityThe flag sends a raw JSON body directly to the API path, bypassing alias parsing. This gives you full control over parameters while still getting structured JSON output. Reserve only for commands that are not Android API calls — like or .
-jpb shellpb shell "cat /proc/cpuinfo"pb shell "getprop ro.build.version.sdk"pb将常见的Android操作(am start、input tap、pm list等)封装为简单的CLI别名。这些别名返回结构化JSON,并且统一处理错误。使用会绕过这套机制——你将失去结构化输出和错误处理能力,而且命令可读性更差。
pb shell "am start ..."你可以把它类比为使用而非手动给git二进制文件传入原始参数——别名存在的意义就是提供更合适的接口。
git log| 不推荐使用的Shell命令 | 推荐使用的别名 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
别名参数限制:支持(动作)、(组件)、(数据)、(类型)和位置参数包名。它不支持类似或这类额外参数标识。当你需要传递额外参数或其他高级Intent参数时,请使用 JSON模式,而非退回到:
pb start-a-n-d-t--es--ei-jpb shellpb -j '{"action":"android.settings.ADD_ACCOUNT_SETTINGS","extras":{"account_types":"com.google"}}' activity/start_activity-jpb shellpb shell "cat /proc/cpuinfo"pb shell "getprop ro.build.version.sdk"Observing the Screen
查看屏幕内容
pb dumpcpb screencapExample: If dumpc shows , you know to tap the center: . No screenshot needed.
android.widget.Button text="NEXT" bounds=[756,2194][1020,2338]pb tap 888 2266pb dumpcpb screencap**示例:**如果dumpc返回,你就知道要点击中心点:。无需截图。
android.widget.Button text="NEXT" bounds=[756,2194][1020,2338]pb tap 888 2266Command Reference
命令参考
Observe
查看
| Command | Purpose |
|---|---|
| Compact UI tree — text, bounds, clickable state (preferred) |
| Full XML accessibility tree (when you need resource IDs or hierarchy) |
| Screenshot image (only for visual-only content like video/game) |
| UI inspection — accessibility tree + marked screenshot |
| 命令 | 用途 |
|---|---|
| 紧凑UI树,包含文本、边界、可点击状态(优先使用) |
| 完整XML无障碍树(需要资源ID或层级结构时使用) |
| 截图(仅用于视频/游戏等纯视觉内容) |
| UI检查:无障碍树+带标记的截图 |
Touch & Input
触摸与输入
| Command | Purpose |
|---|---|
| Tap at coordinates |
| Swipe between two points |
| Type text into focused field |
| Send key event (4=Back, 3=Home, 66=Enter, 82=Menu) |
| 命令 | 用途 |
|---|---|
| 点击指定坐标 |
| 在两个点之间滑动 |
| 向聚焦的输入框输入文本 |
| 发送按键事件(4=返回,3=主页,66=回车,82=菜单) |
App Management
应用管理
| Command | Purpose |
|---|---|
| Launch app by package name |
| Start activity with flags (-a/-n/-d/-t) |
| Force stop an app |
| List all installed packages |
| Install APK from local file or download URL |
| Uninstall an app |
| 命令 | 用途 |
|---|---|
| 通过包名启动应用 |
| 带参数启动Activity(支持-a/-n/-d/-t) |
| 强制停止应用 |
| 列出所有已安装的包 |
| 从本地文件或下载URL安装APK |
| 卸载应用 |
Browser & Navigation
浏览器与导航
| Command | Purpose |
|---|---|
| Open URL in best available browser on the phone |
| Show current foreground activity |
| 命令 | 用途 |
|---|---|
| 在手机上最合适的可用浏览器中打开URL |
| 显示当前前台Activity |
Files & Clipboard
文件与剪贴板
| Command | Purpose |
|---|---|
| List files on device |
| Upload file to device |
| Download file from device |
| Get or set clipboard content |
| 命令 | 用途 |
|---|---|
| 列出设备上的文件 |
| 上传文件到设备 |
| 从设备下载文件 |
| 获取或设置剪贴板内容 |
System
系统
| Command | Purpose |
|---|---|
| Raw shell command (only for non-API commands) |
| Screen resolution and density info |
| 命令 | 用途 |
|---|---|
| 原始Shell命令(仅用于非API命令) |
| 屏幕分辨率和密度信息 |
Discovery
探索
| Command | Purpose |
|---|---|
| List all available API paths (filtered, hides aliased ones) |
| Filter API paths by keyword |
| Show details of a specific alias or API path |
| Full help with alias list and usage |
When you encounter a task not covered by the aliases above, run to discover additional API paths, or to get parameter details.
pb listpb info <name>| 命令 | 用途 |
|---|---|
| 列出所有可用API路径(已过滤,隐藏别名对应的路径) |
| 按关键词过滤API路径 |
| 显示指定别名或API路径的详细信息 |
| 完整帮助,包含别名列表和用法 |
当你遇到上述别名未覆盖的任务时,请运行探索其他API路径,或运行获取参数详情。
pb listpb info <name>Advanced: JSON Mode
高级功能:JSON模式
For complex API calls that go beyond what aliases support, use to pass a full JSON body:
-jpb -j '{"package_name":"com.example","class_name":".MainActivity"}' activity/start_activityYou can also read JSON from a file with :
-fpb -f params.json activity/start_activity
pb -f - activity/start_activity # read from stdinThis is the preferred escape hatch when aliases don't cover your parameters — it still goes through the structured API and returns JSON. Only use for raw Linux commands that aren't part of the phone's control API.
pb shell对于别名支持范围之外的复杂API调用,可以使用传入完整的JSON请求体:
-jpb -j '{"package_name":"com.example","class_name":".MainActivity"}' activity/start_activity你也可以使用从文件读取JSON:
-fpb -f params.json activity/start_activity
pb -f - activity/start_activity # 从标准输入读取当别名无法覆盖你的参数需求时,这是首选的替代方案——它仍然通过结构化API处理,并且返回JSON。只有当需要运行不属于手机控制API的原始Linux命令时,才使用。
pb shellOutput Format
输出格式
Every pb command returns JSON to stdout:
json
{"code": 200, "data": ..., "msg": "OK"}Human-readable messages and logs go to stderr — ignore stderr when parsing responses.
所有pb命令都会向标准输出返回JSON:
json
{"code": 200, "data": ..., "msg": "OK"}人类可读的消息和日志会输出到标准错误——解析响应时请忽略标准错误的内容。
Interaction Pattern
交互模式
The core loop for operating the phone:
- Observe — to see current screen state
pb dumpc - Locate — find the target element's bounds in the output
- Act — to interact (calculate center from bounds)
pb tap <center_x> <center_y> - Verify — again to confirm the action worked
pb dumpc - Repeat as needed
Common gestures:
- Scroll down:
pb swipe 540 1500 540 500 - Scroll up:
pb swipe 540 500 540 1500 - Go back:
pb keyevent 4 - Go home:
pb keyevent 3
操作手机的核心循环:
- 查看 — 运行获取当前屏幕状态
pb dumpc - 定位 — 在输出中找到目标元素的边界
- 执行 — 运行进行交互(根据边界计算中心点)
pb tap <center_x> <center_y> - 验证 — 再次运行确认操作生效
pb dumpc - 根据需要重复上述步骤
常用手势:
- 向下滚动:
pb swipe 540 1500 540 500 - 向上滚动:
pb swipe 540 500 540 1500 - 返回:
pb keyevent 4 - 返回主页:
pb keyevent 3
Detailed Operation Guides
详细操作指南
For multi-step tasks, read the relevant guide from before starting. Each guide is a Claude-standard skill living at :
~/.phonebase/skills/<name>/SKILL.md| Guide | Path | Read it when... |
|---|---|---|
| install-app | | You need to search for, download, and install an Android app |
| web-search | | You need to search the web using the phone's browser |
Run to see all installed guides with their enabled/disabled status. Only read guides that show . Use to add third-party guides; they appear alongside the built-in ones. Additional guides may exist — run to see what's there, then read inside.
pb skills listenabledpb skills install <path-or-url>ls ~/.phonebase/skills/<dir>/SKILL.md对于多步骤任务,开始前请阅读下的相关指南。每个指南都是符合Claude标准的技能,存放在路径下:
~/.phonebase/skills/<name>/SKILL.md| 指南 | 路径 | 适用场景 |
|---|---|---|
| install-app | | 需要搜索、下载和安装Android应用时 |
| web-search | | 需要使用手机浏览器搜索网页时 |
运行查看所有已安装指南及其启用/禁用状态。仅读取显示的指南。使用添加第三方指南,它们会和内置指南一起展示。可能存在其他指南——运行查看已有内容,然后读取对应目录下的文件。
pb skills listenabledpb skills install <path-or-url>ls ~/.phonebase/skills/<dir>/SKILL.md