---
name: onesec-wda
description: Automate "one sec" app-blocking setup on iOS via Shortcuts automations using WebDriverAgent (WDA). Use when the user wants to bulk-configure one sec for multiple apps on a connected iPhone.
---

# one sec WDA Automation

Bulk-create iOS Shortcuts automations that trigger "one sec" when apps are opened, driven by WebDriverAgent.

## Prerequisites

1. **iPhone connected via USB** with developer mode enabled
2. **WebDriverAgent running** via xcodebuild:
   ```bash
   xcodebuild test-without-building \
     -xctestrun <path-to>/WebDriverAgentRunner_iphoneos*.xctestrun \
     -destination id=<DEVICE_UDID> \
     -allowProvisioningUpdates
   ```
3. **WDA accessible** at `http://localhost:8100` (use `pymobiledevice3 remote start-tunnel` + port forward if needed)
4. **one sec app installed** on the device with Shortcuts integration enabled

## Usage

```bash
# Test with one app first
python3 /path/to/onesec_setup.py --test

# Run for all apps
python3 /path/to/onesec_setup.py
```

The script is at: `<skill-dir>/scripts/onesec_setup.py`

## Workflow per App

1. Tap "+" on Shortcuts Automation tab
2. Select "App" trigger
3. Search for and select the target app
4. Confirm "Is Opened" trigger, tap Done
5. Search for "one sec" action
6. Select "Activate one sec (when app opens)"
7. Tap Done to save

Screenshots are saved to `/tmp/onesec_step*` and `/tmp/onesec_fail*` for debugging.

## Customization

Edit `APPS_TO_PROTECT` list in the script. Move completed apps to `ALREADY_DONE` to skip them on re-runs.

## WDA Helpers

The script provides reusable WDA functions (no pip dependencies):
- `wda(method, path, data)` — raw HTTP to WDA
- `find(using, value)` / `find_one(using, value)` — element lookup
- `tap(element_id)` / `tap_name(name)` / `tap_label(label)` — tap elements
- `type_text(text)` — type into active element
- `swipe(x1, y1, x2, y2)` — drag gesture
- `screenshot(path)` — save screenshot as PNG

## Troubleshooting

- **WDA connection refused**: Ensure xcodebuild test is running and port 8100 is reachable
- **pymobiledevice3 tunnel timeout**: Restart tunnel with `sudo pymobiledevice3 remote start-tunnel`
- **Element not found**: Check screenshots in `/tmp/onesec_fail_*` to see actual UI state
- **App not in picker**: App name must match exactly as shown on device home screen


---
Source attribution: plurigrid
Original project: https://github.com/plurigrid/asi/blob/293ce9f76e3abcd5ba18db284688bc0d9ac6691d/skills/onesec-wda/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2025 SkillCreator.ai

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Dave AI resource metadata

Creator / publisher: plurigrid
Original project: https://github.com/plurigrid/asi/blob/293ce9f76e3abcd5ba18db284688bc0d9ac6691d/skills/onesec-wda/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Product Management
Roles: Mobile Developer, Product Manager
Specialties: Mobile
Tools: Pymobiledevice3, Xcode
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 165c0d025a2ff1d93e4292be6eef7940207b5ed2dee989a210a452e84ea92640
