rewriter: auto-rewrite xcodebuild → rtk xcodebuild (filter exists since v0.30.0)
#1551 opened on Apr 27, 2026
Description
Context
Issue #376 was closed COMPLETED in v0.30.0 with a xcodebuild.toml TOML filter — rtk xcodebuild build correctly strips CompileSwift lines etc.
However, the rewriter registry (rtk rewrite) does not auto-rewrite raw xcodebuild invocations to rtk xcodebuild. This means when xcodebuild is called from a Claude Code Bash hook (or any wrapper that uses rtk rewrite), the command falls through unchanged and the filter never fires.
Reproduction (rtk 0.34.2)
$ rtk rewrite "xcodebuild build -project Foo.xcodeproj"; echo $?
1 # exit 1 = "no RTK equivalent" → passthrough
$ rtk rewrite "git status"; echo $?
rtk git status
0 # exit 0 = rewrite applied
$ rtk xcodebuild build -project Foo.xcodeproj # explicit prefix works fine
... (filtered output)
Impact
From a single Claude Code user's rtk discover over 30 days:
xcodebuild 3,231 invocations (top unhandled command after ssh)
That's ~3,231 calls/month per user that bypass the v0.30.0 filter purely because the rewriter doesn't add the prefix.
Suggested fix
Add xcodebuild (and probably xcrun, swift-already-supported, etc.) to the rewriter registry in src/discover/registry.rs so it returns exit 0 with "rtk xcodebuild $args". The filter is already there — this is just wiring the rewriter side.
Verification of fix
$ rtk rewrite "xcodebuild build -project Foo.xcodeproj"
rtk xcodebuild build -project Foo.xcodeproj
$ echo $?
0