DriftBuild Implementation
Workflow
Start by reading the files that own the requested behavior:
- Shared models and utilities:
Sources/DriftCore/Models.swift, Sources/DriftCore/Utilities.swift
- CLI commands and client HTTP behavior:
Sources/DriftCLI/main.swift
- Server routes, state, queue, worker, discovery publisher:
Sources/DriftServer/main.swift
- Server command wrappers:
Sources/DriftServer/Commands.swift
- Tests:
Tests/DriftBuildTests/DriftBuildTests.swift
Keep changes consistent with the current package: Swift 5.10, macOS 13+, Foundation, ArgumentParser, Vapor, and no shell execution for build-critical subprocesses.
Implementation Rules
- Keep protocol structs in
DriftCore when both CLI and server need them.
- Keep user-facing command options in the relevant
ArgumentParser command.
- Keep server endpoint behavior in
configureRoutes unless the route surface becomes large enough to justify extraction.
- Use
Process.executableURL and arguments; do not introduce sh -c for Git, CocoaPods, xcodebuild, ditto, or zip.
- Preserve the job lifecycle:
queued, preparing, fetching, installingDependencies, building, packaging, terminal status.
- Preserve offset-based log reads with monotonically increasing
nextOffset.
- Preserve artifact creation on failure, timeout, and success.
- Prefer focused XCTest coverage for shared model/utility behavior and pure validation logic.
Common Tasks
When adding a CLI option, update all of these surfaces if applicable:
- Add the stored property to the
ArgumentParser command in Sources/DriftCLI/main.swift.
- Add the field to
BuildRequest or another shared DriftCore model when the server needs it.
- Update server validation and build-worker use.
- Update README examples and tests.
When changing build behavior:
- Make the smallest change in
BuildWorker.run(jobId:) or its helper methods.
- Log the selected stage or command clearly, without logging bearer tokens.
- Keep generated outputs under the job directory and
output/.
- Keep
result.zip shape compatible with existing docs.
Read references/architecture.md for a compact map of current responsibilities and invariants.
Source: zylcold/DriftBuild — distributed by TomeVault.
1---2name: driftbuild-implementation3description: Implement, debug, or extend DriftBuild, a Swift LAN remote iOS simulator build system. Use when working on the DriftBuild Swift Package, drift CLI, drift-server, Vapor HTTP API, ArgumentParser commands, Bonjour or UDP discovery, pairing, build queue, xcodebuild invocation, log streaming, artifact packaging, or tests. Use when this capability is needed.4---56# DriftBuild Implementation78## Workflow910Start by reading the files that own the requested behavior:1112- Shared models and utilities: `Sources/DriftCore/Models.swift`, `Sources/DriftCore/Utilities.swift`13- CLI commands and client HTTP behavior: `Sources/DriftCLI/main.swift`14- Server routes, state, queue, worker, discovery publisher: `Sources/DriftServer/main.swift`15- Server command wrappers: `Sources/DriftServer/Commands.swift`16- Tests: `Tests/DriftBuildTests/DriftBuildTests.swift`1718Keep changes consistent with the current package: Swift 5.10, macOS 13+, `Foundation`, `ArgumentParser`, `Vapor`, and no shell execution for build-critical subprocesses.1920## Implementation Rules2122- Keep protocol structs in `DriftCore` when both CLI and server need them.23- Keep user-facing command options in the relevant `ArgumentParser` command.24- Keep server endpoint behavior in `configureRoutes` unless the route surface becomes large enough to justify extraction.25- Use `Process.executableURL` and `arguments`; do not introduce `sh -c` for Git, CocoaPods, xcodebuild, ditto, or zip.26- Preserve the job lifecycle: `queued`, `preparing`, `fetching`, `installingDependencies`, `building`, `packaging`, terminal status.27- Preserve offset-based log reads with monotonically increasing `nextOffset`.28- Preserve artifact creation on failure, timeout, and success.29- Prefer focused XCTest coverage for shared model/utility behavior and pure validation logic.3031## Common Tasks3233When adding a CLI option, update all of these surfaces if applicable:34351. Add the stored property to the `ArgumentParser` command in `Sources/DriftCLI/main.swift`.362. Add the field to `BuildRequest` or another shared `DriftCore` model when the server needs it.373. Update server validation and build-worker use.384. Update README examples and tests.3940When changing build behavior:41421. Make the smallest change in `BuildWorker.run(jobId:)` or its helper methods.432. Log the selected stage or command clearly, without logging bearer tokens.443. Keep generated outputs under the job directory and `output/`.454. Keep `result.zip` shape compatible with existing docs.4647Read `references/architecture.md` for a compact map of current responsibilities and invariants.4849---50> Source: [zylcold/DriftBuild](https://github.com/zylcold/DriftBuild) — distributed by [TomeVault](https://tomevault.io).51<!-- tomevault:4.0:skill_md:2026-06-16 -->