mobilecli 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ # mobilecli
2
+
3
+ A universal command-line tool for managing iOS and Android devices, simulators, emulators and apps from [Mobile Next](https://github.com/mobile-next/).
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/mobile-next/mobilecli">
7
+ <img src="https://img.shields.io/github/stars/mobile-next/mobilecli" alt="Mobile Next Stars" />
8
+ </a>
9
+ <a href="https://github.com/mobile-next/mobilecli">
10
+ <img src="https://img.shields.io/github/contributors/mobile-next/mobilecli?color=green" alt="Mobile Next Downloads" />
11
+ </a>
12
+ <a href="https://www.npmjs.com/package/mobilecli">
13
+ <img src="https://img.shields.io/npm/dm/mobilecli?logo=npm&style=flat&color=red" alt="npm">
14
+ </a>
15
+ <a href="https://github.com/mobile-next/mobilecli/releases">
16
+ <img src="https://img.shields.io/github/release/mobile-next/mobilecli">
17
+ </a>
18
+ <a href="https://github.com/mobile-next/mobilecli/blob/main/LICENSE">
19
+ <img src="https://img.shields.io/badge/license-AGPL v3.0-blue.svg" alt="Mobile MCP is released under the AGPL v3.0 License">
20
+ </a>
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="http://mobilenexthq.com/join-slack">
25
+ <img src="https://img.shields.io/badge/join-Slack-blueviolet?logo=slack&style=flat" alt="Slack community channel" />
26
+ </a>
27
+ </p>
28
+
29
+ ## Features 🚀
30
+
31
+ - **Device Management**: List, manage, interactive with connected mobile devices
32
+ - **Cross-Platform Support**: Works with iOS physical devices, iOS simulators, Android devices, and Android emulators
33
+ - **Emulator/Simulator Control**: Boot and shutdown emulators and simulators programmatically
34
+ - **Screenshot Capture**: Take screenshots from any connected device with format options
35
+ - **Multiple Output Formats**: Save screenshots as PNG or JPEG with quality control
36
+ - **Screencapture video streaming**: Stream mjpeg/h264 video directly from device
37
+ - **Device Control**: Reboot devices, tap screen coordinates, press hardware buttons
38
+ - **App Management**: Launch, terminate, install, uninstall, list, and get foreground apps
39
+ - **Crash Reports**: List and fetch crash reports from iOS and Android devices
40
+
41
+ ### 🎯 Platform Support
42
+
43
+ | Platform | Supported |
44
+ |----------|:---------:|
45
+ | iOS Real Device | ✅ |
46
+ | iOS Simulator | ✅ |
47
+ | Android Real Device | ✅ |
48
+ | Android Emulator | ✅ |
49
+
50
+ ## Installation 📦
51
+
52
+ #### Prerequisites 📋
53
+ - **Android SDK** with `adb` in PATH (for Android device support)
54
+ - **Xcode Command Line Tools** (for iOS simulator support on macOS)
55
+
56
+ #### Run instantly with npx
57
+ ```bash
58
+ npx mobilecli@latest
59
+ ```
60
+
61
+ #### Install globally with npm
62
+ ```bash
63
+ npm install -g mobilecli@latest
64
+ ```
65
+
66
+ #### Install from Source 🛠️
67
+ ```bash
68
+ git clone https://github.com/mobile-next/mobilecli.git
69
+ cd mobilecli
70
+ make build
71
+ ```
72
+
73
+ ### Install Dependencies
74
+
75
+ #### 🍎 For iOS Simulator Support
76
+
77
+ Xcode is required. Make sure you have it installed with the runtimes relevant for you installed. You will have to create Simulators and have them booted before `mobilecli` can use them.
78
+
79
+ `mobilecli` will automatically install an agent on the device that is required for functions such as tapping on elements, pressing buttons and streaming screen capture.
80
+
81
+ #### 🤖 For Android Support
82
+ ```bash
83
+ # Install Android SDK and ensure adb is in PATH
84
+ # Download from: https://developer.android.com/studio/command-line/adb
85
+ # or
86
+ brew install --cask android-platform-tools
87
+ ```
88
+
89
+ ## Usage
90
+
91
+ ### List Connected Devices 🔍
92
+
93
+ ```bash
94
+ # List all online devices and simulators
95
+ mobilecli devices
96
+
97
+ # List all devices including offline emulators and simulators
98
+ mobilecli devices --include-offline
99
+ ```
100
+
101
+ Example output:
102
+ ```json
103
+ [
104
+ {
105
+ "id": "12345678-1234567890ABCDEF",
106
+ "name": "iPhone 15",
107
+ "platform": "ios",
108
+ "type": "real",
109
+ "state": "online"
110
+ },
111
+ {
112
+ "id": "Pixel_6",
113
+ "name": "Pixel 6",
114
+ "platform": "android",
115
+ "type": "emulator",
116
+ "state": "online"
117
+ },
118
+ {
119
+ "id": "iPhone_13",
120
+ "name": "iPhone 13",
121
+ "platform": "ios",
122
+ "type": "simulator",
123
+ "state": "offline"
124
+ }
125
+ ]
126
+ ```
127
+
128
+ **Note**: Offline emulators and simulators can be booted using the `mobilecli device boot` command.
129
+
130
+ ### Take Screenshots 📸
131
+
132
+ ```bash
133
+ # Take a PNG screenshot (default)
134
+ mobilecli screenshot --device <device-id>
135
+
136
+ # Take a JPEG screenshot with custom quality
137
+ mobilecli screenshot --device <device-id> --format jpeg --quality 80
138
+
139
+ # Save to specific path
140
+ mobilecli screenshot --device <device-id> --output screenshot.png
141
+
142
+ # Output to stdout
143
+ mobilecli screenshot --device <device-id> --output -
144
+ ```
145
+
146
+ ### Stream Screen 🎥
147
+
148
+ ```bash
149
+ mobilecli screencapture --device <device-id> --format mjpeg | ffplay -
150
+ ```
151
+
152
+ Note that screencapture is one way. You will have to use `io tap` commands to tap on the screen.
153
+
154
+ ### Device Control 🎮
155
+
156
+ ```bash
157
+ # Boot an offline emulator or simulator
158
+ mobilecli device boot --device <device-id>
159
+
160
+ # Shutdown a running emulator or simulator
161
+ mobilecli device shutdown --device <device-id>
162
+
163
+ # Reboot a device
164
+ mobilecli device reboot --device <device-id>
165
+
166
+ # Tap at coordinates (x,y)
167
+ mobilecli io tap --device <device-id> 100,200
168
+
169
+ # Long press at coordinates (x,y) with optional duration in milliseconds
170
+ mobilecli io longpress --device <device-id> 100,200
171
+ mobilecli io longpress --device <device-id> 100,200 --duration 2000
172
+
173
+ # Press hardware buttons
174
+ mobilecli io button --device <device-id> HOME
175
+ mobilecli io button --device <device-id> VOLUME_UP
176
+ mobilecli io button --device <device-id> POWER
177
+
178
+ # Send text
179
+ mobilecli io text --device <device-id> 'hello world'
180
+ ```
181
+
182
+ ### Supported Hardware Buttons
183
+
184
+ - `HOME` - Home button
185
+ - `BACK` - Back button (Android only)
186
+ - `POWER` - Power button
187
+ - `VOLUME_UP`, `VOLUME_DOWN` - Volume up and down
188
+ - `DPAD_UP`, `DPAD_DOWN`, `DPAD_LEFT`, `DPAD_RIGHT`, `DPAD_CENTER` - D-pad controls (Android only)
189
+
190
+ ### App Management 📱
191
+
192
+ ```bash
193
+ # List installed apps on device
194
+ mobilecli apps list --device <device-id>
195
+
196
+ # Get currently foreground app
197
+ mobilecli apps foreground --device <device-id>
198
+
199
+ # Launch an app
200
+ mobilecli apps launch <bundle-id> --device <device-id>
201
+
202
+ # Terminate an app
203
+ mobilecli apps terminate <bundle-id> --device <device-id>
204
+
205
+ # Install an app (.apk for Android, .ipa for iOS, .zip for iOS Simulator)
206
+ mobilecli apps install <path> --device <device-id>
207
+
208
+ # Uninstall an app
209
+ mobilecli apps uninstall <bundle-id> --device <device-id>
210
+ ```
211
+
212
+ Example output for `apps foreground`:
213
+ ```json
214
+ {
215
+ "status": "ok",
216
+ "data": {
217
+ "packageName": "com.example.app",
218
+ "appName": "Example App",
219
+ "version": "1.0.0"
220
+ }
221
+ }
222
+ ```
223
+
224
+ ### Crash Reports 💥
225
+
226
+ ```bash
227
+ # List crash reports from a device
228
+ mobilecli crashes list --device <device-id>
229
+
230
+ # Get a specific crash report by ID
231
+ mobilecli crashes get <crash-id> --device <device-id>
232
+ ```
233
+
234
+ Example output for `crashes list`:
235
+ ```json
236
+ {
237
+ "status": "ok",
238
+ "data": [
239
+ {
240
+ "processName": "ShareExtension",
241
+ "timestamp": "2026-01-24-195529",
242
+ "id": "ShareExtension-2026-01-24-195529.ips"
243
+ }
244
+ ]
245
+ }
246
+ ```
247
+
248
+ **Note**: On iOS real devices, crash reports are fetched via the Apple crashreport service. On iOS simulators, they are read from `~/Library/Logs/DiagnosticReports/`. On Android, crashes are parsed from `adb logcat -b crash`.
249
+
250
+ ## HTTP API 🔌
251
+
252
+ ***mobilecli*** provides an http interface for all the functionality that is available through command line. As a matter of fact, it is preferable to
253
+ use mobilecli as a webserver, so it can cache and keep tunnels alive, speeding up your interactions with the mobile device or simulator/emulator.
254
+
255
+ For the full list of available JSON-RPC methods and their parameters, see the [OpenRPC specification](https://github.com/mobile-next/mobile-openrpc/blob/main/mobilecli/openrpc.md).
256
+
257
+ ```bash
258
+ # Start the server (default port 12000)
259
+ mobile server start
260
+
261
+ curl http://localhost:12000/rpc -XPOST -d '{"jsonrpc":"2.0", "id": 1, "method": "devices", "params": {}}'
262
+ curl http://localhost:12000/rpc -XPOST -d '{"jsonrpc":"2.0", "id": 1, "method": "screenshot", "params": {"deviceId": "your-device-id"}}'
263
+
264
+ ## WebSocket Support 🔌
265
+
266
+ ***mobilecli*** includes a WebSocket server that allows multiple requests over a single connection using the same JSON-RPC 2.0 format as the HTTP API.
267
+
268
+ ```bash
269
+ # Start the server (default port 12000)
270
+ mobilecli server start
271
+
272
+ # Connect and send requests using wscat
273
+ wscat -c ws://localhost:12000/ws
274
+ > {"jsonrpc":"2.0","id":1,"method":"devices","params":{}}
275
+ < {"jsonrpc":"2.0","id":1,"result":[...]}
276
+ > {"jsonrpc":"2.0","id":2,"method":"screenshot","params":{"deviceId":"your-device-id"}}
277
+ < {"jsonrpc":"2.0","id":2,"result":{...}}
278
+ ```
279
+
280
+ **Note**: `screencapture` is not supported over WebSocket - use the HTTP `/rpc` endpoint for video streaming.
281
+
282
+ ## Platform-Specific Notes
283
+
284
+ ### iOS Real Devices
285
+ - Currently requires that you install and run WebDriverAgent manually. You may change the BUNDLE IDENTIFIER, and *mobilecli* will be able to launch it if needed, as long as the identifier ends with `*.WebDriverAgent`.
286
+
287
+ ## Development 👩‍💻
288
+
289
+ ### Building 🛠️
290
+
291
+ Please refer to (docs/TESTING.md) for further instructions regarding testing *mobilecli* locally.
292
+
293
+ ```bash
294
+ make lint
295
+ make build
296
+ make test
297
+ ```
298
+
299
+ ## Support 💬
300
+
301
+ For issues and feature requests, please use the [GitHub Issues](https://github.com/mobile-next/mobilecli/issues) page.
302
+
303
+ Be sure to <a href="http://mobilenexthq.com/join-slack">join our slack channel</a> today 💜
304
+
305
+ To learn more about <a href="https://mobilenexthq.com/">Mobile Next</a> and what we're building, <a href="https://mobilenexthq.com/#newsletter">subscribe to our newsletter</a>.
306
+
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobilecli",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "author": "Mobile Next",
5
5
  "description": "A universal command-line tool for managing iOS and Android devices, simulators, emulators and apps",
6
6
  "repository": {