-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Phase 0: Module Foundation
Related Issue: #199 - Enable Remote Debugging
Timeline: Week 1
Priority: Critical (Foundational)
Packages Modified: bushelkit, bushelapp
POC Focus: Create protocol modules and establish dependencies
Overview
Establish the foundational module structure and shared protocol definitions required by all subsequent phases. This phase creates the BushelHarvestProtocol module in BushelKit (shared between host and guest) and sets up the host-side module skeleton in BushelApp.
Goals
- Create BushelHarvestProtocol target in BushelKit with shared protocol definitions
- Create BushelHarvestHostCore target in BushelApp
- Create BushelHarvestHost target in BushelApp
- Add BushelHarvestHost dependency to BushelMachineViews
- Update HarvestBinKit to depend on BushelHarvestProtocol from BushelKit
- Integrate modules into BushelApp product
- Verify module structure and dependencies
Dependencies
Requires: None (foundational phase)
Blocks:
- Phase 1: Remote Access
- Phase 2: System Profiling
- Phase 3: VirtioSocket Communication
- Phase 4: Command Protocol
- Phase 5: Integration Features
- Phase 6: UI & Polish
Implementation Tasks
BushelKit - Shared Protocol Module
-
Create
BushelHarvestProtocoltarget in BushelKit- Location:
Packages/BushelKit/Sources/BushelHarvestProtocol/ - Dependencies:
BushelFoundation,BushelLogging
- Location:
-
Implement protocol files:
-
CommandProtocol.swift- Message format and command type definitions -
MessageTypes.swift- Request/response/event message structures -
SecurityTypes.swift- Authentication and authorization types -
HarvestCommand.swift- Command definitions and payload structures
-
-
Export BushelHarvestProtocol as BushelKit product
- Update
Packages/BushelKit/Package.swift - Add
.library(name: "BushelHarvestProtocol", targets: ["BushelHarvestProtocol"])
- Update
BushelApp - Host-Side Modules
-
Create
BushelHarvestHostCoretarget using PackageDSL- Location: Create
Packages/BushelApp/Package/Sources/Targets/BushelHarvestHostCore.swift - Dependencies:
BushelFoundation,BushelLogging,BushelHarvestProtocol(from BushelKit),BushelGuestProfile,BushelMachine
- Location: Create
-
Create
BushelHarvestHosttarget using PackageDSL- Location: Create
Packages/BushelApp/Package/Sources/Targets/BushelHarvestHost.swift - Dependencies:
BushelFoundation,BushelLogging,BushelHarvestProtocol(from BushelKit),BushelHarvestHostCore,BushelMachine,BushelServiceClient
- Location: Create
-
Update
BushelMachineViewstarget to depend onBushelHarvestHost- Location: Edit
Packages/BushelApp/Package/Sources/Targets/BushelMachineViews.swift - Add dependency:
BushelHarvestHost()
- Location: Edit
-
Create source directories:
-
Packages/BushelApp/Sources/BushelHarvestHostCore/ -
Packages/BushelApp/Sources/BushelHarvestHost/
-
-
Create placeholder files to verify structure:
-
BushelHarvestHostCore/VMDiscoveryService.swift(empty protocol) -
BushelHarvestHostCore/HarvestConnectionManager.swift(empty protocol) -
BushelHarvestHostCore/HarvestAuthenticationService.swift(empty protocol) -
BushelHarvestHost/HarvestManager.swift(empty protocol) -
BushelHarvestHost/CommandDispatcher.swift(empty protocol) -
BushelHarvestHost/HarvestCommandService.swift(empty protocol)
-
HarvestBinKit - Guest-Side Dependencies
- Update
HarvestBinKitPackage.swift to depend on BushelHarvestProtocol- Location:
Packages/HarvestBin/Packages/HarvestBinKit/Package.swift - Add dependency:
.package(path: "../../../../BushelKit") - Add target dependency:
.product(name: "BushelHarvestProtocol", package: "BushelKit")
- Location:
Package Generation
-
Regenerate BushelApp Package.swift
- Run:
make generate-packages - Verify all new targets appear in generated Package.swift
- Run:
-
Regenerate Xcode project
- Run:
make xcodeproject - Verify new modules appear in Xcode project navigator
- Run:
Integration
-
Integrate modules into BushelApp product
- Modules are automatically discovered by PackageDSL through dependency traversal
- Verify
BushelHarvestHostis accessible toBushelMachineViews
-
Verify build succeeds
- Build
BushelAppscheme in Xcode - Ensure no compilation errors
- Build
Success Criteria
- BushelHarvestProtocol module exists in BushelKit with all protocol files
- BushelHarvestProtocol is exported as a BushelKit product
- BushelHarvestHostCore target is defined and has source directory
- BushelHarvestHost target is defined and has source directory
- BushelMachineViews depends on BushelHarvestHost
- HarvestBinKit depends on BushelHarvestProtocol from BushelKit
- Package.swift regeneration succeeds without errors
- Xcode project regeneration succeeds without errors
- BushelApp scheme builds successfully
- All placeholder files compile (empty protocols/classes)
- Module dependency graph is correct (verified via Xcode project)
Technical Details
Module Dependency Graph
BushelMachineViews (includes Harvest UI)
└── BushelHarvestHost
├── BushelHarvestHostCore
│ ├── BushelHarvestProtocol (BushelKit - shared)
│ ├── BushelGuestProfile (BushelKit)
│ └── BushelMachine (BushelKit)
└── BushelServiceClient
HarvestBinKit (guest-side)
└── BushelHarvestProtocol (BushelKit - shared)
PackageDSL Target Definition Example
// Packages/BushelApp/Package/Sources/Targets/BushelHarvestHostCore.swift
struct BushelHarvestHostCore: Target {
var dependencies: any Dependencies {
BushelFoundation()
BushelLogging()
BushelHarvestProtocol() // From BushelKit
BushelGuestProfile()
BushelMachine()
}
}BushelHarvestProtocol Example Structure
// CommandProtocol.swift
public protocol HarvestCommand: Codable, Sendable {
var action: String { get }
var category: CommandCategory { get }
var payload: [String: Any] { get }
}
public enum CommandCategory: String, Codable, Sendable {
case system
case file
case network
case clipboard
case remote
}Testing
- Verify BushelKit builds independently with new protocol module
- Verify BushelApp builds with new Harvest modules
- Verify HarvestBinKit can import BushelHarvestProtocol
- Verify no circular dependencies exist
- Verify PackageDSL correctly discovers all modules
References
Notes
- This phase establishes the foundation for all Harvest functionality
- No actual functionality is implemented, only structure
- Protocol definitions should be minimal and can be expanded in later phases
- Focus on getting the module structure correct before adding implementation
- Ensure shared protocol is truly shared (both host and guest use same definitions)
Related Issues:
- Main implementation: brightdigit/Bushel#285