Skip to content

jonduenas/xcbuild-parser

Repository files navigation

xcbuild-parser

A Swift tool that parses xcodebuild output and converts it to clean, structured JSON designed for LLM coding agents.

Purpose

xcodebuild produces verbose, hard-to-parse output that clutters LLM context windows. xcbuild-parser solves this by:

  • Keeping context clean - Strips away verbose build logs, providing only actionable information
  • Clear issue identification - Presents errors, warnings, and test failures in a structured format with precise file locations (path, line, column)
  • Enabling agents to fix issues - Gives LLMs exactly what they need to understand problems and navigate to the right code
  • Efficient debugging - Includes the .xcresult bundle path when additional build or test information is needed

Supports both XCTest and Swift Testing frameworks, including parameterized tests.

Installation

Homebrew (recommended)

brew install jonduenas/tap/xcbuild-parser

Build from Source

# Clone the repository
git clone https://github.com/jonduenas/xcbuild-parser.git
cd xcbuild-parser

# Build and install
swift build -c release
cp .build/release/xcbuild-parser /usr/local/bin/

Usage

Pipe xcodebuild output to the parser:

# Parse build and test output
xcodebuild test -scheme "MyScheme" 2>&1 | xcbuild-parser

# Include warnings in the output
xcodebuild test -scheme "MyScheme" 2>&1 | xcbuild-parser --print-warnings

Output

The parser outputs JSON with the following structure:

{
  "status": "success",
  "summary": {
    "errors": 0,
    "warnings": 2,
    "passedTests": 42,
    "failedTests": 0,
    "buildTime": "12.345"
  },
  "errors": [],
  "warnings": [],
  "testResults": [],
  "xcresultPath": "/path/to/Result.xcresult"
}
Field Description
status "success" or "failure"
summary Aggregate counts and build time
errors Array of build errors with file, line, column, and message
warnings Array of build warnings (only with --print-warnings)
testResults Array of failed test results
xcresultPath Path to the .xcresult bundle, if available

Supported Formats

Build errors/warnings:

/path/to/file.swift:123:45: error: cannot find 'foo' in scope

XCTest results:

Test Case '-[MyTests testExample]' passed (0.123 seconds).
Test Case '-[MyTests testFailure]' failed (0.456 seconds).

Swift Testing results:

✔ Test "testExample" passed after 0.123 seconds.
✗ Test "testFailure" failed after 0.456 seconds.
✘ Test "paramTest" recorded an issue at file.swift:41:9: assertion failed

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages