vibe-tools
Version:
CLI tools for AI agents
87 lines (86 loc) • 2.67 kB
TypeScript
/**
* Implementation of the Xcode run command.
* This command handles running iOS apps in the simulator.
*
* Key features:
* - Simulator device management
* - Device state detection
* - App installation and launch
*/
import type { Command, CommandGenerator, CommandOptions } from '../../types';
/**
* Command-specific flags and options
*/
interface RunCommandFlags {
device?: string;
}
export declare class RunCommand implements Command {
flags: RunCommandFlags;
/**
* Ensures that the Simulator.app is running.
* This is required before we can interact with simulator devices.
* @param deviceId - The ID of the device we want to use
*/
private ensureSimulatorRunning;
/**
* Gets the UUID for a simulator device by name.
* Handles parsing the output of xcrun simctl list devices.
*
* @param deviceName - Name of the device to find
* @returns Promise resolving to the device UUID
* @throws Error if device not found or UUID can't be parsed
*/
private getDeviceId;
/**
* Gets the current state of a simulator device.
* States can be: Booted, Shutdown, etc.
*
* @param deviceId - UUID of the device
* @returns Current state string
*/
private getDeviceState;
/**
* Finds the built app bundle in DerivedData.
* Uses multiple strategies to ensure we find the correct bundle.
*
* @param projectDir - Project directory
* @returns Path to the .app bundle
*/
private findAppBundle;
/**
* Handles the simulator lifecycle:
* 1. Gets device UUID
* 2. Checks device state
* 3. Boots simulator if needed
* 4. Installs and launches the app
*
* @param deviceName - Name of the simulator device
* @param bundleId - Bundle identifier of the app
* @param appPath - Path to the built .app bundle
*/
private runOnSimulator;
/**
* Main execution method for the run command.
* First builds the app, then runs it in the simulator.
*
* @param query - Command query string (e.g., "iphone" or "ipad")
* @param options - Command options
* @yields Status messages and command output
*/
execute(query: string, options: CommandOptions): CommandGenerator;
private getDeviceList;
/**
* Extracts the bundle identifier from the app's Info.plist file
*
* @param appPath - Path to the .app bundle
* @returns The bundle identifier string
*/
private getBundleIdentifier;
/**
* Gets the app name from Xcode build settings
*
* @returns The app name
*/
private getAppName;
}
export {};