Files
gstack/skills/ship/references/legacy/ios-clean.md
T

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:

  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 $ship --mode Prepare --module 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 <SchemeName> -destination 'platform=iOS,id=<UDID>' 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" <app-source-dir> (no matches).
  2. ! grep -r "@Snapshotable" <app-source-dir> (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.

Upstream judgment port: PR #679

Match the user language

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.