mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 20:30:47 +02:00
90 lines
4.1 KiB
Markdown
90 lines
4.1 KiB
Markdown
<!-- GENERATED by scripts/gstack2/generate-skill-tree.ts; do not edit. -->
|
|
<!-- GSTACK2_PROVENANCE source=ios-clean/SKILL.md.tmpl base=bb57306d98c97011b0919c6132705a15b1579781 blob=3a64481a99fab0d7247c23df0a07c428c1c5f3da baseline_render_sha256=07faf69966454f513d7d76f0b9f8d77c46a1fd79871dfc4d409dc1dc1f1967ed ported_render_sha256=6a0080b7678f9e1df7ae2da27c4a7e3e85e7bfb83525a2c5651c24c0ab024b4b disposition=BUG_FIX -->
|
|
<!-- GSTACK2_ROUTING replacement=$ship --mode Prepare --module ios-clean visibility=internal depth=standard mutation=fix-safe web=none -->
|
|
|
|
<!-- GSTACK2_LEGACY_BODY_START source=ios-clean -->
|
|
# 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.
|
|
<!-- GSTACK2_LEGACY_BODY_END source=ios-clean -->
|
|
|
|
<!-- GSTACK2_BUG_FIX_START pr=679 anchor=GSTACK2_FIX_679_MATCH_USER_LANGUAGE -->
|
|
## Upstream judgment port: PR #679
|
|
|
|
[Match the user language](https://github.com/garrytan/gstack/pull/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.
|
|
<!-- GSTACK2_BUG_FIX_END pr=679 -->
|