大家好,我最近在做蜂壳云的 Developer CLI 。
背景是这样的:
如果想让脚本、自动化程序或 Agent 操作 Android ,传统方式通常要准备一台实体手机,然后处理 USB 、开发者模式、ADB 、授权、驱动、设备断连、息屏、充电、远程访问等问题。
个人开发时还好,但如果 Agent 跑在云端、CI 机器上,或者团队里有人远程协作,第一步“让程序稳定碰到手机”就会变得很重。
所以我们做了一个比较直接的方案:
把 Android 设备放在云端,然后通过 phones-cloud-cli 操作。
Agent 不需要知道手机在哪里,也不需要处理 USB / ADB 本地连接,只要能调用命令行,就可以对一台云端 Android 做截图、点击、滑动、输入、安装 APK 等动作。
目前 CLI 的基本用法大概是这样:
# 下载 CLI ,以 macOS Apple Silicon 为例
curl -Lo phones-cloud-cli https://www.phones-cloud.cn/static/cli/phones-cloud-cli-darwin-arm64
chmod +x phones-cloud-cli
sudo mv phones-cloud-cli /usr/local/bin/
# 设置 API Key
phones-cloud-cli auth set-key --key pk_xxxx.yyyy
# 查看设备并选择默认设备
phones-cloud-cli device list
phones-cloud-cli device use dev_xxxxxxxxxxxxxxxx
# 截图、点击、输入
phones-cloud-cli adb screenshot --out screen.png
phones-cloud-cli adb tap --x 540 --y 960
phones-cloud-cli adb text --text "hello"
对 Agent 来说,最小闭环就是:
截图 -> 观察屏幕 -> 决定下一步 -> 点击 / 输入 / 滑动 -> 再截图
再往前一点,可以把 CLI 包成几个工具:
phone_screenshot(device_id) -> image file
phone_tap(device_id, x, y) -> result
phone_text(device_id, text) -> result
phone_swipe(device_id, x1, y1, x2, y2, duration) -> result
phone_keyevent(device_id, keycode) -> result
这样 Agent 不用直接接触复杂的设备连接协议,只要把“我要看屏幕”“我要点这里”“我要输入这段文字”翻译成 CLI 命令。
我们现在比较想验证的场景包括:
Developer CLI 页面在这里: https://www.phones-cloud.cn/developer-cli
想听听大家的真实反馈:
感谢,欢迎拍砖。