Skip to content

feat: add Swift/Xcode error and stacktrace compression#9

Open
Cyvid7-Darus10 wants to merge 1 commit intojee599:mainfrom
Cyvid7-Darus10:feat/swift-xcode-filter
Open

feat: add Swift/Xcode error and stacktrace compression#9
Cyvid7-Darus10 wants to merge 1 commit intojee599:mainfrom
Cyvid7-Darus10:feat/swift-xcode-filter

Conversation

@Cyvid7-Darus10
Copy link
Copy Markdown

@Cyvid7-Darus10 Cyvid7-Darus10 commented Apr 5, 2026

This adds a new swift subcommand and Swift crash trace compression to contextzip, addressing #1.

If you work on iOS/macOS projects, you know the pain of Xcode build output flooding your terminal. A typical swift build dumps a CompileSwift normal arm64 /path/to/every/single/file.swift line for every source file in your project, followed by linking steps, code signing, and other noise that buries the actual errors you care about. This filter collapses all of that into a one-line summary like swift build: 47 Swift files compiled, 2 targets linked while preserving every error and warning with full file paths and context.

The same goes for Swift crash stack traces. When your app crashes, you get a wall of numbered frames from UIKit, Foundation, libswiftCore, CoreFoundation, and GraphicsServices that are almost never relevant to debugging. This filter hides those framework frames and keeps only your app's frames, so instead of scrolling through 20+ lines of Apple internals, you see your 2-3 app frames with a (+ 15 framework frames hidden) note.

Here is a before/after for a build with errors:

Before (raw Xcode output):

CompileSwift normal arm64 /Users/dev/project/Sources/App.swift
CompileSwift normal arm64 /Users/dev/project/Sources/Models/User.swift
CompileSwift normal arm64 /Users/dev/project/Sources/Views/ContentView.swift
... 47 more lines like this ...
/Users/dev/project/Sources/App.swift:42:15: error: cannot convert value of type 'String' to expected argument type 'Int'
CompileSwift normal arm64 /Users/dev/project/Sources/Utils/Logger.swift
Ld /Users/dev/build/Debug/MyApp normal arm64
** BUILD FAILED **

After (contextzip swift build):

swift build: 50 Swift files compiled, 1 target linked

1 error:
/Users/dev/project/Sources/App.swift:42:15: error: cannot convert value of type 'String' to expected argument type 'Int'
        let x: Int = name
                     ^~~~

** BUILD FAILED **

The implementation follows the exact same patterns as cargo_cmd.rs and dotnet_cmd.rs. It adds swift_cmd.rs with the command handler and filter logic, extends error_cmd.rs to detect and compress Swift crash traces (making it 6 languages instead of 5), and hooks into the runner.rs post-processing pipeline for contextzip err output. All 1062 existing tests continue to pass, and 6 new tests cover the Swift-specific functionality.

Demo

Swift/Xcode filter demo

Add a new swift_cmd filter module that compresses Xcode build output and
Swift crash stack traces. CompileSwift noise lines are collapsed into a
count summary, build step noise is stripped, and framework frames in
crash reports (UIKit, Foundation, libswiftCore, etc.) are hidden while
app frames are preserved. The filter integrates into the existing error
compression pipeline in error_cmd.rs and the runner post-processing
chain. Closes jee599#1.
@Cyvid7-Darus10 Cyvid7-Darus10 force-pushed the feat/swift-xcode-filter branch from 57bf8e9 to cad3a32 Compare April 5, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant