### Launch Application Source: https://simdeck.sh/guide Start an installed application on the device using its bundle ID. ```bash simdeck launch com.example.App ``` -------------------------------- ### Install App Source: https://simdeck.sh/api/rest Installs an application on a simulator using a provided app path. ```APIDOC ## POST /api/simulators/{udid}/install ### Description Installs an application on a simulator using a provided app path. ### Method POST ### Endpoint /api/simulators/{udid}/install ### Parameters #### Path Parameters - **udid** (string) - Required - The unique identifier of the simulator. #### Request Body - **appPath** (string) - Required - The path to the application file (e.g., "/path/to/App.app"). ``` -------------------------------- ### Install and Manage Applications Source: https://simdeck.sh/cli/commands Commands for installing, uninstalling, and launching applications on simulators. Supports .app, .ipa, and .apk formats. ```bash simdeck install /path/to/App.app ``` ```bash simdeck install /path/to/App.ipa ``` ```bash simdeck install android: /path/to/app.apk ``` ```bash simdeck uninstall com.example.App ``` ```bash simdeck launch com.example.App ``` ```bash simdeck open-url https://example.com ``` ```bash simdeck toggle-appearance ``` -------------------------------- ### Clone and Install SimDeck Source: https://simdeck.sh/contributing Clone the SimDeck repository, navigate into the directory, install dependencies, and build the project. ```shell git clone https://github.com/NativeScript/SimDeck.git cd SimDeck npm install npm run build ``` -------------------------------- ### Start Simulator Screen Recording Source: https://simdeck.sh/api/rest Start an MP4 screen recording for the simulator and return a recording ID. ```APIDOC ## POST /api/simulators/{udid}/screen-recording/start ### Description Start MP4 recording and return `recordingId`. ### Method POST ### Endpoint /api/simulators/{udid}/screen-recording/start ``` -------------------------------- ### Develop Documentation Locally Source: https://simdeck.sh/contributing Start a local development server to preview the documentation site. ```shell npm run docs:dev ``` -------------------------------- ### Install App Upload Source: https://simdeck.sh/api/rest Installs an application on a simulator by uploading raw app bytes. Supports .ipa for iOS and .apk for Android. ```APIDOC ## POST /api/simulators/{udid}/install-upload ### Description Installs an application on a simulator by uploading raw app bytes. Supports .ipa for iOS and .apk for Android. This endpoint is intended for browser clients. ### Method POST ### Endpoint /api/simulators/{udid}/install-upload ### Parameters #### Path Parameters - **udid** (string) - Required - The unique identifier of the simulator. #### Request Body - Raw `.ipa` or `.apk` bytes. The filename should be provided via the `x-simdeck-filename` header. ``` -------------------------------- ### Start Camera Feed Source: https://simdeck.sh/cli Starts a camera feed for a specific application, using a provided video file. ```bash simdeck camera start com.example.App --file /absolute/path/to/feed.mov ``` -------------------------------- ### Install React Native SimDeck Source: https://simdeck.sh/inspector/react-native Install the `react-native-simdeck` package and run pod install for iOS. ```sh npm install react-native-simdeck cd ios && pod install ``` -------------------------------- ### Start SimDeck with Hostname or IP Source: https://simdeck.sh/guide/lan-access Demonstrates starting SimDeck by advertising different types of host identifiers that remote devices can resolve. Choose an IP address or hostname reachable by the remote device. ```shell simdeck --bind 0.0.0.0 --advertise-host my-mac.local --open ``` ```shell simdeck --bind 0.0.0.0 --advertise-host 192.168.1.50 --open ``` ```shell simdeck --bind 0.0.0.0 --advertise-host 100.101.102.103 --open ``` -------------------------------- ### Install Application Source: https://simdeck.sh/guide Install an application package onto the selected device. Supports both .app (iOS) and .ipa (iOS) formats. ```bash simdeck install /path/to/App.app ``` ```bash simdeck install /path/to/App.ipa ``` -------------------------------- ### Hierarchy Request Example Source: https://simdeck.sh/api/inspector-protocol Example of a request to get the UI hierarchy with specific parameters. ```APIDOC ## Hierarchy request ```json { "id": 2, "method": "View.getHierarchy", "params": { "includeHidden": false, "maxDepth": 20, "source": "uikit" } } ``` Framework runtimes may return logical nodes with source locations: ```json { "type": "Label", "title": "Continue", "sourceLocation": { "file": "src/app/home.component.html", "line": 12, "column": 5 } } ``` ``` -------------------------------- ### Install and Launch Apps with SimDeck Source: https://simdeck.sh/guide/quick-start Install application packages (.app or .ipa for iOS, .apk for Android) and launch them using the SimDeck CLI. For Android, specify the emulator name prefixed with 'android:'. ```sh simdeck install /path/to/App.app simdeck install /path/to/App.ipa simdeck launch com.example.App simdeck open-url myapp://debug ``` ```sh simdeck install android: /path/to/app.apk simdeck launch android: com.example.app ``` -------------------------------- ### Boot a Device Source: https://simdeck.sh/guide Start a simulator or emulator using 'simdeck boot '. Ensure the device is not already running. ```bash simdeck boot ``` -------------------------------- ### Install x264 Dependency Source: https://simdeck.sh/guide/installation Install the `x264` library using Homebrew, a prerequisite for building SimDeck from source. ```shell brew install x264 ``` -------------------------------- ### Action Request Example Source: https://simdeck.sh/api/inspector-protocol Example of a request to perform an action on a specific view. ```APIDOC ## Actions ```json { "id": 3, "method": "View.perform", "params": { "id": "view:0x1234", "action": "tap" } } ``` Common actions include `tap`, `focus`, `resignFirstResponder`, `setText`, `setValue`, `toggle`, `scrollBy`, and `scrollTo`. Support depends on the inspector runtime and selected view. ``` -------------------------------- ### Run Development Server Source: https://simdeck.sh/contributing Start the SimDeck development server for active development. ```shell npm run dev ``` -------------------------------- ### Enable Autostart Login Source: https://simdeck.sh/guide Configure SimDeck to automatically start and log in on system startup using the '-a' flag. ```bash simdeck -a ``` -------------------------------- ### Build SimDeck from Source Source: https://simdeck.sh/guide/installation Clone the SimDeck repository, install dependencies, and build the project from source. This process includes installing Rust stable. ```shell git clone https://github.com/NativeScript/SimDeck.git cd SimDeck npm install npm run build ./build/simdeck ``` -------------------------------- ### Install SimDeck CLI Source: https://simdeck.sh/ Install the SimDeck CLI globally using npm. This command is used to manage simulators from your command line. ```bash npm i -g simdeck@latest ``` -------------------------------- ### View Hierarchy Request Example Source: https://simdeck.sh/api/inspector-protocol Shows a request to get the UI hierarchy, with options to include hidden views, set maximum depth, and specify the source. Framework runtimes may return logical nodes with source locations. ```json { "id": 2, "method": "View.getHierarchy", "params": { "includeHidden": false, "maxDepth": 20, "source": "uikit" } } ``` ```json { "type": "Label", "title": "Continue", "sourceLocation": { "file": "src/app/home.component.html", "line": 12, "column": 5 } } ``` -------------------------------- ### Start and Control SimDeck Service Source: https://simdeck.sh/cli/commands Use these commands to start, manage, and control the SimDeck background service. Specify ports, enable autostart, or view service status. ```bash simdeck -p 4320 --open ``` ```bash simdeck --open ``` ```bash simdeck pair ``` ```bash simdeck service kill ``` ```bash simdeck service restart --video-codec software --stream-quality low ``` -------------------------------- ### Start SimDeck Service Source: https://simdeck.sh/guide/quick-start Run the SimDeck command to start the service. It provides local and network URLs, along with a pairing code for LAN browsers. Open the local URL to access the SimDeck UI. ```sh simdeck ``` -------------------------------- ### List, Use, and Boot Devices with SimDeck Source: https://simdeck.sh/guide/quick-start Manage your simulators and emulators using the SimDeck CLI. Use 'list' to see available devices, 'use ' to set a default device for the project, and 'boot ' to start a device. ```sh simdeck list simdeck use simdeck boot ``` -------------------------------- ### Start SimDeck Service Source: https://simdeck.sh/guide/service Starts or reuses the background service. Use `--open` to open the browser and `-p` to select a non-default port (default is 4310). ```sh simdeck simdeck --open simdeck -p 4311 ``` -------------------------------- ### Install SimDeck Globally Source: https://simdeck.sh/guide/installation Install the SimDeck package globally using npm for regular use. This makes the `simdeck` command available system-wide. ```shell npm install -g simdeck@latest simdeck ``` -------------------------------- ### Check Xcode Selection Source: https://simdeck.sh/guide/installation Verify the active Xcode installation path. This is useful if you have multiple Xcode versions installed. ```shell xcode-select -p ``` -------------------------------- ### View Perform Action Example Source: https://simdeck.sh/api/inspector-protocol Demonstrates performing an action, such as 'tap', on a specific view identified by its ID. The available actions depend on the inspector runtime and the selected view. ```json { "id": 3, "method": "View.perform", "params": { "id": "view:0x1234", "action": "tap" } } ``` -------------------------------- ### Check Common Build Prerequisites Source: https://simdeck.sh/guide/troubleshooting Verify that essential development tools like Xcode command-line tools, Rust, and Node.js are installed. ```shell xcode-select --install rustc --version node --version ``` -------------------------------- ### Enable SimDeck Autostart Source: https://simdeck.sh/guide/service Installs or refreshes the macOS LaunchAgent for automatic SimDeck startup after login. `simdeck pair` also handles pairing. ```sh simdeck -a simdeck --autostart simdeck pair ``` -------------------------------- ### Quick SimDeck Try with npx Source: https://simdeck.sh/guide/installation Use `npx` to quickly run SimDeck without a global installation. This is ideal for testing or occasional use. ```shell npx simdeck ``` -------------------------------- ### Start SimDeck with LAN Access Enabled Source: https://simdeck.sh/guide/troubleshooting Configure SimDeck to listen on all interfaces and advertise a specific host IP for LAN access. ```shell simdeck --bind 0.0.0.0 --advertise-host 192.168.1.50 --open ``` -------------------------------- ### Simulate Camera Feeds Source: https://simdeck.sh/cli/commands Commands to manage camera simulations for applications. Supports starting feeds from files or webcams, and switching sources. ```bash simdeck camera sources ``` ```bash simdeck camera start com.example.App --file /absolute/path/to/feed.mov --mirror off ``` ```bash simdeck camera start com.example.App --webcam ``` ```bash simdeck camera switch --placeholder ``` ```bash simdeck camera switch --file /absolute/path/to/frame.png ``` ```bash simdeck camera status ``` ```bash simdeck camera stop ``` -------------------------------- ### Manage CoreSimulator Service with Simdeck CLI Source: https://simdeck.sh/cli/commands Commands to restart, start, or shut down the CoreSimulator service. Use these when the service is unresponsive. ```bash simdeck core-simulator restart ``` ```bash simdeck core-simulator start ``` ```bash simdeck core-simulator shutdown ``` -------------------------------- ### Start React Native Inspector (Manual Entrypoint) Source: https://simdeck.sh/inspector/react-native Import the auto entrypoint and register the app component manually. ```ts import "react-native-simdeck/auto"; import { AppRegistry } from "react-native"; import App from "./App"; AppRegistry.registerComponent("Example", () => App); ``` -------------------------------- ### SimDeck Command Options Source: https://simdeck.sh/guide/service Options accepted by `simdeck`, `service start`, `service restart`, `service on`, and `service reset` for configuring service behavior. ```text Flag| Default| Use it when ---|---|--- `--port ` / `-p`| `4310`| You want a specific service port `--bind `| `127.0.0.1`| You need LAN access with `0.0.0.0` or `::` `--advertise-host `| detected| Remote browsers need a specific host or IP `--video-codec `| `auto`| You need to force encoder behavior `--android-gpu `| `host`| You need to change Android emulator GPU rendering `--stream-quality `| `full`| You want lower CPU or bandwidth use `--local-stream-fps `| `60`| You want a different local stream target `--client-root `| bundled UI| You are serving a custom static client ``` -------------------------------- ### Open SimDeck UI Source: https://simdeck.sh/cli Opens the SimDeck UI, optionally selecting a specific simulator by name or UDID. Without arguments, it starts or reuses the background service and prints browser URLs. ```bash simdeck simdeck "iPhone 17 Pro Max" simdeck --open simdeck -p 4311 simdeck -a ``` -------------------------------- ### WebRTC Offer Setup Source: https://simdeck.sh/api/rest Used for setting up a WebRTC offer/answer stream for live video. The streamConfig allows specifying profile, FPS, and video codec. ```json { "type": "offer", "sdp": "v=0...", "streamConfig": { "profile": "balanced", "fps": 60, "videoCodec": "auto" } } ``` -------------------------------- ### Start, Switch, and Stop Camera Simulation Source: https://simdeck.sh/guide/testing Use these commands to manage camera simulation for iOS apps using AVFoundation. Ensure the camera feed file path is absolute. ```sh simdeck camera start com.example.App --file /absolute/path/to/feed.mov --mirror off simdeck camera switch --placeholder simdeck camera stop ``` -------------------------------- ### Manage Simulator Pasteboard with Simdeck CLI Source: https://simdeck.sh/cli/commands Set or get content from the simulator's pasteboard. ```bash simdeck pasteboard set "hello" ``` ```bash simdeck pasteboard get ``` -------------------------------- ### Check SimDeck Version and Service Status Source: https://simdeck.sh/guide/troubleshooting Verify your SimDeck installation and check the status of the background service. ```shell simdeck --version xcode-select -p simdeck service status simdeck list ``` -------------------------------- ### Create Simulator Source: https://simdeck.sh/api/rest Create and boot a new simulator or emulator. ```APIDOC ## POST /api/simulators ### Description Creates and boots a new simulator or emulator. For Android, optional arguments like `androidEmulatorArgs` and `androidDisableAudio` can be provided. For iOS, paired devices can also be created. ### Method POST ### Endpoint /api/simulators ### Request Body - **platform** (string) - Required - The platform of the device (e.g., "ios", "android"). - **name** (string) - Required - The name of the device. - **deviceTypeIdentifier** (string) - Required - The identifier for the device type. - **runtimeIdentifier** (string) - Required - The identifier for the runtime. - **pairedWatch** (object) - Optional - Configuration for a paired Apple Watch (for iOS). - **name** (string) - Required - The name of the watch. - **deviceTypeIdentifier** (string) - Required - The device type identifier for the watch. - **runtimeIdentifier** (string) - Required - The runtime identifier for the watch. - **androidEmulatorArgs** (array) - Optional - Arguments to pass to the Android emulator on startup. - **androidDisableAudio** (boolean) - Optional - Whether to disable audio for the Android emulator. Defaults to true. ### Request Example ```json { "platform": "android", "name": "Pixel_8_API_36", "deviceTypeIdentifier": "pixel_8", "runtimeIdentifier": "system-images;android-36;google_apis;arm64-v8a", "androidEmulatorArgs": ["-no-snapshot"], "androidDisableAudio": true } ``` ``` -------------------------------- ### Start Camera Feed Request Source: https://simdeck.sh/api/rest Initiates a camera feed from a specified source. Supports video, image, and webcam sources. Local files must be absolute paths. Video sources can also use URLs. ```json { "bundleId": "com.example.App", "mirror": "off", "source": { "kind": "video", "arg": "/absolute/path/to/feed.mov" } } ``` -------------------------------- ### Build Documentation Source: https://simdeck.sh/contributing Generate a static build of the documentation site for deployment. ```shell npm run docs:build ``` -------------------------------- ### Start Inspector Agent with Custom Configuration Source: https://simdeck.sh/inspector/swift Configure the SimDeckInspectorAgent to bind to non-localhost addresses and set an authentication token for shared or remote hosts. ```swift try? SimDeckInspectorAgent.shared.start( configuration: .init( port: 47370, bindToLocalhostOnly: false, authToken: "debug-secret" ) ) ``` -------------------------------- ### List and Select Simulators Source: https://simdeck.sh/cli/commands Commands to list available simulators and select a default one for the current project. Use `--format json` for detailed inventory. ```bash simdeck list ``` ```bash simdeck list --format json ``` ```bash simdeck use ``` -------------------------------- ### Manage SimDeck Service Lifecycle Source: https://simdeck.sh/cli/commands Commands for managing the SimDeck service, including starting, stopping, and restarting. The service can be configured to autostart on macOS. ```bash simdeck ``` ```bash simdeck ``` ```bash simdeck -p 4311 ``` ```bash simdeck -a ``` ```bash simdeck service status ``` ```bash simdeck service stop ``` ```bash simdeck service restart ``` ```bash simdeck service on/off/reset ``` -------------------------------- ### Start SimDeck with LAN Access Source: https://simdeck.sh/guide/lan-access Binds SimDeck to all available network interfaces and advertises a specific LAN IP address. Use this to allow other devices to access the SimDeck UI. ```shell simdeck \ --bind 0.0.0.0 \ --advertise-host 192.168.1.50 \ --open ``` -------------------------------- ### SimDeck CLI Commands for Agent Control Source: https://simdeck.sh/ A set of SimDeck CLI commands for agents to interact with simulators. These commands allow booting, installing apps, tapping elements, and describing the simulator state. ```bash $ simdeck boot "iPhone 17" ``` ```bash $ simdeck install app.app ``` ```bash $ simdeck tap --label Continue ``` ```bash $ simdeck describe --format agent ``` -------------------------------- ### Start React Native Inspector with Explicit Options Source: https://simdeck.sh/inspector/react-native Start the inspector with explicit options, such as specifying the port. ```ts import { startSimDeckReactNativeInspector } from "react-native-simdeck"; if (__DEV__) { startSimDeckReactNativeInspector({ port: 4310 }); } ``` -------------------------------- ### Automate App Tests with simdeck/test Source: https://simdeck.sh/guide/testing Use `simdeck/test` for app-level JS/TS automation. Connect to a device, launch an app, interact with UI elements, and capture evidence like screenshots or recordings. The `connect()` function starts the service and reuses healthy instances. ```typescript import { connect } from "simdeck/test"; const udid = process.env.SIMDECK_UDID!; const sim = await connect({ udid }); try { await sim.launch("com.example.App"); await sim.tap(0.5, 0.5); await sim.waitFor({ label: "Continue" }); await sim.screenshot(); await sim.screenshot({ withBezel: true }); await sim.record({ seconds: 5 }); } finally { sim.close(); } ``` -------------------------------- ### Run Android Emulator Session Source: https://simdeck.sh/guide/github-actions Execute an Android emulator session using the SimDeck CLI. This command starts a new session for Android application testing. ```text simdeck run android ``` -------------------------------- ### Create Options Source: https://simdeck.sh/api/rest List available device types and runtimes for creating new simulators or emulators. ```APIDOC ## GET /api/simulators/create-options ### Description Lists the available device types and runtimes that can be used for creating new simulators or emulators. ### Method GET ### Endpoint /api/simulators/create-options ``` -------------------------------- ### Configure SimDeck Server Options Source: https://simdeck.sh/cli/flags These flags are used with `simdeck`, `service start`, `service restart`, `service on`, and `service reset` commands. They control the HTTP port, network binding, advertised host, client directory, video codec, Android GPU rendering, stream quality, and latency. ```shell simdeck --port 4311 --bind 0.0.0.0 --advertise-host my-simdeck.local --client-root ./my-client --video-codec hardware --android-gpu lavapipe --stream-quality balanced --local-stream-fps 30 --low-latency --open --autostart ``` -------------------------------- ### Start SimDeck Inspector Manually Source: https://simdeck.sh/guide/troubleshooting Manually start the SimDeck inspector within your application code before bootstrapping the app. ```javascript startSimDeckInspector({ port: 4310 }) ``` -------------------------------- ### Configure Remote Access with TURN Server Source: https://simdeck.sh/guide/video Set environment variables for TURN server configuration before starting SimDeck for routed remote access. This ensures WebRTC connectivity through a relay. ```shell SIMDECK_WEBRTC_ICE_SERVERS=turns:turn.example.com:5349?transport=tcp \ SIMDECK_WEBRTC_ICE_USERNAME=simdeck \ SIMDECK_WEBRTC_ICE_CREDENTIAL=secret \ SIMDECK_WEBRTC_ICE_TRANSPORT_POLICY=relay \ simdeck service start --video-codec software --stream-quality low ``` -------------------------------- ### Install @nativescript/simdeck-inspector Source: https://simdeck.sh/inspector/nativescript Install the NativeScript inspector package using npm. This is the first step to integrating SimDeck with your NativeScript application. ```sh npm install @nativescript/simdeck-inspector ``` -------------------------------- ### Boot Device Source: https://simdeck.sh/api/rest Boot a simulator or emulator. ```APIDOC ## POST /api/simulators/{udid}/boot ### Description Boots a simulator or emulator identified by its UDID. ### Method POST ### Endpoint /api/simulators/{udid}/boot ### Parameters #### Path Parameters - **udid** (string) - Required - The unique identifier of the device. ``` -------------------------------- ### Build SimDeck CLI from Source Source: https://simdeck.sh/guide/troubleshooting Build the SimDeck command-line interface from a source checkout. ```shell npm run build:cli ``` -------------------------------- ### Add SimDeck Agent Skill Source: https://simdeck.sh/guide/installation Install the SimDeck skill for your agent to use stable commands. Remember to restart your agent after installation. ```shell npx skills add NativeScript/SimDeck --skill simdeck -g ``` -------------------------------- ### Run iOS Integration Tests Source: https://simdeck.sh/contributing Build the CLI and client, then run the integration tests for iOS. ```shell npm run build:cli npm run build:client npm run test:integration:cli ``` -------------------------------- ### Set Active Xcode Installation Source: https://simdeck.sh/guide/troubleshooting Explicitly set the active Xcode installation path using `xcode-select` to ensure SimDeck uses the correct version. ```shell sudo xcode-select -s /Applications/Xcode.app simdeck list ``` -------------------------------- ### Start Inspector for Angular NativeScript Apps Source: https://simdeck.sh/inspector/nativescript For Angular NativeScript apps, start the inspector before calling `runNativeScriptAngularApp`. This ensures the inspector is active when the Angular application bootstraps. ```ts import { startSimDeckInspector } from "@nativescript/simdeck-inspector"; startSimDeckInspector({ port: 4310 }); runNativeScriptAngularApp({ appModuleBootstrap: () => bootstrapApplication(AppComponent), }); ``` -------------------------------- ### Run Build and Check Commands Source: https://simdeck.sh/contributing Execute formatting, linting, testing, and continuous integration checks. ```shell npm run format npm run lint npm run test npm run ci ``` -------------------------------- ### SimDeck Help Source: https://simdeck.sh/cli Displays help information for the SimDeck CLI and its subcommands. ```bash simdeck --help simdeck tap --help simdeck service status ``` -------------------------------- ### Open SimDeck UI in Browser Source: https://simdeck.sh/guide Launch the SimDeck browser UI. Use '--open' to automatically open the default browser. ```bash simdeck --open ``` -------------------------------- ### Start NativeScript Inspector in Debug Builds Source: https://simdeck.sh/inspector/nativescript Call `startSimDeckInspector` before app bootstrap in debug builds. Ensure the `__DEV__` flag is true to conditionally start the inspector. The `port` option specifies the SimDeck server port. ```ts import { startSimDeckInspector } from "@nativescript/simdeck-inspector"; if (__DEV__) { startSimDeckInspector({ port: 4310 }); } ``` -------------------------------- ### Open URL in Simulator Source: https://simdeck.sh/cli Opens a specified URL in the simulator's default browser. ```bash simdeck open-url https://example.com ``` -------------------------------- ### Describe a device using the CLI Source: https://simdeck.sh/inspector Use the 'simdeck describe' command to inspect a device. You can specify the format, maximum depth, and whether to use an interactive mode. The default source is 'native-ax'. ```sh simdeck describe simdeck describe --format agent --max-depth 3 simdeck describe --format agent --max-depth 3 --interactive simdeck snapshot --format agent --max-depth 3 -i simdeck describe --source native-ax simdeck describe --source react-native ``` -------------------------------- ### Start SimDeck Flutter Inspector in Dart Source: https://simdeck.sh/inspector/flutter Initialize and start the SimDeck Flutter inspector within your Flutter application's main function. This should only be done in debug builds. The 'port' parameter specifies the SimDeck server port. ```dart import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:simdeck_flutter_inspector/simdeck_flutter_inspector.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); if (kDebugMode) { startSimDeckFlutterInspector(port: 4310); } runApp(const App()); } ``` -------------------------------- ### Inspect SwiftUI and UIKit Trees via CLI Source: https://simdeck.sh/inspector/swift Use the `simdeck describe` command with the `--source swiftui` or `--source uikit` flags and `--format agent` to inspect the published trees. ```sh simdeck describe --source swiftui --format agent simdeck describe --source uikit --format agent ``` -------------------------------- ### Get Stats Source: https://simdeck.sh/cli Retrieves statistics from the simulator. ```bash simdeck stats ``` -------------------------------- ### Manage Studio and Providers with Simdeck CLI Source: https://simdeck.sh/cli/commands Commands for interacting with Simdeck Studio and connecting to remote simulator hosts. ```bash simdeck studio expose [simulator] ``` ```bash simdeck provider connect --studio-url --host-id --host-token ``` ```bash simdeck provider run ``` ```bash simdeck provider status ``` -------------------------------- ### Device State Source: https://simdeck.sh/api/rest Get the current state of a specific device. ```APIDOC ## GET /api/simulators/{udid}/state ### Description Retrieves the current state of a specific device identified by its UDID. ### Method GET ### Endpoint /api/simulators/{udid}/state ### Parameters #### Path Parameters - **udid** (string) - Required - The unique identifier of the device. ``` -------------------------------- ### Stream Quality Source: https://simdeck.sh/api/rest Get and update current stream quality settings. ```APIDOC ## GET /api/stream-quality ### Description Retrieves the current stream quality settings. ### Method GET ### Endpoint /api/stream-quality ``` ```APIDOC ## POST /api/stream-quality ### Description Updates the stream quality settings. ### Method POST ### Endpoint /api/stream-quality ``` -------------------------------- ### Server Metrics Source: https://simdeck.sh/api/rest Get counters for video, encoder, and client stream statistics. ```APIDOC ## GET /api/metrics ### Description Retrieves video, encoder, and client stream counters. ### Method GET ### Endpoint /api/metrics ``` -------------------------------- ### Rendered Device Chrome PNG Source: https://simdeck.sh/api/rest Get a PNG image of the rendered device chrome. ```APIDOC ## GET /api/simulators/{udid}/chrome.png ### Description Rendered device chrome PNG. ### Method GET ### Endpoint /api/simulators/{udid}/chrome.png ``` -------------------------------- ### Get Pasteboard Text Source: https://simdeck.sh/api/rest Retrieve the current text content of the simulator's pasteboard. ```APIDOC ## GET /api/simulators/{udid}/pasteboard ### Description Get pasteboard text. ### Method GET ### Endpoint /api/simulators/{udid}/pasteboard ``` -------------------------------- ### Rendered Screen Mask PNG Source: https://simdeck.sh/api/rest Get a PNG image of the rendered screen mask for the simulator. ```APIDOC ## GET /api/simulators/{udid}/screen-mask.png ### Description Rendered screen mask PNG. ### Method GET ### Endpoint /api/simulators/{udid}/screen-mask.png ``` -------------------------------- ### Rendered Button Sprite Source: https://simdeck.sh/api/rest Get a PNG image of a rendered button sprite for the device chrome. ```APIDOC ## GET /api/simulators/{udid}/chrome-button/{button} ### Description Rendered button sprite. ### Method GET ### Endpoint /api/simulators/{udid}/chrome-button/{button} #### Path Parameters - **button** (string) - Required - The name of the button to retrieve. ``` -------------------------------- ### Navigate Back Source: https://simdeck.sh/guide Simulate a back navigation action on the device. ```bash simdeck back ``` -------------------------------- ### Get Service Health Source: https://simdeck.sh/api/health Checks if the SimDeck service is reachable and returns its current status and configuration. ```APIDOC ## GET /api/health ### Description Checks if the SimDeck service is reachable and returns its current status and configuration. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **ok** (boolean) - Server is alive - **serverId** (string) - Stable identity for the current service token - **advertiseHost** (string) - Host/IP the service advertises for non-local clients - **hostId** (string) - Stable hashed identity for the Mac hardware host - **hostName** (string) - Local host name for grouping LAN/Tailscale/Bonjour URLs - **httpPort** (integer) - Port serving UI and API - **serverKind** (string) - `launchAgent` or `standalone` - **timestamp** (number) - Current timestamp - **videoCodec** (string) - Requested codec mode: `auto`, `hardware`, or `software` - **androidGpu** (string) - Android emulator renderer mode for SimDeck-owned boots - **lowLatency** (boolean) - Indicates if low latency mode is enabled - **realtimeStream** (boolean) - Indicates if real-time streaming is enabled - **localStreamFps** (integer) - Local stream frames per second - **streamQuality** (object) - Active stream profile and limits - **profile** (string) - The active stream profile - **webRtc** (object) - ICE settings the browser should use - **iceServers** (array) - List of ICE servers - **urls** (array) - URLs for the ICE server - **iceTransportPolicy** (string) - Policy for ICE transport ### Response Example ```json { "ok": true, "serverId": "2e640c5a06a9b732", "advertiseHost": "192.168.1.50", "hostId": "5163434b8c5e3fa4", "hostName": "Dj-MacBook-Pro", "httpPort": 4310, "serverKind": "launchAgent", "timestamp": 1714094761.234, "videoCodec": "auto", "androidGpu": "host", "lowLatency": false, "realtimeStream": true, "localStreamFps": 60, "streamQuality": { "profile": "full" }, "webRtc": { "iceServers": [{ "urls": ["stun:stun.l.google.com:19302"] }], "iceTransportPolicy": "all" } } ``` ``` -------------------------------- ### Create Android Emulator Configuration Source: https://simdeck.sh/api/rest Specify the configuration for creating a new Android emulator, including its name, device type, runtime, and optional boot arguments. ```json { "platform": "android", "name": "Pixel_8_API_36", "deviceTypeIdentifier": "pixel_8", "runtimeIdentifier": "system-images;android-36;google_apis;arm64-v8a", "androidEmulatorArgs": ["-no-snapshot"], "androidDisableAudio": true } ``` -------------------------------- ### Read Client Buffer Statistics Source: https://simdeck.sh/api/health Retrieve statistics from the client buffer using this GET request. ```http GET /api/client-stream-stats ``` -------------------------------- ### Simulator Screen Recording Source: https://simdeck.sh/api/rest Record the simulator screen as an MP4 video. This endpoint starts and stops the recording. ```APIDOC ## POST /api/simulators/{udid}/screen-recording ### Description MP4 recording with `{ "seconds": 5 }`. ### Method POST ### Endpoint /api/simulators/{udid}/screen-recording #### Request Body - **seconds** (integer) - Required - The duration of the recording in seconds. ``` -------------------------------- ### Get Performance Metrics Source: https://simdeck.sh/api/health Retrieves performance metrics for the SimDeck service to diagnose stream performance issues. ```APIDOC ## GET /api/metrics ### Description Retrieves performance metrics for the SimDeck service to diagnose stream performance issues. ### Method GET ### Endpoint /api/metrics ### Response #### Success Response (200) - **latest_first_frame_ms** (number) - First-frame startup time - **frames_dropped_server** (integer) - Server dropping stale frames to stay current - **keyframe_requests** (integer) - Stream refresh or recovery activity - **stream_pipeline_resets** (integer) - Encoder resets after all viewers disconnect - **latest_accessibility_snapshot_ms** (number) - Most recent native accessibility duration - **max_accessibility_snapshot_ms** (number) - Slowest native accessibility duration - **accessibility_snapshot_timeouts** (integer) - Native accessibility calls that timed out - **active_streams** (integer) - Open browser streams - **encoders** (array) - Encoder statistics - **encoder** (object) - **overloadState** (string) - Encoder overload state: `nominal`, `strained`, or `overloaded` - **androidEncoders** (array) - Android video source kind, videoCodec, and encoder stats - **client_streams** (object) - Recent browser decoder and render reports ``` -------------------------------- ### Run Android Integration Tests Source: https://simdeck.sh/contributing Build the CLI and the simdeck-test package, then run integration tests for Android. ```shell npm run build:cli npm run build:simdeck-test npm run test:integration:android ``` -------------------------------- ### Run Android Emulator Session with Options Source: https://simdeck.sh/guide/github-actions Run an Android emulator session with optional flags to control quality and health reporting. Supported quality values range from `tiny` to `ci-software`. ```text simdeck run android quality=low ``` ```text simdeck run android public-health ``` -------------------------------- ### Change SimDeck Port if Already in Use Source: https://simdeck.sh/guide/troubleshooting If the default port 4310 is in use, start SimDeck with an alternative port. ```shell simdeck -p 4320 --open ``` -------------------------------- ### List Simulators Source: https://simdeck.sh/api/rest List available iOS Simulators and Android emulators. ```APIDOC ## GET /api/simulators ### Description Lists all available iOS Simulators and Android emulators. ### Method GET ### Endpoint /api/simulators ``` -------------------------------- ### Get Logs Source: https://simdeck.sh/cli Retrieves simulator logs within a specified time frame and with a limit on the number of log entries. ```bash simdeck logs --seconds 30 --limit 200 ``` -------------------------------- ### Uninstall SimDeck Source: https://simdeck.sh/guide/installation Remove the globally installed SimDeck package using npm. Ensure any running services are stopped before uninstalling. ```shell npm uninstall -g simdeck ``` -------------------------------- ### Run Normal Unit and Client Tests Source: https://simdeck.sh/guide/testing Execute standard unit and client tests for your project using npm. ```sh npm run test ``` -------------------------------- ### Start React Native Inspector (Expo Router) Source: https://simdeck.sh/inspector/react-native Import the auto entrypoint before the app registers when using Expo Router. ```ts import "react-native-simdeck/auto"; import "expo-router/entry"; ``` -------------------------------- ### Get Simulator Logs Source: https://simdeck.sh/api/rest Retrieve recent logs from the simulator. Supports filtering by time, level, process, and message content. ```APIDOC ## GET /api/simulators/{udid}/logs ### Description Recent logs. ### Method GET ### Endpoint /api/simulators/{udid}/logs #### Query Parameters - **backfill** (boolean) - Optional - Fetch recent history instead of current tail. - **seconds** (integer) - Optional - Time window in seconds. - **limit** (integer) - Optional - Maximum number of log entries to retrieve. - **levels** (string) - Optional - Filter logs by level (e.g., `error,fault`). - **processes** (string) - Optional - Filter logs by process name substring (e.g., `MyApp`). - **q** (string) - Optional - Filter logs by message text. ``` -------------------------------- ### Run Experimental SwiftUI Preview Runner Source: https://simdeck.sh/inspector/swift Utilize the experimental preview runner for local development by specifying the simulator UDID, file path, preview name, and enabling watch mode. ```sh npm run preview:swiftui -- \ --udid \ --file Sources/MyFeature/MyView.swift \ --preview "Default" \ --watch ``` -------------------------------- ### List Available Devices Source: https://simdeck.sh/guide Use 'simdeck list' to view all available iOS simulators and Android emulators recognized by SimDeck. ```bash simdeck list ``` -------------------------------- ### TCP Transport Example Source: https://simdeck.sh/api/inspector-protocol Demonstrates sending an Inspector.getInfo request over TCP, which is newline-delimited JSON. Ensure the port is within the specified range. ```sh printf '{"id":1,"method":"Inspector.getInfo"}\n' | nc 127.0.0.1 47370 ``` -------------------------------- ### Start Inspector Agent in UIKit App Source: https://simdeck.sh/inspector/swift Add the SimDeckInspectorAgent initialization to your UIKit application's `didFinishLaunchingWithOptions` method for debug builds. ```swift func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { #if DEBUG try? SimDeckInspectorAgent.shared.start() #endif return true } ``` -------------------------------- ### Configure SimDeck Global Server URL and Device Source: https://simdeck.sh/cli/flags Use `--server-url` to target a specific running SimDeck service or `--device` to override the default simulator. `SIMDECK_SERVER_URL` and `SIMDECK_DEVICE` environment variables are also supported. ```shell simdeck --server-url http://localhost:4310 --device "iPhone 14 Pro" ``` -------------------------------- ### Describe Device State Source: https://simdeck.sh/guide Inspect the current state of the device, including app hierarchy. Use --format agent and --max-depth for detailed output. ```bash simdeck describe --format agent --max-depth 3 --interactive ```