mobilecli 1.0.5 → 1.0.7

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 CHANGED
@@ -37,7 +37,9 @@ A universal command-line tool for managing iOS and Android devices, simulators,
37
37
  - **Device Control**: Reboot devices, tap screen coordinates, press hardware buttons
38
38
  - **App Management**: Launch, terminate, install, uninstall, clear data, list, and get foreground apps
39
39
  - **Filesystem**: Push, pull, list, mkdir, and rm files on-device or in app containers (Android, iOS Simulator)
40
+ - **Location Override**: Fake the GPS location reported by a device
40
41
  - **Crash Reports**: List and fetch crash reports from iOS and Android devices
42
+ - **Device Logs**: Stream real-time device logs with filtering from iOS and Android devices
41
43
  - **Webview Inspection**: List, navigate, query DOM, and evaluate JavaScript in embedded webviews
42
44
 
43
45
  ### 🎯 Platform Support
@@ -138,6 +140,12 @@ mobilecli screenshot --device <device-id>
138
140
  # Take a JPEG screenshot with custom quality
139
141
  mobilecli screenshot --device <device-id> --format jpeg --quality 80
140
142
 
143
+ # Scale the screenshot down to half size
144
+ mobilecli screenshot --device <device-id> --scale 0.5
145
+
146
+ # Limit the largest dimension to 800 pixels, keeping aspect ratio
147
+ mobilecli screenshot --device <device-id> --max-size 800
148
+
141
149
  # Save to specific path
142
150
  mobilecli screenshot --device <device-id> --output screenshot.png
143
151
 
@@ -190,6 +198,28 @@ mobilecli io clipboard set --device <device-id> 'hello world'
190
198
  mobilecli io keys --device <device-id> "cmd+v"
191
199
  ```
192
200
 
201
+ ### Location Override 📍
202
+
203
+ ```bash
204
+ # Fake the device location (latitude,longitude)
205
+ mobilecli device location set --device <device-id> 37.7749,-122.4194
206
+
207
+ # Hold the override until Ctrl-C, then clear it automatically
208
+ mobilecli device location set --device <device-id> 37.7749,-122.4194 --wait
209
+
210
+ # Restore the real location
211
+ mobilecli device location clear --device <device-id>
212
+ ```
213
+
214
+ Caveats per platform:
215
+
216
+ | Platform | Notes |
217
+ |----------|-------|
218
+ | iOS Simulator | Works out of the box, the override survives mobilecli exiting |
219
+ | iOS Real Device | The override only lives as long as the mobilecli process that set it, so `--wait` is required. `clear` has to come from that same process |
220
+ | Android Emulator | Uses the emulator console. It has no way to undo a fix, so `clear` sets the location back to the coordinates an emulator boots with (the Googleplex), not to a real one |
221
+ | Android Real Device | Runs an on-device agent as a mock location provider, granting the `mock_location` appop to `com.android.shell`. Some OEM ROMs ignore mock providers, and apps checking `Location.isFromMockProvider()` or Play Integrity can tell |
222
+
193
223
  ### Supported Hardware Buttons
194
224
 
195
225
  - `HOME` - Home button
@@ -438,6 +468,47 @@ Example output for `crashes list`:
438
468
 
439
469
  **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`.
440
470
 
471
+ ### Device Logs 📋
472
+
473
+ ```bash
474
+ # Stream logs from a device (Ctrl+C to stop)
475
+ mobilecli device logs --device <device-id>
476
+
477
+ # Stop after 100 entries
478
+ mobilecli device logs --device <device-id> --limit 100
479
+
480
+ # Filter by field (exact match)
481
+ mobilecli device logs --filter process=SpringBoard
482
+ mobilecli device logs --filter tag=ActivityManager
483
+
484
+ # Exclude by field
485
+ mobilecli device logs --filter process!=SpringBoard
486
+
487
+ # Combine filters (AND logic)
488
+ mobilecli device logs --filter level=Error --filter process!=SpringBoard
489
+ ```
490
+
491
+ Supported filter keys: `pid`, `process`, `tag`, `level`, `subsystem`, `category`, `message`
492
+
493
+ Each log entry is printed as a JSON line:
494
+ ```json
495
+ {"timestamp":"2026-04-15 12:17:14.224451+0300","message":"Start proc...","level":"Default","subsystem":"com.apple.UIKit","category":"EventDispatch","pid":54052,"process":"SpringBoard"}
496
+ ```
497
+
498
+ Logs are also available over the [HTTP API](#http-api-) via the `device.logs` method, which takes the same `limit` and `filters` and returns a URL to stream from:
499
+
500
+ ```bash
501
+ curl -X POST http://localhost:12000/rpc -H "Content-Type: application/json" -d '{
502
+ "jsonrpc": "2.0", "method": "device.logs", "id": 1,
503
+ "params": { "deviceId": "<device-id>", "limit": 100, "filters": ["level=Error", "process!=SpringBoard"] }
504
+ }'
505
+ # => {"jsonrpc":"2.0","id":1,"result":{"sessionUrl":"/sessions/<session-id>/logs"}}
506
+
507
+ curl -N http://localhost:12000/sessions/<session-id>/logs
508
+ ```
509
+
510
+ The session expires one minute after creation and accepts a single connection. Disconnecting stops the log stream on the device.
511
+
441
512
  ### Remote Devices ☁️
442
513
 
443
514
  ```bash
package/index.js CHANGED
@@ -3,16 +3,19 @@
3
3
  const { join } = require("node:path");
4
4
  const { spawn } = require("node:child_process");
5
5
 
6
- let binary;
6
+ let packageName;
7
+ let binaryName;
7
8
 
8
9
  switch (process.platform) {
9
10
  case "darwin":
10
11
  switch (process.arch) {
11
12
  case "arm64":
12
- binary = "mobilecli-darwin-arm64";
13
+ packageName = "@mobilenext/mobilecli-darwin-arm64";
14
+ binaryName = "mobilecli-darwin-arm64";
13
15
  break;
14
16
  case "x64":
15
- binary = "mobilecli-darwin-amd64";
17
+ packageName = "@mobilenext/mobilecli-darwin-amd64";
18
+ binaryName = "mobilecli-darwin-amd64";
16
19
  break;
17
20
  }
18
21
  break;
@@ -20,10 +23,12 @@ switch (process.platform) {
20
23
  case "linux":
21
24
  switch (process.arch) {
22
25
  case "arm64":
23
- binary = "mobilecli-linux-arm64";
26
+ packageName = "@mobilenext/mobilecli-linux-arm64";
27
+ binaryName = "mobilecli-linux-arm64";
24
28
  break;
25
29
  case "x64":
26
- binary = "mobilecli-linux-amd64";
30
+ packageName = "@mobilenext/mobilecli-linux-amd64";
31
+ binaryName = "mobilecli-linux-amd64";
27
32
  break;
28
33
  }
29
34
  break;
@@ -31,21 +36,30 @@ switch (process.platform) {
31
36
  case "win32":
32
37
  switch (process.arch) {
33
38
  case "arm64":
34
- binary = "mobilecli-windows-arm64.exe";
39
+ packageName = "@mobilenext/mobilecli-windows-arm64";
40
+ binaryName = "mobilecli-windows-arm64.exe";
35
41
  break;
36
42
  case "x64":
37
- binary = "mobilecli-windows-amd64.exe";
43
+ packageName = "@mobilenext/mobilecli-windows-amd64";
44
+ binaryName = "mobilecli-windows-amd64.exe";
38
45
  break;
39
46
  }
40
47
  break;
41
48
  }
42
49
 
43
- if (!binary) {
50
+ if (!packageName) {
44
51
  console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
45
52
  process.exit(1);
46
53
  }
47
54
 
48
- const binaryPath = join(__dirname, "bin", binary);
55
+ let binaryPath;
56
+ try {
57
+ const packagePath = require.resolve(`${packageName}/package.json`);
58
+ binaryPath = join(packagePath, "..", binaryName);
59
+ } catch (error) {
60
+ console.error(`Failed to find ${packageName}. Please reinstall @mobilenext/mobilecli.`);
61
+ process.exit(1);
62
+ }
49
63
 
50
64
  const args = process.argv.slice(2);
51
65
  const child = spawn(binaryPath, args, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobilecli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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": {
@@ -10,5 +10,13 @@
10
10
  "license": "MIT",
11
11
  "bin": {
12
12
  "mobilecli": "index.js"
13
+ },
14
+ "optionalDependencies": {
15
+ "@mobilenext/mobilecli-darwin-amd64": "1.0.7",
16
+ "@mobilenext/mobilecli-darwin-arm64": "1.0.7",
17
+ "@mobilenext/mobilecli-linux-amd64": "1.0.7",
18
+ "@mobilenext/mobilecli-linux-arm64": "1.0.7",
19
+ "@mobilenext/mobilecli-windows-amd64": "1.0.7",
20
+ "@mobilenext/mobilecli-windows-arm64": "1.0.7"
13
21
  }
14
22
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file