✳ClaudeModsClaude Code 模組目錄
☰
● 0 人在線上 · 瀏覽 0 次
+ 提交作品
← 返回作品集
Reddit 貼文 · 開發與除錯 / 工具與整合 / 工作流程與 CI

讓 Claude 直接讀取 xcodebuild 編譯錯誤的 Claude Code Mod

作者用新版 mod 系統做了一個 mod:當 Claude 透過 Bash 執行 xcodebuild 失敗時,自動追加 -resultBundlePath 並用 xcresulttool 提取錯誤/警告/測試失敗,把 Claude 看到的

GGary_BBGames@Gary_BBGames
已翻譯

關於這個 mod

這是一個面向用 Claude 執行 xcodebuild 的使用者的 Claude Code mod。問題在於 Bash 命令失敗且輸出很長時,Claude Code 只給模型開頭和結尾,中間被裁掉,而失敗的 xcodebuild 恰恰把編譯錯誤放在中間。作者舉例:一個小型 Swift 套件有三個編譯錯誤,日誌 295 行,Claude 只收到 10,039 字元且不含任何錯誤資訊,它知道哪些檔案失敗卻不知原因,只能去 grep 原始碼並用自己的過濾方式重跑。

該 mod 的做法是:給 xcodebuild 命令追加 -resultBundlePath,再用 xcresulttool 從 Xcode 的 result bundle 中讀取錯誤、警告和測試失敗;用摘要替換 Claude 讀到的內容,同一測試中摘要為 499 字元且包含每個已回報錯誤的檔案、行、列;記錄(transcript)裡仍保留原始輸出;還會顯示一個面板,按檔案分組展示錯誤、失敗測試、警告和最近的建置。

侷限:在作者測試中它沒有讓 Claude 用更少的建置次數修好專案(都是三次),但修復更有效率,因為不用再搜尋錯誤。它只能看到 Claude 透過 Bash 執行的建置,看不到腳本、make 或 fastlane 裡的建置;swift build 只從日誌中讀取。原始碼、安裝說明和一個簡短 GIF 見 GitHub 倉

安裝

安裝方式請查看原始來源。

原文 / 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]

查看原始來源 ↗

更多類似作品