Registry / devops / xcode-build-queue

xcode-build-queue

JSON →
library0.6.0jsnpmunverified

xbq is a command-line interface (CLI) tool designed to manage serial Xcode builds for projects utilizing Git worktrees. It aims to solve the problem of duplicating large `DerivedData` and Swift Package Manager (SPM) resolution caches when running multiple concurrent AI coding sessions (e.g., Claude Code) on the same Xcode project. By routing all build and test requests through a single 'main' repository, it significantly reduces disk space usage and prevents `DerivedData` corruption. The current stable version is `0.6.0`, with a consistent, albeit irregular, release cadence that introduces new features and fixes. Key differentiators include its snapshot-based build process (no commit required), strict serial queue enforcement, and robust worktree management, making it an essential tool for environments leveraging AI-driven development with Xcode.

npm install xcode-build-queue
INSTALL
IMPORT
SIG · XCODE-BUILD-QUEUE
X
xcode-build-queue
devopsjavascriptv0.6.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

xbq
npm install -g xcode-build-queue xbq --version
import { xbq } from 'xcode-build-queue'
This package is a global CLI tool, not a library for programmatic import within JavaScript/TypeScript. Its functionality is accessed via the `xbq` command in the terminal after global npm installation.
xbq init
xbq init ~/path/to/your/project
Initializes the xbq system for a specified Xcode project, configuring the main repository for build queuing.
xbq config
xbq config set backend xcodebuild
edit ~/.bq/config.json
Since v0.2.0, all configuration should be managed via the `xbq config` CLI commands. Direct manual editing of `~/.bq/config.json` is discouraged and can lead to validation issues.
xbq fleet
xbq fleet launch my-experiment -p "refactor auth module"
Manages parallel Claude Code sessions across worktrees, using templates for consistent session setup and tracking.

This script demonstrates the installation, initialization, daemon startup, configuration, and a simulated build request using the `xbq` command-line interface via Node.js `child_process`. It illustrates typical setup and interaction patterns.

const { execSync } = require('child_process'); const path = require('path'); const os = require('os'); // Ensure xbq is installed globally. For a real scenario, handle installation checks robustly. try { execSync('npm list -g xcode-build-queue', { stdio: 'ignore' }); console.log('xcode-build-queue is already installed globally.'); } catch (error) { console.log('Installing xcode-build-queue globally...'); execSync('npm install -g xcode-build-queue', { stdio: 'inherit' }); console.log('xcode-build-queue installed.'); } // Define a dummy Xcode project path for demonstration purposes. const xcodeProjectPath = path.join(os.tmpdir(), 'MyDummyXcodeProject'); console.log(`\nSetting up dummy Xcode project directory at: ${xcodeProjectPath}`); execSync(`mkdir -p ${xcodeProjectPath}/.git`, { stdio: 'inherit' }); // Simulate a git repo for xbq init try { // 1. Initialize xbq for the dummy Xcode project console.log('\n--- Initializing xbq ---'); execSync(`xbq init ${xcodeProjectPath}`, { stdio: 'inherit' }); // 2. Start the xbq daemon. In a real setup, this would run as a background service. console.log('\n--- Starting xbq daemon (in background) ---'); execSync('xbq daemon start', { stdio: 'inherit' }); // 3. Configure a separate test scheme (feature introduced in v0.6.0) console.log('\n--- Configuring default test scheme ---'); execSync('xbq config set default_test_scheme MyUnitTestsScheme', { stdio: 'inherit' }); // 4. Simulate a build request from a worktree. // This command will queue a build. It will likely fail without a real Xcode project. console.log('\n--- Simulating a build request (expected to fail for dummy project) ---'); try { execSync(`xbq build --project-path ${xcodeProjectPath}`, { stdio: 'inherit' }); } catch (buildError) { console.warn(`xbq build command failed as expected for dummy project: ${buildError.message.split('\n')[0]}`); } // 5. Check fleet status to see managed sessions console.log('\n--- Checking xbq fleet status ---'); execSync('xbq fleet status', { stdio: 'inherit' }); } catch (error) { console.error('\nAn unhandled error occurred during xbq quickstart:', error.message); } finally { // Attempt to stop the daemon and clean up the temporary directory console.log('\n--- Attempting cleanup ---'); try { execSync('xbq daemon stop', { stdio: 'inherit' }); } catch (cleanupError) { console.warn('Failed to stop xbq daemon:', cleanupError.message.split('\n')[0]); } console.log(`Cleaning up dummy Xcode project directory: ${xcodeProjectPath}`); execSync(`rm -rf ${xcodeProjectPath}`, { stdio: 'inherit' }); console.log('Cleanup complete.'); }
xbq --version
Debug
Known issues
gotchaDirect manual editing of the configuration file (`~/.bq/config.json`) is no longer supported and can lead to validation errors or unexpected behavior.
fix
Always use the `xbq config` CLI commands (e.g., `xbq config set backend xcodebuild`) to manage xbq settings.
affects: >=0.2.0
gotchaSuboptimal incremental build performance might be observed after Git branch switches without `git-restore-mtime` installed.
fix
Install `git-restore-mtime` via `pip3 install git-restore-mtime` for improved build performance.
affects: all
gotchaIf `xbq test` is used and a separate test scheme is intended, configuring it explicitly is required. The `default_scheme` setting now only applies to `xbq build`.
fix
Set `default_test_scheme` and `default_test_plan` (if applicable) using `xbq config set default_test_scheme MyUnitTests`.
affects: >=0.6.0
Errors
Common errors & fixes
command not found: xbq
The `xcode-build-queue` package is not installed globally or is not in your system's PATH.
fix
Install the package globally: `npm install -g xcode-build-queue`.
Error: The provided path is not a git repository.
`xbq init` requires the target project directory to be a valid Git repository.
fix
Navigate to your Xcode project directory and ensure it is initialized as a Git repository (e.g., `git init`). Then run `xbq init ~/path/to/your/project`.
Validation Error: Invalid value for backend. Must be 'mcp' or 'xcodebuild'.
An attempt was made to set an unsupported value for the `backend` configuration key.
fix
Use a valid backend value: `xbq config set backend mcp` or `xbq config set backend xcodebuild`.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
git-restore-mtimeoptionalOptional dependency installed via pip3 for optimal incremental build performance after branch switches.
Agent activity
41 hits · last 30 days
node
34
OpenAI (training)
2
Resources