Skip to content

n0an/VivaDicta / .agents/skills/ios-simulator-skill

ios-simulator-skill

Verified

21 production-ready scripts for iOS app testing, building, and automation. Provides semantic UI navigation, build automation, accessibility testing, and simulator lifecycle management. Optimized for AI agents with minimal token output.

FileKindSize
SKILL.mdskill md9.9 KB
agents/openai.yamlconfig279 B
references/accessibility_checklist.mdmarkdown1.5 KB
references/idb_quick.mdmarkdown1.1 KB
references/simctl_quick.mdmarkdown1.3 KB
references/test_patterns.mdmarkdown1.6 KB
references/troubleshooting.mdmarkdown1.3 KB
scripts/accessibility_audit.pyexecutablescript10.0 KB
scripts/app_launcher.pyexecutablescript9.5 KB
scripts/app_state_capture.pyexecutablescript12.9 KB
scripts/build_and_test.pyexecutablescript11.1 KB
scripts/clipboard.pyexecutablescript2.6 KB
scripts/common/__init__.pyscript1.5 KB
scripts/common/cache_utils.pyscript8.1 KB
scripts/common/device_utils.pyscript13.5 KB
scripts/common/idb_utils.pyscript5.3 KB
scripts/common/screenshot_utils.pyscript10.0 KB
scripts/gesture.pyexecutablescript12.3 KB
scripts/keyboard.pyexecutablescript11.5 KB
scripts/log_monitor.pyexecutablescript14.6 KB
scripts/navigator.pyexecutablescript14.0 KB
scripts/privacy_manager.pyexecutablescript8.7 KB
scripts/push_notification.pyexecutablescript6.5 KB
scripts/screen_mapper.pyexecutablescript10.4 KB
scripts/sim_health_check.shexecutablescript7.7 KB
scripts/sim_list.pyexecutablescript8.9 KB
scripts/simctl_boot.pyexecutablescript8.6 KB
scripts/simctl_create.pyexecutablescript8.9 KB
scripts/simctl_delete.pyexecutablescript10.3 KB
scripts/simctl_erase.pyexecutablescript9.8 KB
scripts/simctl_shutdown.pyexecutablescript8.4 KB
scripts/simulator_selector.pyexecutablescript10.3 KB
scripts/status_bar.pyexecutablescript6.6 KB
scripts/test_recorder.pyexecutablescript10.6 KB
scripts/visual_diff.pyexecutablescript7.6 KB
scripts/xcode/__init__.pyscript378 B
scripts/xcode/builder.pyscript12.8 KB
scripts/xcode/cache.pyscript5.5 KB
scripts/xcode/config.pyscript5.4 KB
scripts/xcode/reporter.pyscript10.3 KB
scripts/xcode/xcresult.pyscript16.5 KB

scripts/status_bar.py

View on GitHub
#!/usr/bin/env python3
"""
iOS Status Bar Controller

Override simulator status bar for clean screenshots and testing.
Control time, network, wifi, battery display.

Usage: python scripts/status_bar.py --preset clean
"""

import argparse
import subprocess
import sys

from common import resolve_udid


class StatusBarController:
    """Controls iOS simulator status bar appearance."""

    # Preset configurations
    PRESETS = {
        "clean": {
            "time": "9:41",
            "data_network": "5g",
            "wifi_mode": "active",
            "battery_state": "charged",
            "battery_level": 100,
        },
        "testing": {
            "time": "11:11",
            "data_network": "4g",
            "wifi_mode": "active",
            "battery_state": "discharging",
            "battery_level": 50,
        },
        "low_battery": {
            "time": "9:41",
            "data_network": "5g",
            "wifi_mode": "active",
            "battery_state": "discharging",
            "battery_level": 20,
        },
        "airplane": {
            "time": "9:41",
            "data_network": "none",
            "wifi_mode": "failed",
            "battery_state": "charged",
            "battery_level": 100,
        },
    }

    def __init__(self, udid: str | None = None):
        """Initialize status bar controller.

        Args:
            udid: Optional device UDID (auto-detects booted simulator if None)
        """
        self.udid = udid

    def override(
        self,
        time: str | None = None,
        data_network: str | None = None,
        wifi_mode: str | None = None,
        battery_state: str | None = None,
        battery_level: int | None = None,
    ) -> bool:
        """
        Override status bar appearance.

        Args:
            time: Time in HH:MM format (e.g., "9:41")
            data_network: Network type (none, 1x, 3g, 4g, 5g, lte, lte-a)
            wifi_mode: WiFi state (active, searching, failed)
            battery_state: Battery state (charging, charged, discharging)
            battery_level: Battery percentage (0-100)

        Returns:
            Success status
        """
        cmd = ["xcrun", "simctl", "status_bar"]

        if self.udid:
            cmd.append(self.udid)
        else:
            cmd.append("booted")

        cmd.append("override")

        # Add parameters if provided
        if time:
            cmd.extend(["--time", time])
        if data_network:
            cmd.extend(["--dataNetwork", data_network])
        if wifi_mode:
            cmd.extend(["--wifiMode", wifi_mode])
        if battery_state:
            cmd.extend(["--batteryState", battery_state])
        if battery_level is not None:
            cmd.extend(["--batteryLevel", str(battery_level)])

        try:
            subprocess.run(cmd, capture_output=True, check=True)
            return True
        except subprocess.CalledProcessError:
            return False

    def clear(self) -> bool:
        """
        Clear status bar override and restore defaults.

        Returns:
            Success status
        """
        cmd = ["xcrun", "simctl", "status_bar"]

        if self.udid:
            cmd.append(self.udid)
        else:
            cmd.append("booted")

        cmd.append("clear")

        try:
            subprocess.run(cmd, capture_output=True, check=True)
            return True
        except subprocess.CalledProcessError:
            return False


def main():
    """Main entry point."""
    parser = argparse.ArgumentParser(
        description="Override iOS simulator status bar for screenshots and testing"
    )

    # Preset option
    parser.add_argument(
        "--preset",
        choices=list(StatusBarController.PRESETS.keys()),
        help="Use preset configuration (clean, testing, low-battery, airplane)",
    )

    # Custom options
    parser.add_argument(
        "--time",
        help="Override time (HH:MM format, e.g., '9:41')",
    )
    parser.add_argument(
        "--data-network",
        choices=["none", "1x", "3g", "4g", "5g", "lte", "lte-a"],
        help="Data network type",
    )
    parser.add_argument(
        "--wifi-mode",
        choices=["active", "searching", "failed"],
        help="WiFi state",
    )
    parser.add_argument(
        "--battery-state",
        choices=["charging", "charged", "discharging"],
        help="Battery state",
    )
    parser.add_argument(
        "--battery-level",
        type=int,
        help="Battery level 0-100",
    )

    # Other options
    parser.add_argument(
        "--clear",
        action="store_true",
        help="Clear status bar override and restore defaults",
    )
    parser.add_argument(
        "--udid",
        help="Device UDID (auto-detects booted simulator if not provided)",
    )

    args = parser.parse_args()

    # Resolve UDID with auto-detection
    try:
        udid = resolve_udid(args.udid)
    except RuntimeError as e:
        print(f"Error: {e}")
        sys.exit(1)

    controller = StatusBarController(udid=udid)

    # Clear mode
    if args.clear:
        if controller.clear():
            print("Status bar override cleared - defaults restored")
        else:
            print("Failed to clear status bar override")
            sys.exit(1)

    # Preset mode
    elif args.preset:
        preset = StatusBarController.PRESETS[args.preset]
        if controller.override(**preset):
            print(f"Status bar: {args.preset} preset applied")
            print(
                f"  Time: {preset['time']}, "
                f"Network: {preset['data_network']}, "
                f"Battery: {preset['battery_level']}%"
            )
        else:
            print(f"Failed to apply {args.preset} preset")
            sys.exit(1)

    # Custom mode
    elif any(
        [
            args.time,
            args.data_network,
            args.wifi_mode,
            args.battery_state,
            args.battery_level is not None,
        ]
    ):
        if controller.override(
            time=args.time,
            data_network=args.data_network,
            wifi_mode=args.wifi_mode,
            battery_state=args.battery_state,
            battery_level=args.battery_level,
        ):
            output = "Status bar override applied:"
            if args.time:
                output += f" Time={args.time}"
            if args.data_network:
                output += f" Network={args.data_network}"
            if args.battery_level is not None:
                output += f" Battery={args.battery_level}%"
            print(output)
        else:
            print("Failed to override status bar")
            sys.exit(1)

    else:
        parser.print_help()
        sys.exit(1)


if __name__ == "__main__":
    main()
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall