xc-mcp
Version:
MCP server that wraps Xcode command-line tools for iOS/macOS development workflows
90 lines • 3.05 kB
TypeScript
import { SimulatorRuntime, SimulatorDeviceType } from '../types/xcode.js';
export interface SimulatorInfo {
udid: string;
name: string;
deviceTypeIdentifier: string;
state: string;
isAvailable: boolean;
availability: string;
availabilityError?: string;
lastUsed?: Date;
bootHistory: Date[];
performanceMetrics?: {
avgBootTime?: number;
reliability?: number;
};
}
export interface CachedSimulatorList {
devices: {
[runtime: string]: SimulatorInfo[];
};
runtimes: SimulatorRuntime[];
devicetypes: SimulatorDeviceType[];
lastUpdated: Date;
preferredByProject: Map<string, string>;
}
export declare class SimulatorCache {
private cache;
private cacheMaxAge;
private bootStates;
private preferredByProject;
private lastUsed;
constructor();
setCacheMaxAge(milliseconds: number): void;
getCacheMaxAge(): number;
clearCache(): void;
getSimulatorList(force?: boolean): Promise<CachedSimulatorList>;
getAvailableSimulators(deviceType?: string, runtime?: string): Promise<SimulatorInfo[]>;
getPreferredSimulator(projectPath?: string, deviceType?: string): Promise<SimulatorInfo | null>;
findSimulatorByUdid(udid: string): Promise<SimulatorInfo | null>;
recordSimulatorUsage(udid: string, projectPath?: string): void;
recordBootEvent(udid: string, success: boolean, duration?: number): void;
getBootState(udid: string): 'booted' | 'shutdown' | 'booting' | 'unknown';
getCacheStats(): {
isCached: boolean;
lastUpdated?: Date;
cacheMaxAgeMs: number;
cacheMaxAgeHuman: string;
deviceCount: number;
recentlyUsedCount: number;
isExpired: boolean;
timeUntilExpiry?: string;
};
private isCacheValid;
private findExistingDevice;
private formatDuration;
/**
* Get suggested simulators ranked by multiple criteria
*
* Scoring Algorithm:
* - Recent usage (40% weight): Most recent first
* - iOS version (30% weight): Latest versions preferred
* - Common models (20% weight): Popular models ranked higher
* - Boot performance (10% weight): Faster boots preferred
*/
getSuggestedSimulators(projectPath?: string, deviceType?: string, maxSuggestions?: number): Promise<Array<{
simulator: SimulatorInfo;
score: number;
reasons: string[];
}>>;
/**
* Get best simulator for a project
* Considers: project preference, recent usage, boot performance, availability
*/
getBestSimulator(projectPath?: string, deviceType?: string): Promise<{
simulator: SimulatorInfo;
score: number;
reason: string;
} | null>;
/**
* Load persisted state from disk
*/
private loadPersistedState;
/**
* Persist state to disk with debouncing
*/
private saveStateTimeout;
private persistStateDebounced;
}
export declare const simulatorCache: SimulatorCache;
//# sourceMappingURL=simulator-cache.d.ts.map