The generic 'generic/platform=macOS,arch=x86_64' destination is rejected by
the runner's Xcode ("Any Mac" does not support the arch option), failing the
release-package build. Match the working build-and-test destination.
Also correct the same specifier in README.md and AGENTS.md.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
7.7 KiB
7.7 KiB
AGENTS.md: Developer & AI Agent Operating Guide
Welcome to MacMonitor. This document serves as the authoritative operating manual for autonomous AI coding agents and human engineers contributing to this repository.
1. Non-Negotiable Architectural Rules
- Architecture & Target OS:
- The target architecture is Intel
x86_64exclusively. Do not introduce Apple Silicon ARM64-only assembly, intrinsics, or dependencies. - The minimum deployment target is macOS 14.0 (Sonoma). Do not downgrade deployment targets or use deprecated Carbon APIs.
- The target architecture is Intel
- Language Boundaries:
- UI & Presentation: Modern SwiftUI with
@Observable,@MainActor, and Swift Charts. - Kernel & Telemetry: Objective-C / C communicating directly with Mach kernel, IOKit, BSD sysctls, and CoreFoundation.
- Bridging: All Objective-C headers exposed to Swift must be declared in
Sources/Bridging/MacMonitor-Bridging-Header.h.
- UI & Presentation: Modern SwiftUI with
- Gitea MCP Tool Usage:
- Whenever performing repository operations, creating branches, reviewing issues, updating comments, or managing pull requests on
git.i3omb.com, always use the available tools on thegiteaMCP server (call_mcp_toolwithServerName: "gitea"). - Never use raw shell scripts (
curl, raw tokens) to interact with the Gitea API.
- Whenever performing repository operations, creating branches, reviewing issues, updating comments, or managing pull requests on
2. Deterministic Branching Strategy & Workflow
Every feature implementation must follow the branch taxonomy defined in BUILD-PLAN.md:
gitGraph
commit id: "Initial commit"
branch develop
checkout develop
commit id: "Docs & Build Plan"
branch milestone/m1-foundation
checkout milestone/m1-foundation
branch feat/1-core-architecture
checkout feat/1-core-architecture
commit id: "MMTelemetryCoordinator"
checkout milestone/m1-foundation
merge feat/1-core-architecture id: "PR #1 Merged"
branch feat/2-smc-client
checkout feat/2-smc-client
commit id: "AppleSMC IOKit client"
checkout milestone/m1-foundation
merge feat/2-smc-client id: "PR #2 Merged"
checkout develop
merge milestone/m1-foundation id: "M1 Complete"
2.1 Branch Naming Directory
When picking up an issue, you must use the exact branch name assigned to that issue:
- Issue #1:
feat/1-core-architecture(branch frommilestone/m1-foundation) - Issue #2:
feat/2-smc-client(branch frommilestone/m1-foundation) - Issue #25:
feat/25-gitea-ci(branch frommilestone/m1-foundation) - Issue #3:
feat/3-cpu-thermals(branch frommilestone/m2-primary-telemetry) - Issue #4:
feat/4-fan-telemetry(branch frommilestone/m2-primary-telemetry) - Issue #5:
feat/5-cpu-load(branch frommilestone/m2-primary-telemetry) - Issue #8:
feat/8-ram-breakdown(branch frommilestone/m2-primary-telemetry) - Issue #9:
feat/9-storage-volumes(branch frommilestone/m2-primary-telemetry) - Issue #18:
feat/18-component-temps(branch frommilestone/m2-primary-telemetry) - Issue #19:
feat/19-power-voltage(branch frommilestone/m2-primary-telemetry) - Issue #6:
feat/6-kernel-counters(branch frommilestone/m3-advanced-telemetry) - Issue #7:
feat/7-load-averages(branch frommilestone/m3-advanced-telemetry) - Issue #10:
feat/10-disk-io(branch frommilestone/m3-advanced-telemetry) - Issue #11:
feat/11-process-explorer(branch frommilestone/m3-advanced-telemetry) - Issue #12:
feat/12-process-threads(branch frommilestone/m3-advanced-telemetry) - Issue #14:
feat/14-gpu-telemetry(branch frommilestone/m3-advanced-telemetry) - Issue #15:
feat/15-network-throughput(branch frommilestone/m3-advanced-telemetry) - Issue #16:
feat/16-network-sockets(branch frommilestone/m3-advanced-telemetry) - Issue #17:
feat/17-battery-telemetry(branch frommilestone/m3-advanced-telemetry) - Issue #20:
feat/20-bus-topology(branch frommilestone/m3-advanced-telemetry) - Issue #21:
feat/21-audio-status(branch frommilestone/m3-advanced-telemetry) - Issue #13:
feat/13-display-brightness(branch frommilestone/m4-presentation) - Issue #22:
feat/22-menubar-popover(branch frommilestone/m4-presentation) - Issue #23:
feat/23-trend-charts(branch frommilestone/m4-presentation) - Issue #24:
feat/24-threshold-alerts(branch frommilestone/m5-alerts-hardening)
3. Telemetry Provider Implementation Invariants
Every low-level telemetry provider created by an agent must conform to the following contract:
3.1 Contract Interface
@protocol MMTelemetryProvider <NSObject>
@property (nonatomic, readonly) MMTelemetryDomain domain;
@property (nonatomic, readonly, copy) NSString *providerIdentifier;
@property (nonatomic, readonly, getter=isAvailable) BOOL available;
- (nullable NSDictionary<NSString *, id> *)sampleTelemetryWithError:(NSError **)error;
@optional
- (void)startMonitoring;
- (void)stopMonitoring;
@end
3.2 Critical Memory Management Rules
- Mach Pointer Deallocation: Any call to
host_processor_infoallocates a Mach virtual memory buffer. Always invokevm_deallocate(mach_task_self(), (vm_address_t)ptr, size)on previous iterations. - IOKit Registry Release: Every
io_registry_entry_torio_iterator_treturned byIOServiceGetMatchingServicesorIOIteratorNextmust be balanced withIOObjectRelease(). - IOKit Connection Cleanup: Close user clients using
IOServiceClose()indeallocor sleep handlers. - Autorelease Pool Scoping: Wrap sampling logic inside
@autoreleasepool { ... }blocks to reclaim temporary CoreFoundation/Objective-C allocations immediately on each timer tick.
4. Concurrency & Thread-Safety Invariants
- Zero UI Blocking:
Under no circumstances may low-level C calls (IOKit, Mach, sysctl) be invoked directly on the main thread (
@MainActor). All sampling occurs exclusively oncom.i3omb.macmonitor.telemetry(QOS_CLASS_UTILITY). - Value-Type Boundaries:
Data passed from Objective-C to Swift view models must be immutable snapshot copies (primitive scalars, strings, or
Sendablestructs). Never pass mutable Objective-C object references into SwiftUI views. - Fast Mutex Synchronization:
For shared state (such as SMC key caches or ring buffers), use
os_unfair_lockorNSLock. Do not use@synchronized(self).
5. Testing & Verification Requirements
5.1 Synthetic Hardware Mocking in CI
When writing unit tests for Gitea Actions runners (which may execute in headless virtual machines without physical SMC chips):
- Never assert that physical hardware calls return live metrics in unit tests.
- Structure providers with dependency injection to accept synthetic binary test buffers:
// Test mock SMC byte decoding uint8_t mockTempBytes[2] = { 0x36, 0x80 }; // 54.5°C in sp78 format float temp = [MMSMCParser decodeSP78:mockTempBytes]; XCTAssertEqualWithAccuracy(temp, 54.5, 0.01); - Mock Mach host statistics using recorded structs to verify delta load calculation algorithms.
5.2 Build Command Verification
Before opening any Pull Request, ensure that the project compiles cleanly for Intel x86_64:
xcodebuild build test \
-scheme MacMonitor \
-destination 'platform=macOS,arch=x86_64' \
CODE_SIGNING_ALLOWED=NO
6. Label & Issue Conventions on Gitea
- Tagging: Every issue, PR, and milestone must carry the
Project/Antigravitylabel. - Components: Tag issues with functional area labels:
Feature/ArchitectureorBug/ArchitectureFeature/BackendorBug/BackendFeature/UIorBug/UIFeature/DevOpsorBug/DevOps
- Priorities: Must accurately reflect system value (
Priority/Critical,Priority/High,Priority/Medium,Priority/Low). - Dependencies: Keep cross-references updated in the issue body under
### Dependencies.