$ show xtool-org/xtool
xtool is a cross-platform CLI tool and Swift library that enables building, signing, and deploying iOS applications without requiring Xcode. It serves as a replacement for Xcode's build-and-deploy pipeline, supporting macOS and Linux (via Docker). The core library, XKit, provides modules for interacting with Apple Developer Services (certificates, provisioning profiles, devices), implementing Apple's GrandSlam authentication protocol (including Anisette data), code signing via zsign, and device installation via libimobiledevice. The tool also includes a packaging subsystem (PackLib) that resolves SwiftPM dependencies, builds the app, signs it, and bundles it into an .app or .ipa. It supports both free and paid developer accounts and can automatically manage capabilities and provisioning profiles. The architecture is modular, with clear separation between CLI commands (XToolSupport), core library (XKit), and packaging logic (PackLib). It uses modern Swift concurrency (async/await, actors) and dependency injection via swift-dependencies. The codebase includes generated OpenAPI client for Apple's REST API, cross-platform HTTP client abstraction, and utilities for ZIP compression, temporary files, and key-value storage. Examples and integration tests verify functionality. While primarily a developer tool for side-loading and CI/CD for iOS apps, it also exposes the underlying libraries as SwiftPM dependencies for programmatic use. The codebase demonstrates good engineering practices with protocol-oriented design, clean abstractions, and testability. However, it relies on private Apple APIs and a large number of external dependencies, which introduce maintenance risks. The generated OpenAPI client and platform-specific device interactions add fragility, but the core patterns are well-implemented.
The LLM identified 3 files worth highlighting for reuse:
Defines a Swift async HTTP client protocol (HTTPClientProtocol) with URLSession and AsyncHTTPClient implementations. This abstraction allows injecting different HTTP backends for testing or platform-specific support. Reusable in any Swift project needing a mockable HTTP layer.
Provides a KeyValueStorage protocol with in-memory, directory-based, and macOS keychain implementations. Uses swift-depenencies for dependency injection, enabling testable and configurable storage. Can be extracted for any Swift application needing a generic KV store.
A robust TemporaryDirectory type that creates a unique directory, tracks files via PID, and ensures cleanup. Supports optional persistence. Reusable in any Swift tool or library that needs scratch directories for intermediate files.