formatting-build-output
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesexcsift - Xcode Build Output Formatter
xcsift - Xcode构建输出格式化工具
xcsift is a Swift command-line tool that parses and formats xcodebuild/SPM output for coding agents. It transforms verbose Xcode build output into token-efficient TOON format optimized for machine readability.
xcsift是一款Swift命令行工具,用于为编码Agent解析并格式化xcodebuild/SPM的输出。它将冗长的Xcode构建输出转换为令牌效率优化的TOON格式,更适合机器读取。
When to Use
使用场景
Use xcsift when running Swift or Xcode build commands:
xcodebuild buildxcodebuild testswift buildswift test
在运行Swift或Xcode构建命令时使用xcsift:
xcodebuild buildxcodebuild testswift buildswift test
Usage Pattern
使用模式
Always pipe build output through xcsift with stderr redirected:
bash
undefined始终通过xcsift管道传输构建输出,并重定向stderr:
bash
undefinedBasic usage
基础用法
xcodebuild build 2>&1 | xcsift -f toon
swift build 2>&1 | xcsift -f toon
xcodebuild build 2>&1 | xcsift -f toon
swift build 2>&1 | xcsift -f toon
With warnings
显示警告
xcodebuild build 2>&1 | xcsift -f toon -w
xcodebuild build 2>&1 | xcsift -f toon -w
With code coverage
包含代码覆盖率
swift test --enable-code-coverage 2>&1 | xcsift -f toon -c
xcodebuild test -enableCodeCoverage YES 2>&1 | xcsift -f toon -c
swift test --enable-code-coverage 2>&1 | xcsift -f toon -c
xcodebuild test -enableCodeCoverage YES 2>&1 | xcsift -f toon -c
With executable targets
包含可执行目标
xcodebuild build 2>&1 | xcsift -f toon -e
xcodebuild build 2>&1 | xcsift -f toon -e
Strict CI mode (fail on warnings)
严格CI模式(警告视为错误)
xcodebuild build 2>&1 | xcsift -f toon -W -E
undefinedxcodebuild build 2>&1 | xcsift -f toon -W -E
undefinedKey Flags
关键参数
| Flag | Description |
|---|---|
| TOON format (30-60% fewer tokens) |
| Show detailed warnings |
| Treat warnings as errors |
| Quiet mode (no output on success) |
| Include code coverage |
| Include executable targets |
| Exit with failure on build failure |
| Per-target phases and timing |
| 参数 | 说明 |
|---|---|
| TOON格式(令牌数量减少30-60%) |
| 显示详细警告 |
| 将警告视为错误 |
| 静默模式(成功时无输出) |
| 包含代码覆盖率 |
| 包含可执行目标 |
| 构建失败时以失败状态退出 |
| 按目标显示阶段和耗时 |
Output Format
输出格式
TOON format provides structured output optimized for LLMs:
toon
status: failed
summary:
errors: 1
warnings: 3
errors[1]{file,line,message}:
main.swift,15,"use of undeclared identifier"
warnings[3]{file,line,message}:
Parser.swift,20,"unused variable"TOON格式提供针对LLM优化的结构化输出:
toon
status: failed
summary:
errors: 1
warnings: 3
errors[1]{file,line,message}:
main.swift,15,"use of undeclared identifier"
warnings[3]{file,line,message}:
Parser.swift,20,"unused variable"Important
重要提示
- Always use to capture stderr (where compiler errors are written)
2>&1 - TOON format reduces tokens by 30-60% compared to raw xcodebuild output
- The hook automatically wraps build commands when installed
- 始终使用捕获stderr(编译器错误会输出到这里)
2>&1 - 与原始xcodebuild输出相比,TOON格式可减少30-60%的令牌数量
- 安装后,钩子会自动包装构建命令