Skip to content

About

Syncs Apple OS, Xcode, Swift, SDK and simulator release data into CloudKit with MistKit

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

SwoopMistKit

SwoopMistKit Swift 6.4 Platforms License: MIT

SwoopMistKit syncs Apple OS, Xcode, Swift, SDK and simulator release data into CloudKit with MistKit.

It fetches macOS restore images, Xcode versions, Swift versions, SDK versions and simulator runtimes from several public sources, deduplicates and links them, and writes them to the public database of a CloudKit container (iCloud.com.brightdigit.Swoop by default) using Server-to-Server authentication, so no signed-in iCloud user is needed. Apps such as Stewed read the records back to match the software installed on a Mac.

The package has two products:

  • SwoopMistKit, a library: the fetchers, DataSourcePipeline, SyncEngine, SwoopMistKitService and the MistKit CloudKitRecord conformances for SwoopKit's records.
  • swoopmist, a command-line tool with sync, export, list, status, clear and delete-runtimes commands. The scheduled sync workflows in this repository run it.

Requirements

  • Swift 6.4 (Xcode 27.2 on macOS, or the swift:6.4 images on Linux)
  • macOS 15, iOS 18, watchOS 11, tvOS 18, visionOS 2, or Linux
  • A CloudKit container with the schema in schema.ckdb and a Server-to-Server key for it

Using the library

dependencies: [
  .package(url: "https://github.com/brightdigit/SwoopMistKit.git", from: "1.0.0-alpha.3")
],
targets: [
  .target(name: "MyTool", dependencies: ["SwoopMistKit"])
]
import SwoopMistKit

let service = try SwoopMistKitService(
  containerIdentifier: "iCloud.com.brightdigit.Swoop",
  keyID: keyID,
  privateKeyPath: privateKeyPath,
  environment: .development
)
let images = try await service.queryAllRecords(recordType: "RestoreImage")

It depends on SwoopKit 1.0.0-beta.1 and MistKit 1.0.0-beta.6 or later.

Using swoopmist

swift build -c release
export CLOUDKIT_KEY_ID="your-key-id"
export CLOUDKIT_PRIVATE_KEY_PATH="$HOME/.cloudkit/swoop-private-key.pem"   # or CLOUDKIT_PRIVATE_KEY with the PEM text
export CLOUDKIT_ENVIRONMENT="development"
export VIRTUALBUDDY_API_KEY="..."   # optional: live signing status from https://tss.virtualbuddy.app/

.build/release/swoopmist sync --dry-run --verbose   # fetch and print, write nothing
.build/release/swoopmist sync --verbose
Command What it does
sync Fetch from every source, deduplicate, and write to CloudKit. --dry-run (write nothing), --verbose, --restore-images-only, --xcode-only (Xcode, SDK and simulator runtime records), --swift-only, --runtimes-only (simulator runtimes only), --no-betas, --no-apple-wiki, --force (ignore fetch intervals), --min-interval <seconds>, --source <name> (one source, such as ipsw.me), --json-output-file <file.json>.
export Query CloudKit and write the records as JSON: --output <file.json> (stdout otherwise), --pretty, --signed-only, --no-betas, --verbose.
export --snapshot <file.json> Write SDKVersion, XcodeVersion and SimulatorRuntime as SwoopKit's ReleaseDataSnapshot (an app's bundled snapshot, such as Stewed's). Read-only; fails if a type is empty or a record doesn't map. Development only unless --allow-production is passed (a flag only, with no environment variable).
list List the records in CloudKit: all of them, or --restore-images, --xcode-versions, --swift-versions.
status Show each data source's last fetch, record count and errors: --errors-only, --detailed.
clear Delete every record SwoopMistKit writes, after a prompt: --yes skips it, --verbose.
delete-runtimes Delete only SimulatorRuntime records, in Development only; a dry run unless --confirm-delete.

CLOUDKIT_CONTAINER_ID defaults to iCloud.com.brightdigit.Swoop. The CloudKit settings can also be passed as --cloudkit-container-id, --cloudkit-key-id, --cloudkit-private-key-path, --cloudkit-private-key and --cloudkit-environment, the VirtualBuddy key as --virtualbuddy-api-key, and fetch intervals as --fetch-interval-global <seconds> or per source, such as --fetch-interval-appledb-dev <seconds>. Options take --option value or --option=value.

Every option can also be set with an environment variable named SWOOP_ plus the command and option in capitals, for example SWOOP_SYNC_DRY_RUN=true for sync --dry-run or SWOOP_FETCH_INTERVAL_GLOBAL=3600. A flag on the command line wins over its variable. The names from before the rename (BUSHEL_SYNC_DRY_RUN, …) still work, with a deprecation warning, and a SWOOP_ value wins when both are set. See .env.example.

Data sources

Source Provides
ipsw.me (via IPSWDownloads) macOS restore images for VirtualMac2,1
AppleDB Restore images with hashes and signing status
Apple MESU The current signed restore image
Mr. Macintosh Restore image archive
VirtualBuddy TSS (optional) Live signing status per restore image
xcodereleases.com Xcode versions and the SDKs they ship
swiftversion.net Swift versions
Apple's simulator index (index2.dvtdownloadableindex) Simulator runtimes, and SDK builds that correct xcodereleases.com

sync deduplicates by build number (restore images, Xcode, SDKs, runtimes) or version (Swift). MESU and VirtualBuddy decide signing status, AppleDB supplies hashes, and Apple's index wins over xcodereleases.com for SDKs. Each source has a minimum fetch interval, tracked in DataSourceMetadata records.

CloudKit records

Record type Key References
RestoreImage build number
SwiftVersion version
XcodeVersion build number minimumMacOS → RestoreImage, includedSwiftVersion → SwiftVersion
SDKVersion platform + build xcodeVersion → XcodeVersion, supersededBy → the final SDK (for betas)
SimulatorRuntime platform + build none; sdkBuildNumbersText lists its SDK builds
DataSourceMetadata source + record type

Record names are deterministic and every write is a .forceReplace, so repeated syncs update records instead of duplicating them. Records are uploaded in reference order, at most 200 operations per request.

To set up a container, import the schema with Scripts/setup-cloudkit-schema.sh (it uses xcrun cktool), then create a Server-to-Server key in the CloudKit Dashboard. A key belongs to one container. The DocC catalog has the full walkthrough: CloudKit Server-to-Server Authentication Setup.

Scheduled sync

GitHub Actions keeps the Development database current:

See .github/CLOUDKIT_SYNC_SETUP.md and .github/SECRETS_SETUP.md.

Development

swift build
swift test
make lint           # Scripts/lint.sh; run `mise install` once for swift-format, SwiftLint and periphery
make format
make docs           # DocC in .build/docs, warnings are errors
make docs-preview
make docker-test    # the tests in swift:6.4-noble

There's also a dev container (.devcontainer, swift:6.4-noble) and an optional XcodeGen project (make xcode). Guidance for contributors and coding agents is in AGENTS.md.

CI (SwoopMistKit.yml) builds and tests on Ubuntu (noble, plus jammy for PRs into main) and on the xcode-27 runner with Xcode 27.2 (macOS and iOS, plus watchOS, tvOS and visionOS for PRs into main), builds the docs, and lints. dependency-policy.yml blocks merging into main while any dependency is a branch.

License

MIT. See LICENSE.

About

Syncs Apple OS, Xcode, Swift, SDK and simulator release data into CloudKit with MistKit

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages