Skip to content

feat(cli): cloud device control + listing#372

Merged
RasulOs merged 5 commits into
mainfrom
feat/cloud-device-cli
Jun 22, 2026
Merged

feat(cli): cloud device control + listing#372
RasulOs merged 5 commits into
mainfrom
feat/cloud-device-cli

Conversation

@sleynsol

@sleynsol sleynsol commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds first-class cloud-device support to the mobilerun CLI:

  • mobilerun device <action> --cloud --device-id <id> — tap, swipe, screenshot, ui, type, press, apps, start, long-press now work against a cloud device on cloud.mobilerun.ai (in addition to local ADB). -d <id> is accepted as a shorthand for --device-id when --cloud is set.
  • mobilerun devices --cloud — lists cloud devices (id / name / state / type) via the SDK.
  • mobilerun devices (no flag) — now lists local ADB devices AND cloud devices (when a credential is present, silent otherwise). Single command, two sections.
  • Auto-route to cloud when -d is a UUID. mobilerun device ui -d <uuid> (no --cloud flag) now works as long as a credential is resolvable — mirrors the unified devices ergonomics so users don't have to remember --cloud after copy-pasting a cloud id from mobilerun devices. Strict UUID match, so ADB serials (emulator-5554, R5CN10ABCDE, 192.168.1.5:5555) never trigger auto-routing.
  • Cloud key resolved from MOBILERUN_API_KEY env var (the mobilerun login credential is added in the stacked PR on top of this one).
  • --base-url defaults to https://api.mobilerun.ai/v1; pass https://dev-api.mobilerun.ai/v1 for dev.
  • --cloud and --ios are mutually exclusive (cloud is Android-only).

Stack

This is PR 1 of 4 in a stack:

  1. this PR — cloud device control + listing + UUID auto-routing
  2. feat/cli-login-logoutmobilerun login / logout / whoami (OAuth 2.0 device flow)
  3. feat/cli-streammobilerun stream live cloud viewer (not pushed yet)
  4. feat/extract-viewer — extract viewer into separate mobilerun-viewer distribution (not pushed yet)

Test plan

  • MOBILERUN_API_KEY=… mobilerun devices --cloud lists devices on prod
  • Same with --base-url https://dev-api.mobilerun.ai/v1 lists devices on dev
  • mobilerun devices (no flag) shows both local and cloud sections when authenticated
  • mobilerun devices (no flag) shows only local section when no credential is set (cloud silently skipped, no error)
  • mobilerun device ui -d <uuid> (no --cloud flag) auto-routes to cloud when authenticated
  • mobilerun device ui -d <uuid> falls back to local ADB when no credential is set (preserves old error)
  • mobilerun device ui -d emulator-5554 (or other non-UUID serial) stays on the local path even when authenticated
  • mobilerun device ui --cloud --device-id <id> works (explicit form unchanged)
  • mobilerun device ui --cloud --device-id <id> returns an accessibility tree against a real device
  • mobilerun device screenshot --cloud --device-id <id> returns a PNG path
  • mobilerun device tap/swipe/type round-trip against a cloud device
  • mobilerun device --cloud --ios is rejected with a clear error
  • Missing MOBILERUN_API_KEY on a --cloud subcommand produces a helpful error pointing to mobilerun login
  • Local device flows (no --cloud, non-UUID serial) still work

sleynsol added 2 commits June 22, 2026 15:29
Wire the existing CloudDriver into the `device` subcommands so screenshot/
tap/swipe/type/press/ui/apps/start can target a cloud.mobilerun.ai device.

- add --cloud/--device-id/--base-url to every device subcommand
- -d/--device doubles as the cloud device id when --cloud is set
- resolve the API key from MOBILERUN_API_KEY or the saved credential
- accept package_name/packageName in `device apps` (cloud field names)
Add --cloud/--base-url to the devices command and a helper that lists cloud
devices (id, name, state, type) via the SDK, so users can discover device ids.
sleynsol and others added 2 commits June 22, 2026 15:51
`mobilerun devices` (no flags) now lists local ADB devices and, when a
Mobilerun credential is present (env var or saved login), also lists
cloud devices. With no auth, the cloud section is silently skipped.
`mobilerun devices --cloud` continues to show cloud-only.
Mirrors the unified `mobilerun devices` ergonomics. Previously
`mobilerun device ui -d <uuid>` without `--cloud` fell into the local
ADB path and surfaced an unhelpful "device 'uuid' not found" from
adbutils. Now: if `-d` / `--device-id` matches the RFC-4122 UUID shape
AND a cloud credential is resolvable (env var or `mobilerun login`),
the cloud driver is used automatically. `--cloud` is no longer required
for the common case of "I copied this id from `mobilerun devices`".

Detection is strict (full-string UUID regex) so real ADB serials
(`emulator-5554`, `R5CN10ABCDE`, `192.168.1.5:5555`) never match.

Help text on `-d` / `--device-id` updated to surface the behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@RasulOs RasulOs merged commit 25d5e8e into main Jun 22, 2026
5 of 7 checks passed
@mintlify

mintlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Docs PR opened: https://github.com/droidrun/mobilerun-docs/pull/22

Documented new cloud device support in the CLI guide for the mobilerun devices and mobilerun device commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants