BWB Deployment Infrastructure Handoff
Built a complete 4-mode deployment infrastructure for the BWB (Brews With Beats) iOS app ecosystem. The system enables deploying Customer, POS, and Kiosk apps to iPhones and iPads via Discord commands, with intelligent automatic routing based on device availability and network conditions.
Full Public Reader
BWB Deployment Infrastructure Handoff
Date: 2026-02-09
Session: #bwb-customer Discord channel
Author: Claude (Clawdbot agent)
---
Executive Summary
Built a complete 4-mode deployment infrastructure for the BWB (Brews With Beats) iOS app ecosystem. The system enables deploying Customer, POS, and Kiosk apps to iPhones and iPads via Discord commands, with intelligent automatic routing based on device availability and network conditions.
---
What Was Built
1. Universal Deploy Script
Location: `Desktop/BWB/scripts/deploy/bwb-deploy.sh`
A bash script supporting 4 deployment modes:
| Mode | Description | Use Case |
|---|---|---|
| `device` | Direct deploy via devicectl | Same network as Mac |
| `home` | Deploy to iPhone 14 (home device) | Remote deploys |
| `hotspot` | Connect to car WiFi hotspot first | Field deploys |
| `testflight` | Upload to App Store Connect | Works anywhere |
| `smart` | Auto-select best mode | Default behavior |
Smart Routing Logic:
1. Check if iPhone 16 is available → use device mode
2. Check if iPhone 14 is available → use home mode
3. Check if hotspot is configured → try hotspot mode
4. Check if TestFlight is ready → use testflight mode
5. Fallback → build only2. App-to-Device Mapping
Each app has preferred deployment targets:
declare -A APP_DEVICES=(
["customer"]="iphone16 iphone14"
["pos"]="ipad-pos iphone14 iphone16"
["kiosk"]="ipad-kiosk ipad-pos"
)When deploying "all", each app goes to its preferred device automatically.
3. Device Registry
declare -A DEVICES=(
["iphone16"]="84109044-33B1-5157-A7FA-A69A04C4D05C:iPhone 16 Pro Max:[ip]"
["iphone14"]="45896348-CADA-5868-9FAD-759F2DCDD08B:iPhone 14 Pro Max:[ip]"
["ipad-pos"]="1DE6FABC-D576-5197-A619-ED407A249636:iPad POS:[ip]"
["ipad-kiosk"]="1938B9B3-DCEE-5C69-92C5-A5F106B0B245:iPad Kiosk:[ip]"
)4. MCP Server
Location: `[home-path]`
Provides tools for programmatic deployment:
| Tool | Description |
|---|---|
| `bwb_status` | Check infrastructure status |
| `bwb_deploy` | Deploy with smart routing |
| `bwb_analyze` | Analyze and recommend mode |
5. Clawdbot Skill
Location: `[home-path]`
Natural language triggers:
- `deploy customer` → smart deploy Customer app
- `deploy pos` → smart deploy POS app
- `deploy kiosk` → smart deploy Kiosk app
- `deploy all` → deploy all apps to their devices
- `testflight customer` → force TestFlight upload
6. mDNS Reflector Setup
Location: `Desktop/BWB/scripts/deploy/setup-mdns-reflector.sh`
Enables Bonjour device discovery over Tailscale VPN (optional, for remote device access).
---
Critical Bug Fix: Supabase Configuration
The Problem
App crashed on launch with:
Supabase/SupabaseClient.swift:168: Fatal error: Unexpectedly found nil while unwrapping an Optional valueRoot Cause
xcconfig files treat `//` as comments. The Supabase URL:
SUPABASE_URL = https://vshzgfkrhjfxjkhtrnlu.supabase.coWas being parsed as:
SUPABASE_URL = https:(Everything after `//` was treated as a comment)
Solution
1. Changed to host-only storage:
# In Secrets.xcconfig
SUPABASE_URL_HOST = vshzgfkrhjfxjkhtrnlu.supabase.co2. Created Info.plist for config injection:
Desktop/BWB/BWB_Customer/BWB_Customer/Info.plistContains all config keys with `$(VARIABLE)` substitution.
3. Updated Config.swift to construct URL:
if let host = Bundle.main.infoDictionary?["SUPABASE_URL_HOST"] as? String {
return "https://\(host)"
}Files Modified
- `BWBCore/Configuration/Secrets.xcconfig` - Uses `SUPABASE_URL_HOST`
- `BWBCore/Sources/BWBCore/Utilities/Config.swift` - Reads host, builds URL
- `BWB_Customer/BWB_Customer/Info.plist` - Created with config keys
- `BWB_Customer/BWB_Customer.xcodeproj/project.pbxproj` - References Info.plist
---
File Locations
Scripts
Desktop/BWB/scripts/deploy/
├── bwb-deploy.sh # Main deploy script (executable)
├── setup-mdns-reflector.sh # Bonjour over Tailscale setup
└── config.env.example # Environment config templateDocumentation
Desktop/BWB/docs/
├── DEPLOY-SETUP.md # Full setup guide
└── HANDOFF-2026-02-09.md # This documentMemory (Agent Context)
Desktop/BWB/memory/
├── deploy-infrastructure.md # How deployment works
├── customer-context.md # BWB_Customer specific context
└── context.md # General project contextClawdbot Integration
[home-path]
├── skills/bwb-deploy/SKILL.md # Skill definition
├── mcp-servers/bwb-deploy/index.js # MCP server
└── logs/bwb-deploys/ # Build/deploy logsApp Store Connect
[home-path]
├── README.md # Setup instructions
├── AuthKey_*.p8 # API key (user must add)
└── config # Key ID + Issuer ID (user must add)---
Environment Variables
# Car hotspot SSID (for hotspot mode)
export BWB_HOTSPOT_SSID="YourHotspotName"
# Optional overrides
export BWB_HOME_DEVICE="iphone14"
export BWB_MOBILE_DEVICE="iphone16"---
Usage Examples
Via Discord/iMessage
deploy customer # Smart routing, deploys to best device
deploy pos # Smart routing, prefers iPad POS
deploy kiosk # Smart routing, prefers iPad Kiosk
deploy all # Each app to its preferred device
testflight customer # Force TestFlight upload
deploy customer device # Force device mode
deploy pos to iphone16 # Force specific deviceVia Command Line
# Smart routing (default)
Desktop/BWB/scripts/deploy/bwb-deploy.sh customer smart
# Specific modes
Desktop/BWB/scripts/deploy/bwb-deploy.sh customer device
Desktop/BWB/scripts/deploy/bwb-deploy.sh pos home
Desktop/BWB/scripts/deploy/bwb-deploy.sh all testflight
# With options
Desktop/BWB/scripts/deploy/bwb-deploy.sh customer device --device=iphone14
Desktop/BWB/scripts/deploy/bwb-deploy.sh pos testflight --skip-build---
Pending Setup (User Action Required)
1. TestFlight API Key
Status: NOT CONFIGUREDUser needs to:
1. Go to https://appstoreconnect.apple.com/access/api
2. Generate API key with "App Manager" role
3. Download .p8 file to `[home-path]`
4. Create `[home-path]`:
API_KEY_ID=<key-id>
API_ISSUER_ID=<issuer-id>2. Car Hotspot SSID
Status: NOT CONFIGUREDUser needs to find their Verizon hotspot name and run:
echo 'export BWB_HOTSPOT_SSID="HotspotName"' >> [home-path]3. iPad Pairing
Status: iPads registered but unavailableUser needs to:
1. Connect iPads to home WiFi
2. Enable Developer Mode (Settings → Privacy & Security → Developer Mode)
3. Pair with Xcode via USB once
4. Optionally install Tailscale for remote access
---
Network Behavior
| Scenario | Device Deploy | TestFlight |
|---|---|---|
| Mac & devices on same WiFi | ✅ Works (~30s) | ✅ Works |
| Mac on WiFi, device on cellular | ❌ Bonjour fails | ✅ Works |
| Using car hotspot | ✅ After connecting | ✅ Works |
| Tailscale only | ⚠️ Needs mDNS reflector | ✅ Works |
---
Build Artifacts
| Type | Location |
|---|---|
| Device builds | `/tmp/bwb-builds/<app>/Build/Products/Debug-iphoneos/` |
| Archives | `/tmp/bwb-builds/<app>/<scheme>.xcarchive` |
| IPAs | `/tmp/bwb-builds/<app>/export/` |
| Logs | `[home-path]` |
---
Git Commits
c46a37f feat: Add 4-mode deployment infrastructure with smart routing
0c6e692 feat: Add iPad support with app-to-device mapping---
Known Issues / Warnings
Non-blocking Warnings in BWB_Customer
AIRoutingService is deprecated: Use AIRoutingFacade instead
→ CheckoutView.swift (3 locations)
result of 'try?' is unused
→ EventsView.swift, MenuView.swift
no 'async' operations occur within 'await' expression
→ OrderTrackingService.swiftDevice Connectivity
- Cellular devices can't be reached for direct deploy (use TestFlight)
- iPads need initial USB pairing before wireless deploys work
- Tailscale helps but requires mDNS reflector for Bonjour
---
Architecture Diagram
┌─────────────────────────────────────────────────────────────────────────┐
│ User Request │
│ "deploy customer" (Discord) │
└────────────────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Clawdbot Agent (Claude) │
│ │ │
│ Reads bwb-deploy skill │
│ │ │
│ ▼ │
│ bwb-deploy.sh smart │
└────────────────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Smart Router │
│ │
│ 1. xcrun devicectl list devices → Check availability │
│ 2. Check APP_DEVICES mapping → Find preferred device │
│ 3. Check network/hotspot/TF → Select best mode │
│ │
└───────────┬───────────────────┬───────────────────┬─────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────────┐
│ Device │ │ Hotspot │ │ TestFlight │
│ Deploy │ │ Mode │ │ Upload │
│ │ │ │ │ │
│ xcodebuild │ │ Connect to │ │ xcodebuild │
│ devicectl │ │ hotspot, │ │ archive │
│ install │ │ then deploy │ │ export IPA │
│ launch │ │ │ │ altool upload │
│ │ │ │ │ │
│ ~30 sec │ │ ~45 sec │ │ ~5-10 min │
└──────┬──────┘ └──────┬──────┘ └────────┬────────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────────┐
│ iPhone 16 │ │ iPhone 16 │ │ App Store │
│ iPhone 14 │ │ (via │ │ Connect │
│ iPad POS │ │ hotspot) │ │ │ │
│ iPad Kiosk │ │ │ │ ▼ │
└─────────────┘ └─────────────┘ │ TestFlight │
│ auto-install │
└─────────────────┘---
Resuming This Work
To continue or modify this infrastructure:
1. Read the memory files:
- `Desktop/BWB/memory/deploy-infrastructure.md`
- `Desktop/BWB/memory/customer-context.md`
2. Check the skill:
- `[home-path]`
3. Understand the script:
- `Desktop/BWB/scripts/deploy/bwb-deploy.sh`
4. Key patterns:
- Smart routing is default - just `deploy <app>`
- APP_DEVICES maps apps to preferred devices
- TestFlight is the fallback for any network issues
---
Contact Points
- Project location: `Desktop/BWB/`
- Discord channel: #bwb-customer
- Related channels: #bwb-pos, #bwb-kiosk, #bwb-core
---
End of handoff document
Promotion Decision
Keep in the searchable backlog until it intersects a live paper or system.
Source Anchor
BWB/docs/HANDOFF-2026-02-09.md
Detected Structure
Method · References · Figures · Code Anchors · Architecture