Fix main CI Swift file length budget

Merged
LA
7mo ago
+300-293

Main CI is failing in the workflow guard because CLI/cmux.swift grew past its file length budget: https://github.com/manaflow-ai/cmux/actions/runs/25471460485\n\nThis splits the event command helpers and process runner out of CLI/cmux.swift without changing behavior.\n\nVerification:\n- ./scripts/swift_file_length_budget.py --budget .github/swift-file-length-budget.tsv\n- xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-cli -configuration Debug -destination 'platform=macOS' -derivedDataPath /tmp/cmux-fix-main-ci-cli-budget-cli build


[!NOTE]
Low Risk
Primarily a refactor to move existing CLI helper code into separate files; behavior should be unchanged aside from possible access-level/compilation integration issues.

Overview
Refactors the CLI to satisfy the Swift file-length budget by moving the events command implementation (option parsing, frame parsing, cursor read/write, reconnect logic) out of CLI/cmux.swift into CMUXCLI+Events.swift.

Extracts the process execution utilities (CLIProcessRunner/CLIProcessResult) into a new CMUXCLI+Process.swift, updates Xcode project sources accordingly, and relaxes authenticateClientIfNeeded visibility so the extracted events code can call it.

Reviewed by Cursor Bugbot for commit 061c2b38901cbc154a26e97b4f03148f3a5fddfa. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes main CI failure by bringing CLI/cmux.swift back under the file-length budget. Extracts event streaming and process runner code into dedicated files with no behavior changes.

  • Refactors
    • Split events command handling into CLI/CMUXCLI+Events.swift (options parsing, cursor I/O, frame parsing, reconnect/backoff).
    • Added CLI/CMUXCLI+Process.swift with CLIProcessRunner and CLIProcessResult; removed from CLI/cmux.swift and updated the project file.
    • Made CMUXCLI.authenticateClientIfNeeded non-private so extensions can call it.

Summary by CodeRabbit

  • New Features
    • Expanded events subcommand with new command-line options: filtering by event name and category, cursor-based resumption across sessions, reconnection control, selective output filtering, and stream limiting capabilities.
    • Introduced process execution utility with configurable timeout and comprehensive result reporting.