# xtool-org/xtool architecture

> Architecture diagram of the GitHub repository xtool-org/xtool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xtool-org/xtool
- Repository: https://github.com/xtool-org/xtool

## Overview

xtool is a cross-platform Xcode replacement for building SwiftPM iOS apps, signing and deploying them, managing Apple Developer Services, and operating connected devices. The principal workflow runs from CLI commands through planning and packaging, then signing and installation; separate branches handle authentication and Developer Services management, SDK setup, and device control. The graph includes major README capabilities and central indexed modules. Several subsystem paths are directories because their individual implementations were not sampled; their internal wiring is therefore omitted where evidence is unavailable.

Main entry points: [`Sources/XToolSupport`](https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport) (Development commands), [`Sources/XToolSupport/AuthCommand.swift`](https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/AuthCommand.swift) (Auth command), [`Sources/XKit/DeveloperServices/DeveloperServicesClient.swift`](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/DeveloperServices/DeveloperServicesClient.swift) (Developer Services API), [`Sources/PackLib/Packer.swift`](https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/Packer.swift) (App packer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_cli["xtool CLI<br/>[XTool.swift]"]
  node_commands["Development commands"]
  node_authcommand["Auth command<br/>[AuthCommand.swift]"]
end

subgraph group_build["Build and projects"]
  node_buildplanner["Build planner<br/>[Planner.swift]"]
  node_packer["App packer<br/>[Packer.swift]"]
  node_buildsettings["Build settings"]
  node_sdk["SDK management<br/>[SDKBuilder.swift]"]
  node_projects["Xcode project model<br/>[XcodeProject.swift]"]
  node_workspace["Workspace model"]
end

subgraph group_identity["Signing and services"]
  node_signing["Signing context"]
  node_autosigner["Automatic signing<br/>[AutoSigner.swift]"]
  node_entitlements["Entitlements<br/>[Entitlements.swift]"]
  node_provisioning["Provisioning profiles"]
  node_authstorage[("Auth token storage<br/>[AuthToken.swift]")]
  node_login["Apple account login"]
  node_grand_slam["Apple account protocol"]
  node_developer_services["Developer Services API"]
  node_ds_commands["Developer Services commands"]
end

subgraph group_devices["Device operations"]
  node_device_commands["Device commands"]
  node_installer["App installation<br/>[IPAInstaller.swift]"]
  node_connection["Device connection"]
  node_profile_manager["Profile installation"]
end

node_user(("Developer"))
node_apple{{"Apple services"}}
node_ios_device(("iOS device"))

node_user -->|"invokes"| node_cli
node_cli -->|"dispatches"| node_commands
node_commands -.->|"plans builds"| node_buildplanner
node_buildplanner -->|"uses settings"| node_buildsettings
node_commands -.->|"builds app"| node_packer
node_packer -->|"reads project"| node_projects
node_packer -->|"reads workspace"| node_workspace
node_user -->|"manages SDK"| node_sdk
node_commands -.->|"signs app"| node_autosigner
node_autosigner -.->|"uses context"| node_signing
node_signing -->|"reads entitlements"| node_entitlements
node_signing -->|"uses profiles"| node_provisioning
node_user -->|"authenticates"| node_authcommand
node_authcommand -->|"logs in"| node_login
node_login -->|"authenticates account"| node_grand_slam
node_authcommand -->|"lists teams"| node_developer_services
node_authcommand -->|"saves token"| node_authstorage
node_authstorage -->|"provides credentials"| node_developer_services
node_developer_services -.->|"sends API requests"| node_apple
node_user -->|"manages developer data"| node_ds_commands
node_ds_commands -.->|"uses API"| node_developer_services
node_user -->|"controls devices"| node_device_commands
node_device_commands -.->|"installs app"| node_installer
node_installer -.->|"uses connection"| node_connection
node_connection -->|"connects"| node_ios_device
node_profile_manager -->|"starts client"| node_connection
node_profile_manager -->|"installs profiles"| node_provisioning

click node_cli "https://github.com/xtool-org/xtool/blob/main/Sources/xtool/XTool.swift"
click node_commands "https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport"
click node_authcommand "https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/AuthCommand.swift"
click node_buildplanner "https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/Planner.swift"
click node_packer "https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/Packer.swift"
click node_buildsettings "https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/BuildSettings.swift"
click node_sdk "https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/SDKBuilder.swift"
click node_projects "https://github.com/xtool-org/xtool/blob/main/Sources/XcodeProjects/XcodeProject.swift"
click node_workspace "https://github.com/xtool-org/xtool/blob/main/Sources/XcodeProjects/XcodeWorkspace.swift"
click node_signing "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Signer/SigningContext.swift"
click node_autosigner "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Signer/AutoSigner.swift"
click node_entitlements "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Model/Entitlements/Entitlements.swift"
click node_provisioning "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Model/Mobileprovision.swift"
click node_authstorage "https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/AuthToken.swift"
click node_login "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/DeveloperServices/DeveloperServicesLoginManager.swift"
click node_grand_slam "https://github.com/xtool-org/xtool/tree/main/Sources/XKit/GrandSlam"
click node_developer_services "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/DeveloperServices/DeveloperServicesClient.swift"
click node_ds_commands "https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport/DSCommands"
click node_device_commands "https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport"
click node_installer "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/IPAInstaller.swift"
click node_connection "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/ConnectionManager.swift"
click node_profile_manager "https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/ProfileManager.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_commands,node_authcommand toneBlue
class node_buildplanner,node_packer,node_buildsettings,node_sdk,node_projects,node_workspace toneAmber
class node_signing,node_autosigner,node_entitlements,node_provisioning,node_authstorage,node_login,node_grand_slam,node_developer_services,node_ds_commands toneMint
class node_device_commands,node_installer,node_connection,node_profile_manager toneRose
class node_user,node_apple,node_ios_device toneIndigo
```

## Components

### CLI workflows

- [xtool CLI](https://github.com/xtool-org/xtool/blob/main/Sources/xtool/XTool.swift): `Sources/xtool/XTool.swift`
- [Development commands](https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport): `Sources/XToolSupport`
- [Auth command](https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/AuthCommand.swift): `Sources/XToolSupport/AuthCommand.swift`

### Build and projects

- [Build planner](https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/Planner.swift): `Sources/PackLib/Planner.swift`
- [App packer](https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/Packer.swift): `Sources/PackLib/Packer.swift`
- [Build settings](https://github.com/xtool-org/xtool/blob/main/Sources/PackLib/BuildSettings.swift): `Sources/PackLib/BuildSettings.swift`
- [SDK management](https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/SDKBuilder.swift): `Sources/XToolSupport/SDKBuilder.swift`
- [Xcode project model](https://github.com/xtool-org/xtool/blob/main/Sources/XcodeProjects/XcodeProject.swift): `Sources/XcodeProjects/XcodeProject.swift`
- [Workspace model](https://github.com/xtool-org/xtool/blob/main/Sources/XcodeProjects/XcodeWorkspace.swift): `Sources/XcodeProjects/XcodeWorkspace.swift`

### Signing and services

- [Signing context](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Signer/SigningContext.swift): `Sources/XKit/Signer/SigningContext.swift`
- [Automatic signing](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Signer/AutoSigner.swift): `Sources/XKit/Signer/AutoSigner.swift`
- [Entitlements](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Model/Entitlements/Entitlements.swift): `Sources/XKit/Model/Entitlements/Entitlements.swift`
- [Provisioning profiles](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Model/Mobileprovision.swift): `Sources/XKit/Model/Mobileprovision.swift`
- [Auth token storage](https://github.com/xtool-org/xtool/blob/main/Sources/XToolSupport/AuthToken.swift): `Sources/XToolSupport/AuthToken.swift`
- [Apple account login](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/DeveloperServices/DeveloperServicesLoginManager.swift): `Sources/XKit/DeveloperServices/DeveloperServicesLoginManager.swift`
- [Apple account protocol](https://github.com/xtool-org/xtool/tree/main/Sources/XKit/GrandSlam): `Sources/XKit/GrandSlam`
- [Developer Services API](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/DeveloperServices/DeveloperServicesClient.swift): `Sources/XKit/DeveloperServices/DeveloperServicesClient.swift`
- [Developer Services commands](https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport/DSCommands): `Sources/XToolSupport/DSCommands`

### Device operations

- [Device commands](https://github.com/xtool-org/xtool/tree/main/Sources/XToolSupport): `Sources/XToolSupport`
- [App installation](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/IPAInstaller.swift): `Sources/XKit/Installation/IPAInstaller.swift`
- [Device connection](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/ConnectionManager.swift): `Sources/XKit/Installation/ConnectionManager.swift`
- [Profile installation](https://github.com/xtool-org/xtool/blob/main/Sources/XKit/Installation/ProfileManager.swift): `Sources/XKit/Installation/ProfileManager.swift`

### Other components

- **Developer**
- **Apple services**
- **iOS device**

## Connections

- Developer → xtool CLI: invokes
- xtool CLI → Development commands: dispatches
- Development commands → Build planner: plans builds
- Build planner → Build settings: uses settings (evidence: `Sources/PackLib/Planner.swift`)
- Development commands → App packer: builds app
- App packer → Xcode project model: reads project
- App packer → Workspace model: reads workspace
- Developer → SDK management: manages SDK
- Development commands → Automatic signing: signs app
- Automatic signing → Signing context: uses context
- Signing context → Entitlements: reads entitlements (evidence: `Sources/XKit/DeveloperServices/App IDs/DeveloperServicesAddAppOperation.swift`)
- Signing context → Provisioning profiles: uses profiles (evidence: `Sources/XKit/DeveloperServices/Profiles/DeveloperServicesFetchProfileOperation.swift`)
- Developer → Auth command: authenticates
- Auth command → Apple account login: logs in (evidence: `Sources/XToolSupport/AuthCommand.swift`)
- Apple account login → Apple account protocol: authenticates account (evidence: `Sources/XKit/DeveloperServices/DeveloperServicesLoginManager.swift`)
- Auth command → Developer Services API: lists teams (evidence: `Sources/XToolSupport/AuthCommand.swift`)
- Auth command → Auth token storage: saves token (evidence: `Sources/XToolSupport/AuthCommand.swift`)
- Auth token storage → Developer Services API: provides credentials (evidence: `Sources/XToolSupport/AuthToken.swift`)
- Developer Services API → Apple services: sends API requests
- Developer → Developer Services commands: manages developer data
- Developer Services commands → Developer Services API: uses API
- Developer → Device commands: controls devices
- Device commands → App installation: installs app
- App installation → Device connection: uses connection
- Device connection → iOS device: connects
- Profile installation → Device connection: starts client (evidence: `Sources/XKit/Installation/ProfileManager.swift`)
- Profile installation → Provisioning profiles: installs profiles (evidence: `Sources/XKit/Installation/ProfileManager.swift`)
