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/xcode/reporter.py

View on GitHub
"""
Build/test output formatting.

Provides multiple output formats with progressive disclosure support.
"""

import json


class OutputFormatter:
    """
    Format build/test results for display.

    Supports ultra-minimal default output, verbose mode, and JSON output.
    """

    @staticmethod
    def format_minimal(
        status: str,
        error_count: int,
        warning_count: int,
        xcresult_id: str,
        test_info: dict | None = None,
        hints: list[str] | None = None,
        errors: list[dict] | None = None,
        failed_tests: list[dict] | None = None,
    ) -> str:
        """
        Format ultra-minimal output (5-10 tokens on success, more on failure).

        On failure, automatically surfaces top errors/failed tests inline so agents
        don't need a second round-trip with --get-errors.

        Args:
            status: Build status (SUCCESS/FAILED)
            error_count: Number of errors
            warning_count: Number of warnings
            xcresult_id: XCResult bundle ID
            test_info: Optional test results dict
            hints: Optional list of actionable hints
            errors: Optional error list to surface on failure
            failed_tests: Optional failed test list to surface on failure

        Returns:
            Minimal formatted string
        """
        lines = []

        if test_info:
            # Test mode
            total = test_info.get("total", 0)
            passed = test_info.get("passed", 0)
            failed = test_info.get("failed", 0)
            duration = test_info.get("duration", 0.0)

            test_status = "PASS" if failed == 0 else "FAIL"
            lines.append(
                f"Tests: {test_status} ({passed}/{total} passed, {duration:.1f}s) [{xcresult_id}]"
            )
        else:
            # Build mode
            lines.append(
                f"Build: {status} ({error_count} errors, {warning_count} warnings) [{xcresult_id}]"
            )

        # Surface errors inline on failure
        if status == "FAILED" and errors:
            lines.append("")
            lines.append(OutputFormatter.format_errors(errors, limit=5))

        # Surface failed tests inline on failure
        if failed_tests:
            lines.append("")
            lines.append(OutputFormatter.format_test_failures(failed_tests, limit=5))

        # Add hints if provided and build failed
        if hints and status == "FAILED":
            lines.append("")
            lines.extend(hints)

        return "\n".join(lines)

    @staticmethod
    def format_test_failures(failed_tests: list[dict], limit: int = 5) -> str:
        """
        Format failed test details.

        Args:
            failed_tests: List of dicts with test_name and failure_message
            limit: Maximum failures to show

        Returns:
            Formatted failure list
        """
        if not failed_tests:
            return "No test failures found."

        lines = [f"Failed tests ({len(failed_tests)}):"]
        lines.append("")

        for i, test in enumerate(failed_tests[:limit], 1):
            name = test.get("test_name", "Unknown")
            message = test.get("failure_message", "")
            lines.append(f"{i}. {name}")
            if message:
                lines.append(f"   {message}")
            lines.append("")

        if len(failed_tests) > limit:
            lines.append(f"... and {len(failed_tests) - limit} more failures")

        return "\n".join(lines)

    @staticmethod
    def format_errors(errors: list[dict], limit: int = 10) -> str:
        """
        Format error details.

        Args:
            errors: List of error dicts
            limit: Maximum errors to show

        Returns:
            Formatted error list
        """
        if not errors:
            return "No errors found."

        lines = [f"Errors ({len(errors)}):"]
        lines.append("")

        for i, error in enumerate(errors[:limit], 1):
            message = error.get("message", "Unknown error")
            location = error.get("location", {})

            # Format location
            loc_parts = []
            if location.get("file"):
                file_path = location["file"].replace("file://", "")
                loc_parts.append(file_path)
            if location.get("line"):
                loc_parts.append(f"line {location['line']}")

            location_str = ":".join(loc_parts) if loc_parts else "unknown location"

            lines.append(f"{i}. {message}")
            lines.append(f"   Location: {location_str}")
            lines.append("")

        if len(errors) > limit:
            lines.append(f"... and {len(errors) - limit} more errors")

        return "\n".join(lines)

    @staticmethod
    def format_warnings(warnings: list[dict], limit: int = 10) -> str:
        """
        Format warning details.

        Args:
            warnings: List of warning dicts
            limit: Maximum warnings to show

        Returns:
            Formatted warning list
        """
        if not warnings:
            return "No warnings found."

        lines = [f"Warnings ({len(warnings)}):"]
        lines.append("")

        for i, warning in enumerate(warnings[:limit], 1):
            message = warning.get("message", "Unknown warning")
            location = warning.get("location", {})

            # Format location
            loc_parts = []
            if location.get("file"):
                file_path = location["file"].replace("file://", "")
                loc_parts.append(file_path)
            if location.get("line"):
                loc_parts.append(f"line {location['line']}")

            location_str = ":".join(loc_parts) if loc_parts else "unknown location"

            lines.append(f"{i}. {message}")
            lines.append(f"   Location: {location_str}")
            lines.append("")

        if len(warnings) > limit:
            lines.append(f"... and {len(warnings) - limit} more warnings")

        return "\n".join(lines)

    @staticmethod
    def format_log(log: str, lines: int = 50) -> str:
        """
        Format build log (show last N lines).

        Args:
            log: Full build log
            lines: Number of lines to show

        Returns:
            Formatted log excerpt
        """
        if not log:
            return "No build log available."

        log_lines = log.strip().split("\n")

        if len(log_lines) <= lines:
            return log

        # Show last N lines
        excerpt = log_lines[-lines:]
        return f"... (showing last {lines} lines of {len(log_lines)})\n\n" + "\n".join(excerpt)

    @staticmethod
    def format_json(data: dict) -> str:
        """
        Format data as JSON.

        Args:
            data: Data to format

        Returns:
            Pretty-printed JSON string
        """
        return json.dumps(data, indent=2)

    @staticmethod
    def generate_hints(errors: list[dict]) -> list[str]:
        """
        Generate actionable hints based on error types.

        Args:
            errors: List of error dicts

        Returns:
            List of hint strings
        """
        hints = []
        error_types: set[str] = set()

        # Collect error types
        for error in errors:
            error_type = error.get("type", "unknown")
            error_types.add(error_type)

        # Generate hints based on error types
        if "provisioning" in error_types:
            hints.append("Provisioning profile issue detected:")
            hints.append("  • Ensure you have a valid provisioning profile for iOS Simulator")
            hints.append(
                '  • For simulator builds, use CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO'
            )
            hints.append("  • Or specify simulator explicitly: --simulator 'iPhone 16 Pro'")

        if "signing" in error_types:
            hints.append("Code signing issue detected:")
            hints.append("  • For simulator builds, code signing is not required")
            hints.append("  • Ensure build settings target iOS Simulator, not physical device")
            hints.append("  • Check destination: platform=iOS Simulator,name=<device>")

        if not error_types or "build" in error_types:
            # Generic hints when error type is unknown
            if any("destination" in error.get("message", "").lower() for error in errors):
                hints.append("Device selection issue detected:")
                hints.append("  • List available simulators: xcrun simctl list devices available")
                hints.append("  • Specify simulator: --simulator 'iPhone 16 Pro'")

        return hints

    @staticmethod
    def format_verbose(
        status: str,
        error_count: int,
        warning_count: int,
        xcresult_id: str,
        errors: list[dict] | None = None,
        warnings: list[dict] | None = None,
        test_info: dict | None = None,
    ) -> str:
        """
        Format verbose output with error/warning details.

        Args:
            status: Build status
            error_count: Error count
            warning_count: Warning count
            xcresult_id: XCResult ID
            errors: Optional error list
            warnings: Optional warning list
            test_info: Optional test results

        Returns:
            Verbose formatted output
        """
        lines = []

        # Header
        if test_info:
            total = test_info.get("total", 0)
            passed = test_info.get("passed", 0)
            failed = test_info.get("failed", 0)
            duration = test_info.get("duration", 0.0)

            test_status = "PASS" if failed == 0 else "FAIL"
            lines.append(f"Tests: {test_status}")
            lines.append(f"  Total: {total}")
            lines.append(f"  Passed: {passed}")
            lines.append(f"  Failed: {failed}")
            lines.append(f"  Duration: {duration:.1f}s")
        else:
            lines.append(f"Build: {status}")

        lines.append(f"XCResult: {xcresult_id}")
        lines.append("")

        # Errors
        if errors and len(errors) > 0:
            lines.append(OutputFormatter.format_errors(errors, limit=5))
            lines.append("")

        # Warnings
        if warnings and len(warnings) > 0:
            lines.append(OutputFormatter.format_warnings(warnings, limit=5))
            lines.append("")

        # Summary
        lines.append(f"Summary: {error_count} errors, {warning_count} warnings")

        return "\n".join(lines)
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