Files
vphone-cli/sources/VPhoneCore/VPhoneBundleReport.swift
zqxwceandClaude Fable 5 d37c06b61d vphone-cli: Add network to vm info/vm list JSON
`vm info --json` and `vm list --json` encode VPhoneBundleReport, which
carried no network field — so the network mode was absent from JSON even
though the human-readable output prints `net:`. Consumers parsing JSON had
no way to read a VM's network config.

Project the manifest's NetworkConfig into VPhoneBundleReport as `network`,
so both `info` and `list` emit it as structured JSON (mode, macAddress,
bridgeInterface). NetworkConfig gains Equatable (VPhoneBundleReport is
Equatable). The text `net:` line now reads from the same report projection.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-03 11:35:34 +03:00

22 lines
794 B
Swift

import Foundation
public struct VPhoneBundleReport: Codable, Equatable, Sendable {
public let name: String
public let cpuCount: Int
public let memoryMB: Int
public let diskSizeBytes: Int64
public let network: VPhoneVirtualMachineManifest.NetworkConfig
public let restoreInfo: VPhoneRestoreInfo?
public let udid: String?
public init(bundle: VPhoneBundle) {
self.name = bundle.name
self.cpuCount = Int(bundle.manifest.cpuCount)
self.memoryMB = Int(bundle.manifest.memorySize / (1024 * 1024))
self.diskSizeBytes = bundle.diskSizeBytes
self.network = bundle.manifest.networkConfig
self.restoreInfo = VPhoneRestoreInfo.load(fromBundle: bundle)
self.udid = VPhoneRestoreOps.resolveUDID(bundle: bundle)
}
}