---
title: "讓 Claude 直接讀取 xcodebuild 編譯錯誤的 Claude Code 外掛"
url: "https://claudemods.dev/zh-tw/builds/i-built-a-claude-code-mod-that-gives-claude-your-xcodebuild--d9a001"
source: "https://github.com/griches/xcpane"
source_type: "github"
repo: "https://github.com/griches/xcpane"
author: "Gary_BBGames"
author_handle: "Gary_BBGames"
stars: 4
category: "開發與除錯"
categories: ["debug", "tools", "workflow"]
tags: ["bash-tool", "claude-code-mod", "error-summary", "swift", "xcodebuild", "xcresulttool"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add griches/xcpane\nclaude plugin install xcpane@griches"
added: "2026-10-04T00:04:24.843Z"
updated: "2026-10-09T14:27:09Z"
locale: "zh-tw"
content_locale: "zh-tw"
---

# 讓 Claude 直接讀取 xcodebuild 編譯錯誤的 Claude Code 外掛

作者利用新的 mod 系統製作了一個外掛：Claude 透過 Bash 執行 xcodebuild 失敗時，它會自動加上 -resultBundlePath，再用 xcresulttool 擷取錯誤、警告和測試失敗，讓 Claude 看到

## Description

這是一個針對使用 xcodebuild 搭配 Claude 的 Claude Code 外掛。問題在於，Bash 指令失敗且輸出很長時，Claude Code 只會把開頭和結尾交給模型，中間部分會被截斷；而失敗的 xcodebuild 剛好會把編譯錯誤放在中間。作者舉了一個例子：一個小型 Swift package 有 3 個編譯錯誤，日誌長達 295 行，Claude 只收到 10,039 個字元，完全沒有取得錯誤資訊；它知道哪些檔案失敗，卻不知道原因，只能 grep 原始碼，再用自己的篩選條件重新執行。

這個 mod 的做法是：在 xcodebuild 指令後加上 -resultBundlePath，接著使用 xcresulttool 從 Xcode 的結果包讀取錯誤、警告和測試失敗；把 Claude 讀取的內容替換成摘要。同一項測試中，摘要只有 499 個字元，卻包含每個回報錯誤的檔案、行號和欄號；轉錄記錄仍保留原始輸出；它也會按照檔案分組顯示錯誤、失敗的測試、警告和最近的建置。

限制是：在作者的測試中，它沒有讓 Claude 用更少的建置次數修好專案（兩種方式都是 3 次），但修正過程更有效率，因為不必再尋找錯誤。它只能看到 Claude 透過 Bash 執行的建置，看不到腳本、make 或 fastlane 裡的建置；swift build 只能從日誌讀取。原始碼、安裝說明和一個短 GIF 都在 GitHub 儲存庫中。

## Install

```
claude plugin marketplace add griches/xcpane
claude plugin install xcpane@griches
```

## Original README

I built a mod for Claude Code with the new mod system. It's for anyone who lets Claude run xcodebuild. When a Bash command fails with long output, Claude Code gives the model the start and the end and cuts out the middle. A failing xcodebuild puts the compiler errors in the middle. On a small Swift package with three compile errors, the log was 295 lines and Claude received 10,039 characters, none of them an error message. It knew which files failed but not why, so it grepped the source and re-ran the build through its own filter. It: - Appends `-resultBundlePath` to the xcodebuild command and reads errors, warnings and test failures from Xcode's result bundle with xcresulttool. - Replaces what Claude reads with a summary: in the same test, 499 characters with every reported error's file, line and column. The transcript keeps the raw output. - Shows a pane with errors grouped by file, failed tests, warnings and recent builds. It doesn't: It didn't make Claude fix the project in fewer builds in my test (three either way) but it does make it fix the issues more efficiently as it doesn't need to search the errors. It only sees builds Claude runs through Bash, not builds inside scripts, make or fastlane. swift build is read from the log only. Source, install instructions and a short GIF: https://github.com/griches/claude-xcode-mod (MIT) Happy to answer questions about the mod API, since there isn't much written about it yet. submitted by /u/Gary_BBGames [link] [comments]
