sorcha-app
Skill2 starsChanged 10 months agoMITView on GitHub
Build, sign, and ship the Sorcha mobile apps (Capacitor + fastlane on a Mac build node, driven from the Windows orchestrator). Use when triggering or debugging iOS/Android builds, running a fastlane lane, dispatching the build workflow, watching a build, registering or fixing the self-hosted runner, deriving app versions, onboarding the Mac toolchain, mapping where signing secrets live, or configuring native passkeys / Associated Domains (AASA, assetlinks, App-ID capability, relying-party / Fido2 ServerDomain, secure-origin server.url). Covers the Sorcha Wallet PWA (app.sorcha.wallet).
- Reads credentials
- Deletes or force-pushes
- Installs packages
In this repository79 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- docs/llms-full.txtllms.txt
- llms.txtllms.txt
- aspireSkill
- aspnet-coreSkill
- blazorSkill
- blueprint-builderSkill
- configuring-opentelemetry-dotnetSkill
- coverage-analysisSkill
- coverletSkill
- cryptographySkill
- database-expertSkill
- dockerSkill
- dotnetSkill
- entity-framework-coreSkill
- entity-frameworkSkill
- fluent-assertionsSkill
- frontend-designSkill
- grpcSkill
- jwtSkill
- mcpSkill
- microsoft-extensionsSkill
- migrate-xunit-to-xunit-v3Skill
- minimal-api-file-uploadSkill
- minimal-apisSkill
- mongodbSkill
- moqSkill
- nbitcoinSkill
- network-bootstrapSkill
- nunitSkill
- optimizing-ef-core-queriesSkill
- playwrightSkill
- postgresqlSkill
- prodexecSkill
- redisSkill
- scalarSkill
- signalrSkill
- sorcha-architectureSkill
- sorcha-cliSkill
- sorcha-uiSkill
- speckit-agent-context-updateSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-git-commitSkill
- speckit-git-featureSkill
- speckit-git-initializeSkill
- speckit-git-remoteSkill
- speckit-git-validateSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-specifySkill
- speckit-tasksSkill
- speckit-taskstoissuesSkill
- verifiable-credentialsSkill
- walkthrough-builderSkill
- worker-servicesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Keep it clean on master; lanes that mutate it (pbxproj signing edits) are reset with git reset --hard origin/master.
- Distinctive: line 73
Check what is actually there before guessing:
- Very specific: line 87
Every lane begins with the shared web step mobile/scripts/build-web.sh: dotnet publish (the Blazor WASM "web build") → www → rewrite <base …
- Very specific: line 90
Driving a lane headless (the proven pattern): write a small script on the Mac that sources ~/.zprofile (+ ~/.sorcha-signing/ios-match.env …
- Distinctive: line 202
Before touching it, ask Stuart: what the node should be (dev API?
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sorcha-app — mobile build/deploy orchestration
You orchestrate; you are not in the critical path of a build. The build engine (Capacitor +
fastlane, in the repo at mobile/) runs headless on the Mac and is identical whether triggered
by a human, a git tag, or you. If a build only works because you drove it interactively, it's wrong.
Topology (the one-screen model)
| Role | Host | What it does |
| Orchestrator | Windows dev box (here) | SSH to the Mac, trigger lanes, dispatch the workflow, watch/parse builds. No build toolchain. |
| Build node | Mac mini M1, ssh stuart@macmini (192.168.51.4) | Xcode + JDK 21 + Android SDK + Capacitor + fastlane. All signing secrets live here and nowhere else. Hosts the GitHub Actions self-hosted runner. |
| Unattended trigger | GitHub Actions | .github/workflows/build.yml on a [self-hosted, sorcha-build] runner; fires on tag v*, release, or workflow_dispatch. |
App: src/Apps/Sorcha.Wallet.Pwa — a Blazor WASM PWA (NOT a JS app), wrapped by Capacitor 8
in mobile/wallet/. Bundle id app.sorcha.wallet. The Verifier app is server-hosted → not in scope.
Full detail: references/topology.md. Secret locations: references/secrets-map.md. Fixes: references/troubleshooting.md. Passkeys / Associated Domains (PROVEN iOS recipe — RP model, App-ID capability + match force, AASA/assetlinks via the apex CI pipeline + the upload-pages-artifact dotfile-strip gotcha, Fido2 ServerDomain, secure-origin server.url, account reset): references/passkeys.md.
Session preflight (do this FIRST, every mobile session)
The build node is a separate machine — nothing builds without it. Before driving any lane, confirm the orchestrator can reach the Mac over SSH (PowerShell tool, never Git Bash):
ssh stuart@macmini 'echo OK; hostname; cd ~/projects/Sorcha && git rev-parse --short HEAD'- Expect
OK+macmini.local+ a commit. If it hangs orPermission denied/Too many auth failures: the orchestrator box's SSH public key isn't in the Mac's~/.ssh/authorized_keys, the Mac is off/asleep, or you used Git Bash (use the PowerShell tool). A new/different orchestrator box must have its key added to the Mac first — without it, you cannot build. Resolve access before anything else. ~/projects/Sorchais the dedicated lane-running checkout (distinct from the runner's~/actions-runner/_work/...). Keep it clean onmaster; lanes that mutate it (pbxproj signing edits) are reset withgit reset --hard origin/master.
Iron rules
- SSH only via Windows OpenSSH (the PowerShell tool), never the Bash tool / Git Bash — Git Bash has no agent socket and every key auth fails ("Too many authentication failures"). All scripts here are PowerShell.
- Never copy signing material to Windows or into the repo/skill. Keystores, certs, profiles,
.p8/.p12,keystore.propertiesstay on the Mac. The skill records locations only. - Don't trust an outer ssh wrapper's exit code — have the remote script append its own
EXIT=$?and read that. (ssh host 'cmd; echo EX=$?'— single-quote in PowerShell so$?reaches the remote.) - Versioning is automatic:
versionNamefrom the git tag (v1.2.3→1.2.3),versionCodefrom the Actions run number. Never bump versions by hand. - Production store lanes are out of scope. First targets only: TestFlight, Play Internal, ad-hoc.
Intent → lane → script
| You want to… | Do this |
| On-call build right now (debug, bypass CI) | scripts/trigger-build.ps1 -Lane android_adhoc (SSH-runs fastlane on the Mac) |
| Fire the unattended workflow on demand (Android only) | scripts/dispatch-workflow.ps1 -Lane android_adhoc (needs build.yml on master; else push a v* tag). Do NOT use for iOS — the runner has no keychain session (see gotchas); run iOS lanes via the SSH/nohup path below. |
| Watch a build + get the failure reason | scripts/watch-build.ps1 [-RunId <id>] |
| Mirror CI's version for a local build | scripts/bump-version.ps1 -BuildNumber <n> |
| Stand up / repair the Mac toolchain | mobile/scripts/bootstrap-mac.sh (idempotent; in the repo) |
| (Re)register the runner | mobile/scripts/setup-runner.sh (defaults SCOPE=repo — see below) + sudo mobile/scripts/install-runner-daemon.sh |
Lanes (mobile/wallet/fastlane/Fastfile) — ALL FOUR PROVEN END-TO-END (2026-06-23) on real accounts
android_adhoc— signed release APK. No account needed.android_internal— AAB → Play Internal viasupply. Needs~/.sorcha-signing/play_service_account.json- the SA granted account-level Admin in Play Console (a narrower track grant kept failing).
SORCHA_VERSION_CODEmust be EPOCH SECONDS ($(date +%s)). ⚠ The old note here said "vc1 manual, vc2 automated" — that is stale by three orders of magnitude and will send you straight into a wall. The internal track already carries 1783011347 (a prior build used epoch seconds), and Play rejects anything lower with a message that does not mention version codes at all: "You cannot rollout this release because it does not allow any existing users to upgrade to the newly added APKs." That reads like a device-compatibility/minSdk problem. It is not — it is the version code. Check what is actually there before guessing:
Also: the lane now passesbundle exec fastlane run google_play_track_version_codes package_name:app.sorcha.wallet track:internal json_key:$HOME/.sorcha-signing/play_service_account.jsonskip_upload_apk: true.supplyrefuses to upload when it finds BOTH an.aaband a stray.apkinbuild/outputs— and ANY./gradlew assembleDebug(e.g. while verifying a native plugin) leaves one behind. That failure says "Cannot provide both apk(s) and aab" and reads like a signing problem.- the SA granted account-level Admin in Play Console (a narrower track grant kept failing).
ios_adhoc— signed ad-hoc IPA.ios_beta— IPA → TestFlight. Both usematch(repoSorcha-Platform/ios-certs) + the ASC API key; the lanes callsetup_ci(headless keychain) andapply_match_signing(Capacitor ships automatic signing/no team → must force manual). iOS env (MATCH_GIT_URL/MATCH_PASSWORD) lives in~/.sorcha-signing/ios-match.env(NOT~/.zprofile), so iOS lanes mustsourceit —trigger-build.ps1does NOT, so run iOS inline with the env sourced.
Every lane begins with the shared web step mobile/scripts/build-web.sh: dotnet publish (the Blazor
WASM "web build") → www → rewrite <base href> to / → strip precompressed dupes → cap sync.
Driving a lane headless (the proven pattern): write a small script on the Mac that sources
~/.zprofile (+ ~/.sorcha-signing/ios-match.env for iOS), cds to mobile/wallet, bundle install,
then bundle exec fastlane <lane>; launch it with nohup … > ~/<lane>.log 2>&1 & and poll the log
(builds outlast a single SSH call). Remove the scratch script + log when done.
Decision rules / gotchas (learned the hard way)
- Runner must be registered at the REPO level, not org level. An org runner (Default group,
visibility:all, online, labels matching) is silently not routed repo jobs — the job hangs on "Waiting for a runner…". Repo-level registration dispatches in seconds.setup-runner.shdefaults toSCOPE=repo. - Match
runs-onon the uniquesorcha-buildlabel, not the OS labelmacOS/macos(case ambiguity). - Runner persistence = system LaunchDaemon (
install-runner-daemon.sh, needs sudo once). Survives reboot with no GUI login. (svc.sh's LaunchAgent can't bootstrap over SSH.) - iOS lanes will NOT run on the GH Actions runner — only Android. The runner is a system
LaunchDaemon with no user keychain/Security session, so
setup_ci'ssecurity create-keychainfails and everydispatch-workflow.ps1 -Lane ios_*dies atsetup_ci→setup_keychain(setup_ci.rb:42) in ~15s. Tell-tale in the log:ORIGINAL_DEFAULT_KEYCHAIN = "…/System.keychain"(a real user session showslogin.keychain). Android signs from the keystore file, never the macOS keychain, so it builds fine on the runner. Don't chase red herrings — it is NOT the app code, a reboot, a stale temp keychain (security delete-keychaindoesn't help), or the user's default-keychain pref (restoring it doesn't propagate to the daemon session). Run iOS via the SSH/nohupuser-session pattern above (a realstuartlogin session can create keychains →setup_ci0s, TestFlight upload OK). (Durable fix candidate: host the runner as a per-user GUI-session LaunchAgent so it has a keychain — blocked by the same can't-bootstrap-over-SSH issue; the SSH path is the pragmatic answer.) - A run-script authored on Windows ships CRLF. Piped to the Mac it yields
source ~/.zprofile^M: no such file or directoryand aparse error near '\n'. Strip carriage returns on upload:Get-Content script.sh | ssh stuart@macmini "tr -d '\r' > ~/script.sh". - CI steps run
bash + source ~/.zprofile(not a login shell), so.zprofilemust exportdotnet,JAVA_HOME(JDK 21),ANDROID_HOME, ruby/gem bin — bootstrap handles this. - Capacitor 8 needs JDK 21 (docs say "17+", but its Android lib compiles at Java 21) and SDK 36.
- Toolchain unblocked (Xcode 26.5 / clang 21, 2026-06-18): native gems compile,
Gemfile.lockis committed, lanes run viabundle exec fastlane(deterministic). Earlier Xcode 15.4 blocked this — its clang lacked the C23<stdckdint.h>ruby needs. - Little Snitch blocks Homebrew Ruby → Apple ASC API (the session-eating one):
matchhangs at "Creating authorization token for App Store Connect API" with the socket inCLOSE_WAIT, whilecurlto the same host works. The Mac's per-app outbound firewall denies the unsigned Ruby; headless there's no GUI prompt. Fix = LS allow rule*.apple.com:443 Any Process. - iOS signing on a headless Mac:
matchneedssetup_ci(login.keychain is locked over SSH/daemon) and the Capacitor project must be forced to manual signing (apply_match_signing) or archive fails "requires a development team". Both are already in the Fastfile. - Play upload "caller does not have permission": grant the SA account-level Admin in Play Console → Users and permissions (a narrower "Release to testing tracks" grant kept failing). Setup→API access is now folded into Users and permissions.
- TestFlight: internal testing needs no redeem code (that's external); testers must be team users.
Export compliance is baked into
Info.plist(ITSAppUsesNonExemptEncryption=false).
Accounts — ACTIVE (Individual/Personal) since 2026-06-23
Both enrolled; all creds placed on the Mac under ~/.sorcha-signing (see references/secrets-map.md).
- Apple: Developer Program live (team HY5HSW5FUT); ASC API key
asc_api_key.p8+asc_api_key.json(key MBZVZTN4VX); App IDapp.sorcha.wallet+ a device UDID registered;matchrepoSorcha-Platform/ios-certs; ASC app id6783321595. Little Snitch on the Mac silently blocked Homebrew Ruby → Apple's ASC API (match hung at "Creating authorization token") — fixed with an LS allow rule for*.apple.com; if the Ruby/toolchain is reinstalled or LS rules reset, this can recur (see troubleshooting). - Google Play: live;
play_service_account.jsonplaced; SAsorcha-play-ci@sorcha-494515…granted account-level Admin. The first AAB (vc1) was uploaded manually;supplyautomates from there. - Setup runbook (what to do if re-enrolling / a fresh account):
references/finishing-accounts.md.
Production store lanes (App Store / Play production) remain out of scope and need extra work: a publicly reachable backend the build points at + a demo login for App Review, plus store listing/screenshots. Internal/TestFlight (current targets) need none of that.
Native plugins (Feature 185 — the first one)
mobile/plugins/sorcha-proximity/ is the repo's first native code. Until F185, mobile/wallet had
zero Capacitor plugins and its only hand-edited native file was App.entitlements.
The rule that keeps it small: the plugin moves opaque bytes and knows nothing else — no CBOR, no mdoc,
no credentials, no session state. Every byte of ISO 18013-5 protocol lives in C# (Sorcha.Mdoc), written once
and shared by holder and reader. That is what lets LoopbackProximityTransport stand in for the radio so the
whole exchange is proven in CI with no phones. Protocol logic in the plugin would be logic the C# suite
cannot reach — written twice, in two languages, with two chances to get the tag-24 rules wrong, and those fail
silently. If you want to parse something in a plugin, you are in the wrong file.
Building / verifying a plugin on the Mac node
# iOS — SPM. NOTE: plain `swift build` targets macOS and fails with "no such module 'Capacitor'";
# Capacitor is iOS-only, so you MUST give xcodebuild an iOS destination.
cd mobile/plugins/sorcha-proximity
xcodebuild -scheme SorchaProximity -destination "generic/platform=iOS" build
xcodebuild test -scheme SorchaProximity -destination "platform=iOS Simulator,name=iPhone 17 Pro"
# Android — the plugin is a gradle subproject of the APP, not standalone.
cd mobile/wallet && npm install && npx cap sync android # registers the plugin
cd android && ./gradlew :sorcha-proximity:testDebugUnitTest # unit tests
./gradlew assembleDebug # app builds with the pluginGotchas that cost time:
npm installSYMLINKS afile:dependency. Gradle therefore compiles the plugin frommobile/plugins/…, and build output lands there — not undermobile/wallet/android/. Looking for test results in the app tree finds nothing and looks like "0 tests ran".- The simulator name must exist.
iPhone 16is not installed on this Mac;xcrun simctl list devices availableis the source of truth (currently iPhone 17 Pro / 17 Pro Max / 17e). xcodebuild -listnames the scheme after the library PRODUCT (SorchaProximity), not the target (SorchaProximityPlugin).- The plugin's
package.jsonfileswhitelist governs what a published package ships. It does not affect a symlinkedfile:dep, but omittingandroid/src/test/would hide the tests from a real consumer.
Permissions the proximity plugin needs
- iOS:
NSBluetoothAlwaysUsageDescriptioninInfo.plist(the app is killed on first BLE touch without it). The peripheral role is restricted in the background — irrelevant here, a presentation is always foreground. - Android:
BLUETOOTH_ADVERTISE/BLUETOOTH_CONNECT/BLUETOOTH_SCAN, the last withneverForLocation— without that flag Android demandsACCESS_FINE_LOCATION, i.e. we would be asking a citizen for their location in order to show a credential to the person standing in front of them.
Full detail: mobile/plugins/sorcha-proximity/README.md.
Optional separate workstream (ASK FIRST)
A NAT'd Docker backend node can run on the Mac so the apps have a real backend during dev/ad-hoc builds. Before touching it, ask Stuart: what the node should be (dev API? full peer/validator? demo register?), which ports to forward, and LAN-only vs publicly tunnelled. Don't assume.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

