Skip to content

Commit 0789699

Browse files
committed
feat: add agent-friendly simulator CLI shortcuts
1 parent e90839a commit 0789699

16 files changed

Lines changed: 742 additions & 75 deletions

File tree

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ CLI commands automatically use the same warm daemon:
9595
simdeck list
9696
simdeck tap <udid> 0.5 0.5 --normalized
9797
simdeck describe <udid> --format agent --max-depth 2
98+
SIMDECK_DEVICE=<udid> simdeck tap "Continue"
99+
simdeck --device <udid> describe --format agent --max-depth 2 --interactive
98100
```
99101

100102
## Daemon
@@ -155,11 +157,13 @@ simdeck record <udid> --seconds 5 --output screen-recording.mp4
155157
simdeck stream <udid> --frames 120 > stream.h264
156158
simdeck describe <udid>
157159
simdeck describe <udid> --format agent --max-depth 4
160+
simdeck describe <udid> --format agent --max-depth 4 --interactive
158161
simdeck describe <udid> --point 120,240
159162
simdeck wait-for <udid> --label "Welcome" --timeout-ms 5000
160163
simdeck assert <udid> --id login.button --source auto --max-depth 8
161164
simdeck tap <udid> 120 240
162165
simdeck tap <udid> --label "Continue" --wait-timeout-ms 5000
166+
simdeck tap "Continue"
163167
simdeck swipe <udid> 200 700 200 200
164168
simdeck gesture <udid> scroll-down
165169
simdeck pinch <udid> --start-distance 160 --end-distance 80
@@ -214,9 +218,11 @@ external tools such as `ffplay`.
214218
Flutter, or UIKit in-app inspectors, then falls back to the built-in private
215219
CoreSimulator accessibility bridge. Use `--format agent` or
216220
`--format compact-json` for
217-
lower-token hierarchy dumps. Coordinate commands accept screen coordinates from
218-
the accessibility tree by default; pass `--normalized` to send `0.0..1.0`
219-
coordinates directly.
221+
lower-token hierarchy dumps, and add `--interactive`/`-i` when an agent only
222+
needs actionable elements plus their ancestors. `describe` and `tap` can infer a
223+
target from `--device`, `SIMDECK_DEVICE`, `SIMDECK_UDID`, or the only booted
224+
simulator. Coordinate commands accept screen coordinates from the accessibility
225+
tree by default; pass `--normalized` to send `0.0..1.0` coordinates directly.
220226

221227
## JS/TS Tests
222228

docs/api/rest.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ Touch, edge-touch, and multi-touch coordinates are normalized from `0.0` to `1.0
207207

208208
Tree query parameters:
209209

210-
| Parameter | Values |
211-
| --------------- | --------------------------------------------------------------------------------------------------------- |
212-
| `source` | `auto`, `nativescript`, `react-native`, `flutter`, `swiftui`, `uikit`, `native-ax`, `android-uiautomator` |
213-
| `maxDepth` | Integer depth limit |
214-
| `includeHidden` | `true` or `false` |
210+
| Parameter | Values |
211+
| ----------------- | --------------------------------------------------------------------------------------------------------- |
212+
| `source` | `auto`, `nativescript`, `react-native`, `flutter`, `swiftui`, `uikit`, `native-ax`, `android-uiautomator` |
213+
| `maxDepth` | Integer depth limit |
214+
| `includeHidden` | `true` or `false` |
215+
| `interactiveOnly` | `true` keeps actionable elements plus their ancestors |
215216

216217
Point query parameters:
217218

docs/cli/commands.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ simdeck toggle-appearance <udid>
6969
```sh
7070
simdeck describe <udid>
7171
simdeck describe <udid> --format agent --max-depth 4
72+
simdeck describe <udid> --format agent --max-depth 4 --interactive
7273
simdeck describe <udid> --format compact-json
7374
simdeck describe <udid> --source nativescript
7475
simdeck describe <udid> --source react-native
@@ -80,7 +81,7 @@ simdeck wait-for <udid> --label "Welcome" --timeout-ms 5000
8081
simdeck assert <udid> --id login.button --source auto --max-depth 8
8182
```
8283

83-
Default source selection prefers a connected framework inspector, then the Swift in-app agent, then native accessibility.
84+
Default source selection prefers a connected framework inspector, then the Swift in-app agent, then native accessibility. Use `--interactive` or `-i` to keep actionable elements and the ancestor context needed to find them. For quick agent loops, `describe` can infer the device from `--device`, `SIMDECK_DEVICE`, `SIMDECK_UDID`, or the only booted simulator.
8485

8586
## Performance
8687

@@ -97,12 +98,13 @@ Performance data is simulator-only and uses host-process telemetry for matching
9798

9899
## Input
99100

100-
Coordinates are screen points unless `--normalized` is present.
101+
Coordinates are screen points unless `--normalized` is present. `tap "Continue"` is shorthand for a label tap on the inferred device. Use `--device <udid>` or `SIMDECK_DEVICE=<udid>` when more than one simulator is booted.
101102

102103
```sh
103104
simdeck tap <udid> 120 240
104105
simdeck tap <udid> 0.5 0.5 --normalized
105106
simdeck tap <udid> --label "Continue" --wait-timeout-ms 5000
107+
simdeck tap "Continue"
106108
simdeck swipe <udid> 200 700 200 200
107109
simdeck gesture <udid> scroll-down
108110
simdeck pinch <udid> --start-distance 160 --end-distance 80

docs/cli/flags.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,38 @@ simdeck daemon start --help
1010

1111
## Global
1212

13-
| Flag | Env | Purpose |
14-
| -------------------- | -------------------- | -------------------------------- |
15-
| `--server-url <url>` | `SIMDECK_SERVER_URL` | Target a specific running daemon |
13+
| Flag | Env | Purpose |
14+
| --------------------- | -------------------- | ---------------------------------------------- |
15+
| `--server-url <url>` | `SIMDECK_SERVER_URL` | Target a specific running daemon |
16+
| `--device <selector>` | `SIMDECK_DEVICE` | Default simulator for inferred-device commands |
1617

1718
## Server Options
1819

1920
Used by `simdeck ui`, `daemon start`, `daemon restart`, `service on`, and `service restart`.
2021

2122
| Flag | Default | Notes |
22-
| ---------------------------- | -------------- | ----------------------------------------------------------------------------------- | ------ | ------------ |
23+
| ---------------------------- | -------------- | ----------------------------------------------------------------------------------- |
2324
| `--port <port>` | `4310` | HTTP port. LaunchAgent service commands probe up to 4320 when this port is occupied |
2425
| `--bind <ip>` | `127.0.0.1` | Use `0.0.0.0` or `::` for LAN access |
2526
| `--advertise-host <host>` | detected | Host printed for remote browsers |
2627
| `--client-root <path>` | bundled client | Static client directory |
27-
| `--video-codec auto | hardware | software` | `auto` | Encoder mode |
28+
| `--video-codec <mode>` | `auto` | `auto`, `hardware`, or `software` |
2829
| `--stream-quality <profile>` | `full` | `full`, `balanced`, `economy`, `low`, `tiny`, `ci-software`, and related profiles |
2930
| `--local-stream-fps <fps>` | `60` | Local stream frame target |
3031
| `--low-latency` | off | Conservative software H.264 profile |
3132
| `--open` | off | `ui` only |
3233

3334
## `describe`
3435

35-
| Flag | Purpose |
36-
| ------------------ | ------------------------------------------------- | ------------ | ------------------- | ----- | --------- | -------------------- | --------------------- |
37-
| `--format json | compact-json | agent` | Choose output shape |
38-
| `--source auto | nativescript | react-native | flutter | uikit | native-ax | android-uiautomator` | Pick inspector source |
39-
| `--max-depth <n>` | Trim hierarchy depth |
40-
| `--include-hidden` | Include hidden nodes when supported |
41-
| `--point <x>,<y>` | Describe the element at a screen point |
42-
| `--direct` | Skip daemon and use native accessibility directly |
36+
| Flag | Purpose |
37+
| --------------------- | ------------------------------------------------------------------------------------------------- |
38+
| `--format <format>` | `json`, `compact-json`, or `agent` |
39+
| `--source <source>` | `auto`, `nativescript`, `react-native`, `flutter`, `uikit`, `native-ax`, or `android-uiautomator` |
40+
| `--max-depth <n>` | Trim hierarchy depth |
41+
| `--include-hidden` | Include hidden nodes when supported |
42+
| `-i`, `--interactive` | Keep only actionable elements plus ancestors |
43+
| `--point <x>,<y>` | Describe the element at a screen point |
44+
| `--direct` | Skip daemon and use native accessibility directly |
4345

4446
## Input
4547

docs/cli/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ simdeck install <udid> /path/to/App.ipa
3737
simdeck launch <udid> com.example.App
3838
simdeck open-url <udid> https://example.com
3939
simdeck tap <udid> --label "Continue" --wait-timeout-ms 5000
40-
simdeck describe <udid> --format agent --max-depth 3
40+
simdeck tap "Continue"
41+
simdeck describe <udid> --format agent --max-depth 3 --interactive
4142
simdeck screenshot <udid> --output screen.png
4243
simdeck screenshot <udid> --with-bezel --output screen-bezel.png
4344
simdeck record <udid> --seconds 5 --output screen-recording.mp4
@@ -46,6 +47,8 @@ simdeck stats <udid>
4647
simdeck sample <udid> --seconds 3
4748
```
4849

50+
`tap` and `describe` can infer their simulator from `--device`, `SIMDECK_DEVICE`, `SIMDECK_UDID`, or the only booted simulator.
51+
4952
Most successful commands print JSON so they can be piped into tools such as `jq`.
5053

5154
## Help

docs/guide/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ simdeck install <udid> /path/to/App.app
3030
simdeck install <udid> /path/to/App.ipa
3131
simdeck launch <udid> com.example.App
3232
simdeck tap <udid> --label "Continue" --wait-timeout-ms 5000
33-
simdeck describe <udid> --format agent --max-depth 3
33+
simdeck tap "Continue"
34+
simdeck describe <udid> --format agent --max-depth 3 --interactive
3435
```
3536

3637
Use `simdeck -d` for a detached background daemon, `simdeck -k` to stop it, and `simdeck -r` to restart it.

docs/guide/quick-start.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Use selectors when you want automation to wait for UI state:
6666

6767
```sh
6868
simdeck tap <udid> --label "Continue" --wait-timeout-ms 5000
69-
simdeck describe <udid> --format agent --max-depth 3
69+
simdeck tap "Continue"
70+
simdeck describe <udid> --format agent --max-depth 3 --interactive
7071
```
7172

7273
## 5. Keep It Running In The Background

docs/inspector/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ Use the built-in accessibility fallback for any app. Add an in-app inspector whe
2020
```sh
2121
simdeck describe <udid>
2222
simdeck describe <udid> --format agent --max-depth 3
23+
simdeck describe <udid> --format agent --max-depth 3 --interactive
2324
simdeck describe <udid> --source native-ax
2425
simdeck describe <udid> --source react-native
2526
```
2627

27-
`auto` source selection uses the best available source and falls back to accessibility.
28+
`auto` source selection uses the best available source and falls back to accessibility. Add `--interactive` or `-i` for a smaller agent-oriented tree of actionable elements plus ancestors.
2829

2930
## Use From The Browser
3031

packages/simdeck-test/dist/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type QueryOptions = {
1111
source?: "auto" | "nativescript" | "react-native" | "flutter" | "swiftui" | "uikit" | "native-ax" | "android-uiautomator";
1212
maxDepth?: number;
1313
includeHidden?: boolean;
14+
interactiveOnly?: boolean;
1415
};
1516
export type ElementSelector = {
1617
text?: string;

packages/simdeck-test/dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ function treeQuery(options = {}) {
524524
params.set("maxDepth", String(options.maxDepth));
525525
if (options.includeHidden)
526526
params.set("includeHidden", "true");
527+
if (options.interactiveOnly)
528+
params.set("interactiveOnly", "true");
527529
return params.toString();
528530
}
529531
function logsQuery(options = {}) {

0 commit comments

Comments
 (0)