--- name: ios-clean preamble-tier: 3 version: 1.0.0 description: | Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. Cleans up StateServer, DebugOverlay, accessor codegen output, and app-side hooks installed by /ios-qa. This is a convenience wrapper — the structural Release-build guard (Package.swift conditional + CI swift build -c release check) is the safety-critical path. Use when asked to "clean the iOS debug bridge", "remove DebugBridge", or "strip the gstack iOS instrumentation". (gstack) voice-triggers: - "clean the iOS debug bridge" - "remove DebugBridge" - "strip the gstack iOS instrumentation" allowed-tools: - Bash - Read - Edit - Glob - Grep - AskUserQuestion triggers: - clean the ios debug bridge - remove debugbridge - strip the gstack ios instrumentation --- {{PREAMBLE}} # 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 `/ios-qa`'s template installation. This skill exists for developers who: - Manually copied DebugBridge files (without using `/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: 1. The `DebugBridge` SPM target from `Package.swift`. 2. The `#if DEBUG` block in the app's `@main` entry that calls `DebugBridgeManager.shared.start()`. 3. Any `@Snapshotable` property 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). 4. Generated `StateAccessor.swift` files anywhere under the app source. 5. The `gstack-ios-qa.token` file under `NSTemporaryDirectory()` on the device (best-effort — only works if device is connected when /ios-clean runs). ## What it does NOT touch - App business logic, view models, view code. - Anything outside `#if DEBUG` blocks. - Other test or QA infrastructure. ## Phase 1: Inventory 1. Glob for `import DebugBridge` across the app source. 2. Glob for `#if DEBUG ... DebugBridgeManager` blocks. 3. Glob for `// Auto-generated state accessor` headers in `StateAccessor.swift` files. 4. Parse `Package.swift` for the DebugBridge dependency entry. 5. 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: 1. Use Edit tool to strip the import + the `#if DEBUG` block (keep the surrounding code intact). 2. Use Edit tool to remove the `.package(url:...DebugBridge...)` entry from `Package.swift` and any `targets` referencing `"DebugBridge"`. 3. Delete generated `StateAccessor.swift` files. 4. Run `xcodebuild -scheme -destination 'platform=iOS,id=' build install -configuration Release` to verify Release builds without the bridge. If it fails on a missing DebugBridge symbol, the removal was incomplete — STOP and report. ## Phase 3: Verify 1. `! grep -r "DebugBridge" ` (no matches). 2. `! grep -r "@Snapshotable" ` (no matches). 3. `swift build -c release` succeeds. 4. `nm -j` on 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.