@autifyhq/aximo-cli 0.5.0 → 0.6.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.
Files changed (36) hide show
  1. package/README.md +181 -64
  2. package/dist/cli.js +4 -0
  3. package/dist/client.d.ts +2 -0
  4. package/dist/client.js +18 -0
  5. package/dist/commands/mobile/connect-core.js +27 -13
  6. package/dist/commands/mobile/doctor.js +22 -3
  7. package/dist/commands/mobile/index.js +1 -0
  8. package/dist/commands/mobile/install.d.ts +43 -0
  9. package/dist/commands/mobile/install.js +76 -0
  10. package/dist/commands/mobile/install.test.d.ts +1 -0
  11. package/dist/commands/mobile/install.test.js +104 -0
  12. package/dist/commands/mobile/register.d.ts +6 -1
  13. package/dist/commands/mobile/register.js +12 -6
  14. package/dist/commands/mobile/register.test.js +34 -3
  15. package/dist/commands/schema.js +15 -8
  16. package/dist/mobile-control/app-install.d.ts +21 -0
  17. package/dist/mobile-control/app-install.js +28 -0
  18. package/dist/mobile-control/app-install.test.d.ts +1 -0
  19. package/dist/mobile-control/app-install.test.js +78 -0
  20. package/dist/mobile-control/appium-controller.d.ts +3 -0
  21. package/dist/mobile-control/appium-controller.js +5 -0
  22. package/dist/mobile-control/devices.d.ts +3 -1
  23. package/dist/mobile-control/devices.js +33 -3
  24. package/dist/mobile-control/devices.test.js +41 -1
  25. package/dist/mobile-control/ios-signing.d.ts +28 -0
  26. package/dist/mobile-control/ios-signing.js +38 -0
  27. package/dist/mobile-control/ios-signing.test.d.ts +1 -0
  28. package/dist/mobile-control/ios-signing.test.js +73 -0
  29. package/dist/mobile-control/tunnel.d.ts +5 -1
  30. package/dist/mobile-control/tunnel.js +15 -2
  31. package/dist/mobile-control/tunnel.test.js +1 -1
  32. package/dist/proxy.d.ts +11 -0
  33. package/dist/proxy.js +85 -0
  34. package/dist/proxy.test.d.ts +1 -0
  35. package/dist/proxy.test.js +72 -0
  36. package/package.json +3 -2
package/README.md CHANGED
@@ -64,46 +64,47 @@ Credentials and device registrations are **per-environment** — to switch betwe
64
64
 
65
65
  Run `aximo <command> --help` for detailed usage. `aximo schema [command.path]` returns machine-readable argument introspection (e.g. `aximo schema session.create`).
66
66
 
67
- | Command | Description |
68
- | ---------------------------- | ------------------------------------------------------ |
69
- | `aximo configure` | Save credentials to `$AXIMO_HOME/config.json` |
70
- | `aximo health check` | Check API reachability |
71
- | `aximo project list` | List organization projects |
72
- | `aximo session create` | Create and queue a test session |
73
- | `aximo session get` | Get session status |
74
- | `aximo session save-as-case` | Save a finished session as a reusable test case |
75
- | `aximo case create` | Create a test case |
76
- | `aximo case delete` | Delete a test case |
77
- | `aximo plan create` | Create a test plan |
78
- | `aximo plan add-case` | Add a case to a plan |
79
- | `aximo plan remove-case` | Remove a case from a plan |
80
- | `aximo trigger case run` | Trigger a dashboard-created test case |
81
- | `aximo trigger case get` | Get triggered case status |
82
- | `aximo trigger plan run` | Trigger a test plan |
83
- | `aximo trigger plan get` | Get plan run status |
84
- | `aximo upload create` | Create an upload slot for an APK/IPA |
85
- | `aximo upload list` | List previously uploaded apps |
86
- | `aximo upload get` | Poll upload processing status |
87
- | `aximo upload put` | Upload binary file to the slot |
88
- | `aximo upload submit` | Finalize upload and trigger processing |
89
- | `aximo device list` | List mobile devices from Device Farm |
90
- | `aximo device setup` | First-time BYOD onboarding (API + Python + register) |
91
- | `aximo device register` | Register this machine as a BYOD device |
92
- | `aximo device connect` | Start the BYOD agent and connect to the relay |
93
- | `aximo device status` | List your organization's BYOD devices |
94
- | `aximo device ping` | Check your BYOD device's server-side status |
95
- | `aximo device doctor` | Diagnose BYOD setup (env, Python, relay, status) |
96
- | `aximo device logs` | Show the BYOD agent log |
97
- | `aximo device unregister` | Remove a BYOD device server-side + clear local creds |
98
- | `aximo device reset` | Remove BYOD local state (Python, deps, credentials) |
99
- | `aximo mobile list` | List physically-connected phones (Android via adb) |
100
- | `aximo mobile setup` | Install the Appium drivers used to drive phones |
101
- | `aximo mobile doctor` | Diagnose Appium prerequisites (adb, SDK, driver) |
102
- | `aximo mobile register` | Register a connected Android phone as an Aximo device |
103
- | `aximo mobile connect` | Start managed Appium + open the tunnel for the phone |
104
- | `aximo mobile unregister` | Remove a local mobile device server-side + local creds |
105
- | `aximo schema` | Show CLI surface as JSON |
106
- | `aximo mcp` | Run a stdio MCP server for agents (see below) |
67
+ | Command | Description |
68
+ | ---------------------------- | ------------------------------------------------------- |
69
+ | `aximo configure` | Save credentials to `$AXIMO_HOME/config.json` |
70
+ | `aximo health check` | Check API reachability |
71
+ | `aximo project list` | List organization projects |
72
+ | `aximo session create` | Create and queue a test session |
73
+ | `aximo session get` | Get session status |
74
+ | `aximo session save-as-case` | Save a finished session as a reusable test case |
75
+ | `aximo case create` | Create a test case |
76
+ | `aximo case delete` | Delete a test case |
77
+ | `aximo plan create` | Create a test plan |
78
+ | `aximo plan add-case` | Add a case to a plan |
79
+ | `aximo plan remove-case` | Remove a case from a plan |
80
+ | `aximo trigger case run` | Trigger a dashboard-created test case |
81
+ | `aximo trigger case get` | Get triggered case status |
82
+ | `aximo trigger plan run` | Trigger a test plan |
83
+ | `aximo trigger plan get` | Get plan run status |
84
+ | `aximo upload create` | Create an upload slot for an APK/IPA |
85
+ | `aximo upload list` | List previously uploaded apps |
86
+ | `aximo upload get` | Poll upload processing status |
87
+ | `aximo upload put` | Upload binary file to the slot |
88
+ | `aximo upload submit` | Finalize upload and trigger processing |
89
+ | `aximo device list` | List mobile devices from Device Farm |
90
+ | `aximo device setup` | First-time BYOD onboarding (API + Python + register) |
91
+ | `aximo device register` | Register this machine as a BYOD device |
92
+ | `aximo device connect` | Start the BYOD agent and connect to the relay |
93
+ | `aximo device status` | List your organization's BYOD devices |
94
+ | `aximo device ping` | Check your BYOD device's server-side status |
95
+ | `aximo device doctor` | Diagnose BYOD setup (env, Python, relay, status) |
96
+ | `aximo device logs` | Show the BYOD agent log |
97
+ | `aximo device unregister` | Remove a BYOD device server-side + clear local creds |
98
+ | `aximo device reset` | Remove BYOD local state (Python, deps, credentials) |
99
+ | `aximo mobile list` | List physically-connected phones (Android adb, iOS idb) |
100
+ | `aximo mobile setup` | Install the Appium drivers used to drive phones |
101
+ | `aximo mobile doctor` | Diagnose prerequisites (adb/idb, SDK/Xcode, driver) |
102
+ | `aximo mobile register` | Register a connected Android phone or iPhone |
103
+ | `aximo mobile install` | Install an app (.apk via adb, .ipa via idb) |
104
+ | `aximo mobile connect` | Start managed Appium + open the tunnel for the phone |
105
+ | `aximo mobile unregister` | Remove a local mobile device server-side + local creds |
106
+ | `aximo schema` | Show CLI surface as JSON |
107
+ | `aximo mcp` | Run a stdio MCP server for agents (see below) |
107
108
 
108
109
  Mutating commands support `--json '<raw body>'` for direct OpenAPI payloads and `--dry-run` to preview requests without executing.
109
110
 
@@ -355,16 +356,22 @@ Normal for brief network blips — the agent retries with exponential backoff (1
355
356
  - Confirm outbound WebSocket on 443 isn't blocked: `aximo device doctor` runs a handshake probe.
356
357
 
357
358
  **Python download or pip install fails (corporate proxy).**
358
- The embedded Python is fetched from `github.com/astral-sh/python-build-standalone/releases`; packages come from PyPI. Behind a proxy:
359
+ The embedded Python is fetched from `github.com/astral-sh/python-build-standalone/releases` and packages come from PyPI, so `aximo device setup` needs outbound access to both. On a network that only reaches the internet through a proxy, set the standard proxy variables — the CLI, pip, and the desktop agent all honor them:
359
360
 
360
361
  ```bash
361
362
  # macOS / Linux
362
- ~/.aximo/python/bin/python3 -m pip config set global.proxy http://your-proxy:port
363
+ export HTTPS_PROXY=http://your-proxy:port
364
+ export HTTP_PROXY=http://your-proxy:port
363
365
 
364
- # Windows
365
- %USERPROFILE%\.aximo\python\python.exe -m pip config set global.proxy http://your-proxy:port
366
+ # Windows (PowerShell)
367
+ $env:HTTPS_PROXY = "http://your-proxy:port"
368
+ $env:HTTP_PROXY = "http://your-proxy:port"
366
369
  ```
367
370
 
371
+ Loopback and a private-range `AXIMO_BASE_URL` (e.g. an on-prem `172.30.x.x` server) are always reached directly, so you don't have to list them in `NO_PROXY`. If your proxy performs TLS interception, also point `NODE_EXTRA_CA_CERTS` at the proxy's CA so the download's certificate verifies.
372
+
373
+ If the proxy cannot reach GitHub at all, ask your network team to allow-list both `github.com` and its release-asset CDN `release-assets.githubusercontent.com` — the download redirects from the former to the latter, so allow-listing only `github.com` is not enough.
374
+
368
375
  To retry from a clean slate: `aximo device reset --python && aximo device setup`.
369
376
 
370
377
  **Device shows online, but tests fail on screenshot / click.**
@@ -394,11 +401,11 @@ Default `$AXIMO_HOME` is `~/.aximo` on macOS/Linux, `%USERPROFILE%\.aximo` on Wi
394
401
 
395
402
  > Devices are registered per-environment (see [Configuration](#configuration)) — a device registered against sandbox can't connect to production and vice versa.
396
403
 
397
- ## Mobile (local Android phone)
404
+ ## Mobile (local Android phone or iPhone)
398
405
 
399
- The `mobile` commands let you register a **physically-connected Android phone** as an Aximo device and drive it locally, over the same gateway tunnel as desktop BYOD. Aximo's agent controls the phone through a CLI-managed [Appium](https://appium.io) (UiAutomator2) server — useful for running mobile tests against your own handset instead of a Device Farm device.
406
+ The `mobile` commands let you register a **physically-connected Android phone or iPhone** as an Aximo device and drive it locally, over the same gateway tunnel as desktop BYOD. Aximo's agent controls the phone through a CLI-managed [Appium](https://appium.io) server — UiAutomator2 for Android, XCUITest for iOS — useful for running mobile tests against your own handset instead of a Device Farm device.
400
407
 
401
- > **Android only today.** iOS local devices are not yet supported — `aximo mobile register --platform ios` is blocked, and registration accepts only `--platform android`. (The Appium XCUITest plumbing is partially present but disabled; iOS local devices are planned for a future release.)
408
+ > **iOS is macOS-only and needs Xcode + an Apple Developer account.** Driving a physical iPhone goes through Appium's XCUITest driver, which builds and code-signs a WebDriverAgent (WDA) runner onto the device. That requires macOS, Xcode, an Apple Developer **Team ID**, and a WDA bundle id backed by a valid provisioning profile — set via the `AXIMO_IOS_*` env vars below. Android has no such requirement, so iOS setup is heavier; everything after setup (`register` → `connect` → run) works the same on both platforms.
402
409
 
403
410
  Terminology note: **`aximo mobile list`** shows phones plugged into _this_ machine; **`aximo device list`** (under [Device / BYOD](#device-byod--bring-your-own-device)) returns mobile devices from AWS Device Farm. Don't confuse the two.
404
411
 
@@ -406,34 +413,143 @@ Terminology note: **`aximo mobile list`** shows phones plugged into _this_ machi
406
413
 
407
414
  - **Node.js 20+**, plus `aximo-cli` installed globally (see [Install](#install)).
408
415
  - **An Aximo API key**, configured via `aximo configure` or env vars.
409
- - **A USB-connected Android phone** with **USB debugging** enabled in Developer Options, plugged in, and authorized (accept the "Allow USB debugging?" prompt on the phone).
410
- - **adb** (Android platform-tools) on your `PATH` — Appium delegates to it. Install via `brew install --cask android-platform-tools` (macOS), your distro's `adb` package (Linux), or the Android Studio SDK Manager (Windows).
411
- - **The Android SDK**, with `ANDROID_HOME` (or `ANDROID_SDK_ROOT`) set — e.g. installed via Android Studio. Appium's UiAutomator2 driver requires it even though adb is already on PATH.
416
+ - **A USB-connected phone**:
417
+ - **Android** — **USB debugging** enabled and authorized — see [Enable USB debugging on the phone](#enable-usb-debugging-on-the-phone).
418
+ - **iOS** — **Developer Mode** enabled (Settings → Privacy & Security) and the computer trusted.
419
+ - **On the machine that runs `aximo mobile connect`**:
420
+ - **Android** — `adb` and the Android SDK, with `ANDROID_HOME` set — see [Set up your computer (Android)](#set-up-your-computer-android).
421
+ - **iOS** — macOS with **Xcode** + command line tools, **`idb`**, and the `AXIMO_IOS_*` signing env vars — see [Set up your computer (iOS)](#set-up-your-computer-ios).
422
+
423
+ > The Appium server is bundled with the CLI; `aximo mobile setup` installs the UiAutomator2 (Android) and/or XCUITest (iOS) driver — you don't install or manage Appium yourself.
424
+
425
+ ### Set up your computer (Android)
426
+
427
+ You only need **`adb`** and the **Android SDK** on the machine running `aximo mobile connect`. Appium delegates to `adb`, and its UiAutomator2 driver needs the SDK (even though `adb` is already on `PATH`).
428
+
429
+ **macOS**
430
+
431
+ ```bash
432
+ # Option A — standalone platform-tools (just adb):
433
+ brew install --cask android-platform-tools
434
+ # Option B — full Android Studio (also installs the SDK):
435
+ brew install --cask android-studio
436
+
437
+ # Point ANDROID_HOME at the SDK (Android Studio's default location shown):
438
+ echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zshrc
439
+ echo 'export PATH="$PATH:$ANDROID_HOME/platform-tools"' >> ~/.zshrc
440
+ source ~/.zshrc
441
+ ```
442
+
443
+ **Linux**
444
+
445
+ ```bash
446
+ # Debian/Ubuntu — adb from the distro (or download platform-tools from Google):
447
+ sudo apt-get install -y android-tools-adb
448
+ # Install the SDK via Android Studio or sdkmanager, then export its path:
449
+ echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
450
+ echo 'export PATH="$PATH:$ANDROID_HOME/platform-tools"' >> ~/.bashrc
451
+ source ~/.bashrc
452
+ ```
453
+
454
+ **Windows**
455
+
456
+ - Install **Android Studio** (bundles the SDK + platform-tools), or download the standalone **SDK Platform-Tools** zip from Google.
457
+ - Set `ANDROID_HOME` to the SDK path (e.g. `%LOCALAPPDATA%\Android\Sdk`) and add `%ANDROID_HOME%\platform-tools` to `PATH` via _System Properties → Environment Variables_.
458
+
459
+ > `aximo mobile doctor` auto-detects the SDK at the standard locations above, so `ANDROID_HOME` is optional when you use the defaults — but setting it explicitly is the most reliable. Confirm `adb` works with `adb version`.
460
+
461
+ ### Set up your computer (iOS)
462
+
463
+ iOS local devices are **macOS-only** (Appium's XCUITest driver delegates to Xcode). You need Xcode, `idb`, and the signing env vars.
464
+
465
+ ```bash
466
+ # 1. Xcode + command line tools (XCUITest builds WebDriverAgent with them):
467
+ xcode-select --install # or install Xcode from the App Store, then: sudo xcodebuild -license accept
412
468
 
413
- > The Appium server is bundled with the CLI, and the UiAutomator2 driver is installed by `aximo mobile setup` — you don't manage Appium yourself.
469
+ # 2. idb — discovers connected iPhones and installs .ipa builds:
470
+ brew tap facebook/fb && brew install idb-companion
471
+ pipx install fb-idb # or: pip install fb-idb
472
+
473
+ # 3. Signing config for WebDriverAgent (required for a physical iPhone):
474
+ export AXIMO_IOS_TEAM_ID="ABCDE12345" # your Apple Developer Team ID (developer.apple.com/account → Membership)
475
+ # Optional overrides (sensible defaults shown):
476
+ export AXIMO_IOS_SIGNING_ID="Apple Development"
477
+ export AXIMO_IOS_WDA_BUNDLE_ID="com.facebook.WebDriverAgentRunner"
478
+ # Optional: reuse a prebuilt WDA to skip per-session rebuilds:
479
+ # export AXIMO_IOS_DERIVED_DATA_PATH="$HOME/Library/Developer/Xcode/DerivedData/WebDriverAgent-xxxx"
480
+ ```
481
+
482
+ `AXIMO_IOS_TEAM_ID` is the load-bearing setting: the XCUITest driver uses it (with the signing id and WDA bundle id) to build and sign WebDriverAgent so it can run on the device. The WDA bundle id must be associated with a valid provisioning profile under that team. Run `aximo mobile doctor --platform ios` to confirm Xcode, `idb`, and the signing config are all present.
483
+
484
+ > Already set up Autify's MobileLink? The CLI also reads MobileLink's names as fallbacks — `XCODE_TEAM_ID`, `XCODE_SIGN_ID`, `WDA_BUNDLE_ID` — so an existing host needs no reconfiguration. `AXIMO_IOS_*` takes precedence when both are set.
485
+
486
+ > First connect to a physical iPhone is slow: Xcode builds and installs WebDriverAgent (a minute or two). If the build fails on signing, open `WebDriverAgent.xcodeproj` in Xcode once, pick your team, and let it auto-manage signing — or set `AXIMO_IOS_DERIVED_DATA_PATH` to a prebuilt WDA.
487
+
488
+ ### Enable USB debugging on the phone
489
+
490
+ Exact labels vary by manufacturer and Android version, but the flow is:
491
+
492
+ 1. **Unlock Developer options** — open **Settings → About phone** and tap **Build number** seven times until you see "You are now a developer".
493
+ 2. **Turn on USB debugging** — open **Settings → System → Developer options** and enable **USB debugging**.
494
+ 3. **Connect and authorize** — plug the phone into your computer with a **data-capable** USB cable, then tap **Allow** on the "Allow USB debugging?" prompt on the phone (tick "Always allow from this computer" to skip it next time).
495
+ 4. **Verify the computer sees it**:
496
+ ```bash
497
+ adb devices # or: aximo mobile list
498
+ ```
499
+ The phone should appear in state **`device`**. **`unauthorized`** → re-accept the prompt on the phone; **`offline`** → re-plug the cable and unlock the screen. Emulators are not supported — connect a physical phone.
500
+
501
+ > Keep the phone **unlocked** the first time you run a session: the initial command installs Appium's UiAutomator2 helper and creates the automation session on the device.
414
502
 
415
503
  ### First-time setup
416
504
 
417
505
  ```bash
418
- aximo mobile setup # installs the UiAutomator2 Appium driver
419
- aximo mobile doctor # checks adb / Android SDK / driver / bundled server
506
+ aximo mobile setup # installs the Appium driver(s) for your platform(s)
507
+ aximo mobile doctor # checks tooling / drivers / bundled server
508
+ # Limit to one platform if you only test on one:
509
+ aximo mobile setup --platform ios # installs only the XCUITest driver
510
+ aximo mobile doctor --platform ios # checks Xcode / idb / signing config
420
511
  ```
421
512
 
422
- `setup` installs the Appium driver, then prints what (if anything) is still missing. `doctor` is the first thing to run when anything's off — it reports the bundled Appium server, the UiAutomator2 driver, `adb`, and the Android SDK in one shot, and exits non-zero if a required check fails.
513
+ `setup` installs the Appium driver(s) — UiAutomator2 for Android, XCUITest for iOS — then prints what (if anything) is still missing. `doctor` is the first thing to run when anything's off: for Android it reports `adb` and the Android SDK; for iOS it reports `xcrun`/Xcode, `idb`, and your `AXIMO_IOS_TEAM_ID` signing config — alongside the bundled Appium server and driver — and exits non-zero if a required check fails.
423
514
 
424
515
  ### Registering and connecting
425
516
 
426
517
  ```bash
427
- aximo mobile list # see connected phones + their adb serials
518
+ aximo mobile list # see connected phones (adb serials / iOS udids)
519
+
520
+ # Android:
428
521
  aximo mobile register --name "My Pixel" --platform android # --platform defaults to android
522
+ # iOS:
523
+ aximo mobile register --name "My iPhone" --platform ios # targets the single connected iPhone
524
+
429
525
  aximo mobile connect # starts managed Appium + opens the tunnel
430
526
  # Ctrl+C to disconnect
431
527
  ```
432
528
 
433
- `register` writes credentials to `$AXIMO_HOME/mobile-devices/<deviceId>.json` (mode `0600`). It targets the single connected phone by default — pass `--serial` to pick a specific one when several are attached. `connect` re-checks prerequisites, starts the managed Appium server, and opens the tunnel; it runs until Ctrl+C. If you have more than one registered phone, pass `--device-id` to choose which to connect.
529
+ `register` writes credentials to `$AXIMO_HOME/mobile-devices/<deviceId>.json` (mode `0600`). It targets the single connected phone by default — pass `--serial` (Android) or `--udid` (iOS) to pick a specific one when several are attached. `connect` re-checks prerequisites, starts the managed Appium server, and opens the tunnel; it runs until Ctrl+C. If you have more than one registered phone, pass `--device-id` to choose which to connect.
434
530
 
435
531
  Once connected, create a **mobile session in Aximo targeting this local device** — the agent routes its actions through the tunnel to the phone over Appium.
436
532
 
533
+ ### Testing your own app
534
+
535
+ Unlike Device Farm, a local phone runs the apps already installed on it. To test your own build, install it first:
536
+
537
+ ```bash
538
+ aximo mobile install --app ./app-debug.apk # Android: adb install -r
539
+ aximo mobile install --app ./MyApp.ipa # iOS: idb install (the .ipa must be signed for the device)
540
+ ```
541
+
542
+ Then create the session with the app's bundle id / package name as `--bundle-id` — the agent launches it on startup before the test begins:
543
+
544
+ ```bash
545
+ # Android:
546
+ aximo session create --platform ANDROID --user-device-id DEVICE_ID --bundle-id com.example.app \
547
+ --project-id PROJECT_ID --title "Smoke" --prompt "Sign in and open settings"
548
+ # iOS:
549
+ aximo session create --platform IOS --user-device-id DEVICE_ID --bundle-id com.example.MyApp \
550
+ --project-id PROJECT_ID --title "Smoke" --prompt "Sign in and open settings"
551
+ ```
552
+
437
553
  ### Managing devices
438
554
 
439
555
  ```bash
@@ -443,14 +559,15 @@ aximo mobile unregister --device-id DEVICE_ID # target a specific device when se
443
559
 
444
560
  ### Flags reference
445
561
 
446
- | Command | Flags |
447
- | ------------------------- | ----------------------------------------------------------------------------------- |
448
- | `aximo mobile list` | _(none)_ |
449
- | `aximo mobile setup` | _(none)_ |
450
- | `aximo mobile doctor` | _(none)_ |
451
- | `aximo mobile register` | `--name <name>` (required), `--platform android` (default), `--serial <adb-serial>` |
452
- | `aximo mobile connect` | `--device-id <id>` (required only if multiple devices are registered) |
453
- | `aximo mobile unregister` | `--device-id <id>` (defaults to the locally registered device) |
562
+ | Command | Flags |
563
+ | ------------------------- | ---------------------------------------------------------------------------------------------------- |
564
+ | `aximo mobile list` | _(none)_ |
565
+ | `aximo mobile setup` | `--platform android \| ios` (optional; installs both drivers by default) |
566
+ | `aximo mobile doctor` | `--platform android \| ios` (optional; checks both by default) |
567
+ | `aximo mobile register` | `--name <name>` (required), `--platform android \| ios` (default android), `--serial`/`--udid` |
568
+ | `aximo mobile install` | `--app <path-to-.apk\|.ipa>` (required), `--platform android \| ios` (inferred), `--serial`/`--udid` |
569
+ | `aximo mobile connect` | `--device-id <id>` (required only if multiple devices are registered) |
570
+ | `aximo mobile unregister` | `--device-id <id>` (defaults to the locally registered device) |
454
571
 
455
572
  ## MCP server
456
573
 
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from "citty";
3
3
  import pkg from "../package.json" with { type: "json" };
4
+ import { installProxySupport } from "./proxy.js";
4
5
  // citty's --help prints to stdout; route to stderr for `mcp` since its stdout
5
6
  // is JSON-RPC.
6
7
  const args = process.argv.slice(2);
@@ -34,4 +35,7 @@ const main = defineCommand({
34
35
  mcp: () => import("./commands/mcp/index.js").then((m) => m.default),
35
36
  },
36
37
  });
38
+ // Honor HTTP_PROXY / HTTPS_PROXY / NO_PROXY for every fetch the CLI makes (the
39
+ // embedded-Python download, API calls). No-op unless a proxy is configured.
40
+ await installProxySupport();
37
41
  runMain(main);
package/dist/client.d.ts CHANGED
@@ -16,3 +16,5 @@ export interface ClientDeps {
16
16
  }
17
17
  export declare function request<T>(path: string, options?: RequestOptions, deps?: ClientDeps): Promise<T>;
18
18
  export declare function requestBuffer(path: string, deps?: ClientDeps): Promise<Buffer>;
19
+ /** Authenticated GET that streams the response body to a file (no full-buffering). */
20
+ export declare function requestToFile(path: string, destPath: string, deps?: ClientDeps): Promise<void>;
package/dist/client.js CHANGED
@@ -88,3 +88,21 @@ export async function requestBuffer(path, deps = {}) {
88
88
  }
89
89
  return Buffer.from(await res.arrayBuffer());
90
90
  }
91
+ /** Authenticated GET that streams the response body to a file (no full-buffering). */
92
+ export async function requestToFile(path, destPath, deps = {}) {
93
+ const apiKey = deps.apiKey ?? getApiKey();
94
+ const baseUrl = deps.baseUrl ?? getBaseUrl();
95
+ const fetchImpl = deps.fetchImpl ?? fetch;
96
+ const url = buildUrl(baseUrl, path);
97
+ const res = await fetchImpl(url, { method: "GET", headers: { "x-api-key": apiKey } });
98
+ if (!res.ok) {
99
+ const retryAfter = res.headers.get("retry-after") ?? undefined;
100
+ throw httpError(res.status, await errorMessage(res), retryAfter);
101
+ }
102
+ if (!res.body)
103
+ throw new Error(`Empty response body from ${path}`);
104
+ const { Readable } = await import("node:stream");
105
+ const { pipeline } = await import("node:stream/promises");
106
+ const { createWriteStream } = await import("node:fs");
107
+ await pipeline(Readable.fromWeb(res.body), createWriteStream(destPath));
108
+ }
@@ -1,7 +1,9 @@
1
1
  import { getBaseUrl } from "../../client.js";
2
2
  import { formatError } from "../../output.js";
3
3
  import { AppiumController } from "../../mobile-control/appium-controller.js";
4
+ import { installUploadedApp } from "../../mobile-control/app-install.js";
4
5
  import { startAppiumServer } from "../../mobile-control/appium-server.js";
6
+ import { resolveIosSigning } from "../../mobile-control/ios-signing.js";
5
7
  import { runControlTunnel } from "../../mobile-control/tunnel.js";
6
8
  import { runMobileDoctor } from "./doctor.js";
7
9
  import { listMobileDeviceConfigs, readMobileDeviceConfig, } from "./paths.js";
@@ -32,30 +34,35 @@ export function resolveDeviceConfig(deviceId) {
32
34
  return { ok: true, config: only };
33
35
  }
34
36
  export function buildController(config, endpoint) {
35
- return new AppiumController({ endpoint, platform: config.platform, target: config.target });
37
+ return new AppiumController({
38
+ endpoint,
39
+ platform: config.platform,
40
+ target: config.target,
41
+ ...(config.platform === "ios" ? { iosSigning: resolveIosSigning() } : {}),
42
+ });
36
43
  }
37
- // A blocking check is any hard failure, plus a missing UiAutomator2 driver
44
+ // A blocking check is any hard failure, plus a missing automation driver
38
45
  // (only a warning for `doctor`, but a hard prerequisite for connecting).
39
- function isBlockingCheck(check) {
46
+ function isBlockingCheck(check, driverName) {
40
47
  if (check.status === "fail")
41
48
  return true;
42
- return check.name === "uiautomator2 driver" && check.status === "warn";
49
+ return check.name === driverName && check.status === "warn";
43
50
  }
44
- async function assertAndroidPrerequisites() {
45
- const report = await runMobileDoctor({ platform: "android" });
51
+ async function assertPrerequisites(platform) {
52
+ const driverName = platform === "ios" ? "xcuitest driver" : "uiautomator2 driver";
53
+ const report = await runMobileDoctor({ platform });
46
54
  const checks = report.ok ? report.data.checks : [];
47
- const blockers = checks.filter(isBlockingCheck);
55
+ const blockers = checks.filter((c) => isBlockingCheck(c, driverName));
48
56
  if (blockers.length === 0)
49
57
  return;
50
58
  const lines = blockers.map((c) => ` - ${c.message}${c.hint ? `\n ${c.hint}` : ""}`);
51
- throw new Error(`Missing Appium prerequisites:\n${lines.join("\n")}\n` +
52
- "Run `aximo mobile setup` and/or fix the above, then re-run. " +
53
- "(`aximo mobile doctor` for details.)");
59
+ const setup = platform === "ios" ? "aximo mobile setup --platform ios" : "aximo mobile setup";
60
+ const doctor = platform === "ios" ? "aximo mobile doctor --platform ios" : "aximo mobile doctor";
61
+ throw new Error(`Missing ${platform} prerequisites:\n${lines.join("\n")}\n` +
62
+ `Run \`${setup}\` and/or fix the above, then re-run. (\`${doctor}\` for details.)`);
54
63
  }
55
64
  export async function connectWithConfig(config) {
56
- if (config.platform === "android") {
57
- await assertAndroidPrerequisites();
58
- }
65
+ await assertPrerequisites(config.platform);
59
66
  const useDrivers = config.platform === "ios" ? ["xcuitest"] : ["uiautomator2"];
60
67
  const server = await startAppiumServer({ useDrivers });
61
68
  const controller = buildController(config, server.endpoint);
@@ -65,6 +72,13 @@ export async function connectWithConfig(config) {
65
72
  deviceToken: config.deviceToken,
66
73
  deviceName: config.name,
67
74
  controller,
75
+ installApp: async ({ uploadId }) => {
76
+ await installUploadedApp({
77
+ uploadId,
78
+ platform: config.platform,
79
+ target: config.target,
80
+ });
81
+ },
68
82
  });
69
83
  }
70
84
  finally {
@@ -6,6 +6,7 @@ import { join } from "node:path";
6
6
  import { formatSuccess, printResult } from "../../output.js";
7
7
  import { importAppium } from "../../mobile-control/appium-import.js";
8
8
  import { getAppiumHome, resolveAndroidSdk } from "../../mobile-control/appium-server.js";
9
+ import { resolveIosSigning } from "../../mobile-control/ios-signing.js";
9
10
  function which(cmd) {
10
11
  const probe = platform() === "win32" ? "where" : "which";
11
12
  const result = spawnSync(probe, [cmd], { encoding: "utf-8" });
@@ -97,15 +98,33 @@ function checkIos() {
97
98
  ? { name: "xcrun", status: "pass", message: xcrun }
98
99
  : {
99
100
  name: "xcrun",
100
- status: "warn",
101
+ status: "fail",
101
102
  message: "xcrun not found",
102
- hint: "Install Xcode command line tools: xcode-select --install. Appium's XCUITest driver delegates to Xcode.",
103
+ hint: "Install Xcode command line tools: xcode-select --install. Appium's XCUITest driver delegates to Xcode and cannot run without it.",
104
+ });
105
+ const idb = which("idb");
106
+ checks.push(idb
107
+ ? { name: "idb", status: "pass", message: idb }
108
+ : {
109
+ name: "idb",
110
+ status: "warn",
111
+ message: "idb not found",
112
+ hint: "Install idb (brew install idb-companion && pipx install fb-idb). It's used to discover connected iPhones and install .ipa builds.",
113
+ });
114
+ const teamId = resolveIosSigning().teamId;
115
+ checks.push(teamId
116
+ ? { name: "ios signing", status: "pass", message: `signing team id is set (${teamId})` }
117
+ : {
118
+ name: "ios signing",
119
+ status: "warn",
120
+ message: "no signing team id is set",
121
+ hint: "Driving a physical iPhone needs an Apple Developer Team ID to sign WebDriverAgent. Set AXIMO_IOS_TEAM_ID (or MobileLink's XCODE_TEAM_ID), and optionally AXIMO_IOS_SIGNING_ID / AXIMO_IOS_WDA_BUNDLE_ID.",
103
122
  });
104
123
  checks.push({
105
124
  name: "ios webdriveragent",
106
125
  status: "info",
107
126
  message: "Physical iPhones are driven via Appium's XCUITest driver, which builds and installs a WebDriverAgent runner on the device.",
108
- hint: "WDA needs an Apple Developer signing identity; enable Developer Mode (Settings → Privacy & Security) and trust the device.",
127
+ hint: "Enable Developer Mode (Settings → Privacy & Security), trust this computer, and ensure the WDA bundle id is backed by a valid provisioning profile.",
109
128
  });
110
129
  return checks;
111
130
  }
@@ -7,6 +7,7 @@ export default defineCommand({
7
7
  subCommands: {
8
8
  list: () => import("./list.js").then((m) => m.default),
9
9
  register: () => import("./register.js").then((m) => m.default),
10
+ install: () => import("./install.js").then((m) => m.default),
10
11
  unregister: () => import("./unregister.js").then((m) => m.default),
11
12
  connect: () => import("./connect.js").then((m) => m.default),
12
13
  setup: () => import("./setup.js").then((m) => m.default),
@@ -0,0 +1,43 @@
1
+ import { type ExecFn } from "../../mobile-control/exec.js";
2
+ import type { Envelope } from "../../types.js";
3
+ import type { MobilePlatform } from "./paths.js";
4
+ export interface MobileInstallResult {
5
+ platform: MobilePlatform;
6
+ /** adb serial (Android). */
7
+ serial?: string;
8
+ /** device udid (iOS). */
9
+ udid?: string;
10
+ app: string;
11
+ output: string;
12
+ }
13
+ export interface MobileInstallOptions {
14
+ app?: string | undefined;
15
+ platform?: string | undefined;
16
+ serial?: string | undefined;
17
+ udid?: string | undefined;
18
+ }
19
+ /**
20
+ * Install an app on the connected phone: Android `.apk` via `adb install -r`,
21
+ * iOS `.ipa` via `idb install`. The iOS build must be signed for the device.
22
+ */
23
+ export declare function runMobileInstall(options: MobileInstallOptions, exec?: ExecFn): Promise<Envelope<MobileInstallResult>>;
24
+ declare const _default: import("citty").CommandDef<{
25
+ readonly app: {
26
+ readonly type: "string";
27
+ readonly description: "Path to the .apk or .ipa to install";
28
+ readonly required: true;
29
+ };
30
+ readonly platform: {
31
+ readonly type: "string";
32
+ readonly description: "android | ios (inferred from the file extension)";
33
+ };
34
+ readonly serial: {
35
+ readonly type: "string";
36
+ readonly description: "Android adb serial (defaults to the connected one)";
37
+ };
38
+ readonly udid: {
39
+ readonly type: "string";
40
+ readonly description: "iOS device udid (defaults to the connected one)";
41
+ };
42
+ }>;
43
+ export default _default;
@@ -0,0 +1,76 @@
1
+ import { existsSync } from "node:fs";
2
+ import { extname, resolve } from "node:path";
3
+ import { defineCommand } from "citty";
4
+ import { resolveAndroidSerial, resolveIosUdid } from "../../mobile-control/devices.js";
5
+ import { execBinary } from "../../mobile-control/exec.js";
6
+ import { formatError, formatSuccess, printResult } from "../../output.js";
7
+ import { parsePlatformArg } from "./register-core.js";
8
+ function inferPlatform(appPath) {
9
+ const ext = extname(appPath).toLowerCase();
10
+ if (ext === ".apk")
11
+ return "android";
12
+ if (ext === ".ipa")
13
+ return "ios";
14
+ return null;
15
+ }
16
+ /**
17
+ * Install an app on the connected phone: Android `.apk` via `adb install -r`,
18
+ * iOS `.ipa` via `idb install`. The iOS build must be signed for the device.
19
+ */
20
+ export async function runMobileInstall(options, exec = execBinary) {
21
+ if (!options.app) {
22
+ return formatError("validation_error", "App path is required (--app <path-to-.apk|.ipa>).", false);
23
+ }
24
+ const appPath = resolve(options.app);
25
+ if (!existsSync(appPath)) {
26
+ return formatError("validation_error", `App not found: ${appPath}`, false);
27
+ }
28
+ const platform = options.platform ? parsePlatformArg(options.platform) : inferPlatform(appPath);
29
+ if (!platform) {
30
+ return formatError("validation_error", "Could not determine platform; pass --platform android|ios (or use a .apk/.ipa file).", false);
31
+ }
32
+ let target;
33
+ try {
34
+ target =
35
+ platform === "ios"
36
+ ? await resolveIosUdid(options.udid, exec)
37
+ : await resolveAndroidSerial(options.serial, exec);
38
+ }
39
+ catch (err) {
40
+ return formatError("validation_error", err instanceof Error ? err.message : String(err), false);
41
+ }
42
+ try {
43
+ const { stdout } = platform === "ios"
44
+ ? await exec("idb", ["install", "--udid", target, appPath])
45
+ : await exec("adb", ["-s", target, "install", "-r", appPath]);
46
+ return formatSuccess({
47
+ platform,
48
+ ...(platform === "ios" ? { udid: target } : { serial: target }),
49
+ app: appPath,
50
+ output: stdout.toString("utf-8").trim(),
51
+ });
52
+ }
53
+ catch (err) {
54
+ return formatError("api_error", err instanceof Error ? err.message : String(err), false);
55
+ }
56
+ }
57
+ export default defineCommand({
58
+ meta: {
59
+ name: "install",
60
+ description: "Install an app on the connected phone (.apk via adb, .ipa via idb)",
61
+ },
62
+ args: {
63
+ app: { type: "string", description: "Path to the .apk or .ipa to install", required: true },
64
+ platform: { type: "string", description: "android | ios (inferred from the file extension)" },
65
+ serial: { type: "string", description: "Android adb serial (defaults to the connected one)" },
66
+ udid: { type: "string", description: "iOS device udid (defaults to the connected one)" },
67
+ },
68
+ async run({ args }) {
69
+ printResult(await runMobileInstall({
70
+ app: args.app,
71
+ platform: args.platform,
72
+ serial: args.serial,
73
+ udid: args.udid,
74
+ }));
75
+ },
76
+ });
@@ -0,0 +1 @@
1
+ export {};