You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Default behavior** (without flag): Only shows warning count in summary, omits detailed warnings array to reduce token usage
160
220
-**Quiet mode** (with `--quiet` or `-q` flag): Produces no output when build succeeds with zero warnings and zero errors
161
221
-**Coverage data** (with `--coverage` flag):
@@ -188,3 +248,51 @@ The tool outputs structured data optimized for coding agents:
188
248
- Supports both SPM (`swift test --enable-code-coverage`) and xcodebuild (`-enableCodeCoverage YES`) formats
189
249
- Automatically detects format and parses accordingly
190
250
- Warns to stderr if target was detected but no matching coverage data found
251
+
252
+
### TOON Format (with `--format toon` / `-f toon` flag)
253
+
254
+
**TOON (Token-Oriented Object Notation)** is a compact serialization format optimized for LLM consumption, providing **30-60% token reduction** compared to JSON.
255
+
256
+
**Key Features:**
257
+
- Tabular format for uniform arrays (errors, warnings, tests, coverage files)
258
+
- Indentation-based structure (similar to YAML)
259
+
- Human-readable while optimized for machine parsing
260
+
- Works with all existing flags (`--quiet`, `--coverage`, `--warnings`)
261
+
- Ideal for reducing LLM API costs
262
+
263
+
**Example TOON Output:**
264
+
265
+
```toon
266
+
status: failed
267
+
summary:
268
+
errors: 1
269
+
warnings: 3
270
+
failed_tests: 0
271
+
passed_tests: null
272
+
build_time: null
273
+
coverage_percent: null
274
+
errors[1]{file,line,message}:
275
+
main.swift,15,"use of undeclared identifier \"unknown\""
276
+
warnings[3]{file,line,message}:
277
+
Parser.swift,20,"immutable value \"result\" was never used"
278
+
Parser.swift,25,"variable \"foo\" was never mutated"
279
+
Model.swift,30,"initialization of immutable value \"bar\" was never used"
280
+
```
281
+
282
+
**Token Efficiency Comparison:**
283
+
284
+
For the same build output with 1 error and 3 warnings:
285
+
-**JSON**: 652 bytes
286
+
-**TOON**: 447 bytes
287
+
-**Savings**: 31.4% (205 bytes)
288
+
289
+
**When to Use TOON:**
290
+
- Passing build output to LLM APIs (reduces costs)
291
+
- Processing large build outputs with many errors/warnings
Copy file name to clipboardExpand all lines: README.md
+106-8Lines changed: 106 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ A Swift command-line tool to parse and format xcodebuild/SPM output for coding a
8
8
9
9
## Features
10
10
11
-
-**Token-efficient JSON output** - Structured format optimized for coding agents
11
+
-**Token-efficient output formats** - JSON (default) or TOON format (30-60% fewer tokens)
12
+
-**TOON format support** - Token-Oriented Object Notation optimized for LLM consumption
12
13
-**Structured error reporting** - Clear categorization of errors, warnings, and test failures
13
14
-**File/line number extraction** - Easy navigation to problematic code locations
14
15
-**Build status summary** - Quick overview of build results
@@ -81,9 +82,9 @@ Pipe xcodebuild output directly to xcsift:
81
82
xcodebuild [flags] 2>&1| xcsift
82
83
```
83
84
84
-
**Important**: Always use `2>&1` to redirect stderr to stdout. This ensures all compiler errors, warnings, and build output are captured, removing noise and providing clean, structured JSON output.
85
+
**Important**: Always use `2>&1` to redirect stderr to stdout. This ensures all compiler errors, warnings, and build output are captured, removing noise and providing clean, structured output.
85
86
86
-
Currently outputs JSON format only.
87
+
Supports both **JSON** (default) and **TOON** formats.
87
88
88
89
### Examples
89
90
@@ -92,7 +93,7 @@ Currently outputs JSON format only.
92
93
xcodebuild build 2>&1| xcsift
93
94
94
95
# Print detailed warnings list (useful for fixing warnings)
95
-
xcodebuild build 2>&1| xcsift --print-warnings
96
+
xcodebuild build 2>&1| xcsift --warnings
96
97
xcodebuild build 2>&1| xcsift -w
97
98
98
99
# Quiet mode - suppress output when build succeeds with no warnings or errors
@@ -120,6 +121,22 @@ xcodebuild test 2>&1 | xcsift
120
121
# Swift Package Manager support
121
122
swift build 2>&1| xcsift
122
123
swift test2>&1| xcsift
124
+
125
+
# TOON format (30-60% fewer tokens for LLMs)
126
+
# Token-Oriented Object Notation - optimized for reducing LLM API costs
127
+
xcodebuild build 2>&1| xcsift --format toon
128
+
xcodebuild build 2>&1| xcsift -f toon
129
+
130
+
# TOON with warnings
131
+
swift build 2>&1| xcsift -f toon --warnings
132
+
xcodebuild build 2>&1| xcsift -f toon -w
133
+
134
+
# TOON with coverage
135
+
swift test --enable-code-coverage 2>&1| xcsift -f toon --coverage
136
+
xcodebuild test -enableCodeCoverage YES 2>&1| xcsift -f toon -c
**Note on warnings:** By default, only the warning count appears in `summary.warnings`. The detailed `warnings` array (shown above) is only included when using the `--print-warnings` flag. This reduces token usage for coding agents that don't need to process every warning.
192
+
**Note on warnings:** By default, only the warning count appears in `summary.warnings`. The detailed `warnings` array (shown above) is only included when using the `--warnings` flag. This reduces token usage for coding agents that don't need to process every warning.
176
193
177
194
**Note on coverage:** The `coverage` section is only included when using the `--coverage-details` flag:
178
195
-**Summary-only mode** (default): Only includes coverage percentage in summary for maximum token efficiency
@@ -187,14 +204,95 @@ swift test 2>&1 | xcsift
187
204
-**Target filtering** (xcodebuild only): Automatically extracts tested target from stdout and shows coverage for that target only
188
205
- xcsift automatically converts `.profraw` files (SPM) or `.xcresult` bundles (xcodebuild) to JSON format without requiring manual llvm-cov or xccov commands
189
206
207
+
### TOON Format
208
+
209
+
With the `--format toon` / `-f toon` flag, xcsift outputs in **TOON (Token-Oriented Object Notation)** format, which provides **30-60% token reduction** compared to JSON. This format is specifically optimized for LLM consumption and can significantly reduce API costs.
210
+
211
+
```toon
212
+
status: failed
213
+
summary:
214
+
errors: 1
215
+
warnings: 3
216
+
failed_tests: 0
217
+
passed_tests: null
218
+
build_time: null
219
+
coverage_percent: null
220
+
errors[1]{file,line,message}:
221
+
main.swift,15,"use of undeclared identifier \"unknown\""
222
+
warnings[3]{file,line,message}:
223
+
Parser.swift,20,"immutable value \"result\" was never used"
224
+
Parser.swift,25,"variable \"foo\" was never mutated"
225
+
Model.swift,30,"initialization of immutable value \"bar\" was never used"
226
+
```
227
+
228
+
**TOON Benefits:**
229
+
-**30-60% fewer tokens** - Reduces LLM API costs significantly
0 commit comments