emd-agents 0.0.0-stage → 0.14.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 (77) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +121 -2
  4. package/dist/adapters/expo/index.d.ts +3 -0
  5. package/dist/adapters/expo/index.js +55 -0
  6. package/dist/bin.d.ts +2 -0
  7. package/dist/bin.js +11 -0
  8. package/dist/cli/main.d.ts +1 -0
  9. package/dist/cli/main.js +265 -0
  10. package/dist/core/adapter.d.ts +32 -0
  11. package/dist/core/adapter.js +3 -0
  12. package/dist/core/check.d.ts +20 -0
  13. package/dist/core/check.js +214 -0
  14. package/dist/core/checkrecord.d.ts +22 -0
  15. package/dist/core/checkrecord.js +34 -0
  16. package/dist/core/detect.d.ts +2 -0
  17. package/dist/core/detect.js +27 -0
  18. package/dist/core/device/axe.d.ts +10 -0
  19. package/dist/core/device/axe.js +66 -0
  20. package/dist/core/device/backend.d.ts +43 -0
  21. package/dist/core/device/backend.js +72 -0
  22. package/dist/core/device/maestro.d.ts +4 -0
  23. package/dist/core/device/maestro.js +86 -0
  24. package/dist/core/device/screen.d.ts +9 -0
  25. package/dist/core/device/screen.js +7 -0
  26. package/dist/core/doctor.d.ts +12 -0
  27. package/dist/core/doctor.js +70 -0
  28. package/dist/core/evidence.d.ts +9 -0
  29. package/dist/core/evidence.js +107 -0
  30. package/dist/core/gc.d.ts +22 -0
  31. package/dist/core/gc.js +172 -0
  32. package/dist/core/index.d.ts +17 -0
  33. package/dist/core/index.js +16 -0
  34. package/dist/core/input.d.ts +15 -0
  35. package/dist/core/input.js +59 -0
  36. package/dist/core/isolate.d.ts +4 -0
  37. package/dist/core/isolate.js +43 -0
  38. package/dist/core/jobs.d.ts +21 -0
  39. package/dist/core/jobs.js +114 -0
  40. package/dist/core/jobstore.d.ts +21 -0
  41. package/dist/core/jobstore.js +45 -0
  42. package/dist/core/launch.d.ts +8 -0
  43. package/dist/core/launch.js +273 -0
  44. package/dist/core/log.d.ts +5 -0
  45. package/dist/core/log.js +54 -0
  46. package/dist/core/logs.d.ts +19 -0
  47. package/dist/core/logs.js +122 -0
  48. package/dist/core/owned.d.ts +19 -0
  49. package/dist/core/owned.js +91 -0
  50. package/dist/core/probe.d.ts +2 -0
  51. package/dist/core/probe.js +14 -0
  52. package/dist/core/process.d.ts +10 -0
  53. package/dist/core/process.js +32 -0
  54. package/dist/core/project.d.ts +6 -0
  55. package/dist/core/project.js +76 -0
  56. package/dist/core/registry.d.ts +3 -0
  57. package/dist/core/registry.js +13 -0
  58. package/dist/core/result.d.ts +248 -0
  59. package/dist/core/result.js +147 -0
  60. package/dist/core/run.d.ts +15 -0
  61. package/dist/core/run.js +22 -0
  62. package/dist/core/setup.d.ts +29 -0
  63. package/dist/core/setup.js +202 -0
  64. package/dist/core/simulator.d.ts +21 -0
  65. package/dist/core/simulator.js +107 -0
  66. package/dist/core/state.d.ts +2 -0
  67. package/dist/core/state.js +9 -0
  68. package/dist/core/tool.d.ts +5 -0
  69. package/dist/core/tool.js +54 -0
  70. package/dist/core/version.d.ts +1 -0
  71. package/dist/core/version.js +5 -0
  72. package/dist/core/workspace.d.ts +1 -0
  73. package/dist/core/workspace.js +109 -0
  74. package/dist/mcp/server.d.ts +1 -0
  75. package/dist/mcp/server.js +188 -0
  76. package/package.json +58 -4
  77. package/skills/emd/SKILL.md +35 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ EMD: Everything Mobile Development
2
+ Copyright 2026 Andrew Henin
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
package/README.md CHANGED
@@ -1,3 +1,122 @@
1
- # Temporary Holding Version
1
+ # EMD: Everything Mobile Development
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ EMD is an MCP server and CLI. It lets a coding agent launch an Expo app on the iOS simulator, check it, and collect evidence.
4
+
5
+ Status: early.
6
+
7
+ ## What works today
8
+
9
+ Stack: Expo (React Native). `detect` reports iOS and Android. `launch` runs on the iOS simulator only.
10
+
11
+ MCP tools (`emd mcp`):
12
+
13
+ - `detect`: finds the stack, platforms, app IDs, run commands and package manager of a folder. At a workspace root, it lists the app folders instead (`apps`).
14
+ - `launch`: builds the app, installs and opens it on an iOS simulator, and keeps its dev server running. Returns a job at once.
15
+ - `job_status`: the state of a job (queued, running, succeeded, failed) and, at the end, its result.
16
+ - `logs`: the `[EMD:<tag>]` lines that the app wrote during the run of a launch job.
17
+ - `tap`, `type`, `swipe`: act on the launched app. `tap` takes a testID, a visible text or a point. Each says which tool did it (AXe or Maestro).
18
+ - `check`: passes or fails a run from tagged log lines and on-screen elements (by testID or text). Returns a job.
19
+ - `evidence`: puts the checks, log lines, screenshots and Maestro flows of a run in one folder.
20
+
21
+ CLI commands (`npx -y emd-agents@latest <command>`, or `node dist/bin.js <command>` in a clone; below, `emd` means either):
22
+
23
+ - `detect [dir]`: same as the tool.
24
+ - `launch [dir] [--device X] [--timeout N]`: same as the tool, but waits for the result.
25
+ - `job status <id>`: reads a job.
26
+ - `logs <jobId> [--tag T] [--limit N]`: same as the tool.
27
+ - `check <jobId> [--log TAG[=TEXT]] [--element id=X|text=Y] [--name N] [--agent pass|fail]`: same as the tool, but waits.
28
+ - `check reset [dir]`: clears the failed-check count. A person must type `reset` at a terminal.
29
+ - `evidence <jobId>`: same as the tool.
30
+ - `gc [--apply]`: lists, then removes, what EMD made for app folders that no longer exist.
31
+ - `tap <jobId> --id X|--text Y|--x N --y N`, `type <jobId> <text>`, `swipe <jobId> up|down|left|right`: same as the tools.
32
+ - `setup [--dry-run] [--yes] [--agent X]`: registers EMD with your agents and installs the skill (see below).
33
+ - `doctor`: checks that this Mac has what EMD needs (Node, macOS, Xcode, an iPhone simulator, AXe or Maestro) and says how to add what is missing.
34
+ - `mcp`: starts the MCP server on stdio.
35
+
36
+ ## Requirements
37
+
38
+ - An Expo app with `expo` in package.json and `ios.bundleIdentifier` in its app config (app.json, app.config.js or app.config.ts). EMD reads it with the app's own `expo config`. Without the ID, `launch` stops: "No iOS app ID found".
39
+ - The app's dependencies, installed. EMD does not install them.
40
+ - macOS. On other systems `detect` works, and `launch` returns "iOS simulators need macOS."
41
+ - Xcode, tested with Xcode 26 and 27. Expo SDK 58 apps need Xcode 26 or newer. Without Xcode, `launch` fails: "Could not set up this worktree's simulator and build folders."
42
+ - An iOS simulator runtime and at least one shut-down iPhone simulator. EMD clones it once per app folder, as `emd-<key>`. Without one, `launch` fails: "No shut-down iPhone simulator is available to clone."
43
+ - Node 22 or newer.
44
+ - AXe or Maestro, for taps, typing, swipes and element checks. EMD tries AXe first, then Maestro.
45
+ - AXe (about 40 times faster for checks, 60 for taps): `setup` installs it (below). With Xcode 27, Device Hub must be running.
46
+ - Maestro: `curl -fsSL "https://get.maestro.mobile.dev" | bash`. It needs Java 17 or newer, with `JAVA_HOME` set.
47
+ - With neither, taps, typing and swipes fail, and a check with elements returns `error`. `launch`, `logs`, log checks and `evidence` still work.
48
+
49
+ ## Install
50
+
51
+ ```sh
52
+ npx -y emd-agents@latest setup
53
+ ```
54
+
55
+ It finds Claude Code, Codex and Cursor, prints its plan and asks once. On a Mac without AXe, it first installs AXe into `~/.emd/tools/`, from AXe's pinned release archive, checked by SHA-256. Then it registers EMD with each agent and installs EMD's skill, which tells the agent how to use it. It backs up each config to `~/.emd/backups/` first. At the end it runs `doctor` and lists what is still missing. Restart your agents afterwards.
56
+
57
+ - `--dry-run` prints the plan and changes nothing. `--yes` applies it without asking. `--agent codex` (repeatable) picks agents.
58
+ - It registers this exact version, `npx -y emd-agents@<version> mcp`, so the server matches the skill. To upgrade, run the same command again.
59
+ - It calls two installers, pinned: [add-mcp](https://github.com/neondatabase/add-mcp) for the server and [skills](https://github.com/vercel-labs/skills) for the skill.
60
+
61
+ ## Install from source
62
+
63
+ ```sh
64
+ git clone https://github.com/andrewhenin/emd.git
65
+ cd emd
66
+ npm ci
67
+ npm run build
68
+ node dist/bin.js detect fixtures/expo
69
+ ```
70
+
71
+ The last line must print `"verdict":"detected"` and `"appIds":{"ios":"com.emd.sandbox"}`. Then `node dist/bin.js setup` registers this clone's build with your agents.
72
+
73
+ ## First run
74
+
75
+ 1. In your app, log an event with a tag, for example `console.log("[EMD:ready] home shown")`. Give a testID to each element that you want to check.
76
+ 2. Ask your agent, with the full path of your app:
77
+
78
+ > Use the emd tools on /path/to/my-app. Launch it on the iOS simulator. Check that the `ready` log event fired and that the element with testID `home` is on screen. Then gather the evidence and tell me the folder.
79
+
80
+ The agent follows EMD's skill (`skills/emd/SKILL.md`): `launch`, wait for the job with `job_status`, `tap`, read `logs`, `check`, then `evidence`. A check's verdict is `passed`, `failed` (fix and check again), `stopped` (3 failed checks: stop and report) or `error` (the check could not run).
81
+
82
+ Output stays on your Mac:
83
+
84
+ - Each launch has a run folder, `$TMPDIR/emd/runs/<time>-<app folder>/`. The launch result gives it as `logDir`. It holds `build.log`, `metro.log`, the app's log (`app.ndjson`), the check screenshots, and `evidence/` (`manifest.json`, `logs.json`, `screenshots/`, `flows/`).
85
+ - Jobs are in `$TMPDIR/emd/jobs/<jobId>.json`.
86
+ - Data that must stay after a restart is in `~/.emd/`: the record of what EMD made (`owned/`), build folders (`derived/`) and failed-check counts (`checks/`).
87
+
88
+ ## Clean up
89
+
90
+ `gc` removes what EMD made for app folders that no longer exist, for example a deleted git worktree: the simulator clone and its `~/.emd/` folders. It removes only what EMD recorded as its own. For a folder that still exists, it removes nothing. It is a CLI command only, not an MCP tool.
91
+
92
+ ```sh
93
+ emd gc # dry run: lists what it would remove, and the size
94
+ emd gc --apply # removes it
95
+ ```
96
+
97
+ - It lists `emd-*` simulators that no record names, but it never deletes them.
98
+ - It does not touch `$TMPDIR/emd` or a dev server that runs.
99
+
100
+ ## Limits today
101
+
102
+ - Expo apps on the iOS simulator only. No native iOS or Android projects, no Android launch, no physical devices.
103
+ - `launch` leaves the dev server running. The next `launch` of the same folder stops it and starts a new one. A dev server that EMD did not start on that port still blocks `launch` ("Port N already serves a dev server").
104
+ - After 3 failed checks in one app folder, `check` returns `stopped`. Only a person can start over: `emd check reset /path/to/my-app` at a terminal. `EMD_RETRY_LIMIT` (1 to 10) changes the limit.
105
+ - A build can take 900 seconds by default (`timeoutSeconds`, or `--timeout` in the CLI). Two cold builds at the same time can take longer.
106
+ - The CLI `launch` waits and does not make a job. `logs`, `check` and `evidence` need the `jobId` of a `launch` that the agent started.
107
+
108
+ ## Report a problem
109
+
110
+ Open an [issue](https://github.com/andrewhenin/emd/issues) with:
111
+
112
+ - What you asked the agent, and the tool or command that failed, with its JSON result.
113
+ - Versions: EMD's (the `emd-agents@<version>` in your agent's MCP config, or `node dist/bin.js` and `git rev-parse --short HEAD` in a clone), `sw_vers` (macOS), `xcodebuild -version`, `node --version`, and `axe --version` or `maestro --version` if you use them.
114
+ - The output of `emd detect /path/to/my-app`.
115
+ - From the run folder: `build.log` and `metro.log`, or the lines near the error.
116
+ - Before you attach logs or screenshots, remove private details: names, tokens, keys, internal URLs and user data.
117
+
118
+ ## Contributing
119
+
120
+ EMD is open source but not accepting outside pull requests yet. Bug reports and ideas are welcome as issues; report vulnerabilities per [SECURITY.md](SECURITY.md).
121
+
122
+ License: [Apache-2.0](LICENSE)
@@ -0,0 +1,3 @@
1
+ import { type StackAdapter } from "../../core/index.js";
2
+ declare const adapter: StackAdapter;
3
+ export default adapter;
@@ -0,0 +1,55 @@
1
+ import { createRequire } from "node:module";
2
+ import { join } from "node:path";
3
+ import { runTool } from "../../core/index.js";
4
+ // The config as Expo resolves it (app.json, app.config.js or app.config.ts),
5
+ // from the project's installed Expo CLI. Node's resolution finds a hoisted
6
+ // install and never downloads one, as `npx expo` would.
7
+ async function readExpoConfig(dir) {
8
+ try {
9
+ const cli = createRequire(join(dir, "package.json")).resolve("expo/bin/cli");
10
+ const { stdout } = await runTool("expo config", process.execPath, [cli, "config", dir, "--json"], 60);
11
+ return JSON.parse(stdout) ?? {};
12
+ }
13
+ catch {
14
+ return {};
15
+ }
16
+ }
17
+ const isPlatform = (value) => value === "ios" || value === "android";
18
+ const nonEmpty = (value) => typeof value === "string" && value !== "" ? value : undefined;
19
+ const adapter = {
20
+ id: "expo",
21
+ async detect(dir, project) {
22
+ const config = await readExpoConfig(dir);
23
+ const declared = Array.isArray(config.platforms)
24
+ ? [...new Set(config.platforms.filter(isPlatform))]
25
+ : [];
26
+ const platforms = declared.length > 0 ? declared : ["ios", "android"];
27
+ const appIds = {};
28
+ const ios = nonEmpty(config.ios?.bundleIdentifier);
29
+ const android = nonEmpty(config.android?.package);
30
+ if (ios && platforms.includes("ios"))
31
+ appIds.ios = ios;
32
+ if (android && platforms.includes("android"))
33
+ appIds.android = android;
34
+ const expo = `${project.exec} expo`;
35
+ const run = {};
36
+ for (const platform of platforms)
37
+ run[platform] = `${expo} run:${platform}`;
38
+ return {
39
+ stack: "expo",
40
+ platforms,
41
+ appIds,
42
+ commands: { run, server: `${expo} start` },
43
+ };
44
+ },
45
+ launchPlan(project, { platform, deviceId, port }) {
46
+ if (platform !== "ios")
47
+ return undefined;
48
+ const expo = `${project.exec} expo`;
49
+ return {
50
+ server: `${expo} start --port ${port}`,
51
+ build: `${expo} run:ios --device ${deviceId} --no-bundler`,
52
+ };
53
+ },
54
+ };
55
+ export default adapter;
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "./cli/main.js";
3
+ // Composition root: the only file that knows about both the CLI and the MCP
4
+ // server. The server loads on demand so CLI commands never pay for the SDK.
5
+ const args = process.argv.slice(2);
6
+ if (args[0] === "mcp") {
7
+ (await import("./mcp/server.js")).startServer();
8
+ }
9
+ else {
10
+ process.exitCode = await run(args);
11
+ }
@@ -0,0 +1 @@
1
+ export declare function run(argv: string[]): Promise<number>;