✳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]

查看原始来源 ↗

更多类似作品