Skip to main content

createXCodeSandboxClient()

Creates a client for interacting with a sandboxed Xcode build service.
import { createXCodeSandboxClient } from 'limrun';

const client = await createXCodeSandboxClient({
  apiUrl: instance.status.sandbox.xcode.url,
  token: apiKey,
});

Parameters

options
CreateXCodeSandboxClientOptions
required
Configuration options for the Xcode sandbox client
apiUrl
string
required
The API URL of the Xcode sandbox server
token
string
required
Auth token for the sandbox
simulator
SimulatorConfig
Simulator (limulator) connection details. Only needed if the sandbox is not already configured (e.g., when created outside of an iOS instance). When provided, the client will call POST /simulator to set up the connection.
apiUrl
string
required
The API URL of the simulator (limulator)
token
string
Auth token for the simulator. If not provided, uses the sandbox token.
logLevel
LogLevel
default:"info"
Controls logging verbosity. One of: 'none', 'error', 'warn', 'info', 'debug'

Returns

client
Promise<XCodeSandboxClient>
A promise that resolves to an XCodeSandboxClient instance

Examples

// When using an iOS instance (simulator already configured)
const client = await createXCodeSandboxClient({
  apiUrl: instance.status.sandbox.xcode.url,
  token: apiKey,
});

XCodeSandboxClient

Client interface for interacting with a sandboxed Xcode build service.

Methods

sync()

Sync source code to the sandbox. In watch mode, keeps syncing on changes. Does NOT trigger builds - call xcodebuild() when ready.
const result = await client.sync('./my-ios-app', {
  watch: true,
  filter: (path) => !path.startsWith('build/'),
});
localCodePath
string
required
Path to the local code directory to sync
opts
SyncOptions
Sync configuration options
cacheKey
string
default:"xcode-sandbox"
Cache scoping key for delta basis caching. This is not sent to the server.
basisCacheDir
string
Directory for the client-side folder-sync cache
maxPatchBytes
number
Max patch size (bytes) to send as delta before falling back to full upload
watch
boolean
default:false
If true, watch the folder and re-sync on any changes
log
(level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void
Custom logging function
filter
(relativePath: string) => boolean
Optional filter function to include/exclude files and directories. Called with the relative path from the sync root (using forward slashes). For directories, the path ends with ’/’. Return true to include, false to exclude.
// Exclude build folder
filter: (path) => !path.startsWith('build/')

// Only include source files
filter: (path) => path.startsWith('src/') || path.endsWith('.json')
result
Promise<SyncResult>
Sync result containing stopWatching function if watch mode is enabled
stopWatching
() => void
Present only when watch=true; call to stop watching

xcodebuild()

Trigger xcodebuild on the synced source code. Returns a ChildProcess-like object for streaming output.
const build = client.xcodebuild({
  scheme: 'MyApp',
  workspace: 'MyApp.xcworkspace',
});

// Stream build output
build.stdout.on('data', (line) => console.log(line));

const { exitCode } = await build;
opts
XcodeBuildConfig
Build configuration options
workspace
string
Path to .xcworkspace file
project
string
Path to .xcodeproj file
scheme
string
Scheme name to build
process
ExecChildProcess
A ChildProcess-like object that can be awaited or used for streaming. See exec for details.

Types

LogLevel

type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
Controls logging verbosity for the Xcode sandbox client.

XcodeBuildConfig

type XcodeBuildConfig = {
  workspace?: string;
  project?: string;
  scheme?: string;
};
Build configuration for xcodebuild command.

SimulatorConfig

type SimulatorConfig = {
  /** The API URL of the simulator (limulator) */
  apiUrl: string;
  /** Auth token for the simulator. If not provided, uses the sandbox token. */
  token?: string;
};
Simulator connection details for configuring the sandbox.

SyncOptions

type SyncOptions = {
  cacheKey?: string;
  basisCacheDir?: string;
  maxPatchBytes?: number;
  watch?: boolean;
  log?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => void;
  filter?: (relativePath: string) => boolean;
};
Options for syncing source code to the sandbox.

SyncResult

type SyncResult = {
  /** Present only when watch=true; call to stop watching */
  stopWatching?: () => void;
};
Result of a sync operation.

Build docs developers (and LLMs) love