xc-mcp
Version:
MCP server that wraps Xcode command-line tools for iOS/macOS development workflows
59 lines • 2.31 kB
TypeScript
import { AccessibilityElement } from './element-extraction.js';
/**
* View fingerprint for identifying unique app screens/views
* Based on xcode-agent recommendation: element structure hash is primary key
*/
export interface ViewFingerprint {
elementStructureHash: string;
orientation: 'portrait' | 'landscape' | 'portraitUpsideDown' | 'landscapeRight';
screenBounds: {
width: number;
height: number;
};
screenshotHash?: string;
timestamp: Date;
elementCount: number;
topLevelContainers: string[];
}
/**
* Configuration for view fingerprinting
*/
export interface FingerprintConfig {
includeScreenshotHash?: boolean;
includeTimestamps?: boolean;
sortElements?: boolean;
}
/**
* Compute unique fingerprint for a view based on accessibility element structure
*
* Following xcode-agent recommendation:
* - Element structure hash is PRIMARY key (more stable than screenshot)
* - Includes orientation and screen bounds for device-specific layouts
* - Excludes screenshot hash by default (fragile due to status bar, animations)
*
* @param elements Accessibility elements from view
* @param screenDimensions Screen width/height
* @param orientation Device orientation
* @param config Optional fingerprinting configuration
*/
export declare function computeViewFingerprint(elements: AccessibilityElement[], screenDimensions: {
width: number;
height: number;
scale: number;
}, orientation?: 'portrait' | 'landscape' | 'portraitUpsideDown' | 'landscapeRight', config?: FingerprintConfig): ViewFingerprint;
/**
* Generate cache key from fingerprint, bundleId, and app version
* Following xcode-agent recommendation to include app version
*/
export declare function generateCacheKey(fingerprint: ViewFingerprint, bundleId: string, appVersion?: string): string;
/**
* Check if a view is cacheable (excludes dynamic/animated content)
* Following xcode-agent recommendation to exclude uncacheable views
*/
export declare function isViewCacheable(elements: AccessibilityElement[]): boolean;
/**
* Compute Hamming distance between two hash strings
* Used for perceptual hash comparison in future phases
*/
export declare function hammingDistance(hash1: string, hash2: string): number;
//# sourceMappingURL=view-fingerprinting.d.ts.map