mobitru-mobile-cli 1.0.0-beta.0 → 1.0.0-beta.1
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/CHANGELOG.md +1 -0
- package/README.md +17 -6
- package/mobitru-mobile-cli.js +33 -31
- package/package.json +1 -1
- package/skills/SKILL.md +38 -0
- package/skills/references/mobile-sessions.md +66 -13
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -116,6 +116,44 @@ Snapshot refs are session-type-specific (native AX tree ≠ web DOM tree).
|
|
|
116
116
|
Re-snapshot after switching. Recording and logs survive a switch unchanged —
|
|
117
117
|
the cloud captures the device's screen regardless of which session is active.
|
|
118
118
|
|
|
119
|
+
## Parallel sessions
|
|
120
|
+
|
|
121
|
+
Drive multiple devices in parallel by naming each session with `-s/--session`
|
|
122
|
+
(or `MOBITRU_CLI_SESSION` env). Each session has its own daemon and its own
|
|
123
|
+
active booking; commands sent to different sessions don't interfere.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Terminal 1
|
|
127
|
+
mobitru-mobile-cli -s android device-use <serial-a>
|
|
128
|
+
mobitru-mobile-cli -s android snapshot
|
|
129
|
+
|
|
130
|
+
# Terminal 2 — runs in parallel
|
|
131
|
+
mobitru-mobile-cli -s ios device-use <serial-b>
|
|
132
|
+
mobitru-mobile-cli -s ios snapshot
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Set a per-shell default and skip the flag; `-s` still overrides the env for
|
|
136
|
+
a single invocation:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
export MOBITRU_CLI_SESSION=android
|
|
140
|
+
mobitru-mobile-cli device-use <serial-a> # uses session "android"
|
|
141
|
+
mobitru-mobile-cli -s ios device-use <serial-b> # one-off override
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Management:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
mobitru-mobile-cli session-list # what's running, on what device
|
|
148
|
+
mobitru-mobile-cli session-current # which session the next command resolves to
|
|
149
|
+
mobitru-mobile-cli stop # stop the current session (releases its device + cleans up)
|
|
150
|
+
mobitru-mobile-cli stop --all # stop every session
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Without `-s` or the env, commands go to the implicit `default` session —
|
|
154
|
+
fully backward-compatible. See [references/mobile-sessions.md](references/mobile-sessions.md)
|
|
155
|
+
for details.
|
|
156
|
+
|
|
119
157
|
### Observation
|
|
120
158
|
|
|
121
159
|
```bash
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Mobitru Mobile Sessions
|
|
2
2
|
|
|
3
|
-
This CLI leases
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
This CLI leases real devices from Mobitru cloud — one per session, with
|
|
4
|
+
multiple sessions running in parallel if you need to drive several devices
|
|
5
|
+
at once. Every command runs against a remote phone or tablet — there is no
|
|
6
|
+
local emulator. Session state (active booking, Appium session) persists
|
|
7
|
+
across short-lived CLI invocations until you `stop` or `device-release`.
|
|
7
8
|
|
|
8
9
|
## Booking lifecycle
|
|
9
10
|
|
|
@@ -27,10 +28,10 @@ mobitru-mobile-cli device-release
|
|
|
27
28
|
`device-use` is the entry point. Without an active booking, interaction
|
|
28
29
|
commands fail with `no active device — run device-use first`.
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## One device per session
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
A session holds **one active booking at a time**. Trying to book a different
|
|
34
|
+
device in the same session without releasing the current one fails:
|
|
34
35
|
|
|
35
36
|
```
|
|
36
37
|
device "<serial>" is currently in use. Run device-release first, then device-use <new-serial>.
|
|
@@ -40,6 +41,43 @@ This is deliberate. Refs from `snapshot` describe screen coordinates on the
|
|
|
40
41
|
booked device; if the booking silently switched, `tap e3` would land on a
|
|
41
42
|
different phone. Releasing first makes the switch explicit.
|
|
42
43
|
|
|
44
|
+
## Parallel sessions
|
|
45
|
+
|
|
46
|
+
To drive multiple devices simultaneously, name each session with
|
|
47
|
+
`-s/--session`. Each session has its own daemon under
|
|
48
|
+
`~/.mobitru-cli/mobile/sessions/<name>/` and its own active booking; commands
|
|
49
|
+
target the right session by name.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Terminal 1
|
|
53
|
+
mobitru-mobile-cli -s android device-use <serial-a>
|
|
54
|
+
mobitru-mobile-cli -s android snapshot
|
|
55
|
+
|
|
56
|
+
# Terminal 2 — runs in parallel
|
|
57
|
+
mobitru-mobile-cli -s ios device-use <serial-b>
|
|
58
|
+
mobitru-mobile-cli -s ios snapshot
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Set `MOBITRU_CLI_SESSION` as a per-shell default to skip the flag on every
|
|
62
|
+
command; `-s` still overrides the env for a single invocation. Without
|
|
63
|
+
either, commands resolve to the `default` session.
|
|
64
|
+
|
|
65
|
+
Session names match `[a-zA-Z0-9_-]+`, max 32 chars. The `-s` flag goes
|
|
66
|
+
**before** the subcommand (Commander convention):
|
|
67
|
+
`mobitru-mobile-cli -s ios device-use SERIAL`.
|
|
68
|
+
|
|
69
|
+
### Managing sessions
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
mobitru-mobile-cli session-list # all sessions on this machine + their state
|
|
73
|
+
mobitru-mobile-cli session-current # the session this shell resolves to
|
|
74
|
+
mobitru-mobile-cli stop # stop the current session: release device + clean up
|
|
75
|
+
mobitru-mobile-cli stop --all # stop every session: release every device
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`session-list` flags directories whose daemon is dead/absent as `stale`.
|
|
79
|
+
A subsequent `stop` (with the right `-s` selector) cleans them up.
|
|
80
|
+
|
|
43
81
|
## Cleanup window
|
|
44
82
|
|
|
45
83
|
After `device-release`, the cloud puts the device through a cleanup phase —
|
|
@@ -88,6 +126,18 @@ Edit `~/.mobitru-cli/config.json` directly:
|
|
|
88
126
|
}
|
|
89
127
|
```
|
|
90
128
|
|
|
129
|
+
### Or via `config --set`
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
mobitru-mobile-cli config --set baseUrl=app.mobitru.com
|
|
133
|
+
mobitru-mobile-cli config --set apiKey=mobitru_ak_...
|
|
134
|
+
mobitru-mobile-cli config --set slug=your-workspace-slug
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Repeatable; writes atomically to `~/.mobitru-cli/config.json` with mode
|
|
138
|
+
`0600`. Allowed keys: `baseUrl`, `browserHubBaseUrl`, `apiKey`, `slug`,
|
|
139
|
+
`wid`.
|
|
140
|
+
|
|
91
141
|
### Inspect the merged view
|
|
92
142
|
|
|
93
143
|
```bash
|
|
@@ -99,8 +149,8 @@ API key redacted) so you can verify what the next `device-use` will use.
|
|
|
99
149
|
|
|
100
150
|
## Sequential calls only
|
|
101
151
|
|
|
102
|
-
|
|
103
|
-
with:
|
|
152
|
+
Within a session, commands are serialized — only one runs at a time.
|
|
153
|
+
Parallel calls to the same session fail-fast with:
|
|
104
154
|
|
|
105
155
|
```
|
|
106
156
|
another command is in flight; CLI calls must be sequential
|
|
@@ -113,13 +163,16 @@ single device session anyway.
|
|
|
113
163
|
## Cleanup
|
|
114
164
|
|
|
115
165
|
```bash
|
|
116
|
-
# Release the current device
|
|
166
|
+
# Release the current device but keep the daemon alive
|
|
117
167
|
mobitru-mobile-cli device-release
|
|
118
168
|
|
|
119
|
-
#
|
|
169
|
+
# Stop the current session: release device + shut down daemon + remove session dir
|
|
120
170
|
mobitru-mobile-cli stop
|
|
171
|
+
|
|
172
|
+
# Stop every session at once (e.g. end of a CI job)
|
|
173
|
+
mobitru-mobile-cli stop --all
|
|
121
174
|
```
|
|
122
175
|
|
|
123
176
|
> ⚠️ **Always release when done.** A leaked booking holds the device until
|
|
124
|
-
> the lease expires (default 180 minutes). `stop`
|
|
125
|
-
> workflow is the safe default.
|
|
177
|
+
> the lease expires (default 180 minutes). `stop` (or `stop --all`) at the
|
|
178
|
+
> end of any workflow is the safe default.
|