mobitru-mobile-cli 1.0.0-beta.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.
@@ -0,0 +1,125 @@
1
+ # Mobitru Mobile Sessions
2
+
3
+ This CLI leases **one real device at a time** from Mobitru cloud. Every
4
+ command runs against a remote phone or tablet — there is no local emulator.
5
+ Session state (active booking, Appium session) persists across short-lived
6
+ CLI invocations until you `stop` or `device-release`.
7
+
8
+ ## Booking lifecycle
9
+
10
+ ```bash
11
+ # Find devices available now for a platform
12
+ mobitru-mobile-cli device-list android
13
+ mobitru-mobile-cli device-list ios
14
+
15
+ # Book a specific device by its serial (default lease: 180 minutes)
16
+ mobitru-mobile-cli device-use <serial>
17
+ mobitru-mobile-cli device-use <serial> --duration=30
18
+
19
+ # Any number of interaction commands here…
20
+ mobitru-mobile-cli snapshot
21
+ mobitru-mobile-cli tap e3
22
+
23
+ # Release the device — frees the cloud slot
24
+ mobitru-mobile-cli device-release
25
+ ```
26
+
27
+ `device-use` is the entry point. Without an active booking, interaction
28
+ commands fail with `no active device — run device-use first`.
29
+
30
+ ## Single-device model
31
+
32
+ The CLI holds exactly **one active booking at a time**. Trying to book a
33
+ different device without releasing the current one fails:
34
+
35
+ ```
36
+ device "<serial>" is currently in use. Run device-release first, then device-use <new-serial>.
37
+ ```
38
+
39
+ This is deliberate. Refs from `snapshot` describe screen coordinates on the
40
+ booked device; if the booking silently switched, `tap e3` would land on a
41
+ different phone. Releasing first makes the switch explicit.
42
+
43
+ ## Cleanup window
44
+
45
+ After `device-release`, the cloud puts the device through a cleanup phase —
46
+ typically **30 to 60 seconds** during which the same serial returns
47
+ `Failed to take device: 404` on `device-use`. Two options:
48
+
49
+ - Wait, then retry the same serial.
50
+ - Pick a different serial from `device-list` and book that one.
51
+
52
+ The CLI is not stuck — the cloud is. Other devices remain bookable
53
+ throughout.
54
+
55
+ ## Device locale
56
+
57
+ Mobitru routes devices across regional data centers (e.g. EU, CIS). The
58
+ device's locale follows the DC, so geolocated services may serve UI in the
59
+ local language — a EU device commonly hits **Hungarian** Google consent
60
+ dialogs, **German** Play Store strings, etc. Identify elements by
61
+ accessibility label and rect from `snapshot` rather than expecting English
62
+ text. The labels are still localized, but their structure (button vs link,
63
+ EditText vs TextView) and position remain stable.
64
+
65
+ ## Credentials
66
+
67
+ Credentials are read from `~/.mobitru-cli/config.json` first, then
68
+ overridden by environment variables (env vars win). Three values are
69
+ required for mobile: `baseUrl`, `apiKey`, `slug`.
70
+
71
+ ### Via environment variables
72
+
73
+ ```bash
74
+ export DEVICE_FARM_BASE_URL=app.mobitru.com
75
+ export DEVICE_FARM_API_KEY=mobitru_ak_...
76
+ export DEVICE_FARM_SLUG=your-workspace-slug
77
+ ```
78
+
79
+ ### Or via the config file
80
+
81
+ Edit `~/.mobitru-cli/config.json` directly:
82
+
83
+ ```json
84
+ {
85
+ "baseUrl": "app.mobitru.com",
86
+ "apiKey": "mobitru_ak_...",
87
+ "slug": "your-workspace-slug"
88
+ }
89
+ ```
90
+
91
+ ### Inspect the merged view
92
+
93
+ ```bash
94
+ mobitru-mobile-cli config
95
+ ```
96
+
97
+ Prints the resolved credentials (config file plus env overrides, with the
98
+ API key redacted) so you can verify what the next `device-use` will use.
99
+
100
+ ## Sequential calls only
101
+
102
+ Commands are serialized — only one runs at a time. Parallel calls fail-fast
103
+ with:
104
+
105
+ ```
106
+ another command is in flight; CLI calls must be sequential
107
+ ```
108
+
109
+ Serialize from the caller side. The cloud Appium server takes hundreds of
110
+ milliseconds per command and is not designed for concurrent traffic from a
111
+ single device session anyway.
112
+
113
+ ## Cleanup
114
+
115
+ ```bash
116
+ # Release the current device (graceful)
117
+ mobitru-mobile-cli device-release
118
+
119
+ # Reset session state (releases the device first if held)
120
+ mobitru-mobile-cli stop
121
+ ```
122
+
123
+ > ⚠️ **Always release when done.** A leaked booking holds the device until
124
+ > the lease expires (default 180 minutes). `stop` at the end of any
125
+ > workflow is the safe default.