swiftpatch-cli
v2.0.10
Published
Ship React Native OTA updates instantly. Bundle, sign, publish, and manage releases from the terminal. AI-powered diagnostics included.
Maintainers
Readme
Why SwiftPatch?
CodePush is deprecated. Expo Updates locks you into Expo. Shorebird doesn't support React Native.
SwiftPatch is a modern OTA update platform built specifically for React Native. Push JS bundle updates to your users in seconds -- no app store review required.
| Feature | SwiftPatch | CodePush | Expo Updates | |---------|-----------|----------|--------------| | React Native support | Yes | Deprecated | Expo only | | Hermes bytecode | Yes | No | Limited | | Bundle signing (RSA-256) | Yes | No | No | | AI-powered diagnostics | Yes | No | No | | Rollback & rollout control | Yes | Limited | Limited | | CI/CD tokens | Yes | Limited | Yes | | Self-hosted option | Coming soon | No | No |
Installation
npm install -g swiftpatch-cliRequires Node.js 18+.
Quick Start
# 1. Authenticate
swiftpatch login
# 2. Create an app
swiftpatch apps create
# 3. Deploy (bundle + upload + release in one step)
swiftpatch deploy -p ios --ci-token <token>Commands
Authentication
| Command | Description |
|---------|-------------|
| swiftpatch login | Authenticate via browser or API key |
| swiftpatch logout | Clear stored credentials |
| swiftpatch whoami | Show current authenticated user |
Apps
| Command | Description |
|---------|-------------|
| swiftpatch apps list | List all apps |
| swiftpatch apps create | Create a new app |
| swiftpatch apps info <app-id> | Get app details |
| swiftpatch apps update <app-id> | Update app properties |
| swiftpatch apps delete <app-id> | Delete an app |
Publishing & Releases
| Command | Description |
|---------|-------------|
| swiftpatch deploy -p <platform> | One-step bundle + upload + release (recommended) |
| swiftpatch publish-bundle -p <platform> | (Deprecated) Bundle, compile, sign, and upload. Use deploy instead. |
| swiftpatch release-bundle --hash <hash> | (Deprecated) Promote a bundle to a release. Use deploy instead. |
| swiftpatch releases list -a <app-id> | List releases |
| swiftpatch releases rollout <id> --percent 50 | Update rollout percentage |
| swiftpatch releases rollback <id> | Rollback a release |
Channels
| Command | Description |
|---------|-------------|
| swiftpatch channels list -a <app-id> | List channels |
| swiftpatch channels create -a <app-id> | Create a channel |
| swiftpatch channels delete <id> -a <app-id> | Delete a channel |
CI Tokens
| Command | Description |
|---------|-------------|
| swiftpatch ci-tokens create | Generate a CI token |
| swiftpatch ci-tokens list | List CI tokens |
| swiftpatch ci-tokens delete <id> | Revoke a CI token |
| swiftpatch ci-tokens regenerate <id> | Regenerate a CI token |
Utilities
| Command | Description |
|---------|-------------|
| swiftpatch init | Set up SwiftPatch in your project |
| swiftpatch doctor | Diagnose setup issues |
AI-Powered Intelligence
SwiftPatch includes AI features powered by Claude (Anthropic) for local project analysis and by the SwiftPatch backend for release intelligence.
Local AI Commands (Claude-powered)
These commands analyze your local project. You will be prompted for consent before any data is read or sent.
# Scan your project for OTA readiness issues
swiftpatch ai doctor
# Generate a changelog from git history
swiftpatch ai explain
# Safety review your code changes before deploying OTA
swiftpatch ai review| Command | What it does |
|---------|-------------|
| swiftpatch ai doctor | Scans package.json, native deps, assets, Hermes config, signing keys. Flags anything that could break an OTA update. |
| swiftpatch ai explain | Reads git log between the last tag and HEAD, generates a categorized changelog (Features, Bug Fixes, Improvements). |
| swiftpatch ai review | Diffs your JS/TS changes, detects native code modifications, sensitive file changes, and gives an OTA safety score (1-10). |
All three commands support:
-y, --yesto skip the consent prompt (for CI/CD)--jsonfor machine-readable output-f, --fromand-t, --tofor custom git ranges (explain & review)
Backend AI Commands
These require SwiftPatch authentication and query the platform API.
| Command | Description |
|---------|-------------|
| swiftpatch ai ask <question> | Ask AI about releases, crashes, or strategy |
| swiftpatch ai risk-score | Get AI risk assessment for a release |
| swiftpatch ai crashes | List AI-grouped crash reports |
| swiftpatch ai insights | View AI-generated insights |
Setting up the Claude API Key
Local AI commands require a Claude API key. Configure it in one of three ways:
# Option 1: Store in encrypted config (recommended for local dev)
swiftpatch config set claudeApiKey sk-ant-xxxxx
# Option 2: Environment variable (recommended for CI/CD)
export SWIFTPATCH_CLAUDE_API_KEY=sk-ant-xxxxx
# Option 3: SwiftPatch Pro (platform-provisioned key -- no setup needed)Your API key is stored in an encrypted local store and is never logged or exposed.
Data & Privacy
Before any local data is read or sent to the AI:
- You are shown exactly what data categories will be accessed
- You must explicitly consent (or pass
--yesfor CI/CD) - Consent can be remembered or revoked anytime
# Revoke all AI consent
swiftpatch config delete aiConsentScopes
# Remove your Claude API key
swiftpatch config delete claudeApiKeyNo source code is stored by the AI service. All data is transmitted over encrypted HTTPS.
Bundle Signing
SwiftPatch supports RSA-256 bundle signing to verify bundle integrity on device:
# Generate a key pair
swiftpatch generate-key-pair
# Publish with signing
swiftpatch publish-bundle -p ios --hermes -k ./swiftpatch-private.pemAdd the public key to your React Native app via the SwiftPatch SDK.
Hermes Support
Compile your JS bundle to Hermes bytecode for faster startup:
swiftpatch publish-bundle -p ios --hermes
# Or with a custom hermesc binary
swiftpatch publish-bundle -p android --hermes --hermesc-path ./node_modules/react-native/sdks/hermesc/osx-bin/hermescCI/CD Integration
Use CI tokens for automated deployments:
# Create a token
swiftpatch ci-tokens create
# Use in your pipeline
export SWIFTPATCH_CI_TOKEN=sp_ci_xxxxx
swiftpatch deploy -p iosGitHub Actions Example
- name: Deploy OTA update
env:
SWIFTPATCH_CI_TOKEN: ${{ secrets.SWIFTPATCH_CI_TOKEN }}
run: npx swiftpatch-cli deploy -p iosConfiguration
| Command | Description |
|---------|-------------|
| swiftpatch config set <key> <value> | Set a config value |
| swiftpatch config get <key> | Get a config value |
| swiftpatch config delete <key> | Delete a config value |
| swiftpatch config list | List all config values |
Config keys: apiUrl, defaultOrg, defaultApp, defaultPlatform, defaultChannel, claudeApiKey
Environment Variables
| Variable | Description |
|----------|-------------|
| SWIFTPATCH_CI_TOKEN | CI/CD token for automated auth |
| SWIFTPATCH_API_URL | Custom API endpoint |
| SWIFTPATCH_CLAUDE_API_KEY | Claude API key for AI features |
| DEBUG | Enable debug logging |
Development
git clone https://github.com/codewprincee/swiftpatch-cli.git
cd swiftpatch-cli
npm install
npm run dev # watch mode
npm run build # production build
npm test # run testsLinks
License
MIT
