---
description: "Pre-submission store readiness for a built package, iOS and Android, local-only. Three symmetric gates per platform: a static package audit, the store's own authoritative validation, and a policy review against repo source. Separate verdict per gate, a skipped gate never counted as a pass. Validates only, never uploads. Use when a build is about to go to TestFlight or a Play track, or when a submission was rejected and the reason is not obvious."
description-tr: "Üretilmiş paketin yükleme öncesi store hazırlığı, iOS + Android, yalnızca lokal. Platform başına üç simetrik kapı: statik paket denetimi, store'un kendi doğrulayıcısı, ve kaynağa karşı politika incelemesi. Kapı başına ayrı verdict, atlanan kapı asla pass sayılmaz. Sadece doğrular, asla yüklemez."
argument-hint: "[repo]  -  empty = pick; repo name or path; --ipa= | --archive= | --aab= | --apk=; --skip-sweep; --resume"
allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep, TaskCreate, TaskUpdate, AskUserQuestion, Skill, mcp__multi-agent-toolkit__ios_app_store_audit, mcp__multi-agent-toolkit__ios_export_ipa, mcp__multi-agent-toolkit__ios_testflight_validate, mcp__multi-agent-toolkit__ios_xcodebuild, mcp__multi-agent-toolkit__ios_xcresult, mcp__multi-agent-toolkit__android_apk_audit, mcp__multi-agent-toolkit__ios_screenshot, mcp__multi-agent-toolkit__ios_get_ui_tree, mcp__multi-agent-toolkit__ios_set_appearance, mcp__multi-agent-toolkit__ios_set_content_size, mcp__multi-agent-toolkit__android_screenshot, mcp__multi-agent-toolkit__android_get_ui_tree, mcp__multi-agent-toolkit__android_set_dark_mode, mcp__multi-agent-toolkit__android_set_font_scale
---

# /multi-agent:store-ready  -  pre-submission validation, iOS + Android

Catch, before you upload, what App Store Connect or the Play Console would send
back after you do.

**Local-only.** No commits, no push, no PR, no channels unless you ask at the end.
A worktree, when one is needed, exists only to archive without touching your
working tree.

**It never uploads.** iOS runs `--validate-app`, never `--upload-app`. Android
never commits a Play edit. A validation run must not be able to ship a build by
accident.

**Input**: $ARGUMENTS

## Why three gates, and why the same three on both platforms

Each gate sees something the others structurally cannot, and reporting one of them
as "the check" is how a build passes locally and gets rejected anyway. The shapes
are the same on iOS and Android because the failure modes are: a malformed package,
a package the store itself refuses, and a policy a human enforces.

| Gate | Sees | Blind to |
|---|---|---|
| **1. Static** | package structure, manifests, signing, declared APIs and SDKs | anything depending on the store account |
| **2. Authoritative** | what the store's own validator says about this exact binary | written policy  -  no validator reads it |
| **3. Policy** | consent flows, deletion paths, purchase routing, disclosures | anything not visible in source |

### Gate matrix

| Gate | iOS | Android |
|---|---|---|
| 1 Static | `ios_app_store_audit({archive_path, rules: "all"})`  -  18 rules with real ITMS codes. Needs an `.xcarchive`. Reference: `apple-archive-compliance` skill | `android_apk_audit` plus the `google-play-compliance` skill's 21 rules: `bundletool validate` + manifest dump, `aapt2 dump badging`, `apksigner verify`, ABI / native scan. Needs an `.aab` (an `.apk` narrows it, see Step 3) |
| 2 Authoritative | `ios_testflight_validate({ipa_path, platform: "ios", <credentials>})` → `xcrun altool --validate-app`. Needs an `.ipa` + credentials | **No client shipped.** Play's authoritative check exists only server-side, through a Publishing API draft edit that is validated and then abandoned. The pipeline has no tool for it, so this gate reports `SKIPPED (no local Play validator)` and the report says so. Do not substitute `bundletool validate`  -  that is Gate 1 |
| 3 Policy | `ai-ios-toolkit:app-store-review` skill vs repo source | `ai-android-toolkit:play-store-review` skill vs repo source |

Gate 2's asymmetry is real and is reported as an asymmetry, not smoothed over. On
iOS it is the only gate that catches a version+build pair already used  -  the most
common wasted upload. On Android nothing local reproduces it, so an Android run
clears at most 2 of 3 gates and must never print `passed`.

## Step 0  -  parse input, detect platform

| Input | Meaning |
|---|---|
| (empty) | ask which repo (Step 1) |
| `my-app` or a path | that repo |
| `--archive=<path>` | iOS, build supplied; all three gates can run |
| `--ipa=<path>` | iOS, build supplied; Gate 1 reports `SKIPPED (needs .xcarchive)` |
| `--aab=<path>` | Android, build supplied; Gate 1 + 3 run |
| `--apk=<path>` | Android; Gate 1 runs the subset that does not need a bundle, and says which rules it could not apply |
| `--skip-sweep` | skip Step A, when no simulator / emulator is available or only the package matters |
| `--resume` | continue the last run from its state file |

Platform detection when no build flag is given:

```
cwd or repo contains .xcodeproj / .xcworkspace / Package.swift   -> iOS
cwd or repo contains build.gradle / build.gradle.kts             -> Android
both                                                            -> ask which
neither -> halt: "store-ready needs an iOS or Android project"
```

State lives at `$HOME/.claude/logs/multi-agent/<task_id>/agent-state.json` with
`taskId = SR-<repo>-<yyyymmddHHMM>`. Register phases with the tracker
(`$HOME/.claude/multi-agent-refs/tracker-contract.md`) so `:resume` and `:status`
work like any other run.

## Step 1  -  pickers (native, always)

Use `AskUserQuestion` for every step  -  never a numbered text menu. Questions and
descriptions render in `prefs.global.outputLanguage`; `label` and `header` stay
English, per `$HOME/.claude/multi-agent-refs/picker-contract.md`. Print the
`Step <i>/<n>: <what this decides>` breadcrumb for each.

1. **Repo**  -  from `prefs.projects` matching the detected platform. A single match
   auto-resolves (say so in the breadcrumb, do not silently skip the step).
2. **Branch**  -  the branch to validate. Resolution order:
   - `git fetch --prune` first, capturing **stderr**. **If the fetch fails, do not
     silently fall back to a cached ref**, and **classify before naming a cause**  -
     the same rule as the pipeline's own remote gate:

     | stderr contains | Cause | Remedy |
     |---|---|---|
     | `could not read Password`, `Authentication failed`, `403` | credential | store the PAT in the credential helper or switch the remote to SSH. **A VPN cannot fix this**, and the base ref being stale is unrelated to what broke  -  do not offer the cached-ref fallback. |
     | `Could not resolve host`, `Operation timed out`, `Connection refused` | network | retry / continue on the cached ref with an explicit warning / switch remote / abort, per `$HOME/.claude/multi-agent-refs/rules.md` |
     | `Repository not found`, `404` | wrong remote | show `git remote -v` and ask |

     Always print the observed stderr line next to the classification. Asserting
     `unreachable (VPN/DNS)` for a missing-credential error that returns in under a
     second sends the user to fix something that was never broken.
   - Offer the current branch, the default branch, and any `release/*` /
     `tkdevelop/*` heads.
3. **Mode**  -  how the build is obtained:
   - `Supply a build` (Mode B, default)  -  fastest, no signing needed in-run.
   - `Build from this branch` (Mode A)  -  iOS needs a distribution certificate and
     profile in the keychain; Android needs the release signing config. Takes as
     long as a real release build.

## Step 2  -  pre-flight, before anything expensive

Report every line; a missing prerequisite is a halt, not a warning.

**iOS:**

```bash
xcrun --find altool >/dev/null 2>&1 || echo "MISSING: altool (install Xcode)"
xcodebuild -version | head -1
```

Then resolve credentials, and **state which tier is active in the report**:

| Tier | Source | Effect |
|---|---|---|
| 1 | ASC API key  -  key id + issuer id from the keychain via `prefs.global.keychainMapping`, `.p8` at `~/.appstoreconnect/private_keys/AuthKey_<keyId>.p8` | Gate 2 runs |
| 2 | Apple ID + app-specific password, referenced as a keychain item | Gate 2 runs |
| 3 | neither | **Gate 2 reports `SKIPPED`, and the run says so in the verdict line** |

Multi-provider accounts need `--provider-public-id`. When it is not in prefs, run
`ios_testflight_validate({list_providers: true})` once and ask which provider.

**Android:**

```bash
command -v bundletool >/dev/null || echo "MISSING: bundletool"
command -v aapt2      >/dev/null || echo "MISSING: aapt2 (Android SDK build-tools)"
command -v apksigner  >/dev/null || echo "MISSING: apksigner (Android SDK build-tools)"
```

There is no credential tier to resolve: Gate 2 has no local client, so it is
`SKIPPED` by construction rather than by configuration. Say which of the two it is
 -  a user who thinks a credential would unlock it will go looking for one.

Credentials come from `/multi-agent:setup`; never prompt for a secret value in
chat.

## Step A  -  running-app sweep (unless `--skip-sweep`)

The gates read a package; this reads the app. A build can be structurally perfect
and still ship an unreadable screen, so the sweep stays part of store readiness
rather than being a separate errand.

Requires a booted simulator / emulator. When none is available, report
`Sweep: SKIPPED (no booted device)` and continue to the gates  -  never halt the
package validation for it, and never silently omit the line.

Delegate to the UI Bug Hunter flow (`$HOME/.claude/commands/sim-test.md`) for the
mechanics, running the light + dark + large-text passes over every screen. Merge
its findings into the single report at Step 7, severity-grouped alongside the gate
findings.

## Step 3  -  obtain the build

### Mode B  -  a build you supply

- **iOS `.xcarchive`** → Gate 1 runs on it. To reach Gate 2 the archive must be
  exported, so run `ios_export_ipa` (see Mode A for the signing inputs).
- **iOS `.ipa` only** → **Gate 1 is `SKIPPED (needs .xcarchive)`.** The static audit
  reads archive structure an `.ipa` does not carry. Do not present a two-gate run as
  a full pass; say which gate did not run and why, and offer to re-run with the
  archive.
- **Android `.aab`** → Gate 1 runs in full.
- **Android `.apk` only** → Gate 1 runs the rules that do not need a bundle and
  **lists the rules it could not apply**. An `.apk` cannot answer bundle-level
  questions (per-ABI splits, dynamic features, Play App Signing expectations).

When no path is given, pick the newest artifact and print which one you picked:

```
iOS:     newest .xcarchive under ~/Library/Developer/Xcode/Archives/**
Android: newest .aab under **/build/outputs/bundle/**/*.aab
```

Never validate an artifact whose provenance you did not state. "The newest archive"
is a guess the user must be able to correct.

### Mode A  -  build from the branch

1. Worktree at `{projectRoot}/.worktrees/{taskId}` on the chosen branch (phase-0-init.md Step 6 convention; the `.worktrees` segment is fixed, not a preference).
   **Never under `$HOME`**, never a direct checkout of the main working tree.
2. Resolve the scheme / module and workspace / project from prefs; ask if ambiguous.
3. Build:
   - **iOS**: `ios_xcodebuild({workspace|project, scheme, action: "archive", configuration: "Release", destination: "generic/platform=iOS"})`.
     Note the destination: the simulator default would produce an archive that
     cannot be exported for distribution.
   - **Android**: `./gradlew bundleRelease` (or the release variant the module
     declares). A debug-signed bundle fails Gate 1 signing rules for the wrong
     reason  -  if no release signing config resolves, halt and say so rather than
     auditing a debug artifact.
4. **iOS export**:
   `ios_export_ipa({archive_path, output_dir, method: "app-store-connect", team_id, provisioning_profiles?, signing_style?})`.
   Leave `allow_provisioning_updates` off unless the user asks: it lets xcodebuild
   create or modify profiles in the developer account, which a validation run has no
   business doing.
5. A failed build or export halts with the parsed errors. The usual iOS causes are a
   missing distribution certificate, a profile that does not match the bundle ID, or
   `signing_style: "manual"` with no `provisioning_profiles` map.

## Step 4  -  Gate 1, static package audit

- **iOS**: `ios_app_store_audit({archive_path, rules: "all"})`. Consult the
  `apple-archive-compliance` skill for what each rule means.

  Needs `@mmerterden/multi-agent-toolkit-mcp` ≥ v3.0.0, which provides the tool. When the
  MCP server is not registered, the same 18 rules run directly from the package:

  ```bash
  node -e "import('@mmerterden/multi-agent-toolkit-mcp/tools/ios-app-store-audit/index.js').then(m => m.runAudit({ archivePath: '<path>', rules: 'all' }).then(r => console.log(JSON.stringify(r))))"
  ```

  Use the fallback only when the tool is genuinely absent, and say in the report
  which path ran  -  a rule set that silently differed between two invocations is
  worse than a missing gate.

  Then, whichever path ran, count `<archive>/dSYMs/*.dSYM`. Zero is a blocking
  finding: `[SYMBOLS] archive carries no dSYM; crash reports will not symbolicate`,
  with the hint `DEBUG_INFORMATION_FORMAT = dwarf-with-dsym` for the Release
  configuration. This check runs from the package alone and does not need the
  MCP tool.
- **Android**: `android_apk_audit` on the artifact, plus the
  `google-play-compliance` skill's 21 rules  -  `bundletool validate` and manifest
  dump, `aapt2 dump badging`, `apksigner verify`, ABI / native scan.

  Then, when the module has `minifyEnabled true` and the bundle build produced no
  `mapping.txt`, raise the same class of blocking finding:
  `[SYMBOLS] minified bundle carries no mapping.txt; crash reports will not
  deobfuscate`. This check reads the module config and the build output alone
  and does not need the MCP tool.

`error` findings are blocking; `warning` is advisory. Group by severity and keep
each finding's ITMS / Play policy code  -  Gate 2 may return the same code on iOS,
and seeing it in both places tells the user it is real rather than a heuristic.

## Step 5  -  Gate 2, the store's own validation

**iOS**: `ios_testflight_validate({ipa_path, platform: "ios", <credential args>})`.
Render the verdict exactly as returned:

- `PASS`  -  Apple accepted the binary for delivery.
- `FAIL`  -  list each issue with its ITMS code, the mapped guideline, and the hint.
- `SKIPPED`  -  print the reason. **Never render this as a pass.**

Gate 2 is the only gate that catches a build number already used  -  so when it
fails on that, say so plainly and name the next free build number.

**Android**: report `SKIPPED (no local Play validator)` with one line on why: the
authoritative check is a Play Publishing API draft edit, the pipeline ships no
client for it, and no local tool substitutes. `bundletool validate` is Gate 1 and
reporting it here would fake a cleared gate.

## Step 6  -  Gate 3, policy review

Load the platform's review skill and review the repo against it. This is the gate
that catches what a human reviewer rejects, so it reads source, not the binary.

**iOS**  -  `ai-ios-toolkit:app-store-review`:

| Area | Evidence to gather |
|---|---|
| Purpose strings | every `NS*UsageDescription` in Info.plist  -  present, specific, user-facing, and matching what the code actually does with the data |
| Privacy manifest | `PrivacyInfo.xcprivacy` exists, declares required-reason APIs, and matches the SDKs actually linked |
| Tracking | if any tracking API or SDK is present, an ATT prompt exists and runs before collection |
| Account deletion | if the app creates accounts, an in-app deletion path exists (guideline 5.1.1(v)) |
| Privacy policy | reachable in-app and in the metadata |
| IAP | anything unlocking features goes through StoreKit, with no external purchase path |
| Sign in with Apple | present when a third-party social login is offered |
| Crash symbolication | a dSYM upload step exists: an Xcode run-script calling `upload-symbols`, or a Crashlytics / Sentry / Datadog upload in CI |

**Android**  -  `ai-android-toolkit:play-store-review`:

| Area | Evidence to gather |
|---|---|
| Permissions | every `uses-permission` justified by a feature, no sensitive permission without its declaration form |
| Data safety | the declared data-safety answers match what the code collects and transmits |
| Target API level | meets the current Play requirement for new releases |
| Privacy policy | reachable in-app and in the listing |
| Billing | anything unlocking features goes through Play Billing, with no external purchase path |
| Account deletion | if the app creates accounts, an in-app deletion path exists, plus the web deletion URL Play requires |
| Content rating | the questionnaire answers match the app's actual content |
| Signing | Play App Signing configured, upload key distinct from the app signing key |
| Crash symbolication | a `mapping.txt` upload exists: the Firebase Crashlytics Gradle plugin, or the Play App Bundle deobfuscation file |

For each: `pass` / `fail` / `not-applicable` with the evidence path that justifies
it. `not-applicable` needs a reason  -  an unexamined area is not a pass.

## Step 7  -  report

Write to `~/StoreChecks/<platform>-<repo>-<branch>-<timestamp>/report.md` and print
a summary.

```
Verdict: <N> of 3 gates cleared[, <M> skipped]
Platform:<ios|android>
Build:   <artifact path>  ·  <bundle id / applicationId> <version> (<build>)
Auth:    tier <1|2|none>  ·  <method>          (iOS only)
Sweep:   <n> findings | SKIPPED (<reason>)

Gate 1  static audit        PASS | FAIL (<n> blocking, <n> advisory) | SKIPPED (<reason>)
Gate 2  store validation    PASS | FAIL (<n> issues) | SKIPPED (<reason>)
Gate 3  policy review       PASS | FAIL (<n> findings) | <n> not-applicable

Blocking  -  fix before uploading
  [ITMS-90683] Info.plist: NSCameraUsageDescription missing
      guideline 5.1.1 Data Collection and Storage
      <hint>
      <file:line>

Advisory
  ...

Not run
  Gate 2: no local Play validator  -  authoritative check is server-side only

Before rollout (human inputs, not verified)
  Phased rollout: <1% -> 10% -> 50% -> 100% | full>
  Halt thresholds: crash-free < 99.5% (iOS, Android) or ANR > 0.47% (Android) => pause the rollout
  Rollback / forward-fix owner: <name>
  Forward-fix plan: <one line>
```

Rules for the report:

- A skipped gate is never folded into the pass count. The verdict line states the
  skip. An Android run therefore reads `2 of 3 gates cleared, 1 skipped` at best.
- Every blocking finding carries a file path or a store code. A finding the user
  cannot act on is noise.
- The `Before rollout` block is filled by a human, never inferred. When it is
  left unfilled the verdict line gains the suffix `, rollout plan missing`.
- Humanize via `--lang en` by default (`promptLanguage` is locked to `"en"`); pass
  `--lang=tr` explicitly to opt into Turkish.
- No AI or assistant attribution anywhere, per
  `$HOME/.claude/rules/git-conventions.md`.
- Real newlines, no HTML entities, per
  `$HOME/.claude/multi-agent-refs/rules.md "External System Outputs"`.

## Step 8  -  offer the next action, do not take it

Print, and stop:

- the exact upload command for when the gates are clear, so uploading stays an
  explicit human act:
  - iOS: `xcrun altool --upload-app ...`
  - Android: the Play Console upload, or the `gradle publish` task the project
    declares  -  never run it
- `/multi-agent:store-ready --resume` to re-run after fixes
- `/multi-agent:channels` to land the findings in Jira / Confluence / Wiki / PR
- the enabled stack plugin's `fix-bug` skill (`ai-ios-toolkit:fix-bug` or the stack equivalent) when Gate 3 produced code-level findings

Never upload, never commit a Play edit, never bump the build number, never commit.

## Related surfaces

`/multi-agent:testflight-validation` is a thin alias onto this command, kept so the
iOS-only name keeps working; it resolves here with the platform pinned to iOS.
`/multi-agent:test "store-ready"` also resolves here. There is one implementation.
