Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
ci: submit the iOS app for App Store review on every release tag
leepokai5a6cd98d76cb
diff --git a/.github/workflows/ios-submit.yml b/.github/workflows/ios-submit.ymlnew file mode 100644index 00000000..c27623dd--- /dev/null+++ b/.github/workflows/ios-submit.yml@@ -0,0 +1,31 @@+name: Submit iOS++# Xcode Cloud archives the iOS app on the same v* tag and uploads it to TestFlight;+# this waits for that build and submits it for App Review.+on:+ push:+ tags: ["v*"]+ workflow_dispatch:+ inputs:+ version:+ description: "Version to submit, e.g. 2.3.0"+ required: true++concurrency:+ group: ios-submit+ cancel-in-progress: false++jobs:+ submit:+ runs-on: ubuntu-latest+ timeout-minutes: 200+ steps:+ - uses: actions/checkout@v4+ - run: pip install pyjwt cryptography+ - name: Submit for review+ env:+ ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}+ ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}+ ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}+ VERSION: ${{ inputs.version || github.ref_name }}+ run: python3 tools/asc-submit.py "${VERSION#v}"diff --git a/AGENTS.md b/AGENTS.mdindex dfebddc0..5aebeb66 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -29,7 +29,7 @@ Always stop the old Mac app, host and iPhone process before running a new build- **Every source change ships as a release.** A version bump on `main` is the only release trigger (Auto Tag → DMG, host, Linux app, Homebrew, in-app update), so any change to shipped code (`apps/`, `kit/`, `host/`, `packaging/`) bumps the version before it reaches `main`, without being asked. Docs, `web/`, `cloud/`, `relay/` and CI-only changes don't bump.- Pick the bump yourself: patch for fixes and small tweaks, minor for new features or protocol additions. Never bump major (stay on 2.x). One bump per merge into `main`: if `MARKETING_VERSION` is already ahead of the latest `v*` tag, leave it.-- How: set `MARKETING_VERSION` in `apps/project.yml` and `version` in `host/Cargo.toml` (+ its `Cargo.lock` entry) to the same value, run `xcodegen generate --spec apps/project.yml`, commit as `build: bump version to X.Y.Z`. `CURRENT_PROJECT_VERSION` changes only for App Store uploads.+- How: set `MARKETING_VERSION` in `apps/project.yml` and `version` in `host/Cargo.toml` (+ its `Cargo.lock` entry) to the same value, run `xcodegen generate --spec apps/project.yml`, commit as `build: bump version to X.Y.Z`. Never touch `CURRENT_PROJECT_VERSION` (Xcode Cloud sets the iOS build number).## Coding Style & Naming Conventionsdiff --git a/CLAUDE.md b/CLAUDE.mdindex b3378309..53197dd4 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -58,8 +58,7 @@ Always stop the old Mac app, host and iPhone process before running a new build## App Store Upload-- **IMPORTANT**: Every time you archive and upload a new build to App Store Connect, you MUST increment `CURRENT_PROJECT_VERSION` first (App Store Connect rejects duplicate build numbers).-- Versions live in `apps/project.yml` (`MARKETING_VERSION`, `CURRENT_PROJECT_VERSION`); regenerate the project after changing them. Keep `host/Cargo.toml` `version` in sync with `MARKETING_VERSION`.+- Xcode Cloud archives the `iOS` scheme on every `v*` tag and uploads it to App Store Connect with its own build number, then the `Submit iOS` workflow submits it to App Review for the App Store; don't upload from the local machine or edit `CURRENT_PROJECT_VERSION` for it. Details: [development guide](docs/guides/development.md#ios-releases-xcode-cloud).## Versioning@@ -67,7 +66,7 @@ Always stop the old Mac app, host and iPhone process before running a new build- Minor/patch bumps are always backward compatible within the same major; the iOS decoder is lenient (`Bot.init(from:)`) so small host additions don't break older apps- **Every source change ships as a release.** A version bump on `main` is the only release trigger (Auto Tag → DMG, host, Linux app, Homebrew, in-app update), so any change to shipped code (`apps/`, `kit/`, `host/`, `packaging/`) bumps the version before it reaches `main`, without being asked. Docs, `web/`, `cloud/`, `relay/` and CI-only changes don't bump.- Pick the bump yourself: patch for fixes and small tweaks, minor for new features or protocol additions. Never bump major (stay on 2.x). One bump per merge into `main`: if `MARKETING_VERSION` is already ahead of the latest `v*` tag, leave it.-- How: set `MARKETING_VERSION` in `apps/project.yml` and `version` in `host/Cargo.toml` (+ its `Cargo.lock` entry) to the same value, run `xcodegen generate --spec apps/project.yml`, commit as `build: bump version to X.Y.Z`. `CURRENT_PROJECT_VERSION` changes only for App Store uploads.+- How: set `MARKETING_VERSION` in `apps/project.yml` and `version` in `host/Cargo.toml` (+ its `Cargo.lock` entry) to the same value, run `xcodegen generate --spec apps/project.yml`, commit as `build: bump version to X.Y.Z`. Never touch `CURRENT_PROJECT_VERSION` (Xcode Cloud sets the iOS build number).## Targetsdiff --git a/docs/guides/development.md b/docs/guides/development.mdindex f379bb53..5a88bcc0 100644--- a/docs/guides/development.md+++ b/docs/guides/development.md@@ -89,6 +89,8 @@ Host development: `cargo run --manifest-path host/Cargo.toml -- serve`. Avoid coFollow [UI conventions](../design/ui-conventions.md) for native toolbar behavior and [widget design](../design/mobile-widgets.md) for previews. Widget images can be rendered with `python3 tools/render-widgets.py`; output is under `build/widget-previews/`.-For releases, increment `CURRENT_PROJECT_VERSION` before another App Store upload. Versions are defined in `apps/project.yml`; keep the host package version aligned with `MARKETING_VERSION`, then regenerate the Xcode project.+Versions are defined in `apps/project.yml`; keep the host package version aligned with `MARKETING_VERSION`, then regenerate the Xcode project.-Uploading from the command line: archive the `iOS` scheme in Release (`xcodebuild … -destination 'generic/platform=iOS' -archivePath build/archive/Codync-iOS.xcarchive -allowProvisioningUpdates archive`), export an IPA with an ExportOptions plist (`method` app-store-connect, `destination` export, automatic signing, the team id), then `xcrun altool --upload-app -f build/archive/ipa/Codync.ipa -t ios --apiKey <key id> --apiIssuer <issuer id>` with an App Store Connect API key in `~/private_keys`. `-exportArchive` with `destination` upload fails ("Failed to Use Accounts") because xcodebuild has no Apple ID session. App Store Connect then processes the build for a few minutes before it can be attached to a version.+## iOS releases (Xcode Cloud)++The Xcode Cloud workflow on the Codync product starts on tag changes matching `v*` (the tags Auto Tag pushes after a version bump on `main`), archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on the same tag: it waits for that version's build to finish processing, then submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). Empty *What's New* fields get a generic "Bug fixes and improvements" text; write real notes in App Store Connect before the tag when a release deserves them. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.diff --git a/tools/asc-submit.py b/tools/asc-submit.pynew file mode 100755index 00000000..221358a3--- /dev/null+++ b/tools/asc-submit.py@@ -0,0 +1,126 @@+#!/usr/bin/env python3+"""Submit the iOS build of a version for App Review once Xcode Cloud has uploaded it.++Usage: asc-submit.py 2.3.0+Env: ASC_KEY_ID, ASC_ISSUER_ID, ASC_PRIVATE_KEY (.p8 contents); DRY_RUN=1 prints writes instead.++Latest version wins: a version still waiting for review is pulled back, renamed and+resubmitted with the new build. A version already in review is left alone.+"""++import json+import os+import sys+import time+import urllib.error+import urllib.request++import jwt++APP_ID = "6760984418"+API = "https://api.appstoreconnect.apple.com/v1"+WHATS_NEW = {"en-US": "Bug fixes and improvements.", "zh-Hant": "錯誤修正與改進。"}+EDITABLE = {"PREPARE_FOR_SUBMISSION", "READY_FOR_REVIEW", "DEVELOPER_REJECTED", "REJECTED",+ "METADATA_REJECTED", "INVALID_BINARY"}+DONE = {"READY_FOR_DISTRIBUTION", "REPLACED_WITH_NEW_VERSION", "REMOVED_FROM_SALE"}+DRY_RUN = os.environ.get("DRY_RUN") == "1"+++def token():+ now = int(time.time())+ return jwt.encode(+ {"iss": os.environ["ASC_ISSUER_ID"], "iat": now, "exp": now + 1200, "aud": "appstoreconnect-v1"},+ os.environ["ASC_PRIVATE_KEY"], algorithm="ES256", headers={"kid": os.environ["ASC_KEY_ID"]})+++def call(method, path, body=None):+ if method != "GET" and DRY_RUN:+ print(f"DRY_RUN {method} {path} {json.dumps(body)}")+ return {"data": {"id": "dry-run"}}+ req = urllib.request.Request(+ API + path, method=method, data=json.dumps(body).encode() if body else None,+ headers={"Authorization": f"Bearer {token()}", "Content-Type": "application/json"})+ try:+ with urllib.request.urlopen(req) as res:+ raw = res.read()+ except urllib.error.HTTPError as e:+ sys.exit(f"{method} {path} -> {e.code}\n{e.read().decode()}")+ return json.loads(raw) if raw else {}+++def wait_for(what, check, minutes):+ for _ in range(minutes):+ if result := check():+ return result+ print(f"waiting for {what}…", flush=True)+ time.sleep(60)+ sys.exit(f"timed out waiting for {what}")+++def main(version):+ build = wait_for(f"build {version} to finish processing", lambda: next(iter(call(+ "GET", f"/builds?filter[app]={APP_ID}&filter[preReleaseVersion.version]={version}"+ "&filter[processingState]=VALID&sort=-uploadedDate&limit=1")["data"]), None), 150)+ print(f"build {build['attributes']['version']} ({build['id']})")++ def in_flight():+ versions = call("GET", f"/apps/{APP_ID}/appStoreVersions?filter[platform]=IOS&limit=10"+ "&fields[appStoreVersions]=versionString,appVersionState")["data"]+ return next((v for v in versions if v["attributes"]["appVersionState"] not in DONE), None)++ current = in_flight()+ state = current and current["attributes"]["appVersionState"]+ if state == "WAITING_FOR_REVIEW":+ for s in call("GET", f"/reviewSubmissions?filter[app]={APP_ID}&filter[platform]=IOS"+ "&filter[state]=WAITING_FOR_REVIEW")["data"]:+ print(f"pulling {current['attributes']['versionString']} back from review")+ call("PATCH", f"/reviewSubmissions/{s['id']}",+ {"data": {"type": "reviewSubmissions", "id": s["id"], "attributes": {"canceled": True}}})+ if not DRY_RUN:+ current = wait_for("the pulled version to become editable",+ lambda: (v := in_flight()) and v["attributes"]["appVersionState"] in EDITABLE and v, 30)+ state = current["attributes"]["appVersionState"]+ if current and state not in EDITABLE and not DRY_RUN:+ print(f"{current['attributes']['versionString']} is {state}; leaving it alone. "+ "Rerun this workflow once it is released.")+ return++ if current:+ if current["attributes"]["versionString"] != version:+ call("PATCH", f"/appStoreVersions/{current['id']}", {"data": {+ "type": "appStoreVersions", "id": current["id"], "attributes": {"versionString": version}}})+ version_id = current["id"]+ else:+ version_id = call("POST", "/appStoreVersions", {"data": {+ "type": "appStoreVersions",+ "attributes": {"platform": "IOS", "versionString": version, "releaseType": "AFTER_APPROVAL"},+ "relationships": {"app": {"data": {"type": "apps", "id": APP_ID}}}}})["data"]["id"]++ if version_id != "dry-run":+ for loc in call("GET", f"/appStoreVersions/{version_id}/appStoreVersionLocalizations")["data"]:+ if not loc["attributes"].get("whatsNew"):+ text = WHATS_NEW.get(loc["attributes"]["locale"], WHATS_NEW["en-US"])+ call("PATCH", f"/appStoreVersionLocalizations/{loc['id']}", {"data": {+ "type": "appStoreVersionLocalizations", "id": loc["id"], "attributes": {"whatsNew": text}}})++ call("PATCH", f"/appStoreVersions/{version_id}/relationships/build",+ {"data": {"type": "builds", "id": build["id"]}})++ submissions = call("GET", f"/reviewSubmissions?filter[app]={APP_ID}&filter[platform]=IOS"+ "&filter[state]=READY_FOR_REVIEW,UNRESOLVED_ISSUES")["data"]+ submission_id = submissions[0]["id"] if submissions else call("POST", "/reviewSubmissions", {"data": {+ "type": "reviewSubmissions", "attributes": {"platform": "IOS"},+ "relationships": {"app": {"data": {"type": "apps", "id": APP_ID}}}}})["data"]["id"]+ items = [] if submission_id == "dry-run" else call(+ "GET", f"/reviewSubmissions/{submission_id}/items?include=appStoreVersion")["data"]+ if not any(i["relationships"]["appStoreVersion"]["data"] for i in items):+ call("POST", "/reviewSubmissionItems", {"data": {"type": "reviewSubmissionItems", "relationships": {+ "reviewSubmission": {"data": {"type": "reviewSubmissions", "id": submission_id}},+ "appStoreVersion": {"data": {"type": "appStoreVersions", "id": version_id}}}}})+ call("PATCH", f"/reviewSubmissions/{submission_id}",+ {"data": {"type": "reviewSubmissions", "id": submission_id, "attributes": {"submitted": True}}})+ print(f"submitted {version} ({build['attributes']['version']}) for review")+++if __name__ == "__main__":+ main(sys.argv[1])