zig-mobile-runner 0.1.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 (225) hide show
  1. package/CHANGELOG.md +484 -0
  2. package/CONTRIBUTING.md +42 -0
  3. package/FEATURES.md +112 -0
  4. package/LICENSE +21 -0
  5. package/README.md +255 -0
  6. package/SECURITY.md +34 -0
  7. package/build.zig +38 -0
  8. package/build.zig.zon +7 -0
  9. package/clients/README.md +144 -0
  10. package/clients/go/README.md +24 -0
  11. package/clients/go/examples/fake-session/main.go +93 -0
  12. package/clients/go/go.mod +3 -0
  13. package/clients/go/zmr/client.go +432 -0
  14. package/clients/kotlin/README.md +35 -0
  15. package/clients/kotlin/build.gradle.kts +35 -0
  16. package/clients/kotlin/settings.gradle.kts +15 -0
  17. package/clients/kotlin/src/main/kotlin/dev/zmr/FakeSession.kt +86 -0
  18. package/clients/kotlin/src/main/kotlin/dev/zmr/ZmrClient.kt +67 -0
  19. package/clients/python/README.md +29 -0
  20. package/clients/python/examples/fake_session.py +48 -0
  21. package/clients/python/pyproject.toml +13 -0
  22. package/clients/python/zmr_client.py +202 -0
  23. package/clients/rust/Cargo.lock +107 -0
  24. package/clients/rust/Cargo.toml +10 -0
  25. package/clients/rust/README.md +19 -0
  26. package/clients/rust/examples/fake_session.rs +70 -0
  27. package/clients/rust/src/lib.rs +461 -0
  28. package/clients/swift/Package.swift +16 -0
  29. package/clients/swift/README.md +36 -0
  30. package/clients/swift/Sources/ZMRClient/ZMRClient.swift +114 -0
  31. package/clients/swift/Sources/ZMRFakeSession/main.swift +86 -0
  32. package/clients/typescript/README.md +34 -0
  33. package/clients/typescript/examples/fake-session.mjs +36 -0
  34. package/clients/typescript/index.d.ts +144 -0
  35. package/clients/typescript/index.mjs +192 -0
  36. package/clients/typescript/package.json +8 -0
  37. package/docs/adr/0001-agent-native-runner-boundary.md +31 -0
  38. package/docs/adr/0002-app-local-zmr-contract.md +39 -0
  39. package/docs/adr/0003-ios-simulator-xctest-shim.md +41 -0
  40. package/docs/adr/0004-benchmark-claims-and-baseline-collection.md +37 -0
  41. package/docs/adr/README.md +12 -0
  42. package/docs/ai-agents.md +156 -0
  43. package/docs/app-integration.md +316 -0
  44. package/docs/benchmarking.md +275 -0
  45. package/docs/client-installation.md +141 -0
  46. package/docs/clients.md +98 -0
  47. package/docs/config.md +175 -0
  48. package/docs/demo.md +259 -0
  49. package/docs/dsl.md +57 -0
  50. package/docs/install.md +233 -0
  51. package/docs/market-positioning.md +70 -0
  52. package/docs/npm.md +359 -0
  53. package/docs/protocol-fixtures/README.md +8 -0
  54. package/docs/protocol-fixtures/core-session.requests.jsonl +8 -0
  55. package/docs/protocol-fixtures/core-session.responses.jsonl +8 -0
  56. package/docs/protocol-versioning.md +65 -0
  57. package/docs/protocol.md +560 -0
  58. package/docs/publication.md +77 -0
  59. package/docs/release-audit.md +99 -0
  60. package/docs/release-candidate.md +111 -0
  61. package/docs/release-evidence.md +188 -0
  62. package/docs/release-notes-template.md +58 -0
  63. package/docs/roadmap.md +334 -0
  64. package/docs/scenario-authoring.md +88 -0
  65. package/docs/shipping.md +170 -0
  66. package/docs/trace-privacy.md +88 -0
  67. package/docs/troubleshooting.md +256 -0
  68. package/examples/android-app-auth-probe.json +89 -0
  69. package/examples/android-app-error-state.json +13 -0
  70. package/examples/android-app-login-smoke.json +192 -0
  71. package/examples/android-app-onboarding.json +12 -0
  72. package/examples/android-app-referral-deep-link.json +12 -0
  73. package/examples/android-shim-smoke.json +19 -0
  74. package/examples/demo-failure.json +12 -0
  75. package/examples/demo-fake.json +14 -0
  76. package/examples/ios-dev-client-open-link.json +26 -0
  77. package/examples/ios-dev-client-route-snapshot.json +24 -0
  78. package/examples/ios-shim-smoke.json +23 -0
  79. package/examples/ios-smoke.json +9 -0
  80. package/go.work +3 -0
  81. package/npm/agents.mjs +183 -0
  82. package/npm/app-config.mjs +95 -0
  83. package/npm/build-zmr.mjs +21 -0
  84. package/npm/commands.mjs +104 -0
  85. package/npm/generated-files.mjs +50 -0
  86. package/npm/index.mjs +75 -0
  87. package/npm/init-app.mjs +80 -0
  88. package/npm/package-scripts.mjs +72 -0
  89. package/npm/postinstall.mjs +21 -0
  90. package/npm/scaffold.mjs +179 -0
  91. package/npm/scenarios.mjs +93 -0
  92. package/npm/setup.mjs +69 -0
  93. package/npm/wizard.mjs +117 -0
  94. package/npm/zmr.mjs +23 -0
  95. package/package.json +114 -0
  96. package/prebuilds/darwin-arm64/zmr +0 -0
  97. package/prebuilds/darwin-x64/zmr +0 -0
  98. package/prebuilds/linux-arm64/zmr +0 -0
  99. package/prebuilds/linux-x64/zmr +0 -0
  100. package/schemas/README.md +26 -0
  101. package/schemas/action-result.schema.json +27 -0
  102. package/schemas/capabilities-output.schema.json +98 -0
  103. package/schemas/devices-output.schema.json +25 -0
  104. package/schemas/doctor-output.schema.json +51 -0
  105. package/schemas/explain-output.schema.json +51 -0
  106. package/schemas/import-output.schema.json +23 -0
  107. package/schemas/init-output.schema.json +71 -0
  108. package/schemas/json-rpc.schema.json +55 -0
  109. package/schemas/release-manifest.schema.json +43 -0
  110. package/schemas/release-readiness-output.schema.json +127 -0
  111. package/schemas/run-output.schema.json +43 -0
  112. package/schemas/scenario.schema.json +128 -0
  113. package/schemas/schemas-output.schema.json +26 -0
  114. package/schemas/semantic-snapshot.schema.json +116 -0
  115. package/schemas/snapshot.schema.json +60 -0
  116. package/schemas/trace-event.schema.json +14 -0
  117. package/schemas/trace-manifest.schema.json +59 -0
  118. package/schemas/validate-output.schema.json +42 -0
  119. package/schemas/version-output.schema.json +23 -0
  120. package/schemas/zmr-config.schema.json +75 -0
  121. package/scripts/android-emulator.sh +126 -0
  122. package/scripts/assert-ios-physical-ready.sh +213 -0
  123. package/scripts/benchmark-command.sh +307 -0
  124. package/scripts/benchmark.sh +359 -0
  125. package/scripts/benchmark_gate.py +117 -0
  126. package/scripts/benchmark_result_row.py +88 -0
  127. package/scripts/compare-benchmarks.py +288 -0
  128. package/scripts/create-android-demo-app.sh +342 -0
  129. package/scripts/create-ios-demo-app.sh +261 -0
  130. package/scripts/demo-android-real.sh +232 -0
  131. package/scripts/demo-ios-real.sh +270 -0
  132. package/scripts/demo.sh +464 -0
  133. package/scripts/device-matrix.sh +338 -0
  134. package/scripts/ensure-ios-shim-target.rb +237 -0
  135. package/scripts/install-android-shim.sh +281 -0
  136. package/scripts/install-ios-shim.sh +589 -0
  137. package/scripts/pilot-gate.sh +560 -0
  138. package/scripts/release-readiness.py +838 -0
  139. package/scripts/release-readiness.sh +91 -0
  140. package/scripts/run-android-pilot.sh +561 -0
  141. package/scripts/run-ios-pilot.sh +509 -0
  142. package/shims/android/README.md +21 -0
  143. package/shims/android/ZMRShimInstrumentedTest.java +152 -0
  144. package/shims/android/protocol.md +18 -0
  145. package/shims/ios/README.md +50 -0
  146. package/shims/ios/ZMRShim.swift +110 -0
  147. package/shims/ios/ZMRShimUITestCase.swift +475 -0
  148. package/shims/ios/protocol.md +74 -0
  149. package/skills/zmr-mobile-testing/SKILL.md +127 -0
  150. package/src/android.zig +344 -0
  151. package/src/android_device_info.zig +99 -0
  152. package/src/android_emulator.zig +154 -0
  153. package/src/android_screen_recording.zig +112 -0
  154. package/src/android_shell.zig +112 -0
  155. package/src/bundle.zig +124 -0
  156. package/src/bundle_redaction.zig +272 -0
  157. package/src/bundle_tar.zig +123 -0
  158. package/src/cli_devices.zig +97 -0
  159. package/src/cli_doctor.zig +114 -0
  160. package/src/cli_import.zig +70 -0
  161. package/src/cli_info.zig +39 -0
  162. package/src/cli_init.zig +72 -0
  163. package/src/cli_output.zig +467 -0
  164. package/src/cli_run.zig +259 -0
  165. package/src/cli_serve.zig +287 -0
  166. package/src/cli_trace.zig +111 -0
  167. package/src/cli_validate.zig +41 -0
  168. package/src/command.zig +211 -0
  169. package/src/config.zig +305 -0
  170. package/src/config_diagnostics.zig +212 -0
  171. package/src/config_paths.zig +49 -0
  172. package/src/device_registry.zig +37 -0
  173. package/src/doctor.zig +412 -0
  174. package/src/doctor_hints.zig +52 -0
  175. package/src/errors.zig +55 -0
  176. package/src/fake_device.zig +163 -0
  177. package/src/health.zig +28 -0
  178. package/src/importer.zig +343 -0
  179. package/src/importer_json.zig +100 -0
  180. package/src/importer_model.zig +103 -0
  181. package/src/ios.zig +399 -0
  182. package/src/ios_devices.zig +219 -0
  183. package/src/ios_lifecycle.zig +72 -0
  184. package/src/ios_shim.zig +242 -0
  185. package/src/ios_snapshot.zig +20 -0
  186. package/src/json_fields.zig +80 -0
  187. package/src/json_rpc.zig +150 -0
  188. package/src/json_rpc_methods.zig +318 -0
  189. package/src/json_rpc_observation.zig +31 -0
  190. package/src/json_rpc_params.zig +52 -0
  191. package/src/json_rpc_protocol.zig +110 -0
  192. package/src/json_rpc_trace.zig +73 -0
  193. package/src/main.zig +135 -0
  194. package/src/mcp.zig +234 -0
  195. package/src/mcp_protocol.zig +64 -0
  196. package/src/mcp_trace.zig +83 -0
  197. package/src/report.zig +346 -0
  198. package/src/report_html.zig +63 -0
  199. package/src/report_values.zig +27 -0
  200. package/src/run_options.zig +152 -0
  201. package/src/runner.zig +280 -0
  202. package/src/runner_actions.zig +109 -0
  203. package/src/runner_config.zig +6 -0
  204. package/src/runner_diagnostics.zig +268 -0
  205. package/src/runner_events.zig +170 -0
  206. package/src/runner_native.zig +88 -0
  207. package/src/runner_waits.zig +300 -0
  208. package/src/scaffold.zig +472 -0
  209. package/src/scenario.zig +346 -0
  210. package/src/scenario_fields.zig +50 -0
  211. package/src/schema_registry.zig +53 -0
  212. package/src/selector.zig +84 -0
  213. package/src/semantic.zig +171 -0
  214. package/src/trace.zig +315 -0
  215. package/src/trace_json.zig +340 -0
  216. package/src/trace_summary.zig +218 -0
  217. package/src/trace_summary_diagnostic.zig +202 -0
  218. package/src/types.zig +120 -0
  219. package/src/uiautomator.zig +164 -0
  220. package/src/validation.zig +187 -0
  221. package/src/version.zig +22 -0
  222. package/viewer/app.js +373 -0
  223. package/viewer/index.html +126 -0
  224. package/viewer/parser.js +233 -0
  225. package/viewer/styles.css +585 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,484 @@
1
+ # Changelog
2
+
3
+ All notable changes to Zig Mobile Runner are tracked here.
4
+
5
+ ## Unreleased
6
+
7
+ ## 0.1.0 (2026-05-22)
8
+
9
+ ### Added
10
+
11
+ - `zmr doctor` for local environment diagnostics across Zig, ADB, Android devices, `xcrun`, and iOS simulators.
12
+ - `zmr init` for scaffolding a starter scenario.
13
+ - `zmr validate <scenario.json>` for preflight scenario validation without touching a device.
14
+ - Public JSON Schemas under `schemas/` for scenarios, snapshots, action results, trace events, and JSON-RPC messages.
15
+ - `schemas/validate-output.schema.json` for the machine-readable `zmr validate --json` preflight result.
16
+ - Stable public error-code mapping for CLI/protocol-facing failures.
17
+ - Top-level CLI failures now print stable `error[code]` messages instead of
18
+ Zig stack traces.
19
+ - JSON-RPC execution errors now include `publicCode` when a stable code is available.
20
+ - Product roadmap in `docs/roadmap.md`.
21
+ - Demo documentation in `docs/demo.md`.
22
+ - Release evidence checklist in `docs/release-evidence.md` mapping product
23
+ claims to concrete commands and required artifacts.
24
+ - Machine-readable protocol compatibility metadata in `runner.capabilities`.
25
+ - Go and Rust reference JSON-RPC clients with fake-session examples and CI
26
+ coverage.
27
+ - Go and Rust clients now expose the full core mobile control surface for
28
+ session lifecycle, app lifecycle, UI actions, waits, assertions, semantic
29
+ snapshots, trace polling, and trace export.
30
+ - Go and Rust fake-session examples now launch `zmr serve` with the fake-device
31
+ backend and exercise agent-style open-link, wait, tap, type, assertion,
32
+ snapshot, trace polling, and redacted export flows.
33
+ - `zmr-benchmark-command` for timing app-local baseline commands and writing
34
+ normalized rows that can be compared with ZMR benchmark results.
35
+ - `zmr-benchmark --results` / `--replace` for appending ZMR runs to a shared
36
+ comparison JSONL file.
37
+ - `zmr-compare-benchmarks` gates for candidate pass rate, failure count, mean
38
+ speedup, and p95 speedup.
39
+ - Feature catalog in `FEATURES.md`.
40
+ - Architecture decision records under `docs/adr/`.
41
+ - AI agent integration guide in `docs/ai-agents.md`.
42
+ - Simplified market-facing README plus dedicated DSL, client, and positioning docs.
43
+ - Client installation guide for npm, Homebrew, TypeScript, Python, Go, Rust,
44
+ Swift, and Kotlin.
45
+ - SwiftPM and Kotlin/JVM reference clients for host-side native mobile team
46
+ automation.
47
+ - Swift and Kotlin fake-session demo entry points now run from `scripts/demo.sh`
48
+ and export redacted traces alongside the TypeScript, Python, Go, and Rust
49
+ client demos.
50
+ - Kotlin/JVM client calls now reject JSON-RPC error responses instead of
51
+ returning error payloads as successful raw strings.
52
+ - `scripts/release-candidate.sh` now generates release-candidate evidence in
53
+ local, hardware, or combined modes from a source checkout.
54
+ - Hardware release-candidate evidence rows now include structured thresholds,
55
+ app root, app id, app artifact, and device identifiers for readiness checks.
56
+ - The npm package keeps `zmr-release-readiness` for app-local evidence checks
57
+ but does not expose maintainer-only release-candidate tooling as an app
58
+ install command.
59
+ - `zmr-release-readiness` / `scripts/release-readiness.sh` now converts
60
+ release-candidate `evidence.jsonl` into explicit dev-preview, production,
61
+ or market-claim readiness decisions with missing evidence listed for agents
62
+ and maintainers.
63
+ - `schemas/release-readiness-output.schema.json` and `zmr schemas --json`
64
+ metadata for agent-readable release evidence gate output.
65
+ - `zmr-release-readiness --json` now includes `nextSteps` commands for missing
66
+ evidence so agents can continue blocked release gates without scraping text.
67
+ - `zmr-release-readiness --json` now includes per-requirement status rows so
68
+ agents can see which evidence satisfied a release claim and which evidence
69
+ was missing, failed, planned, or insufficient.
70
+ - Market-claim readiness now rejects benchmark evidence that does not prove the
71
+ documented pass-rate, zero-failure, mean-speedup, and p95-speedup thresholds.
72
+ - `zmr-compare-benchmarks` now supports `--evidence-out` so competitive
73
+ benchmark comparisons can append market-claim readiness evidence directly.
74
+ - `zmr-assert-ios-physical-ready` now accepts `--xcrun`, and
75
+ `zmr-pilot-gate` forwards custom `--xcrun` paths into the physical iOS
76
+ readiness preflight as well as the iOS pilot run.
77
+ - `zmr-pilot-gate` now accepts `--zmr-bin` and forwards the explicit runner
78
+ binary to Android, iOS, and physical iOS readiness checks for app-local CI.
79
+ - `zmr-pilot-gate` now records structured app-root and iOS app-artifact
80
+ evidence, and iOS pilots require `--ios-app-root` so production-readiness
81
+ evidence names the tested app source and build.
82
+ - Local release-candidate evidence now runs the generated public iOS simulator
83
+ demo five times by default, with `--local-ios-demo-runs <n>` for explicit
84
+ release-candidate tuning.
85
+ - Local release-candidate evidence can now run the generated public Android
86
+ emulator demo with `--local-android-avd <name>`, `--local-android-device`,
87
+ and `--local-android-demo-runs <n>`.
88
+ - `scripts/assert-ios-physical-ready.sh` now makes release-candidate hardware
89
+ mode fail unless the requested physical iOS device is present and ready, with
90
+ retries for transient CoreDevice list failures.
91
+ - `zmr doctor` now keeps physical iOS checks actionable on multi-device
92
+ machines by reporting disconnected/unavailable device counts even when one
93
+ physical device is ready.
94
+ - `zmr doctor --json` now emits structured `count` and `readyCount` fields for
95
+ Android, iOS simulator, and physical iOS device checks so agents do not need
96
+ to parse human-readable detail strings.
97
+ - Physical iOS discovery and lifecycle support through `xcrun devicectl`,
98
+ including install, launch, deep-link launch, clear-state uninstall, and
99
+ best-effort stop.
100
+ - GitHub issue templates for bug reports and feature requests.
101
+ - Reusable `zmr-mobile-testing` agent skill under `skills/`.
102
+ - `trace.events` JSON-RPC cursor polling for live trace events during long-running agent sessions.
103
+ - `observe.semanticSnapshot` JSON-RPC output with normalized roles, stable
104
+ selectors, center bounds, visible text summary, and recommended actions for
105
+ AI agents.
106
+ - `zmr mcp` stdio server for MCP-capable agents, exposing mobile-specific tools
107
+ for semantic snapshots, selector actions, waits, live trace polling, and
108
+ redacted trace export.
109
+ - `schemas/semantic-snapshot.schema.json` for the machine-readable semantic
110
+ observation contract.
111
+ - `src/cli_output.zig` as the focused home for CLI JSON/text output
112
+ serialization, keeping command routing easier to inspect.
113
+ - `src/runner_events.zig` as the focused home for runner trace events and
114
+ selector diagnostics, keeping scenario execution easier to follow.
115
+ - `src/json_rpc_protocol.zig` as the focused home for JSON-RPC wire-format
116
+ responses, keeping agent-facing dispatch easier to review.
117
+ - `src/trace_summary.zig` as the focused home for reading `trace.json` plus
118
+ `events.jsonl`, keeping run-output and explain-output diagnostics consistent
119
+ for agents.
120
+ - `src/ios_devices.zig` as the focused home for iOS simulator and physical
121
+ device discovery plus `xcrun` command construction, keeping `src/ios.zig`
122
+ focused on app lifecycle and UI actions.
123
+ - `src/android_shell.zig` as the focused home for Android shell action and
124
+ deep-link intent argument construction, keeping `src/android.zig` focused on
125
+ device orchestration.
126
+ - `src/json_fields.zig` as the shared typed JSON field reader for scenario and
127
+ JSON-RPC parameter parsing, reducing duplicated low-level parser code.
128
+ - `src/runner_diagnostics.zig` as the focused selector diagnostic JSON builder,
129
+ keeping `src/runner_events.zig` focused on trace event recording.
130
+ - `src/trace_summary_diagnostic.zig` as the focused trace diagnostic event
131
+ model and JSON serializer, keeping `src/trace_summary.zig` focused on
132
+ reading trace manifests and event streams.
133
+ - `src/run_options.zig` as the focused home for `zmr run`, `zmr serve`, and
134
+ `zmr mcp` option/config precedence, keeping `src/main.zig` closer to a thin
135
+ command router.
136
+ - `src/config_paths.zig` as the focused home for app-local `.zmr/config.json`
137
+ loading and relative path resolution across `doctor`, `run`, `serve`, and
138
+ `mcp`.
139
+ - `src/runner_native.zig` as the focused home for native selector action
140
+ dispatch and trace events, keeping `src/runner.zig` focused on scenario
141
+ orchestration and snapshot fallback behavior.
142
+ - `src/cli_devices.zig` as the focused home for the `zmr devices` command,
143
+ keeping `src/main.zig` closer to command routing.
144
+ - `src/cli_doctor.zig` as the focused home for `zmr doctor` flag parsing,
145
+ app-local config resolution, and output dispatch, keeping setup diagnostics
146
+ easier to review.
147
+ - `src/cli_validate.zig` as the focused home for `zmr validate` parsing and
148
+ result output, keeping the top-level command router smaller.
149
+ - `src/cli_info.zig` as the focused home for `zmr version` and `zmr schemas`
150
+ output, keeping metadata commands out of the top-level router.
151
+ - `src/cli_init.zig` as the focused home for `zmr init` app-local and
152
+ single-scenario scaffolding, keeping first-run DX code easier to inspect.
153
+ - `src/cli_import.zig` as the focused home for `zmr import flow-yaml`
154
+ migration parsing and dispatch, keeping onboarding/migration code out of the
155
+ top-level router.
156
+ - `src/cli_trace.zig` as the focused home for `zmr report`, `zmr explain`, and
157
+ `zmr export` parsing and dispatch, keeping trace-inspection commands out of
158
+ the top-level router.
159
+ - `src/cli_serve.zig` as the focused home for `zmr serve` and `zmr mcp`
160
+ parsing, app-local config resolution, trace setup, and Android/iOS server
161
+ dispatch, keeping agent server startup out of the top-level router.
162
+ - `src/cli_run.zig` as the focused home for `zmr run` parsing, app-local
163
+ config resolution, emulator preflight, trace setup, and Android/iOS scenario
164
+ dispatch, leaving `src/main.zig` as a thin command router.
165
+ - `src/main_tests.zig` and `src/test_harness.zig` as the focused homes for
166
+ command-router integration coverage and module test discovery, keeping
167
+ `src/main.zig` as a runtime-only router.
168
+ - `src/runner_tests.zig` as the focused home for runner orchestration tests,
169
+ keeping `src/runner.zig` focused on the runtime scenario engine.
170
+ - `src/trace_tests.zig` as the focused home for trace serialization,
171
+ redaction, artifact, and manifest tests, keeping `src/trace.zig` focused on
172
+ trace writing behavior.
173
+ - `src/android_tests.zig` as the focused home for Android adapter parser,
174
+ command construction, trace artifact, and native shim tests, keeping
175
+ `src/android.zig` focused on ADB/device behavior.
176
+ - `src/ios_tests.zig` as the focused home for iOS simulator, physical device,
177
+ screenshot, open-link, and XCTest-shim behavior tests, keeping `src/ios.zig`
178
+ focused on simctl/devicectl and shim orchestration.
179
+ - `src/config_tests.zig` as the focused home for `.zmr/config.json` parser,
180
+ diagnostics, artifact controls, and redaction controls, keeping
181
+ `src/config.zig` focused on the app-local config runtime contract.
182
+ - `src/doctor_tests.zig` as the focused home for setup diagnostics, remediation
183
+ hints, fake-device checks, and smoke-scenario validation coverage, keeping
184
+ `src/doctor.zig` focused on environment probe behavior.
185
+ - `src/doctor_hints.zig` as the focused home for setup error-code and
186
+ remediation-hint policy, keeping `src/doctor.zig` focused on running probes
187
+ and assembling checks.
188
+ - `src/bundle_tests.zig` as the focused home for trace archive, redaction, and
189
+ artifact omission coverage, keeping `src/bundle.zig` focused on deterministic
190
+ `.zmrtrace` packaging behavior.
191
+ - `src/scenario_tests.zig` as the focused home for scenario DSL parsing,
192
+ agent-grade flow primitive, simple action, and malformed-input coverage,
193
+ keeping `src/scenario.zig` focused on the runtime scenario parser.
194
+ - `src/report_tests.zig` as the focused home for HTML report and trace
195
+ explanation coverage, keeping `src/report.zig` focused on report rendering
196
+ behavior used by local demos and agent diagnostics.
197
+ - `src/report_html.zig` as the focused home for shared HTML escaping,
198
+ document framing, file writing, and artifact links used by trace and
199
+ benchmark reports.
200
+ - `src/importer_tests.zig` as the focused home for flow-YAML migration
201
+ coverage through the public file import API, keeping `src/importer.zig`
202
+ focused on migration parsing and JSON emission internals.
203
+ - `src/validation_tests.zig` as the focused home for scenario preflight and
204
+ source-location diagnostics coverage, keeping `src/validation.zig` focused
205
+ on public validation result construction.
206
+ - `src/command_tests.zig` as the focused home for command execution timeout
207
+ and ADB escaping coverage, keeping `src/command.zig` focused on subprocess
208
+ and shell-argument behavior.
209
+ - `src/trace_summary_tests.zig` as the focused home for partial visual capture
210
+ explanation coverage, keeping `src/trace_summary.zig` focused on trace
211
+ summary parsing for CLI and agent diagnostics.
212
+ - `src/semantic_tests.zig` as the focused home for agent semantic snapshot
213
+ role/action coverage, keeping `src/semantic.zig` focused on observation
214
+ normalization.
215
+ - Focused test modules for small public contracts: `src/types_tests.zig`,
216
+ `src/selector_tests.zig`, `src/health_tests.zig`,
217
+ `src/device_registry_tests.zig`, `src/schema_registry_tests.zig`, and
218
+ `src/version_tests.zig`, keeping these runtime modules lean and easier to
219
+ audit.
220
+ - `src/uiautomator_tests.zig`, `src/fake_device_tests.zig`, and
221
+ `src/android_emulator_tests.zig` as focused homes for parser, fake-device,
222
+ and emulator-preflight coverage, keeping Android runtime helpers easier to
223
+ review before release pilots.
224
+ - Focused CLI parser test modules for `doctor`, `import`, `info`, `init`,
225
+ `trace`, and `validate`, keeping command entry modules shorter while
226
+ preserving parse-error coverage.
227
+ - Focused parser test modules for `zmr run` and `zmr serve` startup options,
228
+ keeping the primary execution and agent-server command modules focused on
229
+ config resolution and runtime dispatch.
230
+ - Focused public-contract test modules for config path resolution, run/serve
231
+ option precedence, JSON-RPC protocol metadata, and CLI output helpers.
232
+ - Focused public-contract test modules for error classification, iOS device
233
+ discovery parsing, runner event diagnostics, and `.zmr` scaffold generation.
234
+ - `src/ios_shim_tests.zig` as the focused home for XCTest shim command,
235
+ selector, screenshot, snapshot, and response parsing contracts, keeping
236
+ `src/ios_shim.zig` focused on the shim protocol implementation.
237
+ - `src/json_rpc_tests.zig` as the focused home for JSON-RPC dispatch,
238
+ live-trace, event-stream, and protocol-fixture tests.
239
+ - `src/json_rpc_methods.zig` now owns JSON-RPC method execution while
240
+ `src/json_rpc.zig` stays focused on stdio/tcp transport and request framing.
241
+ - JSON-RPC method dispatch is now grouped by protocol area: core/session,
242
+ app lifecycle, observation, UI actions, waits, assertions, and trace tools.
243
+ This keeps the agent-facing server surface easier to audit before release.
244
+ - `src/json_rpc_params.zig` now owns JSON-RPC parameter parsing for selectors,
245
+ primitive fields, directions, and defaults, keeping method dispatch focused
246
+ on protocol behavior.
247
+ - `src/json_rpc_trace.zig` now owns JSON-RPC live trace event streaming and
248
+ simple trace payload helpers, keeping method dispatch focused on routing.
249
+ - `src/json_rpc_observation.zig` now owns JSON-RPC snapshot response
250
+ serialization and trace artifact events, keeping method dispatch focused on
251
+ observation routing.
252
+ - `src/mcp_protocol.zig` now owns MCP response framing, initialization output,
253
+ errors, and tool catalog JSON, keeping the MCP server focused on tool
254
+ execution for agent integrations.
255
+ - `src/mcp_trace.zig` now owns MCP trace-event polling and redacted trace
256
+ export tool responses, keeping the MCP server focused on dispatching
257
+ agent-requested tools.
258
+ - `src/runner_waits.zig` now owns selector wait, assertion, and scroll polling
259
+ behavior, while `src/runner.zig` stays focused on scenario execution and UI
260
+ actions.
261
+ - `src/runner_actions.zig` now owns selector tap/type/erase behavior, keeping
262
+ action targeting separate from high-level scenario orchestration.
263
+ - `src/trace_json.zig` now owns trace JSON serialization and redaction rules,
264
+ leaving `src/trace.zig` focused on trace writing and manifest lifecycle.
265
+ - `src/bundle_tar.zig` now owns deterministic tar entry writing, leaving
266
+ `src/bundle.zig` focused on trace bundle entry selection and redaction policy.
267
+ - `src/importer_model.zig` and `src/importer_json.zig` now own flow-import
268
+ intermediate types and scenario JSON emission, leaving `src/importer.zig`
269
+ focused on translating source flow syntax.
270
+ - `src/config_diagnostics.zig` now owns `.zmr/config.json` field-path
271
+ diagnostics, leaving `src/config.zig` focused on parsing the runtime config
272
+ contract.
273
+ - `src/android_device_info.zig` now owns Android device listing plus window,
274
+ viewport, and density parsers, leaving `src/android.zig` focused on ADB app
275
+ lifecycle, actions, screenshots, and shim orchestration.
276
+ - `src/android_screen_recording.zig` now owns Android screenrecord process
277
+ lifecycle and trace artifact pulling, leaving `src/android.zig` focused on
278
+ app/device orchestration.
279
+ - `src/ios_lifecycle.zig` now owns physical iOS `devicectl` install, launch,
280
+ stop, and uninstall helpers, leaving `src/ios.zig` focused on simulator
281
+ lifecycle, XCTest shim orchestration, screenshots, and snapshots.
282
+ - `src/ios_snapshot.zig` now owns PNG viewport parsing for screenshot
283
+ artifacts, keeping iOS adapter snapshot orchestration easier to review.
284
+ - `scripts/coverage.sh` now guards `kcov` with
285
+ `ZMR_KCOV_TIMEOUT_SECONDS`, so release gates fail fast instead of hanging on
286
+ macOS tracing authorization stalls.
287
+ - Field, line, and column diagnostics in `zmr validate --json` for invalid scenarios.
288
+ - Scenario authoring guide plus onboarding, referral deep-link, and error-state templates.
289
+ - Adapter-level settle hook after mutating scenario actions, with native shim idle support and shell fallback.
290
+ - Trace viewer side-by-side screenshot and UI tree inspection with selectable node details.
291
+ - App-specific trace redaction denylist/allowlist controls for persisted node text, resource ids, and trace events.
292
+ - Release builds now generate SPDX SBOM and third-party license notice artifacts.
293
+ - Release builds now generate a Homebrew formula with per-platform checksums.
294
+ - Release builds now generate `RELEASE_MANIFEST.json`, a machine-readable
295
+ artifact inventory with sizes and SHA-256 digests.
296
+ - Release integrity verification now validates generated archives, metadata
297
+ files, `RELEASE_MANIFEST.json`, and `SHA256SUMS` before packaged binary
298
+ smoke tests.
299
+ - Tagged release workflow now publishes GitHub artifact attestation for release
300
+ archives and metadata.
301
+ - Tagged release workflow now builds the npm tarball, attests it, uploads it
302
+ with the release assets, and publishes with npm provenance when `NPM_TOKEN`
303
+ is configured.
304
+ - Release manifests and checksum verification now include generated npm
305
+ tarballs when present.
306
+ - Native selector wait timeouts now capture one final snapshot when possible,
307
+ giving iOS XCTest-shim failures the same visible text and candidate
308
+ diagnostics as snapshot-based waits.
309
+ - Added `scripts/sign-macos-release.sh` for credentialed maintainers to sign
310
+ macOS release archives and refresh checksums before upload.
311
+ - Added `scripts/notarize-macos-release.sh` for credentialed maintainers to
312
+ submit signed macOS archives to Apple notarytool, persist receipts, and
313
+ refresh release metadata before upload.
314
+ - iOS simulator `clearState` is now idempotent when the app is already uninstalled and documented as best-effort uninstall by bundle id.
315
+ - Android pilot wrapper can reset the emulator and boot from a named snapshot before running smoke flows.
316
+ - Android pilot wrapper can capture an optional MP4 screen recording for visual flake triage.
317
+ - Android and iOS pilot wrappers now run early setup preflights and print
318
+ structured `zmr doctor --json` diagnostics for missing devices/simulators.
319
+ - Android pilot wrapper `--adb` overrides now propagate into the underlying
320
+ `zmr run` and repeated-run benchmark calls.
321
+ - Added `scripts/pilot-gate.sh` and the `zmr-pilot-gate` npm bin for the
322
+ external Android+iOS pre-release pilot gate.
323
+ - `zmr-pilot-gate` now resolves app-local relative paths from the caller's
324
+ checkout, including when invoked through npm's `node_modules/.bin` symlink.
325
+ - The iOS shim installer now resolves multi-project workspaces by matching
326
+ `--bundle-id` when multiple projects contain the same `--app-target`.
327
+ - The iOS shim installer now patches app-local `.zmr/config.json` with
328
+ `tools.iosShimPath` so selector-grade iOS runs use the installed shim by
329
+ default.
330
+ - `zmr init --app`, `zmr-init`, and `zmr-wizard --package-json` now scaffold
331
+ a `zmr:pilot` / `scripts.pilotGate` command for external release pilots.
332
+ - `zmr init --app`, `zmr-init`, and `zmr-wizard` now scaffold
333
+ `.zmr/device-matrix.json` plus `zmr:matrix` / `scripts.matrix` so the
334
+ generated app-local setup can run local Android/iOS matrix gates immediately.
335
+ - `zmr-wizard --expo-dev-client-scheme` now scaffolds Android and iOS Expo
336
+ development-build open-link smoke scenarios and package scripts.
337
+ - Scenario JSON now supports `assertNoneVisible` for app-wide crash/error
338
+ guards after navigation or sign-in steps.
339
+ - Scenario JSON now supports zero-config `assertHealthy` guards for common
340
+ mobile redboxes, crash overlays, and development-client load failures.
341
+ - Health guard policy now lives in a focused `src/health.zig` module so
342
+ contributors can extend default mobile error detection without editing runner
343
+ orchestration.
344
+ - Public schema discovery now lives in `src/schema_registry.zig`, keeping CLI
345
+ command dispatch smaller while preserving `zmr schemas --json` output.
346
+ - Device readiness and `zmr devices --json` serialization now live in
347
+ `src/device_registry.zig`, so CLI and JSON-RPC agents share one portable
348
+ readiness policy for Android, iOS simulators, and physical iOS devices.
349
+ - `zmr init` and `zmr init --app` now scaffold `assertHealthy` into starter
350
+ smoke scenarios so source/archive installs get the same safer default as the
351
+ npm wizard.
352
+ - JSON-RPC and all reference clients now expose `assert.healthy` /
353
+ `assertHealthy` so agents can run the same health guard outside scenario
354
+ files.
355
+ - Swift and Kotlin clients now include fake-server package tests that exercise
356
+ the JSON-RPC session path and `assert.healthy` helper.
357
+ - Android snapshots now include display density DPI when available.
358
+ - Traced Android `zmr run` sessions can capture an opt-in `screenrecord.mp4`, and redacted exports omit screen recordings.
359
+ - Redacted `.zmrtrace` exports now keep replayable screenshot artifact paths by replacing PNG screenshots with safe placeholder images.
360
+ - `zmr export --redact --omit-screenshots` and JSON-RPC
361
+ `trace.export` `omitScreenshots` can omit screenshot artifacts entirely from
362
+ redacted bundles.
363
+ - `zmr run` can now boot an Android AVD, restore a snapshot, reset the emulator, and wait for boot readiness before running a scenario.
364
+ - `zmr run` can create a missing Android AVD from an installed system image before booting it.
365
+ - iOS pilot runs now execute a selector-driven `ios-shim-smoke` flow and export its report/bundles when `--ios-shim` is provided.
366
+ - iOS XCTest shim snapshots now include element `value` fields, and the Zig
367
+ mapper falls back from empty labels to values so text-field contents appear
368
+ in UI trees and agent observations.
369
+ - Added `scripts/release-gate.sh` as the one-command local release gate for formatting, tests, demo, coverage, packaging, and release smoke.
370
+ - Android shim installer can now copy the instrumentation source directly into an app module and idempotently patch AndroidX test dependencies in Gradle.
371
+ - Android shim installer now idempotently patches Gradle `testInstrumentationRunner` when `--gradle-file` is provided and no runner is already configured.
372
+ - Android shim installer now reuses an existing Gradle `testInstrumentationRunner` for the generated shim command when `--runner` is omitted.
373
+ - Troubleshooting guide for doctor output, scenario validation, shims, trace inspection, and release-gate failures.
374
+ - CI and tagged-release workflows now run the same `scripts/release-gate.sh` local acceptance gate.
375
+ - `zmr doctor` now includes remediation hints for missing or warning checks, including machine-readable `hint` fields in JSON output.
376
+ - Added `schemas/doctor-output.schema.json` for machine-readable setup diagnostics.
377
+ - The no-device demo now shows `zmr doctor --json` remediation hints for missing shim setup.
378
+ - `zmr doctor --config` now validates configured Android and iOS smoke scenario files and reports remediation hints for missing or malformed files.
379
+ - `zmr doctor --json --config` now reports malformed config files as structured `config` checks instead of raw CLI errors.
380
+ - Config parsing now rejects non-boolean values for boolean fields instead of silently falling back to defaults.
381
+ - Config parsing now rejects unknown fields so app-local config typos do not silently fall back to defaults.
382
+ - Config parsing now rejects empty strings for schema-required path, id, redaction list, and script command values.
383
+ - `zmr doctor --json --config` now includes stable `errorCode` and `fieldPath` values for actionable app-local config errors.
384
+ - `zmr doctor` now warns, with stable setup error codes, when ADB sees zero devices, `xcrun` sees zero booted iOS simulators, `devicectl` sees zero paired physical iOS devices, or physical iOS devices are listed but disconnected/unavailable.
385
+ - Physical iOS device discovery now exposes the commandable CoreDevice
386
+ identifier from `devicectl` as the `serial` value agents pass back to
387
+ `--device`, with the hardware UDID retained only as a parser fallback.
388
+ - `scripts/run-ios-pilot.sh --ios-device-type physical` now rejects listed but
389
+ disconnected/unavailable physical device identifiers before install with
390
+ `setup.ios.physical_device_not_ready` and prints the matched device state.
391
+ - `zmr doctor --json` now includes stable setup `errorCode` values for missing tools, failed tool commands, and missing shim commands.
392
+ - `zmr doctor --strict` now exits non-zero when any diagnostic check is warning or missing, so CI and setup scripts can fail before device orchestration.
393
+ - `zmr init --app` now scaffolds an app-local `.zmr/config.json`, Android smoke scenario, iOS smoke scenario, and `traces/` gitignore entry without requiring npm.
394
+ - `zmr init --json` now emits machine-readable created files and next-step commands for app and scenario bootstraps.
395
+ - Added `schemas/init-output.schema.json` for the machine-readable `zmr init --json` contract.
396
+ - `zmr import flow-yaml` now converts a supported subset of mobile-flow YAML commands into native `.zmr/*.json` scenarios.
397
+ - Added `schemas/import-output.schema.json` for the machine-readable `zmr import --json` contract.
398
+ - The no-device demo now shows config-driven `zmr doctor --json` smoke scenario diagnostics for missing files and malformed JSON.
399
+ - `zmr devices --json` now emits machine-readable Android device, iOS
400
+ simulator, and physical iOS discovery output for setup scripts.
401
+ - `zmr devices --json` and JSON-RPC `device.list` now include a portable
402
+ `ready` boolean so agents can avoid disconnected physical devices without
403
+ duplicating platform state rules.
404
+ - `zmr doctor --json` now includes a state breakdown for listed-but-not-ready
405
+ physical iOS devices, such as `disconnected=1, unavailable=1`.
406
+ - Added `schemas/devices-output.schema.json` for the machine-readable `zmr devices --json` contract.
407
+ - `zmr version --json` now emits machine-readable runner and protocol compatibility metadata for installers and generated clients.
408
+ - Added `schemas/version-output.schema.json` for the machine-readable `zmr version --json` contract.
409
+ - `runner.capabilities` now reports Android, iOS simulator, and physical iOS
410
+ support as structured `platformSupport` metadata, with `iosPreview: false`.
411
+ - Added `schemas/capabilities-output.schema.json` for the machine-readable
412
+ `runner.capabilities` JSON-RPC result.
413
+ - `zmr explain --json` now emits machine-readable failure triage for agents and CI.
414
+ - Added `schemas/explain-output.schema.json` for the machine-readable `zmr explain --json` contract.
415
+ - `zmr schemas --json` now emits a machine-readable index of packaged public schema contracts.
416
+ - Added `schemas/schemas-output.schema.json` for the machine-readable `zmr schemas --json` contract.
417
+ - `zmr run --json` now emits a machine-readable terminal run summary while preserving failed scenario exit codes.
418
+ - Added `schemas/run-output.schema.json` for the machine-readable `zmr run --json` contract.
419
+ - Partial iOS visual captures now surface `partialFailure` in `zmr run --json`
420
+ and semantic-extraction diagnostics in `zmr explain --json`, separating
421
+ captured screenshot artifacts from failed accessibility/XCTest extraction.
422
+ - Added `zmr-device-matrix` / `scripts/device-matrix.sh` for local Android/iOS
423
+ multi-device smoke gates with `matrix.jsonl`, `summary.json`, and pass-rate
424
+ thresholds.
425
+ - `zmr-device-matrix` rows now support `iosDeviceType: "physical"` so matrix
426
+ runs can exercise physical iOS devices through the same `zmr run` flag used
427
+ by pilot gates.
428
+ - Added `zmr-compare-benchmarks` / `scripts/compare-benchmarks.py` for generic
429
+ candidate-vs-baseline benchmark comparison reports without naming private app
430
+ projects or third-party tools in public fixtures.
431
+ - Added `zmr-demo-ios` and `zmr-create-ios-demo-app` flows for a generic
432
+ simulator app with the XCTest shim installed, selector-grade smoke scenario,
433
+ and redacted trace output.
434
+ - Added `zmr-create-android-demo-app` for a generic native Android APK and
435
+ `.zmr` smoke scenario built with Android SDK command-line tools.
436
+ - Added `zmr-demo-android` for a one-command public Android demo that creates,
437
+ installs, runs, benchmarks, and traces the generated app on an emulator or
438
+ device.
439
+ - `zmr validate --json` now reports missing step selectors as `selector.invalid` with `fieldPath: "$.steps[].selector"` instead of falling back to `internal.error`.
440
+ - `zmr validate --json` now reports unknown scenario action typos as `scenario.invalid` with `fieldPath: "$.steps[].action"` and source location diagnostics.
441
+ - `zmr validate --json` now reports invalid `scrollUntilVisible.direction` values as `scenario.invalid` with `fieldPath: "$.steps[].direction"`.
442
+ - `zmr validate --json` now reports missing `openLink.url` values as `scenario.invalid` with `fieldPath: "$.steps[].url"`.
443
+ - `zmr validate --json` now reports missing `typeText.text` values as `scenario.invalid` with `fieldPath: "$.steps[].text"`.
444
+ - `zmr validate --json` now reports missing `swipe.x1`, `swipe.y1`, `swipe.x2`, and `swipe.y2` values as `scenario.invalid` with field-specific `fieldPath` values.
445
+
446
+ ### Changed
447
+
448
+ - README now links to install, demo, schema, and roadmap materials.
449
+ - Protocol documentation now includes concrete request/response examples and error shapes.
450
+ - Protocol versioning now defines the pre-`v1.0.0` compatibility contract and breaking-change policy.
451
+ - Android `openLink` now avoids blocking `am start -W`, retries when Android leaves the launcher foregrounded, and lets selector waits absorb transient observation command timeouts.
452
+ - iOS simulators are supported for lifecycle, snapshots, logs, deep links,
453
+ clear-state-by-uninstall, and selector-driven XCTest shim interaction.
454
+ - iOS XCTest shim commands now retry once when Xcode/CoreSimulator reports a
455
+ transient server bootstrap failure, reducing fresh-simulator flake while
456
+ preserving immediate failures for real command and assertion errors.
457
+ - Physical iOS devices are supported for local lifecycle and selector-grade
458
+ XCTest shim interaction. Screenshot artifacts use the XCTest shim; log
459
+ capture remains simulator-first.
460
+ - npm package contents now exclude internal test sources, caches, traces, and
461
+ build outputs while keeping runtime source, prebuilds, docs, examples, shims,
462
+ schemas, viewer assets, release scripts, and language clients available.
463
+ - Shipped TypeScript and Rust client metadata now matches the runner
464
+ `0.1.0-dev.1` prerelease, with package tests guarding future drift.
465
+
466
+ ### Known Limitations
467
+
468
+ - Physical iOS log capture is not complete yet.
469
+ - Broad cloud-device-farm certification is not included in this dev-preview
470
+ release.
471
+ - Real app benchmark claims should be made from private app-local
472
+ `zmr-compare-benchmarks` reports, not from generic public fixtures.
473
+
474
+ ## 0.1.0-dev.1
475
+
476
+ Initial local dev preview:
477
+
478
+ - Zig CLI and JSON-RPC runner.
479
+ - Android ADB/UI Automator adapter.
480
+ - iOS simulator lifecycle, snapshots, logs, deep links, and selector-driven
481
+ XCTest shim preview.
482
+ - Scenario runner with waits, assertions, selectors, retries, and trace writing.
483
+ - Fake-device test harness and no-emulator demo.
484
+ - Release archive script and CI workflows.
@@ -0,0 +1,42 @@
1
+ # Contributing
2
+
3
+ ZMR is a Zig-first mobile test runner for external agents and local test files.
4
+ Keep changes small, typed, traceable, and covered by tests.
5
+
6
+ ## Local Checks
7
+
8
+ Run the focused checks for your change first, then run the release gate before a
9
+ PR:
10
+
11
+ ```bash
12
+ zig fmt --check build.zig src
13
+ bash -n scripts/*.sh tests/*.sh
14
+ bash tests/benchmark-results-test.sh
15
+ bash tests/android-emulator-script-test.sh
16
+ bash tests/android-pilot-script-test.sh
17
+ bash tests/ios-pilot-script-test.sh
18
+ bash tests/release-metadata-test.sh
19
+ bash tests/homebrew-formula-test.sh
20
+ node --test tests/viewer-parser.test.mjs tests/npm-package.test.mjs
21
+ bash tests/public-safety-test.sh
22
+ zig test src/main.zig -target aarch64-macos.15.0
23
+ ./scripts/coverage.sh
24
+ ./scripts/build-release.sh
25
+ ./scripts/release-smoke.sh dist/*.tar.gz
26
+ npm pack --dry-run
27
+ ```
28
+
29
+ ## Test Expectations
30
+
31
+ - Keep Zig coverage at or above 90%.
32
+ - Add fake-device or fake-shim tests before emulator/simulator-only tests.
33
+ - Public examples must use generic app ids and fake data.
34
+ - Do not commit raw traces, private app identifiers, tokens, or screenshots.
35
+
36
+ ## Design Expectations
37
+
38
+ - Keep the public interface in scenario files, JSON-RPC, and documented CLI
39
+ flags.
40
+ - Keep platform shims behind adapter boundaries.
41
+ - Preserve ADB/simctl fallback behavior until native shims are proven stable.
42
+ - Prefer deterministic trace evidence over terminal-only diagnostics.
package/FEATURES.md ADDED
@@ -0,0 +1,112 @@
1
+ # Features
2
+
3
+ Zig Mobile Runner is a local, agent-native mobile test runner for Android,
4
+ iOS simulators, and physical iOS devices. It is designed for external agents and normal test files: ZMR
5
+ controls devices, exposes typed observations, executes actions, waits for UI
6
+ state, and writes deterministic traces. It does not embed an LLM.
7
+
8
+ ## Platform Support
9
+
10
+ - Android emulators and connected devices through ADB, UI Automator, and an
11
+ optional app-local instrumentation shim.
12
+ - Android emulator lifecycle helpers for boot, wait-ready, reset, snapshot
13
+ restore, optional AVD creation, and optional screen recording.
14
+ - iOS simulators through `xcrun simctl` for lifecycle, install, launch, deep
15
+ links, screenshots, logs, clear-state-by-uninstall, and device discovery.
16
+ - Physical iOS devices through `xcrun devicectl` for discovery, install,
17
+ launch, deep-link launch, clear-state-by-uninstall, and best-effort stop.
18
+ - iOS selector actions through an app-local XCTest/XCUIAutomation shim on
19
+ simulators and physical devices.
20
+
21
+ ## App Integration
22
+
23
+ - npm-first installation with `zig-mobile-runner` as a dev dependency.
24
+ - `npx zmr-wizard` scaffolds `.zmr/config.json`, Android and iOS smoke
25
+ scenarios, optional app package scripts, and `traces/` gitignore rules.
26
+ - `zmr init --app` provides the same app-local bootstrap for source and archive
27
+ installs.
28
+ - `.zmr/config.json` is schema validated, auto-discovered from app checkouts,
29
+ and overridden by explicit CLI flags.
30
+ - Android and iOS shim installers generate app-local commands and source files
31
+ without requiring ZMR state outside `.zmr/`.
32
+
33
+ ## Agent Interface
34
+
35
+ - JSON-RPC v1 over newline-delimited stdio or localhost TCP.
36
+ - MCP stdio server with mobile-native tools for AI agents, including semantic
37
+ snapshots, selector actions, waits, trace polling, and trace export.
38
+ - `runner.capabilities`, `device.list`, `session.create`,
39
+ `observe.snapshot`, `observe.semanticSnapshot`, UI actions, waits,
40
+ assertions, live trace events, and redacted trace export.
41
+ - TypeScript, Python, Go, Rust, Swift, and Kotlin reference clients.
42
+ - Machine-readable CLI output for `zmr version --json`, `zmr schemas --json`,
43
+ `zmr doctor --json`, `zmr devices --json`, `zmr validate --json`,
44
+ `zmr run --json`, and `zmr explain --json`.
45
+ - Public JSON Schemas for scenarios, snapshots, semantic snapshots, action
46
+ results, trace events, protocol messages, setup diagnostics, and release
47
+ manifests.
48
+
49
+ ## Scenario Execution
50
+
51
+ - JSON scenarios with launch, stop, clear state, open link, tap, type, erase
52
+ text, hide keyboard, swipe, back/home-equivalent navigation, waits,
53
+ assertions, snapshots, optional steps, conditionals, repeats, sleeps, and
54
+ scroll-until-visible.
55
+ - Selector matching for text, text contains, content description, resource id,
56
+ class name, role/class, enabled/visible/selected state, and bounds-aware
57
+ target validation.
58
+ - Wait and retry behavior around transient observation failures.
59
+ - Import helper for a documented subset of common mobile-flow YAML commands
60
+ into native `.zmr/*.json` scenarios.
61
+
62
+ ## Traces And Diagnostics
63
+
64
+ - Deterministic trace directories with `trace.json`, `events.jsonl`,
65
+ snapshots, screenshots, UI hierarchy artifacts, logs, timings, action inputs,
66
+ assertion results, and optional Android screen recordings.
67
+ - Static trace viewer with timeline, screenshot and UI tree inspection,
68
+ selected node details, payloads, artifact links, and snapshot replay
69
+ controls.
70
+ - `zmr explain` summarizes failed traces for humans and agents.
71
+ - Redacted `.zmrtrace` export can replace or omit screenshots, omit screen
72
+ recordings, and redact common secrets plus app-configured denylist fields.
73
+
74
+ ## Reliability And Benchmarks
75
+
76
+ - `zmr-benchmark` repeats ZMR scenarios with pass-rate, failure-count, and p95
77
+ duration gates.
78
+ - `zmr-benchmark-command` records normalized rows for app-local baseline
79
+ commands without hardcoding another tool.
80
+ - `zmr-compare-benchmarks` compares candidate and baseline rows into generic
81
+ reports.
82
+ - `zmr-device-matrix` runs local Android/iOS smoke gates across configured
83
+ devices.
84
+ - `zmr-pilot-gate` coordinates Android and iOS app-local pre-release pilot
85
+ checks.
86
+
87
+ ## Shipping Surface
88
+
89
+ - Release archive builder with checksums, SPDX SBOM, third-party notices,
90
+ generated Homebrew formula, and `RELEASE_MANIFEST.json`.
91
+ - npm package tarball generation with bundled prebuilt binaries.
92
+ - `zmr-release-readiness` checks release-candidate evidence for dev-preview,
93
+ production, or market-claim readiness before maintainers publish or make
94
+ competitive claims.
95
+ - Tagged release workflow with artifact attestation and optional npm
96
+ provenance publishing.
97
+ - Security, contribution, trace privacy, troubleshooting, protocol versioning,
98
+ app integration, benchmarking, and publication docs.
99
+ - Reusable agent skill under `skills/zmr-mobile-testing/`.
100
+
101
+ ## Current Limitations
102
+
103
+ - Current release status is `0.1.0`, a public developer preview rather than
104
+ a production-stable `1.0.0`.
105
+ - Physical iOS log capture is still simulator-first. Physical iOS screenshots
106
+ are available when the XCTest/XCUIAutomation shim is configured.
107
+ - Broad cloud device farm certification is out of scope for this preview.
108
+ - Public benchmark fixtures are generic. Performance claims for a real app
109
+ should come from equivalent app-local candidate and baseline runs.
110
+ - Screenshot and video redaction is conservative: redacted exports can replace
111
+ screenshots with placeholders or omit visual artifacts, but they do not mask
112
+ pixels inside original raw captures.