4.1 KiB
Strip the DebugBridge from an iOS app
This skill is a convenience flow, not a safety mechanism. The structural
guard against shipping DebugBridge in Release is in Package.swift.template
(.when(configuration: .debug)) plus the CI invariant test that runs
swift build -c release and asserts the DebugBridge symbol is absent. Both
ship as part of $qa --mode Report --module ios-qa's template installation.
This skill exists for developers who:
- Manually copied DebugBridge files (without using
$qa --mode Report --module ios-qa's SPM install). - Want a guided, reversible removal flow before a security audit.
- Are migrating away from gstack and want a clean exit.
What it removes
Each item is reverted only after AskUserQuestion confirmation:
- The
DebugBridgeSPM target fromPackage.swift. - The
#if DEBUGblock in the app's@mainentry that callsDebugBridgeManager.shared.start(). - Any
@Snapshotableproperty wrappers on the canonical app state struct (the codegen-detection markers — the wrapper file lives inside DebugBridge so removing the SPM dep removes the wrapper too). - Generated
StateAccessor.swiftfiles anywhere under the app source. - The
gstack-ios-qa.tokenfile underNSTemporaryDirectory()on the device (best-effort — only works if device is connected when $ship --mode Prepare --module ios-clean runs).
What it does NOT touch
- App business logic, view models, view code.
- Anything outside
#if DEBUGblocks. - Other test or QA infrastructure.
Phase 1: Inventory
- Glob for
import DebugBridgeacross the app source. - Glob for
#if DEBUG ... DebugBridgeManagerblocks. - Glob for
// Auto-generated state accessorheaders inStateAccessor.swiftfiles. - Parse
Package.swiftfor the DebugBridge dependency entry. - Show the user what's about to be removed (file list + line counts). AskUserQuestion: proceed, dry-run, or abort.
Phase 2: Remove
For each item the user approved:
- Use Edit tool to strip the import + the
#if DEBUGblock (keep the surrounding code intact). - Use Edit tool to remove the
.package(url:...DebugBridge...)entry fromPackage.swiftand anytargetsreferencing"DebugBridge". - Delete generated
StateAccessor.swiftfiles. - Run
xcodebuild -scheme <SchemeName> -destination 'platform=iOS,id=<UDID>' build install -configuration Releaseto verify Release builds without the bridge. If it fails on a missing DebugBridge symbol, the removal was incomplete — STOP and report.
Phase 3: Verify
! grep -r "DebugBridge" <app-source-dir>(no matches).! grep -r "@Snapshotable" <app-source-dir>(no matches).swift build -c releasesucceeds.nm -jon the built binary doesn't show DebugBridge symbols.
Report the cleanup result + a one-line summary of what got removed.
Reversibility
Every Edit + delete is a git operation; the user can git restore to undo.
This skill never force-pushes, never amends, never deletes the SPM cache —
those are user choices.
Upstream judgment port: PR #679
User-language rule
Write questions, progress updates, reports, and artifacts in the language used by the user. Source material, code identifiers, commands, and quotations may remain in their original language when translating them would reduce accuracy.