From 3b2e2d9e5553755115d6e802c830658c380998af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 20 Feb 2026 12:46:52 +0100 Subject: [PATCH 1/6] feat: add snapshot diff command and snapshot efficiency guidance --- README.md | 24 +- skills/agent-device/SKILL.md | 11 + .../agent-device/references/snapshot-refs.md | 16 ++ src/__tests__/cli-diff.test.ts | 96 +++++++ src/cli.ts | 7 +- src/core/__tests__/capabilities.test.ts | 1 + src/core/capabilities.ts | 1 + src/daemon/__tests__/snapshot-diff.test.ts | 77 ++++++ .../__tests__/snapshot-handler.test.ts | 109 ++++++++ src/daemon/handlers/snapshot.ts | 261 ++++++++++++++---- src/daemon/snapshot-diff.ts | 129 +++++++++ src/utils/__tests__/args.test.ts | 11 + src/utils/__tests__/output.test.ts | 34 +++ src/utils/command-schema.ts | 6 + src/utils/output.ts | 177 ++---------- src/utils/snapshot-lines.ts | 165 +++++++++++ website/docs/docs/commands.md | 2 + website/docs/docs/introduction.md | 3 +- website/docs/docs/quick-start.md | 4 + website/docs/docs/snapshots.md | 14 + 20 files changed, 931 insertions(+), 217 deletions(-) create mode 100644 src/__tests__/cli-diff.test.ts create mode 100644 src/daemon/__tests__/snapshot-diff.test.ts create mode 100644 src/daemon/snapshot-diff.ts create mode 100644 src/utils/__tests__/output.test.ts create mode 100644 src/utils/snapshot-lines.ts diff --git a/README.md b/README.md index 8aa8e1f3a..174bc59b0 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ The project is in early development and considered experimental. Pull requests a ## Features - Platforms: iOS (simulator + physical device core automation) and Android (emulator + device). -- Core commands: `open`, `back`, `home`, `app-switcher`, `press`, `longpress`, `focus`, `type`, `fill`, `scroll`, `scrollintoview`, `wait`, `alert`, `screenshot`, `close`, `reinstall`. -- Inspection commands: `snapshot` (accessibility tree), `appstate`, `apps`, `devices`. +- Core commands: `open`, `back`, `home`, `app-switcher`, `press`, `long-press`, `focus`, `type`, `fill`, `scroll`, `scrollintoview`, `wait`, `alert`, `screenshot`, `close`, `reinstall`. +- Inspection commands: `snapshot` (accessibility tree), `diff snapshot` (structural baseline diff), `appstate`, `apps`, `devices`. - Device tooling: `adb` (Android), `simctl`/`devicectl` (iOS via Xcode). - Minimal dependencies; TypeScript executed directly on Node 22+ (no build step). @@ -39,9 +39,11 @@ Use `press` as the canonical tap command; `click` is an equivalent alias. ```bash agent-device open Contacts --platform ios # creates session on iOS Simulator agent-device snapshot +agent-device diff snapshot # first run initializes baseline agent-device press @e5 agent-device fill @e6 "John" agent-device fill @e7 "Doe" +agent-device diff snapshot # subsequent runs compare against previous baseline agent-device press @e3 agent-device close ``` @@ -135,8 +137,8 @@ agent-device swipe 540 1500 540 500 120 --count 8 --pause-ms 30 --pattern ping-p ## Command Index - `boot`, `open`, `close`, `reinstall`, `home`, `back`, `app-switcher` - `batch` -- `snapshot`, `find`, `get` -- `press` (alias: `click`), `focus`, `type`, `fill`, `longpress`, `swipe`, `scroll`, `scrollintoview`, `pinch`, `is` +- `snapshot`, `diff snapshot`, `find`, `get` +- `press` (alias: `click`), `focus`, `type`, `fill`, `long-press`, `swipe`, `scroll`, `scrollintoview`, `pinch`, `is` - `alert`, `wait`, `screenshot` - `trace start`, `trace stop` - `settings wifi|airplane|location on|off` @@ -149,6 +151,20 @@ Notes: - iOS snapshots use XCTest on simulators and physical devices. - Scope snapshots with `-s "